简体   繁体   中英

How do I create a service ticket using CRM_ORDER_MAINTAIN?

I'm trying to learn the Function Module CRM_ORDER_MAINTAIN and so far I managed to create a standard order with partners and their roles, however now I'm having trouble creating a service ticket with its required fields.

I tried debugging the FM when calling it from WEBUI to see what structures and tables are to be filled but I'm having a bit of trouble figuring out which ones to fill and which ones are generated and don't know if I'm missing something small somewhere that's causing it not to save.

I think the error lies in this part of the code that handles Categorization, because the other code that handles adding partners worked for the standard order.

I'm not filling any GUIDS and only filling HANDLES because that's what I did for the standard order.

*****categorization: motive+submotive******
clear ls_input_fields.
clear ls_fieldsname.

ls_fieldsname-fieldname = 'CONC_KEY'.
INSERT ls_fieldsname INTO TABLE ls_input_fields-field_names.
ls_input_fields-ref_handle = 1."
ls_input_fields-ref_kind = gc_object_kind-orderadm_h.
ls_input_fields-objectname = 'SERVICE_OS'.

ls_subject-ref_handle = ls_orderadm_h-handle.
ls_subject-ref_handle_h = ls_orderadm_h-handle.
ls_subject-katalogart = 'Z1'.
ls_subject-codegruppe = 'ZCA00001'.
ls_subject-code = 'Z044'.
append ls_subject TO ls_osset-subject.
ls_osset-ref_handle = ls_orderadm_h-handle.
ls_osset-profile_type = 'A'.
ls_osset-subject_profile = 'ZCCCAST'.
append ls_osset to ls_service_os-osset.
ls_service_os-ref_handle = ls_orderadm_h-handle.
append ls_service_os to it_service_os.

INSERT ls_input_fields INTO TABLE lt_input_fields.

ls_subject-ref_handle = ls_orderadm_h-handle.
ls_subject-ref_handle_h = ls_orderadm_h-handle.
ls_subject-katalogart = 'Z1'.
ls_subject-codegruppe = 'ZCA00002'.
ls_subject-code = 'Z009'.
append ls_subject TO ls_osset-subject.
ls_osset-ref_handle = ls_orderadm_h-handle.
ls_osset-profile_type = 'A'.
ls_osset-subject_profile = 'ZCCCAST'.
append ls_osset to ls_service_os-osset.
ls_service_os-ref_handle = ls_orderadm_h-handle.
append ls_service_os to it_service_os.

INSERT ls_input_fields INTO TABLE lt_input_fields.

Any help is appreciated

For Service OS there is a multilevel categorization up to four levels. You can check the hierarchy via CRM_ORDER_READ FM in parameter ET_SERVICE_OS .

Also, you can check the hierarchy in the below structure CRMT_SRV_OSSET_WRK

服务操作系统结构

To maintain the data for more than 2 levels of hierarchy you have to create a new ref GUID. You have to prepare and fill data to Create OS as below

 CALL FUNCTION 'GUID_CREATE'
      IMPORTING
        ev_guid_16 = lv_ref_guid.

ls_subject-ref_handle = '0000000000'.
ls_subject-ref_guid   =  lv_ref_guid.   " newly created ref GUID
ls_subject-cat_id = 'As per your req.'.
ls_subject-katalog_type = ''.
ls_subject-mode = 'A'.         "For creation A, for update B
" maintain other Subject parameter as per your requirement
APPEND ls_subject TO lt_subject.

" you can skip preparing Ref-Object structure if you don't want to update 
 ls_refobj-ref_guid    = lv_ref_guid.  " newly created ref GUID
 ls_refobj-product_id  = "Product ID". " optional
 ls_refobj-ref_handle  = '0000000000'.
 ls_refobj-main_object = abap_true.
 ls_refobj-mode        = 'A'.          " mode A for creating, B for update
 INSERT ls_refobj INTO TABLE lt_refobj.

ls_osset-ref_handle      = '0000000000'.
ls_osset-ref_guid        = "Header or Item GUID of Service".  
ls_osset-subject_profile = 'SERVICE'.
ls_osset-profile_type    = 'A'.        " service profile type
ls_osset-refobject       = lt_refobj.
ls_osset-subject         = lt_subject.
INSERT ls_osset INTO TABLE lt_osset.

ls_service_os-ref_guid = "Header or Item GUID of Service".
ls_service_os-ref_kind = "A or B".     " A for Header and B for Item
ls_service_os-osset    = lt_osset.
INSERT ls_service_os INTO TABLE lt_service_os.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM