Skip to Content
0
Former Member
Aug 09, 2010 at 06:12 AM

Creation of Reference Object in Complaints

65 Views

Hi,

I want to create Ibase component as reference object for Complaint . I debugged through the Order_maintain and tried to fill as like that.

Please find the code :

{

DATA: lt_refobj_com TYPE  crmt_srv_refobj_comt.
DATA: ls_refobj_com TYPE crmt_srv_refobj_com.
DATA: lt_input_field  TYPE  crmt_input_field_tab.
DATA: ls_input_field TYPE crmt_input_field.
DATA: lt_field_names  TYPE crmt_input_field_names_tab.
DATA: ls_field_names TYPE crmt_input_field_names.

DATA: lt_service_os TYPE  crmt_srv_osset_comt,
      ls_service_os TYPE  crmt_srv_osset_com.

DATA: lt_crmt_srv_osset_comt1 TYPE crmt_srv_osset_comt1,
      ls_crmt_srv_osset_com1 TYPE crmt_srv_osset_com1.

DATA: lv_guid_16  TYPE  guid_16.

**ls_refobj_com-ref_guid  =  '4C43086918AE56A9E1000000AC1447B6' .
**ls_refobj_com-ref_kind  = 'A' .
*ls_refobj_com-ib_instance = '566' .
**ls_refobj_com-ext_refobj = '10000608'.
**ls_refobj_com-profile_type = 'A'.
*ls_refobj_com-product_id = '10000608'.
**ls_refobj_com-guid =  '4C43086918AE56A9E1000000AC1447B6' .
*ls_refobj_com-mode = 'A' .
*APPEND ls_refobj_com TO lt_refobj_com.

ls_service_os-ref_handle = '0000000000' .
ls_service_os-ref_guid  =  '4C43086918AE56A9E1000000AC1447B6' . ....
ls_service_os-ref_kind  = 'A' .
*ls_service_os-mode = 'C' .

ls_crmt_srv_osset_com1-ref_handle = '0000000000' .
ls_crmt_srv_osset_com1-ref_guid = '4C4308AF18AE56A9E1000000AC1447B6'.........
ls_crmt_srv_osset_com1-subject_profile = 'ZSRVCAL'.
ls_crmt_srv_osset_com1-profile_type = 'A' .
*ls_crmt_srv_osset_com1-mode = 'C' .


CALL FUNCTION 'GUID_CREATE'   " *is it necessary? else what guid needs to giv here*
 IMPORTING
   ev_guid_16       = lv_guid_16
*   EV_GUID_22       =
*   EV_GUID_32       =
          .
ls_refobj_com-ref_handle = '0000000000' .
ls_refobj_com-ref_guid  =  lv_guid_16 .  " 4C56A479560967D6E1000000AC1447B6' .
*ls_refobj_com-ref_kind  = 'A' .
ls_refobj_com-ib_instance = '566' .
*ls_refobj_com-ext_refobj = '10000608'.
*ls_refobj_com-profile_type = 'A'.
*ls_refobj_com-product_id = '10000608'.
*ls_refobj_com-guid =  '4C43086918AE56A9E1000000AC1447B6' .
ls_refobj_com-mode = 'A' .
ls_refobj_com-main_object = 'X' .
APPEND ls_refobj_com TO lt_refobj_com.


ls_crmt_srv_osset_com1-refobject  = lt_refobj_com.

APPEND ls_crmt_srv_osset_com1 TO lt_crmt_srv_osset_comt1.


ls_service_os-osset = lt_crmt_srv_osset_comt1.
APPEND ls_service_os TO lt_service_os.




ls_input_field-ref_handle = '0000000000' .
ls_input_field-ref_guid   = '4C43086918AE56A9E1000000AC1447B6' .
ls_input_field-ref_kind  = 'A' .
ls_input_field-objectname = 'SERVICE_OS' .

ls_field_names-fieldname = 'IB_INSTANCE' .
APPEND ls_field_names TO lt_field_names.

APPEND ls_input_field TO lt_input_field.


CALL FUNCTION 'CRM_ORDER_MAINTAIN'
  EXPORTING
    it_service_os   = lt_service_os
  CHANGING
    ct_input_fields = lt_input_field.
*
*CALL FUNCTION 'CRM_REFOBJ_MAINTAIN_OW'
*  EXPORTING
*    it_refobj_com          = lt_refobj_com
**   IV_EXTERNAL_CALL       = FALSE
*  CHANGING
*    ct_input_field         = lt_input_field
** EXCEPTIONS
**   ERROR_OCCURRED         = 1
**   OTHERS                 = 2
*          .
*IF sy-subrc <> 0.
** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
**         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.

DATA: lt_obj TYPE crmt_object_guid_tab,
      lv_obj TYPE crmt_object_guid.

lv_obj = '4C43086918AE56A9E1000000AC1447B6' .

APPEND lv_obj TO lt_obj.

CALL FUNCTION 'CRM_ORDER_SAVE'
  EXPORTING
    it_objects_to_save         = lt_obj
*   IV_UPDATE_TASK_LOCAL       = FALSE
*   IV_SAVE_FRAME_LOG          = FALSE
*   IV_NO_BDOC_SEND            = FALSE
*   IT_ACTIVE_SWITCH           =
* IMPORTING
*   ET_SAVED_OBJECTS           =
*   ET_EXCEPTION               =
*   ET_OBJECTS_NOT_SAVED       =
* CHANGING
*   CV_LOG_HANDLE              =
* EXCEPTIONS
*   DOCUMENT_NOT_SAVED         = 1
*   OTHERS                     = 2
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
*   WAIT          =
* IMPORTING
*   RETURN        =
          .

COMMIT WORK.

}

Please let me know, where I made mistake?

Sushant

Edited by: Sushantbm on Aug 9, 2010 8:15 AM

Edited by: Sushantbm on Aug 9, 2010 8:17 AM