Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BADI ME_PROCESS_PO_CUST Method:PROCESS_ITEM

Former Member
0 Likes
7,156

Hi,

I have to update the vendor material field through BADI ME_PROCESS_PO_CUST.

I have created an implementation for this BADI.Can anyone help me find the solution for the same.

Thanks.

18 REPLIES 18
Read only

Former Member
0 Likes
3,680

Hi,

Check example class for this badi CL_EXM_IM_ME_PROCESS_PO_CUST.

You need to use method SET_DATA to modify values.

Regards,

Ashok.

Read only

0 Likes
3,680

Hi Ashok,

Thanks for the prompt reply.I will currently check the Sample code in SE18 and then change the code as per the requirement.

Thanks.

Read only

Former Member
0 Likes
3,680

Hi,

You see the sample coding in SE18 transaction then GO TO -> SAMPLE CODE -> DISPLAY.

This will help you how to implement the BADi.

Regards,

Shanmugavel chandrasekaran.

Read only

0 Likes
3,680

Hi Shanmugavel,

Thanks for the suggestion.I am checking the code for the requirement.

Read only

Former Member
0 Likes
3,680

Hi,

Implemeent the method PROCESS_ITEM ....

DATA : lt_item TYPE MEREQ_ITEM.

CALL METHOD im_item->GET_DATA

RECEIVING

RE_DATA = lt_item .

lt_item will contain the data ....

now update the value ....by......lt_item-IDNLF = < >

now set the data by

CALL METHOD im_item->GET_DATA

EXPORTING

RE_DATA = lt_item .

Thanks,

Shailaja Ainala.

Read only

0 Likes
3,680

Hi Shailaja,

Thanks for the reply.I saw ur previous reply in some earlier post too.I am currently looking at the sample code in se18.

Please advice,I have a few set of checks from EKKO EKKN AND A Z TABLE,after the checks i Need to fetch data from VBAP.Can I do the calculation before the final Call Method.

Also if i set the break point in the code.and run me23n will I be able to check the values.?

Thanks a lot for the prompt reply.

Read only

0 Likes
3,680

any suggestions...

Read only

0 Likes
3,680

the following error gets displayed when i am cheking the code:

"Exception CX_SY_NO_HANDLER triggered"

"An exception with the type CX_SY_REF_IS_INITIAL occurred, but was neither handled".

please advice.

Read only

0 Likes
3,680

Hi,

When you are facing this problem .....did you implement the badi correctly.....

Thanks,

Shailaja Ainala.

Read only

0 Likes
3,680

yes.

Implementation created in SE18 for BADI ME_PROCESS_PO_CUST.

Read only

0 Likes
3,680
DATA: wa_ekko TYPE ekko,
        wa_ekkn TYPE ekkn,
        wa_ekpo TYPE ekpo,
        wa_vbap           TYPE vbap.
  DATA : lt_item TYPE mepoitem.
  IF im_item->is_persistent( ) EQ mmpur_no. "Only check for new items
* Retrieve item data into BADI buffer
*get data
    CALL METHOD im_item->get_data
      RECEIVING
        re_data = lt_item.
    ENDIF.

    SELECT SINGLE * FROM ekko
      INTO wa_ekko
      WHERE reswk NE ''.


    IF sy-subrc EQ 0.
      SELECT SINGLE * FROM ekkn
          INTO wa_ekkn
          WHERE ebeln = wa_ekko-ebeln.
      IF wa_ekkn-vbeln <> ''.
        SELECT SINGLE * FROM ekpo
          INTO wa_ekpo
          WHERE ebeln = wa_ekko-ebeln
          AND   idnlf = ''.
        IF sy-subrc EQ 0.
        SELECT SINGLE * FROM vbap
          INTO wa_vbap
          WHERE vbeln = wa_ekkn-vbeln
          AND   posnr = wa_ekkn-ebelp.

        IF sy-subrc EQ 0.
          lt_item-idnlf = wa_vbap-kdmat.

        ENDIF.
      ENDIF.
    ENDIF.
        ENDIF.

* Update changes
    CALL METHOD im_item->set_data
      EXPORTING
        im_data = lt_item.
Read only

0 Likes
3,680

when i am cheking the code the following error gets displayed in the implementation of BADI: ME_PROCESS_PO_CUST :

"Exception CX_SY_NO_HANDLER triggered"

"An exception with the type CX_SY_REF_IS_INITIAL occurred, but was neither handled".

please advice.

any suggestions ...

thanks.

Read only

0 Likes
3,680

Hi ,

I used your coding it is working fine , only thing is you need to use SET_DATA within IF...ENDIF..

Regards,

Ashok.

Read only

0 Likes
3,680

Hi,

I think some problem in implementation of the badi ....do the process again from start

Thanks,

Shailaja Ainala.

Read only

0 Likes
3,680

HI,

Thanks for your quick replies.

I have changed the code location of call method set data.

I have one more doubt,I need to call this piece of code at the time of PO creation.Should i mention that the tcode = ME21n?

Also if I am fetching the data from EKKO,then what fields will i compare in the where clause?

Thanks.

Read only

0 Likes
3,680

Hi,

You can use in create mode also .....check for tcode .....get the header data using...

get header data as below..

data : lo_reF_header type ref to IF_PURCHASE_ORDER_MM,

lt_header type MEPOHEADER.

CALL METHOD im_item->GET_HEADER

RECEIVING

RE_HEADER = lo_reF_header.

CALL METHOD lo_reF_header->GET_DATA

RECEIVING

RE_DATA = lt_header.

Thanks,

Shailaja Ainala.

Read only

Former Member
0 Likes
3,680

In the trx SE24 enter the class name for the badi implementation and edit method process_item:

data:

it_mepo type mepoitem,

mepo_mm type ref to if_purchase_order_item_mm,

mepo_item type mepoitem,

"- Get the data from the purchase item

call method im_item->get_data

receiving re_data = it_mepo.

"- Check the structure mepoitem and change the field that you need. For example idnlf

it_mepo-idnlf = 'SomeData'

"- Update de object

call method im_item->set_data

exporting im_data = it_mepo.

NOTE: The IM_ITEM object its a parameter. Automatically apears once the method is invoked.

Edited by: MARCOS CARRASCO on Mar 5, 2010 6:53 AM

Read only

Former Member
0 Likes
3,680

Thanks for all the inputs