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

Similar Messages

  • BADI - ME_PROCESS_PO_CUST - CHECK Method

    Hi ALL,
    When I create I'm able to get data of all the line items in the purchase order in the method IF_EX_ME_PROCESS_PO_CUST~CHECK.
    I need to do validations and change material and material group.
    I want to call the method like below:
    Data HS_DETAIL type MEPOITEM
          CALL METHOD IM_HEADER->SET_DATA
            EXPORTING
              IM_DATA = HS_DETAIL.
    System is giving an error - type incompatible..
    Am I missing something?
    Meghna

    HI,
    The type of the importing parameter IM_DATA is MEPOHEADER and not MEPOITEM while you have defined HS_DETAIL  of type MEPOITEM
    So you will get the error.
    Regards,
    Ankur Parab
    Edited by: Ankur Parab on Aug 24, 2009 6:06 PM

  • 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

  • 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

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

  • 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

    hi experts,
    we are using me59n to create the stock transfer orders from stock transport requisitions. the requirement is during the creation of STO we need to stop the creation of STO for some of the STR based on custom logic. the logic needs the STR number.
    i tried "check" method  of BADI ME_PROCESS_PO_CUST and it seems working. i was able to stop the creation of PO based on some condition. but, in the actual requirement i need to to know STR ( that is purchase requisition number ) number in the method. based on the values in STR i need to stop the PO creation. i have checked the import parameters of the method but could not find anything.
    but when i went inside IM_HEADER associated type IF_PURCHASE_ORDER_MM I this is the importing parameter of the "check" method) i found a method IF_MESSAGE_OBJ_MM~GET_PARENT. I am not sure whether this will help? or is there any other way u think i can get the STR number in this method.
    or is there any other BADI / exit to meet this requirement.
    thanks

    no replies from anybody

  • 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

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

  • Rollback BAPI in BADI ME_PROCESS_PO_CUST

    hi guys,
    I used BADI ME_PROCESS_PO_CUST to implement a code before saving the purchase order (Method POST).
    This code contains a BAPI to create a delivery BAPI_OUTB_DELIVERY_CREATENOREF. If this BAPI fails (this is when Return parameter contains 'E' message), I execute function BAPI_TRANSACTION_ROLLBACK.
    Guess what is happening?
    There is no purchase order created even when screen shows message "Standard PO created under the number 45#######".
    What do I want to do?
    - Rollback the bapi executed and let the system continue saving the purchase order.
    - If possible show a message to the user that there is an error, but command MESSAGE doesn't seem to work in this BADI
    Could you share your insights with this wannabe-abapper?
    PD: it says in documentation that it is required ABAP OO to implement this BADI and I think I used it correctly for gathering all data I needed. But I just don't understand why MESSAGE statement and FM POPUP_TO_CONFIRM don't work.

    Hello
    You may try an approach like this:
      IF ( 1 = 1 ).
        MESSAGE 'Creation of outbound delivery failed'  type 'I'.
        data: ld_dummy  type string,
              ls_msg    type SMESG,
              lt_msg    type tsmesg.
          message id '00' type 'E' number '398' with 'Creation of outbound delivery failed'
                                                      space space space into gl_dummy.
        move-CORRESPONDING syst to ls_msg.
        APPEND ls_msg to lt_msg.
        CALL FUNCTION 'FB_MESSAGES_DISPLAY_POPUP'
          EXPORTING
            IT_SMESG              = lt_msg
    *       ID_SMESG_ZEILE        =
    *       IT_RETURN             =
    *       ID_SEND_IF_ONE        =
          EXCEPTIONS
            NO_MESSAGES           = 1
            POPUP_CANCELLED       = 2
            OTHERS                = 3.
        IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      endif.
    Regards
      Uwe

Maybe you are looking for

  • Values from a java archive file that uses Coherence are null

    This is essentially the details of my project. Check the values in andrew's coherence cluster. Checkign the values in the stats class. z:\javaclasses\stats.jar Some sample code: -- initialize /* start the stats class (the fields you want to look) */

  • How to use PL/SQL type table in SQL FROM clause

    Hi All, I have to use a PL/SQL type table in our SQL statement as a table? I am using the syntax (below) but it gives PL/SQL: ORA-00902: invalid datatype SELECT ... FROM TABLE(CAST( var_pl/sql_table AS pl/sql_table)) tab WHERE tab.a=1; Plz reply with

  • 3 Questions: Docking Panels, Find doesn't work

    Hello, I am relatively new to Prelude and I have three questions. -First for some reason I no longer can move the panels to other positions and lock them in. That little hot spot tab is missing ?? -Secondly, The finder in the project panels isn't fin

  • Exporting Aperture Slideshow to Itunes

    I created a slide show in Aperture, exported it for iTunes and Apple TV, but I cannot find it in iTunes or show it on the TV. What do I have to do?

  • WinRM query result locale

    I am testing the following scenario: WinRM client is running on a Windows Server 2008 with German locale Hyper-V (and WinRM service respectively) is running on Windows Server 2012 R2 with English as default locale and German locale installed in addit