Introduction
Check this Blog from markus.ganser which talks in detail about how to govern the Reference Master Data.
In this blog, we are not going to talk about how to create governance for Reference Master data, but only about how to achieve Automatic Customizing for Reference Master Data using MDG Data Replication Framework.
FUNCTION zn_companycode.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(IT_BUKRS) TYPE ZNT_BURKS
*" VALUE(IV_RFC_DEST) TYPE RFCDEST
*" EXPORTING
*" VALUE(ET_MESSAGE) TYPE BAPIRET2_T
*" VALUE(E_RC) TYPE SY-SUBRC
*" EXCEPTIONS
*" SYSTEM_FAILURE
*" COMMUNICATION_FAILURE
*"----------------------------------------------------------------------
*"----------------------------------------------------------------------
**This is a generated FM by OIF.
**Please do not change the signature of the FM.
**By default it calls the same FM with an RFC desitination assuming
**that the FM with the same name would exist in the receiver system.
**You can reimplement the FM by commenting out the call to the FM
**with your respective inbound FM based on the destination.
*"--------------------------------------------------------------------
DATA: lo_container TYPE REF TO if_bcfg_config_container,
ls_mapping TYPE if_bcfg_config_container=>ty_s_mapping_info,
lt_langu TYPE if_bcfg_config_container=>ty_t_languages,
lt_mapping TYPE if_bcfg_config_container=>ty_t_mapping_info,
ls_mdg_rd_mapping TYPE mdg_rd_mapping,
ls_header TYPE ttypename,
lv_order TYPE trkorr.
* Step to Create the Transport request number in the target system.
CALL METHOD cl_mdg_ref_data_api=>create_transport
EXPORTING
iv_user = sy-uname
iv_rfc_dest = iv_rfc_dest
IMPORTING
ev_order = lv_order.
ls_header = 'ZNT_BURKS' .
ls_mdg_rd_mapping = cl_mdg_ref_data_api=>read_refdat_config(
iv_tabletype = ls_header ).
MOVE-CORRESPONDING ls_mdg_rd_mapping TO ls_mapping.
CLEAR: ls_mapping-tablename, lt_mapping.
APPEND ls_mapping TO lt_mapping.
INSERT 'E' INTO TABLE lt_langu.
IF sy-langu NE 'E'.
INSERT sy-langu INTO TABLE lt_langu.
ENDIF.
CALL METHOD cl_mdg_ref_data_api=>create_container
EXPORTING
iv_rfc_dest = iv_rfc_dest
it_langu = lt_langu
it_mapping = lt_mapping
IMPORTING
eo_container = lo_container.
* Read data from remote system to check whether
* the data already there, to avoid overwritting
data lt_data type STANDARD TABLE OF t001.
data lt_options type STANDARD TABLE OF RFC_DB_OPT.
data ls_options type rfc_db_opt.
* build where clause for the remote select
FIELD-SYMBOLS: <ls_burks> like line of it_bukrs.
LOOP AT it_bukrs ASSIGNING <ls_burks>.
CONCATENATE 'BUKRS EQ '''
<ls_burks>-bukrs '''' space
INTO ls_options.
APPEND ls_options TO lt_options.
ENDLOOP.
* Source code to read data from target system
CALL FUNCTION 'RFC_READ_TABLE' DESTINATION iv_rfc_dest
EXPORTING
query_table = 'T001'
* DELIMITER = ' '
* NO_DATA = ' '
* ROWSKIPS = 0
* ROWCOUNT = 0
TABLES
options = lt_options
* fields = fields
data = lt_data
EXCEPTIONS
TABLE_NOT_AVAILABLE = 1
TABLE_WITHOUT_DATA = 2
OPTION_NOT_VALID = 3
FIELD_NOT_VALID = 4
NOT_AUTHORIZED = 5
DATA_BUFFER_EXCEEDED = 6
OTHERS = 7
.
IF sy-subrc <> 0.
E_RC = sy-subrc.
ENDIF.
* Source code to generate the BCset and add it to the Transport
CALL METHOD cl_mdg_ref_data_api=>add_lines_generic
EXPORTING
it_lines = it_bukrs
iv_objectname = ls_mapping-objectname
io_container = lo_container
iv_order = lv_order
iv_mapping = ls_mdg_rd_mapping-mapping.
COMMIT WORK.
* Source code to release the Transport request number.
* Please be cautious to uncomment only if you know that all the
* attributes are filled in the customizing.
* Otherwise, you cannot use the same Transport.
* CALL METHOD cl_mdg_ref_data_api=>release_transport
* EXPORTING
* iv_order = lv_order
* iv_rfc_dest = iv_rfc_dest.
ENDFUNCTION.
CALL METHOD cl_mdg_ref_data_api=>create_transport
EXPORTING
* iv_user = sy-uname
iv_user = < replace the actual user id from target system >
iv_rfc_dest = iv_rfc_dest
IMPORTING
ev_order = lv_order.
S_TRANSPRT - Used to secure the functions that change transport requests and tasks
S_CTS_ADMI - Used to secure the administration functions in the CTS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 |