cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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...

Accepted Solutions (1)

Accepted Solutions (1)

yann_bouillut
Active Contributor
0 Kudos

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 ))

Former Member
0 Kudos

Hi Yann,

Thanks...

If i copy paste the code in SRM BADI and do nothing in R3 will it work.do i need anything to be changed in the SRM BADI..if so advise me because i copy pasted the whole code u have sent....

Thanks in advance...

Former Member
0 Kudos

Hi yann,

I want the seperate field Zcatalogid field to be present in R3 can u help me in that.i have created zcatalogid field in ekpo.

so please send the necessary code related to it..

Thanks in advance

Former Member
0 Kudos

Hi Ravi,

before copying pasting and rewarding 10 points, take a breath and read the proposal.

Yann's proposal is to pass SRM CATALOG ID field in R/3 TRACKING NO field.

If you follow this proposal, then you can forget your Zcatalogid field in R/3 (or play with R/3 BADI to get tacking no and pass it into your Z field).

If not, continue with your first attempt, but correct it because it is incorrectly designed. Just take time to understand how it works.

Coding ABAP without knowing what we do is always dangerous.

Rgds

Christophe

Answers (0)