BADI ME_PROCESS_PO_CUST Method:PROCESS_ITEM

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.

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.

Similar Messages

  • Badi: ME_PROCESS_PO_CUST Method: IF_EX_ME_PROCESS_PO_CUST~PROCESS_SCHEDULE

    Hi,
    in method: IF_EX_ME_PROCESS_PO_CUST~PROCESS_SCHEDULE of Badi ME_PROCESS_PO_CUST
    i will get schedule-data and item data.
    I try this:
    METHOD IF_EX_ME_PROCESS_PO_CUST~PROCESS_SCHEDULE.
      DATA: LS_ITEM TYPE MEPOITEM.
      LS_ITEM = IM_ITEM->GET_ITEM( ).
      DATA: LS_SCHEDULE TYPE MEPOSCHEDULE.
      LS_SCHEDULE = IM_SCHEDULE->GET_DATA( ).
      BREAK-POINT.
    ENDMETHOD.
    LS-SCHEDULE are filled correct.
    in Line   LS_ITEM = IM_ITEM->GET_ITEM( ). i get an syntax error -> IM_ITEM are unknown.
    Has anyone an idea how i can get the ITEM Data?
    Thanks.
    Regards, Dieter

    Hi Vinod,
    thanks, it solved my Problem.
    I have another thread for ME_PROCESS_PO_CUST.
    Question to Z_ME_PROCESS_PO_CUST with item catagory L
    Do you have an idea for this problem?
    Thanks.
    Regards, Dieter

  • BADI ME_PROCESS_PO_CUST Method Post

    Hi, how can we know in the method post of the BADI ME_PROCESS_PO_CUST if we are in creation mode (me21n) or change mode (me22n), I need to do some coding only at the creation of the PO but this method is call anytime we click save!
    thanks!

    Hello Alexandre
    It would be possible to check the transaction. However, if the BAPI BAPI_PO_CREATE is used the BAdI is also processed yet the transaction is most likely wrong.
    An <u>unambigous </u>approach is to check IMPORTING parameter IM_TRTYP in method IF_EX_ME_PROCESS_PO_CUST~OPEN:
    METHOD if_ex_me_process_po_cust~open.
    * define local data
      DATA:
        lo_po          TYPE REF TO cl_po_header_handle_mm,
        ls_header      TYPE mepoheader.
      me->md_trtyp = im_trtyp.  " save transaction type
      IF ( im_trtyp = 'H' ).  " add new purchase order
    I would add an instance attribute MD_TRTYP to the BAdI implementing class and save the transaction type in method IF_EX_ME_PROCESS_PO_CUST~OPEN (see above).
    Now you can simply add the following IF condition to your POST method:
    METHOD if_ex_me_process_po_cust~open.
      CASE me->md_trtyp. 
        WHEN 'H'.    " add new purchase order
      ...  " do required action for CREATE
        WHEN ... .
        WHEN others.
      ENDCASE.
    The possible transaction types can be found at: im_trtyp -> data element -> <b>domain </b>(fixed values).
    Regards
      Uwe

  • BADI ME_PROCESS_PO_CUST get item nr

    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

    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.

  • How to Purchase Order number in badi ME_PROCESS_PO_CUST~INITIALIZE

    Hi SDNers,
               I have problem to get  purchase order number in badi ME_PROCESS_PO_CUST method INITIALIZE, when purchase order release from ME28 tcode.

    Hi Suresh,
    I just tried that ... it is working fine... You have to use CMOD to implement it by creating a project...
    Please documentation on how to implement user exits...
    Also Please understand this is a Workflow forum... please do not post ABAP queries here... You would get better answers if you post in ABAP forums...
    Regards
    Gautam

  • Badi-- ME_PROCESS_PO_CUST, PROCESS_ACCOUNT method

    Hi,
    My requirement is that While Creating PO,if the first four characters of Cost Center and FundsCenter is not equal to Plant then an error message should be raised . For this i used
    Badi>ME_PROCESS_PO_CUST   and Method->PROCESS_ACCOUNT .
    The problem is that  in  PROCESS_ACCOUNT method the parameter IM_ACCOUNT doesn't contain Plant value.
    If I am using PROCESS_ITEM method,in this IM_ITEM is not capturing Fundscenter value.
    Please help in solving the issue. Is  there any User Exit or Badi which gives me Plant,CostCenter,FundsCenter Values.?
    Thanks
    K Srinivas

    Hi,
      You can use same Badi for getting Plant,CostCenter,FundsCenter. what are all values you are not getting for that you use field-symbols. like here for getting Plant value Try these steps.
    1. Press F1 on PO Screen Plant value. Get Program name, screen field structure from that.
    2. declare one variable as field as field-symbols, in badi.
    FIELD-SYMBOLS: <lv_var> type any.
    Assign '((SAPLMEGUI)MEPO1211-NAME1) to <lv_var>.
    Here SAPLMEGUI is Program Name And MEPO1211-NAME1 is field structure of your program screen.
    in <lv_var> you will get the value of plant.
    Same process you can try for other fields also.
    Regards
    Vishnu Gupta

  • METHOD PROCESS_ACCOUNT OF BADI ME_PROCESS_PO_CUST.

    HI,
    I need to implement the method PROCESS_ACCOUNT of badi ME_PROCESS_PO_CUST.
    can anyone suugest me the samolw code for the same.
    i know i can get the account assignment data in the mathod IM_ACCOUNT->get_data.
    But how to declare the variable to store the data of im_account->getdata.
    so that i can use it in the progra?
    i mean for ex for header we will declare
    ls_header type mepoheader
    and then
    ls_header  = im_header->get-data.
    similarly can you plese tell me the declaration for storing the account assinment data.
    which table that variable will refer to.
    Smriti

    hai smriti
    u can call the method
    data: it_data type MEPOACCOUNTING
    im_accoutn->get_data  importing re_data  = it_data.
    just click the method type of parameter IM_ACCOUNT which is IF_PURCHASE_ORDER_ACCOUNT_MM  an interface
    u will get all the methods fro the same  u have ur mehtod get_data just click on it and click parameters and u get the paramter type  which is MEPOACCOUNTING
    regards
    m.a
    Edited by: mohammad afzal on Jul 9, 2009 7:11 AM

  • Badi ME_PROCESS_PO_CUST-PROCESS_ITEM

    Hi,
    I have using the badi ME_PROCESS_PO_CUST-PROCESS_ITEM and the works fine.
    But i need to write in a item field that the status is "display", in that status the badi does not write in the field.
    To write i have to change the status to "optional entry" in spro, but the ideia is the field is the field stay non-edit.
    Can someone help with that question?

    Can everyone help me?

  • Post changes of Purchase Order with BADI  ME_PROCESS_PO_CUST

    Hello All,
    I have to make changes to a Purchase Order when it is posted. In some cases I have to set the field WEBRE.
    What i tried is the BADi - Method ME_PROCESS_PO_CUST~post.
    Following Code I entered:
    DATA: position TYPE PURCHASE_ORDER_ITEM,
            tab_pos TYPE PURCHASE_ORDER_ITEMS,
            position_data TYPE mepoitem,
            xcheck TYPE MMPUR_BOOL,
            kopf TYPE REF TO CL_PO_HEADER_HANDLE_MM,
            position_check TYPE mepoitem.
      CLEAR: kopf.
      tab_pos = IM_HEADER->get_items( ).
      xcheck = IM_HEADER->IS_CHANGEABLE( ).
      TRY .
        kopf ?= IM_HEADER.
      CATCH cx_sy_move_cast_error.
      ENDTRY.
      IF kopf is  NOT INITIAL.
         kopf->MY_CUST_FIREWALL_ON = 'X'.
      ENDIF.
    LOOP AT tab_pos INTO position.
      position_data = POSITION-item->get_data( ).
      xcheck = POSITION-item->IS_PERSISTENT( ).
      IF position_data-werks(1) EQ 'D' OR
         position_data-werks(1) EQ 'G' OR
         position_data-werks(1) EQ 'P' OR
         position_data-werks(1) EQ '1'.
      ELSE.
        IF position_data-wepos = 'X' and position_data-UMSON is initial.
          position_data-webre = 'X'.
          POSITION-item->set_data( position_data ).   "write data
        ENDIF.
      ENDIF.
       position_check = POSITION-item->get_data( ). " check if it is written
    ENDLOOP.
    Now my Problem is, that my changes in  position_check are ok, but they are not written to database and I don't know why.
    I have made the changes with TA ME22n.
    I also tried ME_PROCESS_PO_CUSTcheck and ME_PROCESS_PO_CUSTprocess_item. With method process_item it is written to database, but it is not the right point of time. I just want these changes when the purchase order is posted.
    Got anybody an idea, maybe another Exit, Badi or what I'm doing wrong?
    Best regards,
    Ronny

    HI
    Try using this BADI
    ME_PURCHDOC_POSTED - Define Follow-On Processing for External Purchasing Documents
    We have used this BADI for updating the fields in the header and item level; after posting
    Thanks & Regards
    KK

  • BADI ME_PROCESS_PO_CUST - DOES NOT CLEAR OUT ERROR

    In ME21N I want to validate the field Commodity Code - STAWN. I have used the BADI ME_PROCESS_PO_CUST*
    . Have used get_foreign_trade() in the PROCESS_ITEM method . I am able to throw an error . It is doing it but*
    after throwing error then when we give a valid Commoditycode too it is still showing the error and not clearing the error  .*
    As suggested by Dean Q I used   INCLUDE mm_messages_mac,
    tried im_item->set_foreign_trade( ls_mepo_eipo)  still when a valid Commodity code is entered after an invalid one  it does not clear out the error. In fact on checking using break-point I found that the second time it does not enter into the method  PROCESS_ITEM.    Any help is welcome
    Nivedita

    Hi,
    In SE18 give ME_PROCESS_PO_CUST as the enhancement spot and display. At the left side of the screen you can see the badi definition ME_PROCESS_PO_CUST. Expand the tree and double click on implementations. You can see the enhance implementations created. Double click on the enhancement implementation and in that screen there is a check box 'Implementation is active' and field 'Effect in current client'.
    If you know the enhancement implementation name(not the badi implementation name), you can check it directly from se19.
    Regards,
    Poornima

  • ME_PROCESS_PO_CUST: Method "POST"

    Hi all,
    I'm trying to update the 'EKPO', and I will use the BADI 'ME_PROCESS_PO_CUST'.
    When you click the 'SAVE' of purchase order, I want to update the 'EKPO-LGORT'. and I will try to use method 'POST'.But the method 'POST' has only 'IM_HEADER'.
    Now I don't know how to upate the EKPO-LGORT using method 'IM_HEADER' in 'POST'.
    Can someone help me!!
    By Soma

    Hai Tomoyuki,
    The PROCESS_ITEM method has only IMPORTING parameter, meaning that you cannot change the values in the IM_ITEM parameter.
    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( ).
    Also You can refer these links...
    ME_PROCESS_PO_CUST: Method "POST"
    Implementing BADI's ME_PROCESS_PO_CUST
    BADI ME_PROCESS_PO_CUST - FIELDSELECTION_ITEM
    Regards,
    Srikanth.

  • How to issue warning message in BADI ME_PROCESS_PO_CUST

    Hi Guys,
    I have already checked the forum regarding this. There are lots of threads. Unfortunately none of them helped me. I must be missing some thing in my code.
    I tried issuing warning message in BADI ME_PROCESS_PO_CUST and method PROCESS_ITEM.
    First i tried with normal message statement
    MESSAGE w001(00) WITH text-001 text-002.
    Didn't worked.
    Next tried calling standard macros
      DATA:mmmfd_cust_01 TYPE mmpur_metafield VALUE 90000000.
      call method cl_contextfield_mm=>set_current_field
                                      exporting im_field = mmmfd_cust_01.
      mmpur_metafield mmmfd_cust_01.
    mmpur_message_config 'W' 'X' ' '.      "Tried all permutations here
    mmpur_message_forced 'W' '00' '001' text-001 text-002 '' ''.
    Still no solution
    Tried with macro mmpur_message also
    Can some one helpme out to solve this issue.
    Thanks,
    Vinod.

    Hi all,
    Thanks for the responce.
    Not sure whether you have looked into BADI documentation or not. Please check below.
    "Further notes
    The above-mentioned macros are defined in the program MM_MESSAGES_MAC. Please include this program in your own application.
    Never issue messages in BAdI ME_GUI_PO_CUST! This is the task of the business logic and must therefore be done via the BAdI ME_PROCESS_PO_CUST.
    "Never use the ABAP statement MESSAGE in the BAdI ME_PROCESS_PO_CUST. Please use the macro mmpur_message_forced only. This macro only writes a message in the message collector.
    If you wish to mark the business object as invalid in order to prevent posting, you must additionally use the INVALIDATE ( ) method of the relevant interface. In this connection, see also the code example in the PROCESS_ITEM method of the BAdI ME_PROCESS_PO_CUST.
    I have tried almost all macros including mmpur_message_forced 'E' 'ME' '083' l_text ' '  ' '  ' '.
    Not sure where i am missing:(
    If i give error using MESSAGE statement it is working perfectly i.e. give error and save the PO. Only wanted to know if there are any implications.
    Thanks,
    Vinod

  • BADI ME_PROCESS_PO_CUST is not triggering while creating/changing PO

    Hi,
    I am new to BADIs,
    I am trying to implement BADI ME_PROCESS_PO_CUST in ECC 6.0. I have done the implementation and activated. I kept a break point in PROCESS_ITEM method, but the BADI is not triggering while creating or changing the PO. Please advice me what could be the reason behind this?
    I used the SQL trace but i couldn't get the BADI ME_PROCESS_PO_CUST in the list.
    thanks in advance
    Regards
    Jagadish

    hello jagdish,
    implement   this user exit.....
    MM06E005...
    go to     EXIT_SAPMM06E_017   in that   then you can put a break point in the user defined function module.....
    or use
    BREAK  'C5133392'  (use your user in place of C5133392)....it will stop here while creating PO or changing PO...
    now you can do whatever you want to do in create or change PO using this function exit......
    perform the validations on import parameters.....to create  or change ....and activate the project....
    hope this will give you some idea and help

  • 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

    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

  • BADI ME_PROCESS_PO_CUST with ME21N

    Hi.
    I'm using the BADI ME_PROCESS_PO_CUST, i create an implementation and i'm using the method process_item to make some checks in the field Payment Term (autocomplete this field from the table lfm1 acording to lifnr). I have a problem, when i hold a PO and after open it and save it the method process_item dont work (because i dont do any change in the PO).  Anyone know some way to do this cheks in a held PO? I try to using the method open to do this but dont work either. Thx (sorry for my english)

    Yes, i use this method too. I get the data from im_header to a variable X, change the fileld zterm (if the conditions are true) and use the methos im_header->set_data ( X ); but the change is not visible in the screen and when i save lost this change.

Maybe you are looking for

  • EEO Questionnaire -- SAP E-Recruiting

    How you restrict the HM and recruiting from accessing the candidates responses to the EEO questionnaire.  The EEO questionnaire is included in the application wizard

  • Time Capsule Streaming

    Is there a way to stream movies from Time Capsule to Apple TV? The movies are taking up too much room on my hard drive and causing start up file issues. Any help would be greatly appreciated... thank you in advance.

  • AS3 Gotchas to Look Out For

    Two painful issues I found out the hard way about Rendering AS3 Projects: - Stay away from the stage.displayState - regarding normal or setting to Full Screen. this only works correclty in Flash 9.0.115 or greater. - It is impossible to duplicate Dis

  • Sky Go Desktop - Cannot sign in to download.

    When downloading a programme or movie to watch later via the Sky Go desktop and then attempting to log into the desktop to begin the download,  I am getting error code c38740 which says my log in details cannot be saved.  However it does give me acce

  • Iphone 5 won't pick up wifi

    For whatever reason, lately my iPhone 5 won't properly connect to my wifi. Any advice? I can't stay on LTE forever, gets kinda pricey after a while. HELP PLEASE!