Skip to Content
avatar image
Former Member

Problem with using BADI PRODUCT_CUSTOMER2

Hello Experts!

I have problem with using BADI PRODUCT_CUSTOMER2

I have some customer fields in product master record in SRM.

- I used transaction COMM_ATTRSET and created the attributes for all those fields

- I created Set Type ZMAT_A with these attributes

- I use BADI PRODUCT_CUSTOMER2, method MAP_R3_TO_CRM_MATERIAL to map the additional fields to Set Type in SRM.

- When BDOC processed I get dump in program SAPLCOM_PRD_SET_REG, Include LCOM_PRD_SET_REGU05,

FUNCTION COM_PRD_SET_REG_CREATE_M.

34 */ Validate link

35 IF ( IS_REL-KEY_GUID IS INITIAL

36 AND IS_REL-ATTRIBUTES_INT IS INITIAL )

37 OR ( IS_REL-KEY_TYPE IS INITIAL

38 AND IS_REL-FRAGMENT_TYPE IS INITIAL ).

>>>>> MESSAGE X000(COM_PRD_LH_LINKS).

40 ENDIF.

Do I need to fill IS_REL-KEY_GUID and IS_REL-KEY_TYPE any values?

Where can I get values for filling IS_REL-KEY_GUID and IS_REL-KEY_TYPE?

This is the code:

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.

CALL FUNCTION 'COM_PROD_CAT_REL_READ_WITH_PR'

EXPORTING

iv_product_guid = cs_product_bdoc-header-com_product-product_guid

iv_update_buffer = ''

IMPORTING

et_set = lt_categories

.

LOOP AT cs_product_bdoc-header-categories INTO ls_category_bdoc.

MOVE-CORRESPONDING ls_category_bdoc-data TO ls_category.

READ TABLE lt_categories

WITH KEY hierarchy_guid = ls_category-hierarchy_guid

TRANSPORTING NO FIELDS.

IF sy-subrc = 0.

MODIFY lt_categories FROM ls_category.

ELSE.

APPEND ls_category TO lt_categories .

ENDIF.

ENDLOOP.

LOOP AT lt_categories INTO ls_category.

CALL FUNCTION 'COM_CAT_FRAG_REL_READ'

EXPORTING

iv_category_guid = ls_category-category_guid

IMPORTING

et_cat_frag_rel = lt_cat_settype_rel

EXCEPTIONS

wrong_call = 1

OTHERS = 2.

IF sy-subrc = 0.

APPEND LINES OF lt_cat_settype_rel TO lt_cat_settype_rel_all.

ENDIF.

ENDLOOP.

DELETE ADJACENT DUPLICATES FROM lt_cat_settype_rel_all.

DATA: BEGIN OF ls_mat_info,

struc_name(20),

matnr(40),

END OF ls_mat_info.

DATA: BEGIN OF ls_zmat_a,

zname1(30),

zname2(30),

ztiprazm(30),

ztipmark(30),

zmarka(30),

zchertez(30),

zkatn(30),

zgost(30),

zty(30),

zzakaz(30),

zdopinf(30),

END OF ls_zmat_a.

DATA: ls_other_info TYPE bapiextc.

FIELD-SYMBOLS: <source_x> TYPE x,

<target_x> TYPE x.

DATA: ls_zsettype TYPE zmat_a_maintain.

LOOP AT it_other_info INTO ls_other_info.

ASSIGN ls_other_info-field1 TO <source_x> CASTING.

ASSIGN ls_mat_info TO <target_x> CASTING.

IF <source_x> IS ASSIGNED AND

<target_x> IS ASSIGNED.

<target_x> = <source_x>.

ELSE.

CONTINUE.

ENDIF.

IF ls_mat_info-matnr NE is_mara-material.

CONTINUE.

ENDIF.

CASE ls_mat_info-struc_name.

WHEN 'ZMAT_A_R3'.

ASSIGN ls_other_info-field2 TO <source_x> CASTING.

ASSIGN ls_zmat_a TO <target_x> CASTING.

IF <source_x> IS ASSIGNED AND

<target_x> IS ASSIGNED.

<target_x> = <source_x>.

ELSE.

CONTINUE.

ENDIF.

ENDCASE.

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

OTHERS = 4

.

IF sy-subrc <> 0.

CONTINUE.

ENDIF.

CASE ls_settype-frgtype_id.

WHEN 'ZMAT_A'.

ls_zsettype-relation-owner = on.

ls_zsettype-relation-logsys = cs_product_bdoc-header-COM_PRODUCT-logsys.

ls_zsettype-data-zz0010 = ls_zmat_a-zname1.

ls_zsettype-data-zz0011 = ls_zmat_a-zname1.

ls_zsettype-data-zz0012 = ls_zmat_a-ztiprazm.

ls_zsettype-data-zz0013 = ls_zmat_a-ztipmark.

ls_zsettype-data-zz0014 = ls_zmat_a-zmarka.

ls_zsettype-data-zz0015 = ls_zmat_a-zchertez.

ls_zsettype-data-zz0016 = ls_zmat_a-zkatn.

ls_zsettype-data-zz0017 = ls_zmat_a-zgost.

ls_zsettype-data-zz0018 = ls_zmat_a-zty.

ls_zsettype-data-zz0019 = ls_zmat_a-zzakaz.

ls_zsettype-data-zz0020 = ls_zmat_a-zdopinf.

APPEND ls_zsettype TO cs_product_bdoc-data-zmat_a.

APPEND ls_settype-frgtype_id TO cs_product_bdoc-data-mnt_settype.

ENDCASE.

ENDLOOP.

ENDLOOP.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Jan 18, 2009 at 10:36 PM

    Hi, could you kindly tell how this has been fixed? I have the same issue.

    Thanks a lot in advance!

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 19, 2009 at 06:13 AM

    Dear Michele!

    I found only one solution - I filled manually this fields: ls_zsettype-relation-product_guid, ls_zsettype-RELATION-FRAGMENT_TYPE, ls_zsettype-RELATION-KEY_GUID.

    Code sample:

    WHEN 'ZMAT_A'.

    ls_zsettype-relation-owner = on.

    ls_zsettype-relation-logsys = cs_product_bdoc-header-com_product-logsys.

    ls_zsettype-relation-product_guid = cs_product_bdoc-header-com_product-product_guid.

    ls_zsettype-RELATION-FRAGMENT_TYPE = ls_settype-FRGTYPE_GUID.

    select single GUID into ls_zsettype-RELATION-KEY_GUID from

    MDM_PR0000000000 where KEY_TYPE = '0000000000'.

    ls_zsettype-data-zz0010 = ls_zmat_a1-zname1.

    ls_zsettype-data-zz0011 = ls_zmat_a1-zname2.

    ls_zsettype-data-zz0012 = ls_zmat_a1-ztiprazm.

    ls_zsettype-data-zz0013 = ls_zmat_a1-ztipmark.

    ls_zsettype-data-zz0014 = ls_zmat_a1-zmarka.

    ls_zsettype-data-zz0015 = ls_zmat_a1-zchertez.

    ls_zsettype-data-zz0016 = ls_zmat_a1-zkatn.

    ls_zsettype-data-zz0017 = ls_zmat_a1-zgost.

    ls_zsettype-data-zz0018 = ls_zmat_a2-zty.

    ls_zsettype-data-zz0019 = ls_zmat_a2-zzakaz.

    ls_zsettype-data-zz0020 = ls_zmat_a2-zdopinf.

    APPEND ls_zsettype TO cs_product_bdoc-data-zmat_a.

    APPEND ls_settype-frgtype_id TO cs_product_bdoc-data-mnt_settype.

    ENDCASE.

    Best regards,

    Ekaterina Kiselyova.

    Add comment
    10|10000 characters needed characters exceeded