SAP MDG · REPLICATION INBOUND

How do I implement profit center key mapping in MDG outbound replication using BAdI USMD_SE_PC_RPLCTN?

Use BAdI implementation ZCL_PROFIT_CENTER_KEYMAP for interface IF_EX_USMD_PC_RPLCTN. The outbound method reads the profit center bulk request from CS_PROXY_DATA, checks TVARVC entry ZMDG_PC_KEY_MAPPING for the destination system, and rewrites the first four characters of profit center ID before passing the message back to MDG replication.

Use BAdI implementation ZCL_PROFIT_CENTER_KEYMAP for interface IF_EX_USMD_PC_RPLCTN. The outbound method reads the profit center bulk request from CS_PROXY_DATA, checks TVARVC entry ZMDG_PC_KEY_MAPPING for the destination system, and rewrites the first four characters of profit center ID before passing the message back to MDG replication.

Use BAdI implementation ZCL_PROFIT_CENTER_KEYMAP with interface IF_EX_USMD_PC_RPLCTN. In the outbound method, the class reads the bulk request from CS_PROXY_DATA, checks TVARVC entry ZMDG_PC_KEY_MAPPING for the destination system, and replaces the first four characters of the profit center ID when mapping is active. The inbound method normalizes status and GUID data for the confirmation message.

Process flow

  1. Create or reuse class ZCL_PROFIT_CENTER_KEYMAP.
  2. Implement interface IF_EX_USMD_PC_RPLCTN.
  3. In OUTBOUND_PROCESSING, read lt_pc_messages from CS_PROXY_DATA-profit_centre_replication_bulk-profit_centre_replication_requ.
  4. Select TVARVC entry with NAME = 'ZMDG_PC_KEY_MAPPING' and LOW = I_DIS_SYSTEM.
  5. Loop through the replication request rows.
  6. If PROFIT_CENTRE-ID starts with the mapped prefix, replace PROFIT_CENTRE-ID+0(4) with LS_TVARVC-HIGH.
  7. Write the modified table back to CS_PROXY_DATA-profit_centre_replication_bulk-profit_centre_replication_requ.
  8. Leave CT_MESSAGE as-is unless you want to append application-log messages.

Referenced tables

ObjectPurpose
TVARVCStores the configuration switch used by the sample to decide whether profit center key mapping is active for a destination system.

ILLUSTRATIVE ABAP SAMPLE

Source ABAP example

Exact relevant implementation excerpt from the knowledge document.

1class ZCL_PROFIT_CENTER_KEYMAP definition 2 public 3 final 4 create public . 5 6public section. 7*"* public components of class CL_USMD_SE_PC_RPLCTN_BADI 8*"* do not include other source files here!!! 9 10 interfaces IF_BADI_INTERFACE . 11 interfaces IF_EX_USMD_PC_RPLCTN . 12protected section. 13*"* protected components of class CL_USMD_SE_PC_RPLCTN_BADI 14*"* do not include other source files here!!! 15private section. 16*"* private components of class CL_USMD_SE_PC_RPLCTN_BADI 17*"* do not include other source files here!!! 18ENDCLASS. 19 20 21 22CLASS ZCL_PROFIT_CENTER_KEYMAP IMPLEMENTATION. 23 24 25method IF_EX_USMD_PC_RPLCTN~INBOUND_PROCESSING. 26* 27* Method can be used for redefinition (or enhancement) of the incoming processing status data that belongs to a corresponding 28* replication request message for profit centre (confirmation message is sent back to MDGF). 29* 30* In case of an active BAdI implementation, this method would be called during inbound processing from standard service 31* implementation class CL_USMD_CO_PC_IN, method MAPPING_IN. 32*-------------------------------------------------------------------------------------------------------------------- 33 34 35 data: 36 lt_log_item type mdgf_log_item_tab, 37 ls_log_item type mdgf_log_item, 38 lt_message type usmd_t_message, 39 ls_message type usmd_s_message, 40 ls_message_header type mdgf_business_document_messag3. 41 42 43 44* Get processing result code of original replication request message (will be used for status update in MDGF) 45 cs_data-usmd_resultcode = is_proxy_data-log-business_document_processing_r(1). 46 47* Get target system of original replication request message (will be used for status update) 48 cs_data-usmd_dis_system = is_proxy_data-message_header-sender_business_system_id. 49 50* Message header includes message GUIDs (will be also used for status update) 51 ls_message_header = is_proxy_data-message_header. 52 53 54* Inbound conversion of message GUIDs: 55 try. 56 call method cl_gdt_conversion=>guid_inbound 57 exporting 58 im_value = ls_message_header-reference_uuid-content 59 importing 60 ex_guid_c = cs_data-usmd_msg_rqguid. 61 62 catch cx_gdt_conversion. "#EC NO_HANDLER 63 64 endtry. 65 66 try. 67 call method cl_gdt_conversion=>guid_inbound 68 exporting 69 im_value = ls_message_header-uuid-content 70 importing 71 ex_guid_c = cs_data-usmd_msg_coguid. 72 73 catch cx_gdt_conversion. "#EC NO_HANDLER 74 75 endtry. 76 77 78* analyze messages (to be stored in application log) 79 lt_log_item = is_proxy_data-log-item. 80 81* conversion of lt_log_item into message table of cs_data (type: BAPIRET2_TAB) 82 lt_message = ct_message. 83 loop at lt_log_item into ls_log_item. 84 if 1 = 2. 85* for finding message usage 86 message i010(usmd_xi_proxy) with space space space space. 87 endif. 88 89 clear ls_message. 90 case ls_log_item-severity_code. 91 when '3'. ls_message-msgty = 'E'. 92 when '2'. ls_message-msgty = 'W'. 93 when '1'. ls_message-msgty = 'I'. 94 endcase. 95 ls_message-msgid = 'USMD_XI_PROXY'. 96 ls_message-msgno = '010'. 97 ls_message-msgv1 = ls_log_item-note. 98 insert ls_message into table lt_message. 99 endloop. 100 101 ct_message = lt_message. 102 103 104endmethod. 105 106 107METHOD if_ex_usmd_pc_rplctn~outbound_processing. 108* 109* Method for redefinition/enhancement or creation of message data for outbound replication bulk request of 110* Profit center (in CS_PROXY_DATA which contains the bulk message). 111* 112* In case that method is called with initial CS_PROXY_DATA, it can be also used for message creation from scratch (by analysis 113* of the importing parameters). This would be necessary, if no SMT-Mapping is available that transforms the selected 114* MDGF data (in IT_DATA) into the message type data (CS_PROXY_DATA). 115* 116* In case of an active BAdI implementation, this method would be called during outbound processing from standard service implementation 117* class CL_USMD_RQ_PC_OUT, method IF_DRF_OUTBOUND~SEND_MESSAGE. 118*-------------------------------------------------------------------------------------------------------------------- 119*&---------------------------------------------------------------------* 120*& Class : ZCL_PROFIT_CENTER_KEYMAP

The remaining configuration, implementation details, and testing guidance continue from this answer more…

Related questions and keywords

Alternative questions

  • How can I change the profit center ID during MDG outbound replication?
  • How do I use TVARVC to drive profit center key mapping in MDG Finance?
  • What is the implementation pattern for IF_EX_USMD_PC_RPLCTN~OUTBOUND_PROCESSING?

Possible questions

  • How do I implement profit center key mapping in MDG outbound replication using BAdI USMD_SE_PC_RPLCTN?
  • How can I change the profit center ID during MDG outbound replication?
  • How do I use TVARVC to drive profit center key mapping in MDG Finance?
  • What is the implementation pattern for IF_EX_USMD_PC_RPLCTN~OUTBOUND_PROCESSING?
  • How does IF_EX_USMD_PC_RPLCTN~INBOUND_PROCESSING handle confirmation messages?

Keywords

SAP MDGMDG Financeprofit centerkey mappingBAdIUSMD_SE_PC_RPLCTNIF_EX_USMD_PC_RPLCTN~OUTBOUND_PROCESSINGIF_EX_USMD_PC_RPLCTN~INBOUND_PROCESSINGTVARVCZMDG_PC_KEY_MAPPINGCL_GDT_CONVERSIONCS_PROXY_DATA