|
Reference Documents
Description of ProblemThere are several fields in the Material Master of ECC that must be brought over to the Product Master in CRM. These fields are currently not supported by the BDOC. To include these fields in the BDOC use the following procedure. In this document Transportation relevant information is replicated from ECC to CRM. Configuration in ECC for triggering the CRM Middleware download of dataConfiguration Tables TBE24 and TPS34 in ECC must be maintained for triggering the CRM Middleware download of data from ECC to CRM. In Table TPS34 the Process CRM0_200 contains the entry for CRM Middleware download of data. Activate Customer Product by maintaining table TBE24 using transaction SM30
Add the function module that the OPEN_FI function module can find for a Business Transaction Event (BTE) as an alternative to a standard function module by maintaining table TPS34 using transaction SM30
Create Function module for mapping. Function Module Z_SEND_PROD_TO_CRM handles mapping the custom fields to be transferred to the CRM system. Here is an example of the code needed FM Attributes
Import Parameters
Export Parameters
Changing Parameters
Tables
Sample Code FUNCTION Z_SEND_PROD_TO_CRM. *"---------------------------------------------------------------------- *"*"Local Interface: *" IMPORTING *" REFERENCE(I_OBJ_CLASS) LIKE BAPICRMOBJ-OBJCLASS *" REFERENCE(I_OBJ_NAME) LIKE BAPICRMOBJ-OBJ_NAME *" REFERENCE(I_BAPICRMDH2) LIKE BAPICRMDH2 STRUCTURE BAPICRMDH2 *" OPTIONAL *" REFERENCE(I_KEYWORD_IN) LIKE CRM_PARA-KEYWORD_IN *" REFERENCE(I_CRMRFCPAR) LIKE CRMRFCPAR STRUCTURE CRMRFCPAR *" EXPORTING *" REFERENCE(E_DO_NOT_SEND) LIKE CRM_PARA-XFELD *" TABLES *" T_INT_TABLES STRUCTURE BAPIMTCS *" T_BAPISTRUCT STRUCTURE BAPIMTCS *" T_MESSAGES STRUCTURE BAPICRMMSG *" T_KEY_INFO STRUCTURE BAPICRMKEY *" T_BAPIIDLIST STRUCTURE BAPIIDLIST *" T_OTHER_INFO STRUCTURE BAPIEXTC *" CHANGING *" REFERENCE(C_BAPICRMDH2) LIKE BAPICRMDH2 STRUCTURE BAPICRMDH2 *" REFERENCE(C_RFCDEST) LIKE CRMRFCPAR STRUCTURE CRMRFCPAR *" REFERENCE(C_OBJNAME) LIKE BAPICRMOBJ-OBJ_NAME *"---------------------------------------------------------------------- DATA: ls_mara TYPE mara, ls_marc TYPE marc.
* Communication Structure DATA: BEGIN OF ls_com_key, struct(20), matnr(40), END OF ls_com_key.
* Communication structure (additional MARA data) DATA: BEGIN OF ls_com_data1, tragr LIKE mara-tragr, magrv LIKE mara-magrv, END OF ls_com_data1.
* Communication structure (additional MARC data) DATA: BEGIN OF ls_com_data2, mfrgr(8), ladgr(4), vbamg(13), vrvez(7), vbeaz(7), END OF ls_com_data2.
* Field Symbol for Casting BAPIMTCS FIELD-SYMBOLS: <source_x> TYPE x, <target_x> TYPE x.
* Additional Fields used DATA: lv_matnr TYPE mara-matnr.
DATA: ls_BAPISDCOND TYPE BAPISDCOND. DATA: ORIGNAL_COST TYPE BAPISDCOND-COND_VALUE.
* DATA: *** BEGIN ************************************************************** ** ATTENTION: This declaration is needed, to get the right offset for ** a later assign (to prevent alignment error at statement ** ASSIGN ... CASTING ...) * lv_casting TYPE f, "#EC NEEDED ** Never insert a new definition between LV_CASTING and ** and LS_BAPIMTCS !!! * ct_bapimtcs TYPE bapimtcs. *** END **************************************************************** ** * FIELD-SYMBOLS: <ledsource_x> TYPE BAPISDCOND, <ledtarget_x> TYPE BAPISDCOND, <lfs_data> type any.
DATA: gc_condition TYPE tabname30 VALUE 'BAPISDCOND'.
CASE i_obj_name.
WHEN 'MATERIAL'.
* We want to pick up the additional fields from MARA * Mapping of MARA fields into table t_other_info
LOOP AT t_int_tables WHERE tabname = 'MARA'. ASSIGN t_int_tables-data TO <source_x> CASTING. ASSIGN ls_mara TO <target_x> CASTING.
IF <source_x> IS ASSIGNED AND <target_x> IS ASSIGNED.
<target_x> = <source_x>.
ELSE.
CONTINUE.
ENDIF.
ls_com_key-struct = 'MARA'. ls_com_key-matnr = ls_mara-matnr.
MOVE-CORRESPONDING ls_mara TO ls_com_data1.
t_other_info-field1 = ls_com_key. t_other_info-field2 = ls_com_data1. * APPEND t_other_info.
* We want to pick up the additional fields from MARC lv_matnr = t_int_tables-data+3(40). CLEAR ls_marc. CALL FUNCTION 'MARC_SINGLE_READ' EXPORTING matnr = lv_matnr * * STILL NEEDS SOME WORK HERE * There is a 1 to many relationship between MARA and MARC * and we need to determine how to handle this. * For testing purposes Plant 10 is hard coded * werks = '10 ' * END IMPORTING wmarc = ls_marc EXCEPTIONS OTHERS = 5.
MOVE-CORRESPONDING ls_marc TO ls_com_data2.
t_other_info-field3 = ls_com_data2. APPEND t_other_info.
ENDLOOP.
WHEN 'LEDELIVERY'.
*t_int_tables LOOP AT T_BAPISTRUCT WHERE tabname = 'BAPISDCOND'.
ASSIGN T_BAPISTRUCT-data TO <ledsource_x> CASTING. ASSIGN ls_BAPISDCOND TO <ledtarget_x> CASTING.
IF <ledsource_x> IS ASSIGNED AND <ledtarget_x> IS ASSIGNED.
*Following will pass data from T_BAPISTRUCT-data to ls_BAPISDCOND *Both are having separate memory areas. <ledtarget_x> = <ledsource_x>.
ELSE.
CONTINUE.
ENDIF.
ORIGNAL_COST = ls_BAPISDCOND-COND_VALUE.
*As <ledtarget_x> refers to ls_BAPISDCOND memory, *in debugging, you can see <ledtarget_x>-con_value becomes 5000. ls_BAPISDCOND-COND_VALUE = '5000'.
*<ledsource_x> refers to data field of header line (workline) of *internal table T_BAPISTRUCT *So following will change data field of header line of T_BAPISTRUCT <ledsource_x> = ls_BAPISDCOND.
ENDLOOP.
ENDCASE. Configuration in CRM for triggering the CRM Middleware download of dataIn order to populate these fields in CRM there are a number of development objects which are needed in CRM: 1) Every additional field from the Material Master in ECC must be created as an Attribute in CRM. Use transaction COMM_ATTRSET to create the Attributes for the following fields: a. ZMARA_BRGEW - Gross weight - not needed b. ZMARA_NTGEW - Net weight - not needed c. ZMARA_VOLUM - Volume - not needed d. ZMARA_MFRGR - Material Freight Grp (Should be ZMARC_MFRGR) e. ZMARA_TRAGR - Transportation Group f. ZMARC_LADGR - Loading Group g. ZMARC_VBAMG - Base Qty. Shipping - not needed for now h. ZMARC_VRVEZ - Shipping setup time - not needed for now i. ZMARC_VBEAZ - Shipping processing time - not needed for now j. ZMARA_MAGRV - Material Group: Packaging Materials 2) Set Types must be created to handle all of the Attributes created. Set types can only handle 22 Attributes. Create multiple Set Types if needed to handle all of the Attributes. Use transaction COMM_ATTRSET to create the Attributes for the following Set Types: a. ZPROD_XPORT This will be the ZZxxxx fields on the BDOC: a. ZMARA_BRGEW - Gross weight - ZZ0011 b. ZMARA_NTGEW - Net weight - ZZ0013 c. ZMARA_VOLUM - Volume - ZZ0015 d. ZMARA_MFRGR - Material Freight Grp - ZZ0016 (Should be ZMARC_MFRGR) e. ZMARA_TRAGR - Transportation Group - ZZ0017 f. ZMARC_LADGR - Loading Group - ZZ0018 g. ZMARC_VBAMG - Base Qty. Shipping - ZZ0019 h. ZMARC_VRVEZ - Shipping setup time - ZZ0021 i. ZMARC_VBEAZ - Shipping processing time - ZZ0022 j. ZMARA_MAGRV - Material Group: Packaging Materials - ZZ0023
If you make changes to the Set Type, then there is a possibility that the field mappings in BADI PRODUCT_CUSTOMER2, method MAP_R3_TO_CRM_MATERIAL on the CRM side will have to be changed. Please check the mappings after a set type change to ensure they are still correct.
Assign all of the Attributes to the Set Types created. Assign each Set Type to the Hierarchy Category MAT_HALB using transaction COMM_HIERARCHY. See Figure below.
Extending BDocs (By Robert Kuhn) |
|