cancel
Showing results for 
Search instead for 
Did you mean: 

BADI BBP_CATALOG_TRANSFER

Former Member
0 Kudos

Hello!

We are working with SRM 5.0 and we are using punch out.

We need to buy on stock (cost assignment category ST) out of those external catalogs. But the vendor cannot put our SAP material numbers into his system.

How can I do the mapping between the vendor material reference and our material numbers? Can I use the specific BADI BBP_CATALOG_TRANSFER for this?

Thanks a lot,

Regards,

Caroline

Accepted Solutions (0)

Answers (1)

Answers (1)

yann_bouillut
Active Contributor
0 Kudos

Hi,

Yes absolutely

Kind regards,

Yann

Former Member
0 Kudos

Thanks Yann.

Do you have any example of implementation of this BADI ?

Would be really helpfull.... and I will reward some points

Thanks a lot,

Regards,

Caroline

yann_bouillut
Active Contributor
0 Kudos

Hi caroline,

<b>Example 1 for tax mapping :</b>

In method ENRICH_ITEM_DATA do the following:

LOOP AT catalog_content INTO wa_catalog_content.

LOOP AT et_sc_item_data INTO wa_sc_item_data

WHERE catalogitem = wa_catalog_content-ext_product_id.

wa_sc_item_data-<field_for_tax> = wa_catalog_content-cust_field2.

MODIFY et_sc_item_data FROM wa_sc_item_data.

ENDLOOP.

ENDLOOP.

<u>Example 2 :</u>

method IF_EX_BBP_CATALOG_TRANSFER~ENRICH_ITEM_DATA.

  • break-point.

******************************************************************

  • This implementation is writing all the fields that are filled

  • in the OCI-Interface to the application log BCT1. Furhtermore

  • it is also storing the error messages from ENRICH_ITEM_DATA to

  • the same log. The log can be view with transaction SLG1.

******************************************************************

  • ***** DATA DECLARATION *************************************

  • Work area for catalog_content

DATA: ITAB_WA TYPE bbp_ws_oci_item_s.

  • Data of the aplication log

DATA: L_S_LOG TYPE BAL_S_LOG. "Header of application log

DATA: L_S_TEXT(200) TYPE C. "Message lines

DATA: L_S_HANDLE TYPE BALLOGHNDL. "Log Handle.

DATA: L_T_HANDLE_TAB TYPE BAL_T_LOGH. "Handle tab for BAL_DB_SAVE

  • Data for OCI-Fields

DATA: OCI_FIELDS TYPE DDFIELDS. "all OCI-fields

DATA: OCI_FIELDS_WA TYPE DFIES. "work area for OCI-fields

DATA: HELP_FIELD(30) TYPE C. "dynamic field for loop at OCI-fields

DATA: DISP_FIELD(30) TYPE C.

DATA: H2(40) TYPE C. "conversion to type C

FIELD-SYMBOLS: <F1> TYPE ANY.

  • Data for OCI-Error-Tab

DATA: CATALOG_CONTENT_ERRORS_WA TYPE BBP_OCI_ERRORS.

  • ***** END OF DATA DECLARATION ********************************

  • Read all the fields of the OCI-Interface.

CALL FUNCTION 'GET_FIELDTAB'

EXPORTING

tabname = 'BBP_WS_OCI_ITEM_S'

TABLES

fieldtab = oci_fields.

  • create a log

L_S_LOG-EXTNUMBER = 'CATALOG_DOWNLOAD'.

L_S_LOG-ALUSER = SY-UNAME.

L_S_LOG-ALPROG = SY-REPID.

L_S_LOG-OBJECT = 'BCT1'.

CALL FUNCTION 'BAL_LOG_CREATE'

EXPORTING

I_S_LOG = L_S_LOG

IMPORTING

E_LOG_HANDLE = L_S_HANDLE

EXCEPTIONS

OTHERS = 1.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • fill the data for the Application Log

CLEAR ITAB_WA.

LOOP AT CATALOG_CONTENT INTO ITAB_WA.

  • loop at all oci-fields and add nonempty fields to the appl. log

LOOP AT OCI_FIELDS INTO OCI_FIELDS_WA.

CONCATENATE 'ITAB_WA-' OCI_FIELDS_WA-FIELDNAME INTO HELP_FIELD.

ASSIGN (HELP_FIELD) TO <F1>.

IF <F1> IS INITIAL.

  • only write the fields that are not initial

ELSE.

H2 = <F1>. "conversion to type C

CONCATENATE 'NEW_ITEM-' OCI_FIELDS_WA-FIELDNAME INTO DISP_FIELD.

CONCATENATE DISP_FIELD '=' H2 INTO L_S_TEXT SEPARATED BY SPACE.

  • add this line to the application log

CALL FUNCTION 'BAL_LOG_MSG_ADD_FREE_TEXT'

EXPORTING

I_LOG_HANDLE = L_S_HANDLE

I_MSGTY = 'I'

I_TEXT = L_S_TEXT

EXCEPTIONS

LOG_NOT_FOUND = 1

MSG_INCONSISTENT = 2

LOG_IS_FULL = 3

OTHERS = 4.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDIF.

ENDLOOP.

  • check if there are errors for this item in CATALOG_CONTENT_ERRORS

LOOP AT CATALOG_CONTENT_ERRORS INTO CATALOG_CONTENT_ERRORS_WA

WHERE LINE = ITAB_WA-LINE.

CONCATENATE

CATALOG_CONTENT_ERRORS_WA-LINE

CATALOG_CONTENT_ERRORS_WA-TYPE

CATALOG_CONTENT_ERRORS_WA-CODE

CATALOG_CONTENT_ERRORS_WA-MESSAGE

CATALOG_CONTENT_ERRORS_WA-MESSAGE_V1

CATALOG_CONTENT_ERRORS_WA-MESSAGE_V2

CATALOG_CONTENT_ERRORS_WA-MESSAGE_V3

CATALOG_CONTENT_ERRORS_WA-MESSAGE_V4

INTO L_S_TEXT SEPARATED BY SPACE.

  • add this line to the application log

CALL FUNCTION 'BAL_LOG_MSG_ADD_FREE_TEXT'

EXPORTING

I_LOG_HANDLE = L_S_HANDLE

I_MSGTY = CATALOG_CONTENT_ERRORS_WA-TYPE

I_TEXT = L_S_TEXT

EXCEPTIONS

LOG_NOT_FOUND = 1

MSG_INCONSISTENT = 2

LOG_IS_FULL = 3

OTHERS = 4.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDLOOP.

ENDLOOP.

  • Save this log to the data base (Log-Object = BCT1)

CLEAR L_T_HANDLE_TAB.

APPEND L_S_HANDLE TO L_T_HANDLE_TAB.

CALL FUNCTION 'BAL_DB_SAVE'

EXPORTING

I_T_LOG_HANDLE = L_T_HANDLE_TAB

EXCEPTIONS

LOG_NOT_FOUND = 1

SAVE_NOT_ALLOWED = 2

NUMBERING_ERROR = 3

OTHERS = 4.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Kind regards,

Yann

Former Member
0 Kudos

Thank you very much Yann.

You don't have an example for material number mapping?

Thanks in advance,

regards,

Caroline

Former Member
0 Kudos

Hi Caroline,

You can use this same BADI.

Material number must be in field ORDERED_PROD in table type BBPT_PD_SC_ITEM_D (et_sc_item_data).

Regards,

Marcin

Former Member
0 Kudos

Thank you very much Marcin!

I will try it.

Last small question: I will need this BADI for some suppliers, because for some suppliers it's possible to upload our SAP material number for some others it's not possible (reason why I'll use this BADI).

Isn't it a problem that this BADI is activated when our SAP numbers are already in the vendor punch out?

Thanks a lot,

regards,

Caroline

Former Member
0 Kudos

Hi,

Should be no problem, but you can filter this value using table et_sc_partner or catalog_content-vendor.

Regards,

Marcin

Former Member
0 Kudos

Thanks Marcin,

I'll try!

Regards,

Caroline