Skip to Content
0
Former Member
May 13, 2013 at 09:38 AM

How to insert item partner using CRMXIF_ORDER_SAVE?

87 Views

Hi all,

I developed a simple program to insert a partner on an existing item in CRM transaction using function module CRMXIF_ORDER_SAVE. Initially I was able to add the partner at header level , however, using similar codes, I was unable to insert partner at item level. No error was encountered. Can someone kindly advise what is not working ? Below are my codes:

data: ls_bustrans type crmxif_bustrans,
lt_bustrans type crmxif_bustrans_t,
lt_bapiretm type bapiretm,
ls_bapiretm like line of lt_bapiretm,
ls_ordpartner type crmxif_partner.
data: ls_order type crmd_orderadm_h.
data: lt_item type crmxif_bustrans_item_t,
ls_item like line of lt_item,
ls_item_partner type crmxif_partner_i_xt,
lt_partner type crmxif_partner_i_t,
ls_partner like line of lt_partner.
data: ls_crmd_i type crmd_orderadm_i.


parameters: p_objid type crmd_orderadm_h-object_id default '0005000053'.

select single * into ls_order
from crmd_orderadm_h
where object_id = p_objid.
check sy-subrc = 0.

ls_bustrans-object_task = '0'.
ls_bustrans-object_id = ls_order-object_id.
ls_bustrans-object_guid = ls_order-guid.
ls_bustrans-object_type = ls_order-object_type.
ls_bustrans-process_type = ls_order-process_type.


select single * into ls_crmd_i
from crmd_orderadm_i
where header = ls_order-guid. "Get first line as a test example
check sy-subrc = 0.

ls_item_partner-datax = 'X'.
ls_partner-partner_fct = 'Z0000035'.
ls_partner-partner_no = '0000108964'.
ls_partner-display_type = 'BP'.
ls_partner-kind_of_entry = 'A'.

ls_partner-object_task = 'I'.
append ls_partner to ls_item_partner-data.

ls_item-object_task = '0'.
ls_item-item_number = ls_crmd_i-number_int.
ls_item-partner = ls_item_partner.
append ls_item to ls_bustrans-item.

append ls_bustrans to lt_bustrans.

call function 'CRMXIF_ORDER_SAVE'
exporting
data = lt_bustrans
importing
return = lt_bapiretm.

call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.

Thanks in advance

Ivy