ME_PROCESS_PO_CUST  PROCESS_HEADER  help

Hi friends
I want to do some validation at header based on items uisng method PROCESS_HEADER.
please can you tell me how can i get the items in header method.
i am poor OOPS pgming. please any one correct my code as given below.
i am trying to fetch the itm data from hdr as follows , but its going to dump.
DATA:lmepoheader TYPE mepoheader.
  data: ls_item type line of PURCHASE_ORDER_ITEMS.
  data: ls_itm type ref to IF_PURCHASE_ORDER_ITEM_MM.
  data: itm_data type mepoitem.
  DATA: lv_reslo TYPE ekpo-reslo.
  CALL METHOD im_header->get_data
    RECEIVING
      re_data = lmepoheader.
CALL METHOD im_header->get_items
  receiving
    re_items = ls_item.
CALL METHOD ls_itm->get_data
  receiving
    re_data = itm_data.
  lv_reslo = itm_data-reslo. "Issuing Storg
please tell me whre i amdoing wrong.
Thanks
Ramesh

Hi Ramesh,
You should not validate the items in the PROCESS_HEADER method the reason being that this method is only for processing of PO Header. Method PROCESS_ITEM should be used for processing and checking of PO Items. Please refer to the corresponding methods documentation using the steps below.
1. Execute SE24 and input the Interface name IF_EX_ME_PROCESS_PO_CUST.
2. Place the cursor on the relevant method and follow the menu path Goto->Documentation->To component or simply press F9.
Hope this is clear to you.
If at all you want to still continue the same way as you were doing then the only option I can see to avoid the dump is to add the following code.
DATA:lmepoheader TYPE mepoheader.
data: ls_item type PURCHASE_ORDER_ITEMS.
data: wa_item LIKE LINE OF ls_item.
data: itm_data type mepoitem.
DATA: lv_reslo TYPE ekpo-reslo.
CALL METHOD im_header->get_data
RECEIVING
re_data = lmepoheader.
CALL METHOD im_header->get_items
receiving
re_items = ls_item.
loop at ls_item into wa_item.
CALL METHOD wa_item-item->get_data
receiving
re_data = itm_data.
lv_reslo = itm_data-reslo. "Issuing Storg
endloop.
Reward if useful.
Thanks and Regards,
Maddineni Bharath.

Similar Messages

  • ME21N address enhancement using ME_PROCESS_PO_CUST - PROCESS_HEADER

    Hi Experts,
    We are enhancing the PO address on header with reference to partner functions.
    I was able to find the BADI ME_PROCESS_PO_CUST  and method PROCESS_HEADER, which can updated the PO header with address but I am not able to access the partner function details with in the method PROCESS_HEADER for cross reference.
    Can any one help on how to get the partner function details in the PROCESS_HEADER method.
    Thanks in advance.
    Regards,
    Harish

    Hi guys,
    I am back to the same question updating the PO address with reference to partner function (ordering address-OA) …as always user requirement changed :-).
    My requirement is to update the PO header address according to partner function (OA type) and also user may change the vendor in the partner function (OA) while creating PO. By default system provides the vendor address (Funct type-VN) in the header.
    I was able update the PO header address with OA type vender in the partners by implementing ME_PROCESS_PO_CUST - PROCESS_HEADER method.
    But the issue is when PO header is processed and when user changes the vendor in the partner (func - OA) (I mean in the partner Tab). User expects to see the changed address  in the header.
    I tried to change the header address by implementing ME_PROCESS_PO_CUST - CHECK method but it is NOT reflecting the changes on the screen(Address tab) , weird thing is communication tab field(Salesperson,telephone) are changing and can be seen on the screen.
    Here is the code I wrote in Check method.
    data:
            zcl_po           type ref to  cl_po_header_handle_mm,
    call method im_header->get_data
          receiving
            re_data = wal_ekko.
    zcl_po ?= im_header.
    zcl_po->my_cust_firewall_on = 'X'.
    ***.....Changes the address number..
    wal_ekko-adrnr = '0000024999'
              call method im_header->set_data
                EXPORTING
                  im_data = wal_ekko.
    Please let me know if anybody facing the same issue with PO address changing.
    Thanks in advance.
    Regards,
    Harish

  • ME_PROCESS_PO_CUST - Need Help on Methods POST, PROCESS_HEADER

    Hi,
    I will explain the requirement and my approach and the problem i am facing.
    During save of Purchase order, a confirm popup should be shown and according to the user confirmation, it will hit a Z Field in CI_EKKODB.
    For this, i implemented the solution in BADI ME_PROCESS_PO_CUST and Method POST. Even though i use SET_DATA to set the data, it never updates the database table.
    For testing purpose, i put the code in Method PROCESS_HEADER, the SET_DATA worked fine and it finally updated the database table. So, I thought of implementing the solution here by checking sy-ucomm and executing only during SAVE of PO. But here my problem is, Not always all the time this PROCESS_HEADER method executes. For example, If you change any header data and Press "Enter", then the "PROCESS_HEADER" is called. and then immediately without changing any data and you Press "SAVE", the Method PROCESS_HEADER will not be called.
    Could you please anyone suggest me either how to forcefully call the PROCESS_HEADER method everytime or is there any other way to set the Z Data into the database table.
    Thank you in advance.
    Karthik

    I have the same issue. Do you know how you solved ths issue? if so can you please post the reply. Thanks

  • 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

  • Change Delivery Address In PO

    Hi Experts,
    I want to change the delivery address in PO for a particular Account Assignment Category. When the category is 'Z', I want to fetch the sales order ship to party address which is mentioned in Account assignment tab by clicking more button. I have found the enhancement MMDA0001 - Default delivery address where i can pass the adrnr . But i am not getting the account assignment tab values in the debugger.
    Its urgent.
    Awaiting your responses.
    Thanks & Regards
    Akshay J

    Hi Akshay,
    BADI ME_PROCESS_PO_CUST may helpful you to achive this.
    Regards,
    KAUSHIK SAVALIYA

  • PO - Enter Material A in PO, SAP auto order A & B

    Dear Folks,
    I have a requirement where:
    - If I order item A in my PO, the system will automatically create a 2nd line item for item B.
    Item B is not free goods, but the behavior i desired is the same as per that of free goods.
    Please advice how can this be done in SAP? Thank you.
    Best Regards
    Junwen

    Hi,
    To my knowledge there is no standard way to achieve this. But you can check with the BADi - ME_PROCESS_PO_CUST can help to achieve your need.
    Regards,
    Vivek

  • How to get currently running tcode inside the user exist

    Hi All,
    I want to write user exist for me22n & me23n, inside the user exist i want to check tcode whether tcode is me22n or me23n my user exist is ME_PROCESS_PO_CUST
    .please help me
    Thnx//

    Hello Gevan,
    Please check the value of sy-tcode for both transaction in debugging mode in the exit and write your code accordingly.
    case sy-tcode.
    when 'ME22N'
    *ur code
    When 'ME23N'
    *ur logic
    endcase.
    find the screen shot from debugging
    Thanks

  • ME_PROCESS_PO_CUST method PROCESS_HEADER to reset release status of doc

    Hi Everyone,
    I have read lots of threads regarding the implementation of BAdI ME_PROCESS_PO_CUST. However, I could not find one which fits our requirement which is the resetting/ restart of the release status of a PO whenever a released/approved PO has been changed not only in the quantity field but also in the other details of the document.
    I believe that the method to be used in this sense is the PROCESS_HEADER. Would you know any logic which could help me restart an already released PO document whenever any changes have been made to the document?
    Kindly send your recommendations.
    Thanks and regards,
    Reymar

    Hi,
    I used this code:
    CALL METHOD im_header->get_data
    RECEIVING
    re_data =  lmpoheader.
    IF lmpoheader-frgke = 1 AND
        lmpoheader-frgzu IS NOT INITIAL.
    lmpoheader-frgke = 2.
    lmpoheader-frgzu = ''.
    CALL METHOD im_header->set_data
    EXPORTING
    im_data = lmpoheader.
    ENDIF.
    After saving the PO document, the fields FRGKE and FRGZU were not changed. When I debugged the code, the values of the fields were changed. I just don't know if the last CALL METHOD has been properly executed so that IM_DATA may contain the changed values.
    Thank you and regards,
    RE
    Edited by: Reymar Ellazo on Apr 21, 2009 6:19 PM

  • Urgent Help Needed in BAdI ME_PROCESS_PO_CUST

    Hello friends,
    I m workin on BAdI ME_PROCESS_PO_CUST , my requirement is to store header level text in po if it is left blank by user , for this i have creadted standard text for every po header text , and implemeted method POST of the badi. so when user is saving the po , i m checking whether all header text is filled by user or not , for this i have called method GET_TEXT , if the text is blank i m reading data from standard text using READ_TEXT function module and setting in perticular text by using method SET_TEXT , every thing is working fine , the respective text ifrom standard text  getting filled to the perticular text of the po , if left blank by the user .  But the actual problem is that when i m going to display the same po again , the text that i was supplied by standard text is not showing in po.
    is there is anything that i missed out , i also done coomit work , but its not working ,
    so please suggest.......
    dont worry abt points

    Dear Mr Mahesh
    I also face similar problem . But my limitation is that I am new to BADI . Sir it will be great help if you can please mail me the steps / procedure and code to be written for implementing the above BADI .
    Sir , I look forward for your kind help please .
    Regards
    B V Mittal
    [email protected]

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

  • Help Needed on BAdi's ( ME_PROCESS_PO_CUST & ME_BAPI_PO_CUST )

    Hi Experts,
    I am new for BAdi's . So, Plz could anyone suggest me on this.
    My requirement is Some (ZXXXX) item text (text ID F026) on the backend ECC PO is pre-populated with standard text "ZXXXX" during the PO creation from ECC Requisitions, as well as from the Sourcing Cockpit and from Bid Response. BAdI ME_PROCESS_PO_CUST will be used to insert standard text "ZXXXX" for POs created in ECC. BAdI ME_BAPI_PO_CUST will be used to insert this text for POs coming from SRM (Sourcing Cockpit and from Bid Response).
    Regards,
    Vinai.k
    Helpful answers will rewarded.

    Hi,
    I'm trying create Implementation for BADI 'ME_PROCESS_PO_CUST' and when I try activate this Implementation, I got error message 'Implementation Class ZCL_IM_EM_GUI_PO_CUST contains error....'
    But when I try using syntax check, no error message, only for warning message.
    my steps are:
    1. Create Implementation
    2. Give Definition
    3. Fill Description
    4. Activate
    Could you help me.
    Thanks.
    Message was edited by: Andre Andre
    Message was edited by: Andre Andre
    Message was edited by: Andre Andre

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

  • Help need for badi method me_process_po_cust~check

    Dear All expert
    Pl see following thread
    I am stuck
    Help needed
    http://scn.sap.com/thread/3610303

    See the issue here is HOLD feature in PO should not be there if it meets the error condition.
    For this you can refer another BADI for this purpose ME_HOLD_PO.
    Refer one of my previous threads below , it might be helpful :
    Held Purchase order need not be created.
    Reiterating a thread related to same topic is not a good practice.

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

Maybe you are looking for