Skip to Content
avatar image
Former Member

Implementing Badi ME_PROCESS_PO_CUST

Hi all,

I'm trying to implement the BADI ME_PROCESS_PO_CUST, the method PROCESS_ITEM, and I'm trying to change the field ls_positem-lebre, but it doesn't works. I've seen that this field is in the mepoitem_tech structure in the method set_data and it restores this value to his old value, anyone knows how to change this field?

..and another question...

In the same BADI, I'm trying to change the sale's area in the shipping data, but when I call the method set_shipping_data there is a firewall that only allows me to change the fields vstel, lprio, vsbed, route and ablad. Is there any way to change the other fields?

Thanks,

Xavi

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Nov 10, 2005 at 03:36 AM

    Use ls_mepoitem = im_item->get_data( ).

    and chage your item date. Please read the documentation you can change only some set of data at item level.

    Then use im_item->set_data( ).

    I will send you the detailed code by tomorrow.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 09, 2005 at 05:57 PM

    Hi,

    The PROCESS_ITEM method has only IMPORTING parameter, meaning that you cannot change the values in the IM_ITEM parameter.

    Hope this helps,

    Bhanu

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      But if u call the method im_item->set_data u can change the fields that are not in the mepo_tech structure (I've done this). My problem is that I'm trying to change a field that appears in this structure and I don't know how.

      Regards,

      Xavi

  • avatar image
    Former Member
    Nov 10, 2005 at 09:23 AM

    hi ,

    In ME_PROCESS_PO_CUST badi you can use another method FIELDSELECTION_ITEM_REFKEYS to change the value of an item level field( but this method will trigger many times). I think it will work.

    another question of changing the sales area of shipping tab. i too got the same problem when changing delivery creation date. it is not possible to change the sales area through set_shipping_data.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      I've tried to modify the field in the FIELDSELECTION_ITEM_REFKEYS but the problem persists. The problem is that when I call the method im_item->set_data, there is a structure (l_mepotech type mepoitem_tech) that not allows to change any field compressed in this structure. In the structute definition says "Non-Directly-Changeable Fields" and I ask if there is another way (indirectly) to change a field of this structure

  • avatar image
    Former Member
    Nov 10, 2005 at 02:26 PM

    Hi,

    By implementing the above badi you can change limited fields at item level.

    I am using this to change the following and it is working fine for me.

    a) Chaning field -- PLIFZ and RESWK and NETPR based on some header conditions

    DATA : LS_MEPOITEM TYPE MEPOITEM.

    DATA : ZZPLIFZ TYPE EKPO-PLIFZ.

    *----


    • Get the Item data

    *----


    LS_MEPOITEM = IM_ITEM->GET_DATA( ).

    LS_MEPOITEM-PLIFZ = ZZPLIFZ.

    LS_MEPOITEM-NETPR = V_NETPR.

    *----


    • Set the Item data

    *----


    CALL METHOD IM_ITEM->SET_DATA

    EXPORTING

    IM_DATA = LS_MEPOITEM.

    Try this.

    I hope this will help.

    Message was edited by: Lanka Murthy

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 10, 2005 at 02:39 PM

    Hi,

    Try to change the field using field symbol assign

    Field-symbols: <fs> type [type field].

    ASSING('(prgname)tab-field') to <fs>.

    where prgname, is the program name where you can find the fild (at screen) and tab-field is the field name.

    <fs> = some value.

    This is not the more elegant solution, but it can help you.

    Regards!

    Furlan

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Xavier,

      SAP recommends that you should not attempt to change any field which is contained in MEPOITEM_TECH structure (see note 803749). So you should avoid that.

      However if you have no choice and you want to change this field, may be the following code helps:

      *declare an object of class cl_po_item_handle_mm

      DATA: lr_item TYPE REF TO cl_po_item_handle_mm.

      *assign the parameter IM_ITEM of BADI IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM to this *variable

      lr_item ?= im_item.

      lt_items = im_item->get_data( ).

      -


      *modify field lt_items-LEBRE

      and then

      lr_item->set_data( lt_items ).

      This code should do the trick, because now we use method SET_DATA(which has no validation) of class CL_PO_ITEM_HANDLE_MM instead of method IF_PURCHASE_ORDER_ITEM_MM~SET_DATA.

      However please check for any other data changes after implmenting this solution.

      Kind Regards

      Ravi