Application Development 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: 

BADI ME_PROCESS_PO_CUST get item nr

Former Member
0 Kudos

Hi experts,

I would like to get the item number EBELP in a purchase order ME21N, ME22N.

My problem is that when I change of item, I can't get the item n° in the BADI ME_PROCESS_PO_CUST

Thks for help,

Ant

1 ACCEPTED SOLUTION

GauthamV
Active Contributor
0 Kudos

Yes , you can get that values.check this .

badi: ME_PROCESS_PO_CUST

method:PROCESS_ITEM


data:ls_mepoitem TYPE mepoitem,
       ls_mepoitem_prev TYPE mepoitem,

    ls_mepoitem = im_item->get_data( ).

    CLEAR ls_mepoitem_prev-netpr.

    SELECT SINGLE netpr FROM ekpo
    INTO ls_mepoitem_prev-netpr
    WHERE ebeln = ls_mepoitem-ebeln
      AND ebelp = ls_mepoitem-ebelp.
      if  ls_mepoitem-netpr GT ls_mepoitem_prev-netpr.

       MESSAGE 'Not Allowed to change values of Previous years WBS'
        TYPE 'E'.

        ENDIF.

8 REPLIES 8

GauthamV
Active Contributor
0 Kudos

Yes , you can get that values.check this .

badi: ME_PROCESS_PO_CUST

method:PROCESS_ITEM


data:ls_mepoitem TYPE mepoitem,
       ls_mepoitem_prev TYPE mepoitem,

    ls_mepoitem = im_item->get_data( ).

    CLEAR ls_mepoitem_prev-netpr.

    SELECT SINGLE netpr FROM ekpo
    INTO ls_mepoitem_prev-netpr
    WHERE ebeln = ls_mepoitem-ebeln
      AND ebelp = ls_mepoitem-ebelp.
      if  ls_mepoitem-netpr GT ls_mepoitem_prev-netpr.

       MESSAGE 'Not Allowed to change values of Previous years WBS'
        TYPE 'E'.

        ENDIF.

Former Member
0 Kudos

Hi,

Use this method to get the details of item.

DATA : re_data TYPE mepoitem.

CALL METHOD im_item->get_data

RECEIVING

re_data = re_data.

You will get the details

Former Member
0 Kudos

Thanks for your replies !

I need to get the item n° just after changing of item.

My problem is that I don't found any method which triggers when changing of item.

0 Kudos

badi: ME_PROCESS_PO_CUST

method:PROCESS_ITEM


data:ls_mepoitem TYPE mepoitem,
       ls_mepoitem_prev TYPE mepoitem,
 
    ls_mepoitem = im_item->get_data( ).
 
    CLEAR ls_mepoitem_prev-ebelp.
 
    SELECT SINGLE ebelp FROM ekpo
    INTO ls_mepoitem_prev-ebelp
    WHERE ebeln = ls_mepoitem-ebeln
      AND ebelp = ls_mepoitem-ebelp.

     

Here ls_mepoitem_prev-ebelp contains old item number and ls_mepoitem-ebelp current.

Former Member
0 Kudos

Thanks for your reply !

My problem is that the BADI doesn't triggers when I change of item :

10 item1

20 item2

30 item3

If I select items in this way :

10 , 20 , 30 , 10 -> the BADI doesn't triggers in the last selection !

My question is not how to select the item n° (which is in the BADI) but how to trigger the BADI at every item changement.

Thakns for trying to help me !

0 Kudos

Hi

U should use the method PROCESS_ITEM, this method is triggered as soon as some modification is done for a certain item of a PO.

There's no method is triggered as soon as you move from item to another one.

Why do u need an event triggered on this monent?

Max

0 Kudos

Because I ve added a TAB in the PO-item screen and I need to know the item n° to add some record in a itab (ALV).

When I add a record in my itab (ALV), it doesn't trigger the BADI then I don't know where find the item n°.

for exemple :

itab

-

-


10 - X

10 - Y

20 - Z

I hope I explain good enough !

Tks,

0 Kudos

Hi

In this situation try to use some method of BADI ME_GUI_PO_CUST instead of ME_PROCESS_PO_CUST.

Max