Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

HI YANN/VADIM...Still having problem in BADIs...please help me out

Hi Yann/Vadim,

Facing a problem in BADI can u please help me out...

I am implementing sourcing dashboard.

I am facing problem while implementing the badi BBP_ECS_PO_OUT_BADI in SRM. and BBP_PO_INBOUND_BADI in R3.

i have written following code in BBP_ECS_PO_OUT_BADI in SRM

method IF_EX_BBP_ECS_PO_OUT_BADI~BBP_B46B_PO_OUTBOUND.

data : ls_item type BBP_PDS_PO_ITEM_D.

data : w_customer_fields type BBPS_IF_CUSTOMER_FIELDS_PI.

move 'POITEM' to w_customer_fields-refobject.

move 'CATALOGID' to w_customer_fields-fieldname.

move ls_item-catalogid to w_customer_fields-container.

append w_customer_fields to ct_bapi_customer_fields.

endmethod.

i have created field zsrmcatalogid field in R3 in EKPO table.and i am now implementing the Badi in R3 for BBP_PO_INBOUND_BADI .....in extended classic scenario.

i have written following code in R3 BADI

method IF_EX_BBP_PO_INBOUND_BADI~BBP_MAP_BEFORE_BAPI.

data : wa_customer_fields type bbps_if_customer_fields,

wa_bapi_te_mepoitem type bapi_te_mepoitem,

wa_bapi_te_mepoitemx type bapi_te_mepoitemx,

wa_extensionin type bapiparex.

data : txt_960(960) type c.

read table bbp_customer_fields into wa_customer_fields with key

refobject = 'POITEM' fieldname = 'CATALOGID'.

if sy-subrc eq 0.

move wa_customer_fields-container TO

wa_bapi_te_mepoitem-zsrmcatalogid.

wa_bapi_te_mepoitemx-zsrmcatalogid = 'X'.

endif.

clear txt_960.

clear wa_extensionin.

write wa_bapi_te_mepoitem to txt_960 left-justified.

wa_extensionin-structure = 'BAPI_TE_MEPOITEM'.

wa_extensionin-valuepart1 = txt_960(240).

wa_extensionin-valuepart2 = txt_960+240(240).

wa_extensionin-valuepart3 = txt_960+480(240).

wa_extensionin-valuepart4 = txt_960+720(240).

append wa_extensionin to bapi_extensionin.

clear txt_960.

clear wa_extensionin.

write wa_bapi_te_mepoitemx to txt_960 left-justified.

wa_extensionin-structure = 'BAPI_TE_MEPOITEMX'.

wa_extensionin-valuepart1 = txt_960(240).

wa_extensionin-valuepart2 = txt_960+240(240).

wa_extensionin-valuepart3 = txt_960+480(240).

wa_extensionin-valuepart4 = txt_960+720(240).

append wa_extensionin to bapi_extensionin.

endmethod.

But its not working...

The PO details are not passed from SRM to R3.......

PLEASE CAN U GIVE ME EXACT CODE FOR CHANGES TO BE MADE IN THIS BADI ..AS IT IS NOT WORKING...

Can anybody help me regarding how to debug the BADI in R3.

Thanks in Advance...

Former Member
replied

Hi Ravi,

You can transfer the standard SRM catalog ID field to R/3 tracking number field (if not already used for another purpose) in the R/3 PO.

This will avoid to implement the R/3 inbound bapi.

Here is an extract of the code.

The ECS PO badi example was here used to transfer the unlimited delivery flag to R/3 PO for a Z combination of criteria as well as the transfer of <b>catalog ID</b> to <b>tracking number field</b> in R/3 PO :

method IF_EX_BBP_ECS_PO_OUT_BADI~BBP_B46B_PO_OUTBOUND.

update unlimited delivery flag in R3 PO for combination of vendor +

  • Product Category maintained in the bespoke table ZUD_PC_VNDR ..

LOOP AT ct_bapi_poitem INTO ls_bapi_poitem.

lv_tabix = sy-tabix.

IF ls_bapi_poitem-po_item IS NOT INITIAL.

READ TABLE it_item INTO ls_item

WITH KEY number_int = ls_bapi_poitem-po_item

del_ind = ' '.

IF sy-subrc = 0.

  • Set Unlimited delivery Flag

read table li_zud_pc_vndr into ls_zud_pc_vndr

with key partner = ls_partner-PARTNER_ID

category_id = ls_item-category_id.

if sy-subrc eq 0.

ls_bapi_poitem-UNLIMITED_DLV = 'X'.

endif.

  • Set the Dummy catalog.. entry..

if ls_item-catalogid eq c_dummy.

ls_bapi_poitem-TRACKINGNO = c_noncat.

endif.

ls_bapi_poitem-GR_BASEDIV = ' '.

modify ct_bapi_poitem from ls_bapi_poitem index lv_tabix

transporting UNLIMITED_DLV TRACKINGNO GR_BASEDIV.

ENDIF. "READ TABLE it_item ..

ENDIF. "IF ls_bapi_poitem-po_item ..

ENDLOOP. "LOOP AT ct_bapi_poitem ..

endmethod.

Kind regards,

Yann

PS : please do reward helpful answers ))

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question