Skip to Content
0

CRM_ORDER_MAINTAIN does not change the partner

Sep 01, 2017 at 07:26 AM

48

avatar image
Former Member

I want to change the employee responsible of an opportunity. Unfortunately it does not change anything. I think I'm passing all the required informations to the fm.

Thank you for your help!

Below the code:

FORM create_data_zbbp.
 DATA: ls_partner TYPE LINE OF crmt_partner_comt.
 DATA: ls_logic_partner_key TYPE comt_partner_logic_partner_key.

 ls_partner-ref_guid = '8EABE7166E0CC046BA52E8C899EC50E3'. " BUT000-PARTNER_GUID OLD
 ls_partner-ref_handle = '0000000000'.
 ls_partner-ref_kind = 'A'.
 ls_partner-ref_partner_handle = '0000'.
 ls_partner-ref_partner_fct = '00000014'.
 ls_partner-ref_partner_no = '23916'. " BUT000-PARTNER OLD
 ls_partner-ref_no_type = 'BP'.
 ls_partner-ref_display_type = 'BP'.
 ls_partner-partner_guid = 'E0C99D13C908E3F1BD530024E849D73E'. " BUT000-PARTNER_GUID NEW
 ls_partner-kind_of_entry = ''.
 ls_partner-partner_fct = '00000014'.
 ls_partner-partner_no = '27314'. " BUT000-PARTNER NEW
 ls_partner-display_type = 'BP'.
 ls_partner-no_type = 'BP'.
 INSERT ls_partner INTO TABLE lt_partner.

 ls_input_fields-ref_guid = '8EABE7166E0CC046BA52E8C899EC50E3'.
 ls_input_fields-ref_handle = '0000000000'.
 ls_input_fields-ref_kind = 'A'.
 ls_input_fields-objectname = 'PARTNER'.
 ls_input_fields-logical_key = '00000000001423916 BPBP'.

 ls_nametab = 'PARTNER_NO'.
 APPEND ls_nametab TO lt_nametab.
 ls_input_fields-field_names[] = lt_nametab[].

 INSERT ls_input_fields INTO TABLE lt_input_fields.

 CLEAR lt_nametab.
ENDFORM.
FORM execute_query.
 CALL FUNCTION 'CRM_ORDER_MAINTAIN'
 EXPORTING
 it_partner = lt_partner
 IMPORTING
 et_exception = lt_exception1_tmp
 CHANGING
 ct_input_fields = lt_input_fields
 EXCEPTIONS
 error_occurred = 1
 document_locked = 2
 no_change_allowed = 3
 no_authority = 4
 OTHERS = 5.

 IF sy-subrc <> 0.
 ENDIF.
 WHEN OTHERS.
 ENDCASE.

 APPEND LINES OF lt_exception1_tmp TO lt_exception1.

 CLEAR: lt_input_fields.
ENDFORM.
FORM commit_work.
 CALL FUNCTION 'CRM_ORDER_SAVE'
 EXPORTING
 it_objects_to_save = lt_guid_tmp
 IMPORTING
 et_saved_objects = lt_guid_saved_tmp

 et_objects_not_saved = lt_guid_unsaved_tmp
 EXCEPTIONS
 document_not_saved = 1
 OTHERS = 2.

 CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

 CLEAR: lt_guid_tmp, lt_guid_saved_tmp, lt_guid_unsaved_tmp.
ENDFORM.
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers