Capture  field in Badi "me_process_po_cust"

Hello Experts ,
I have a question regarding BADI "ME_PROCEE_PO_CUST"
i want to capture internal order in  " PROCESS_ITEM  " method .
This internal order entered in acount assignment tab in me21n tcode (at item level when account key is 'k').
This internal order is there in MEPOACCOUNTING  structure (feild name is aufnr).
I tried but didn't get, pls help me in this.

Hi ram,
You can get MEPOACCOUNTING in PROCESS_ITEMS method itself,
just follow the code..
DATA LS_ACCOUNTING TYPE MEPOACCOUNTING.
DATA LT_ACCOUNTINGS TYPE PURCHASE_ORDER_ACCOUNTINGS.
DATA LINE_ACCOUNTING TYPE PURCHASE_ORDER_ACCOUNTING.
DATA LS_ACC TYPE REF TO IF_PURCHASE_ORDER_ITEM_MM .
DATA ORDER_NUMBER TYPE AUFNR.
LT_ACCOUNTINGS = IM_ITEM->GET_ACCOUNTINGS( ).
LOOP AT LT_ACCOUNTINGS INTO LINE_ACCOUNTING.
LS_ACCOUNTING = LINE_ACCOUNTING-ACCOUNTING->GET_DATA( ).
*Now you have MEPOACCOUNTING structure in LS_ACCOUNTING
*then do your validations
ORDER_NUMBER = LS_ACCOUNTING-AUFNR.
ENDLOOP.
Hope iit will solve your problem,
Thanks & Regards
SUJI

Similar Messages

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

  • Custom tab data not saving in ME22N w/ BAdI ME_PROCESS_PO_CUST

    Hello all,
    I have implemented BAdis ME_PROCESS_PO_CUST & ME_GUI_PO_CUST and created a custom tab at the header level in ME21N/ME22N. I have fields such as Delivery Date and Ex Factory Date in my tab.
    We are able to put data in these fields and have that data populate their respective fields in the Purchase Order.
    Our users would like to be able to run ME22N and select certain line items and have only those items changed with the data from the custom fields. 
    So, my question is how do I handle line selection in the context of these BAdIs?  Is there a way to know which lines have been selected and then only change the data in those items?
    I have looked in Class CL_PO_ITEM_HANDLE_MM for an attribute or method that might help but I haven't found anything as of yet. 
    I have found that the field MEPO1211-TCSELFLAG is set when a line is selected in ME22N.  However, I haven't found a way to work with it.  It doesn't get passed to any of the methods in the BAdIs, as far as I know. 
    January 27, 2012  **************
    We were able to capture the lines selected by using code from method mass_change in Include LMEGUICJK, Function Group MEGUI.  The lines are in the lt_models table. 
    So, now my issue is getting data to save in ME22N.  When I put data in my custom tabs and select a line, the data gets changed on the screen but does not save.  It does work when I make a change in another field, like changing the description for instance.  I'm using the set_changed method in Process_Header from ME_PROCESS_PO_CUST but it doesn't work. 
    I'm getting the idea that I'm the first ABAP developer to try this...
    Thanks for any help.
    Kind Regards,
    Chris
    Edited by: Chris  Mowl on Jan 11, 2012 10:33 AM
    Edited by: Chris  Mowl on Jan 11, 2012 4:24 PM
    Edited by: Chris  Mowl on Jan 27, 2012 10:57 AM
    Edited by: Chris  Mowl on Jan 27, 2012 2:00 PM

    Hi,
    Checkout the below link :
    <link to blacklisted site removed by moderator>
    Shailaja Ainala.
    Edited by: Thomas Zloch on Jan 28, 2012 9:06 PM

  • 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

  • How to fetch newly updated item data in BADI  ME_PROCESS_PO_CUST?

    Hi Everyone,
    While changing a PO, I have a requirement where I need to only modify fields of newly added items of a purchase order and keep the values of existing items as it is. I have implemented the BADI ME_PROCESS_PO_CUST for this. but not able to know how to achieve this requirement. please suggest a solution.
    Thanks and Regards,
         Indudhar P.G

    Hi,
    interfaces for PO header and item have method is_persistent. This method returns true if the item/header is persistent which is equal to that it has been written to DB. So new items are not be persistent and old items are persistent.
    Cheers

  • BADI ME_PROCESS_PO_CUST for changing header data

    Hello Experts,
    I'm using Method PROCESS_HEADER in Badi ME_PROCESS_PO_CUST in order to change some header data.
    I want to change header data depending on the partner data which are on header level.
    It works fine as long as there are data changed in the header or item level and not only on the partner screen.
    The method in this Badi isn't processed if only partner data are changed. But for me it is necessary to set a special field on the header depending on the partner data.
    Regards,
    Sven

    Hi,
    Firstly, for changing Header data without any INSERT/UPDATE?MODIFY statement, badi - ME_PROCESS_PO_CUST  will not be useful.
    As method you mentioned has no header parameters under CHANGING / EXPORTING clause.
    You can use the badi which has the parametrs you want in either change/ Export mode. It can be defined under table also.
    Below is the list of important badis gettign called, however none of them contains header values in change/export clause.
    ME_CCP_ACTIVE_CHECK
    MD_STOCK_TRANSFER
    ME_DEFINE_CALCTYPE
    ME_PO_PRICING
    ME_FIELDSTATUS_STOCK
    ME_COMMITMENT_STO_CH
    ME_COMMITMNT_PARKING
    ME_INFOREC_SEND
    ME_CHECK_SOURCES
    ME_PURCHDOC_POSTED
    Instead you can use enhacement MM06E005  Customer fields in purchasing document.
    Create a project under Transaction CMOD.
    Assign enhancement as Project component.
    You'll find Exit 012. At time of save you can change header im_ekko based on you parterner data tab.
    Regards,
    Amee.

  • BADI - ME_PROCESS_PO_CUST - To update Condition Types at time of creation

    Hi All
    I'm relatively new to Implementing BADIs. I'm using the BADI ME_PROCESS_PO_CUST.
    I have to update certain condition types with values determined from a custom table maintained for related Vendors.
    I have created a 'Z' implementation for ME_PROCESS_PO_CUST and activated the implementation. But when I try to create a PO, the code doesn't seem to be execute!
    Following is the code bundle -
    METHOD if_ex_me_process_po_cust~process_header .
      DATA : l_items TYPE purchase_order_items.
      DATA : l_single TYPE purchase_order_item.
      DATA : l_item_cond TYPE mmpur_tkomv.
      CALL METHOD im_header->get_items
        RECEIVING
          re_items = l_items.
      LOOP AT l_items INTO l_single.
        CALL METHOD l_single-item->get_conditions
          IMPORTING
            ex_conditions = l_item_cond.
      ENDLOOP.
    ENDMETHOD.       "IF_EX_ME_PROCESS_PO_CUST~PROCESS_HEADER
    Could you please give me your inputs on this?
    Regards
    Kripal
    [email protected]

    Kripal,
           The method PROCESS_HEADER gets trigerred only when you make an entry in any of the header fields and then press ENTER or do some action.
    For a simple case of analysis put a break-point at
    CALL METHOD im_header->get_items
    RECEIVING
    re_items = l_items.
    in your code.
    Now if you execute ME21N you will see that the code will not get triggered.But make an entry for one of the fields say fpr purchasing organisation.Now if you press ENTER or click on any other tab your code will get triggered.
    Hope this helps.
    <i>Reward helpful answers</i>
    Cheers
    Nishanth

  • 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

  • PROCESS_HEADER not fired in BADI ME_PROCESS_PO_CUST

    Dear experts,
    I face the problem, that the method PROCESS_HEADER of BADI ME_PROCESS_PO_CUST is not fired, when I am changing po header text. My requirement is to set a customer po header field, whenever a po header text is existent.
    Does anybody know, if this is the standard behaviour and how I can work around it?
    Thanxs

    Hi Aparna,
    actually I tried this, too.
    In the methods Check and Post (which both are fired normally) I coded my requirements, but in this methods I faced the problem that I was not able to save my programatic header field changes. (Even with the trick to cast the IM_HEADER to CL_PO_HEADER_HANDLE_MM to allow changes of internal attributes, used in method set_data(), any changes of po header fields were not saved.) But maybe I am wrong with my implementation? You may have a look:
      DATA: lv_val_id TYPE thead-tdid.
      DATA: lv_val_name TYPE thead-tdname.
      DATA: lv_val_object TYPE thead-tdobject.
      DATA: p_mepo_header TYPE MEPOHEADER.
      DATA: it_tline TYPE TABLE OF TLINE.
      DATA: lv_cl_po_header_handle_mm TYPE REF TO CL_PO_HEADER_HANDLE_MM.
    check existents of po header text
      lv_val_id = 'F09'.
      p_mepo_header = im_header->get_Data( ).
      lv_val_name = p_mepo_header-ebeln.
      lv_val_object = 'EKKO'.
      CALL FUNCTION 'READ_TEXT'
      EXPORTING
          client = sy-mandt
          id = lv_val_id
          language = sy-langu
          name = lv_val_name
          object = lv_val_object
        TABLES
          lines = it_tline
        EXCEPTIONS
          ID = 1
          LANGUAGE = 2
          NAME = 3
          NOT_FOUND = 4
          OBJECT = 5
          REFERENCE_CHECK = 6
          WRONG_ACCESS_TO_ARCHIVE = 7.
    any text there, then update customer po header field
      IF sy-subrc = 0.
        p_mepo_header-zzfield = 'X'.
      else.
        p_mepo_header-zzfield = ' '.
      endif.
    QD
      lv_cl_po_header_handle_mm ?= im_header.
      lv_cl_po_header_handle_mm->my_cust_firewall_on = 'X'.
      im_header->set_Data( p_mepo_header ).
      im_header->set_changed( ).
    po is still same as before and field zzfield was not updated.

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

  • 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?

  • BADI: ME_PROCESS_PO_CUST~PROCESS_HEADER? it is urgent

    Hi,
    I implemented BADI ME_PROCESS_PO_CUST and write some lines in the method of process_header.
    but i discover the field reswk is still no value. why.
    Thanks.
    Best regards.
      DATA: re_data TYPE mepoheader.
    get the header data
      CALL METHOD im_header->get_data
        RECEIVING
          re_data = re_data.
      re_data-reswk = 'L000'.
      CALL METHOD im_header->set_data
                EXPORTING
                  im_data = re_data.

    Hi
    First check whether this field is there or not in the table data of EKKO
    If it is there then it should come into the code of your BADi header data re_data.
    Also check after calling method whether other fields data is coming into re_data or not ? if other fields data is coming and only this particular field data is not coming then the problem with code(after it is there in EKKO)
    if in EKKO itself it is not there it is not your mistake/code mistake.
    Reward points for useful Answers
    Regards
    Anji

  • Help BADI ME_PROCESS_PO_CUST !?!?

    Hi Friends,
    I've created an implementation for BADI ME_PROCESS_PO_CUST to enhance TCode ME21n. I use method CHECK to check line item but I don't know how to collect the message error if any wrong data exists in that line item.
    My message(s) will be collected as the original program do i.e :
       Typ | Message text                                        |
    |----
    |                             
    Item 20 Sched.line 1
         w  | Can delivery date be met?                      |
    When you chose that line above, program will bring you to the screen field that have wrong value.
    Any one can help me collect the message(s)? Please!
    Thanks,
    Gy

    Check if it's useful  
    DATA : lt_items TYPE purchase_order_items ,
             ls_item TYPE purchase_order_item,
    CALL METHOD im_item->get_data
          RECEIVING
            re_data = lt_item.
    give the condition for the  Error message 
       mmpur_metafield mmmfd_cust_01  .
        mmpur_message_forced 'E' 'ME' '083' text-003 '' '' ''.
       LOOP AT lt_items INTO ls_item.
          CALL METHOD ls_item-item->invalidate( ).
        ENDLOOP .

  • Issue with BADI 'ME_PROCESS_PO_CUST'

    Hi People,
           I have a requirement wherein we need to make the Delivery Date in Schedule line of PO as Uneditable. This needs to be done for specific User-Group. Hence I have decided to use the BADI 'ME_PROCESS_PO_CUST' to attain the solution.
    I am facing a problem in using the BADI. I have created 2 different Field Selection(one with editable and other without) through SPRO and  am trying to swap the field selection based on user in the Method 'FIELDSELECTION_ITEM_REFKEYS' of the BADI interface. This swapping doesn't seems to be working. Can anyone give me some idea on why is this not working, Eventhough the Method is getting trigerred.
    Also i have tried the other method 'FIELDSELECTION_ITEM' to make them uneditable by changing the Field Selection Properties. but still no luck as this method not getting trigerred at all.
    Regards,
    Simin Raveendran.

    Hi Simin,
    Did you check the sample code which is delivered with the BADI. This code can be accessed by following:
    GOTO->Sample Code->Display.
    Check the method FIELDSELECTION_ITEM to see an code example. It appears to me that you should do something like that by changing the properties for field mmmfd_deliv_date.
    Below is the documentation for the method FIELDSELECTION_ITEM:
    Special Field Selection Item
    Functionality
    The FIELDSELECTION_ITEM method enables you to influence the field selection properties for a field.
    Parameters
    The following parameters are available:
    IM_HEADER - Document header
    The interface reference is of the type IF_PURCHASE_ORDER_MM.
    IM_ITEM - Document item
    The interface reference is of the type IF_PURCHASE_ORDER_ITEM_MM.
    CH_FIELDSELECTION - Fiele selection table
    By making changes to this table, you can influence the display properties of a field.
    This table consists of value pairs <METAFIELD|FIELDSTATUS>.
    The Metafield represents a business content (e.g. the PO quantity). Thus, for example, the database field EKPO-MENGE is linked to a certain metafield value just like the field MEPO1211-MENGE on the item overview screen in the purchase order.
    Through this abstraction, reference can be made to business contents on a uniform basis.
    Standard metafields are defined in the type group MMMFD.
    The field selection status has four possible instances:
    '-' Field is suppressed
    '*' Field is purely a display field
    '.' Input field
    '+' Mandatory field
    Notes
    Under no circumstances make any changes to the database within this method. On no account use Commits.
    Kind regards,
    Robert

Maybe you are looking for