cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a new Item of a transaction by Copying an Item from a different existing Transaction

swati_mishra2
Explorer
0 Kudos

Hello Experts ,

I have a Transaction T1 which has 3 different Items of Type "A" "B and "C". I have another Transaction T2 which has 4 different Items of Type "A", "B" , "C" and "D". Both T1 an T2 exist in database. I want to create a new line Item for Transaction T1 by copying the Item "D" of the transaction T2 .

I have used CRM_COPY_PROCESS_PREPARE and CRM_ORDER_MAINTAIN as below but this is not working and is giving me AUTHORIZATION EXCEPTION .

Can you please help me with the code or let me know if there is another way to do it .

ls_predessor-handle = 1.

ls_predessor-pred_guid = GUID_T2 " Transaction of Guid T2.

INSERT ls_predessor into table LT_PREDESSOR.

CALL FUNCTION 'CRM_COPY_PROCESS_PREPARE'

Exporting

it_predecessor = LT_PREDECESSOR

iv_VONA_KIND = "D"

IMPORTING

et_doc_flow = lt_doc_flow

et_orderadm_i = lt_orderadm_i

CHANGING

ct_input_fields = lt_input_fields

EXCEPTION

error_occured = 1

others = 2.

IF SY_SUBRC EQ 0.

CALL FUNCTION 'CRM_ORDER_MAINTAIN'

changing

ct_orderadm_i = lt_orderadm_i

ct_input_fields = lt_input_fields

ct_doc_flow = lt_doc_flow

exceptions

no_authority = 4

others = 99.

ENDIF.

Accepted Solutions (0)

Answers (0)