Hi All,
I am having difficulty in replicating SAP standard field values from ECC to custom fields for products in CRM. This is what i did:
1. I created a new settype(ZMASTER_INFO) with a single attribute(ZIND_STD) and added
this new settype to MAT_HAWA. (As all our materials fall under this material type).
2. I am looking to map SAP standard field from ECC to this custom field of mine.
I wrote the code in CRM BADI
'ZPRODUCT_CUSTOMER2->MAP_R3_TO_CRM_MATERIAL' with the following code:
****************************************************************************************************
DATA: ls_ZMASTER_INFO TYPE ZMASTER_INFO_maintain.
DATA: ls_category_bdoc TYPE COMT_PROD_CAT_REL_MAINTAIN,
ls_category TYPE COMT_PROD_CAT_REL,
lt_categories TYPE COMT_PROD_CAT_REL_TAB,
ls_settype TYPE COMT_settype_ext,
ls_cat_settype_rel TYPE COMT_CAT_FRAG_REL,
lt_cat_settype_rel TYPE COMT_CAT_FRAG_REL_TAB,
lt_cat_settype_rel_all TYPE COMT_CAT_FRAG_REL_TAB.
LOOP AT lt_cat_settype_rel_all INTO ls_cat_settype_rel.
CALL FUNCTION 'COM_SETTYPE_READ_SINGLE'
EXPORTING
IV_SETTYPE_GUID = ls_cat_settype_rel-frgtype_guid
IMPORTING
ES_SETTYPE = ls_settype
EXCEPTIONS
NOT_FOUND = 1
NO_IMPORT_VALUES = 2
NO_TEXT_FOUND = 3 .
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CASE ls_settype-frgtype_id.
WHEN 'ZMASTER_INFO'.
ls_ZMASTER_INFO-relation-owner = 'X'.
ls_ZMASTER_INFO-relation-logsys = cs_product_bdoc-header-com_product-logsys.
ls_ZMASTER_INFO-data-ZZ0010 = is_mara-STD_DESCR.
ls_ZMASTER_INFO-DATA_X-ZZ0010 = 'X'.
APPEND ls_ZMASTER_INFO TO cs_product_bdoc-data-ZMASTER_INFO.
APPEND ls_settype-FRGTYPE_GUID TO cs_product_bdoc-data-MNT_SETTYPE.
ENDCASE.
ENDLOOP.
*****************************************************************************************************
Since in ECC i am not having any custom fields i did not write any code in ECC for TPS34 and TBE24. I just wrote this BADI in CRM and using the field S_MARA-STD_DESCR.
I am not sure if i need to write the code in ECC. COUld anyone please confirm if i need the code in ECC?
Also in the CRM BADI, lt_cat_settype_rel_all is EMPTY. Not sure how this gets its value.
Could anyone please suggest if i am missing anything here? Any help is appreciated.
Thanks,
Karuna.