Code: Alles auswählen.
DATA lt_exception TYPE crmt_exception_t.
DATA lt_orgman TYPE crmt_orgman_comt.
DATA lt_input_fields TYPE crmt_input_field_tab.
lt_orgman = VALUE #( ( ref_guid = <fs_selection>-header_guid
ref_kind = 'A'
sales_org = <fs_selection>-sales_org
dis_channel = <fs_selection>-dis_channel
division = <fs_selection>-division
sales_org_resp = p_nvkorg
sales_org_ori = <fs_selection>-sales_org_ori
dis_channel_ori = <fs_selection>-dis_channel_ori
division_ori = <fs_selection>-division_ori
sales_org_short = <fs_selection>-sales_org
sales_org_resp_short = <fs_selection>-sales_org
error_flag = 'X'
mode = 'B' ) ).
lt_input_fields = VALUE #( ( ref_guid = <fs_selection>-header_guid
ref_kind = 'A'
objectname = gc_object_name-orgman
field_names = VALUE #( ( fieldname = 'DIS_CHANNEL' )
( fieldname = 'DIVISION_ORI' )
( fieldname = 'DIVISION' )
( fieldname = 'DIVISION_ORI' )
( fieldname = 'SALES_ORG_ORI' )
( fieldname = 'DIS_CHANNEL_ORI' )
( fieldname = 'SALES_ORG_RESP' )
( fieldname = 'SALES_ORG_RESP_SHORT' )
( fieldname = 'SALES_ORG_SHORT' ) ) ) ).
DATA(lv_error) = abap_false.
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
it_orgman = lt_orgman
IMPORTING
et_exception = lt_exception
CHANGING
ct_input_fields = lt_input_fields
EXCEPTIONS
error_occurred = 1
document_locked = 2
no_change_allowed = 3
no_authority = 4
OTHERS = 99.
DATA lt_objects_to_save TYPE crmt_object_guid_tab.
DATA lt_saved_objects TYPE crmt_return_objects.
DATA lt_objects_not_saved TYPE crmt_object_guid_tab.
lt_objects_to_save = VALUE #( ( <fs_selection>-header_guid ) ).
CLEAR lt_saved_objects.
CLEAR lt_objects_not_saved.
CALL FUNCTION 'CRM_ORDER_SAVE'
EXPORTING
it_objects_to_save = lt_objects_to_save
iv_update_task_local = abap_true
iv_save_frame_log = abap_true
IMPORTING
et_saved_objects = lt_saved_objects
et_exception = lt_exception
et_objects_not_saved = lt_objects_not_saved
EXCEPTIONS
document_not_saved = 1
OTHERS = 99.
Code: Alles auswählen.
FORM update_sales_org USING logger TYPE zif_logger.
DATA lt_exception TYPE crmt_exception_t.
DATA lt_orgman TYPE crmt_orgman_comt.
DATA lt_input_fields TYPE crmt_input_field_tab.
"...
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
it_orgman = lt_orgman
IMPORTING
et_exception = lt_exception
CHANGING
ct_input_fields = lt_input_fields
EXCEPTIONS
error_occurred = 1
document_locked = 2
no_change_allowed = 3
no_authority = 4
OTHERS = 99.
IF sy-subrc <> 0.
IF sy-msgid IS NOT INITIAL.
logger->add( ).
ELSE.
logger->e( |Failure in CRM_ORDER_MAINTAIN sy-subrc = { sy-subrc }| ).
ENDIF.
LOOP AT lt_exception REFERENCE INTO DATA(lr_exception).
" Prüfung der Ausnahme
ENDLOOP.
RETURN.
ENDIF.
"...
ENDFORM.