Code  of ME_process_cust_Po BADI for checking item data?

Hi all,
While users are creating new PO in ME21N, I have to check the condition records for the Materials they entered.
If the condition record is not maintained for the respective material The creation of PO while saving it , should not be  allowed  and a message should be displayed.
Please mention  the respective method and code to do this?
Thanks
Vamshi.

Hi ,
this is the sample code for Item check, by using mm_messages_mac(include u can raise error msg based on the INFNR(info record) field.
  DATA: ls_mepoitem TYPE mepoitem,
        ls_customer TYPE mepo_badi_exampl,
        ls_tbsg     TYPE tbsg.
  INCLUDE mm_messages_mac. "useful macros for message handling
here we check customers data*
  ls_mepoitem = im_item->get_data( ).
  IF ls_mepoitem-loekz EQ 'D'.
a physical deletion of the item was carried out. therrefor we have to*
delete customer data on the level of the item*
    ls_customer-ebeln = ls_mepoitem-ebeln.
    ls_customer-ebelp = ls_mepoitem-ebelp.
    CALL FUNCTION 'MEPOBADIEX_SET_DATA'
      EXPORTING
        im_data                    = ls_customer
        im_physical_delete_request = 'X'.
  ELSE.
update/insert operation*
    CALL FUNCTION 'MEPOBADIEX_GET_DATA'
      EXPORTING
        im_ebeln = ls_mepoitem-ebeln
        im_ebelp = ls_mepoitem-ebelp
      IMPORTING
        ex_data  = ls_customer.
check customers data*
check field badi_bsgru. This should be carried out only for new items. Once the PO is posted the*
field should no longer be changeable. This is done in Method FIELDSELECTION_ITEM.*
    IF im_item->is_persistent( ) EQ mmpur_no.
      IF ls_customer-badi_bsgru IS INITIAL.
Place the cursor onto field badi_bsgru. The metafield was defined in BAdI ME_GUI_PO_CUST,*
Method MAP_DYNPRO_FIELDS.*
        mmpur_metafield mmmfd_cust_01.
        mmpur_message_forced 'W' 'ME' '083' text-002 '' '' ''.
      ELSE.
check whether the field is valid*
        *SELECT SINGLE * FROM tbsg INTO ls_tbsg WHERE bsgru EQ ls_customer-badi_bsgru.*
        IF NOT sy-subrc IS INITIAL.
          mmpur_metafield mmmfd_cust_01.
          mmpur_message_forced 'E' 'ME' '083' text-004 '' '' ''.
invalidate the object*
          CALL METHOD im_item->invalidate( ).
        ENDIF.
      ENDIF.
    ENDIF.
check field badi_afnam*
    IF ls_customer-badi_afnam IS INITIAL.
      mmpur_metafield mmmfd_cust_02.
      mmpur_message_forced 'W' 'ME' '083' text-003 '' '' ''.
    ENDIF.
  ENDIF.
regards
Prabhu

Similar Messages

  • Reg. Exit/BADI for changing item data of PO in ME22N

    Hi all,
    My requirement is to update the field LABNR (Order Ack.) of few specific line items of a PO, in the Transaction ME22N, using Exit/BADI.
    I have tried the BADI  ME_PROCESS_PO_CUST. But the PROCESS_ITEM method of this BADI processes only the line item which has been changed/inserted in ME22N transaction. But my requirement is to update line items irrespective of whether that line item was "changed/not changed" during the process in ME22N screen.
    Could you please suggest me some suitable Exit/BADI for this requirement.
    Regards,
    Anbarasan K

    Thanks Martin.
    Problem solved by implementing the method Process_Header.
    1. Get the items from Header                              -  im_header->get_items
    2. Loop the item list and get the line item record   - re_item-item->get_data
    3. <- Logic to Update the line item - >.
    4. Update the line item                                       - re_item-item->set_data
    Thank you very much.. Martin.
    Regards,
    Anbarasan K

  • Search for BAdi for Customer Master Data (XD01)

    Hi experts,
    i am looking for a BAdi for Customer Master data (XD01). Can anyone suggest me which one can i use?
    thanks in advance.
    Regards,
    aksh

    hi
    execute this report
    *& Report  ZNAGBADI
    REPORT  ZNAGBADI.
    *report zbadi_find .
    tables : tstc,
    tadir,
    modsapt,
    modact,
    trdir,
    tfdir,
    enlfdir,
    sxs_attrt ,
    tstct.
    data : jtab like tadir occurs 0 with header line.
    data : field1(30).
    data : v_devclass like tadir-devclass.
    parameters : p_tcode like tstc-tcode,
    p_pgmna like tstc-pgmna .
    data wa_tadir type tadir.
    start-of-selection.
    if not p_tcode is initial.
    select single * from tstc where tcode eq p_tcode.
    elseif not p_pgmna is initial.
    tstc-pgmna = p_pgmna.
    endif.
    if sy-subrc eq 0.
    select single * from tadir
    where pgmid = 'R3TR'
    and object = 'PROG'
    and obj_name = tstc-pgmna.
    move : tadir-devclass to v_devclass.
    if sy-subrc ne 0.
    select single * from trdir
    where name = tstc-pgmna.
    if trdir-subc eq 'F'.
    select single * from tfdir
    where pname = tstc-pgmna.
    select single * from enlfdir
    where funcname = tfdir-funcname.
    select single * from tadir
    where pgmid = 'R3TR'
    and object = 'FUGR'
    and obj_name eq enlfdir-area.
    move : tadir-devclass to v_devclass.
    endif.
    endif.
    select * from tadir into table jtab
    where pgmid = 'R3TR'
    and object in ('SMOD', 'SXSD')
    and devclass = v_devclass.
    select single * from tstct
    where sprsl eq sy-langu
    and tcode eq p_tcode.
    format color col_positive intensified off.
    write:/(19) 'Transaction Code - ',
    20(20) p_tcode,
    45(50) tstct-ttext.
    skip.
    if not jtab[] is initial.
    write:/(105) sy-uline.
    format color col_heading intensified on.
    Sorting the internal Table
    sort jtab by object.
    data : wf_txt(60) type c,
    wf_smod type i ,
    wf_badi type i ,
    wf_object2(30) type c.
    clear : wf_smod, wf_badi , wf_object2.
    Get the total SMOD.
    loop at jtab into wa_tadir.
    at first.
    format color col_heading intensified on.
    write:/1 sy-vline,
    2 'Enhancement/ Business Add-in',
    41 sy-vline ,
    42 'Description',
    105 sy-vline.
    write:/(105) sy-uline.
    endat.
    clear wf_txt.
    at new object.
    if wa_tadir-object = 'SMOD'.
    wf_object2 = 'Enhancement' .
    elseif wa_tadir-object = 'SXSD'.
    wf_object2 = ' Business Add-in'.
    endif.
    format color col_group intensified on.
    write:/1 sy-vline,
    2 wf_object2,
    105 sy-vline.
    endat.
    case wa_tadir-object.
    when 'SMOD'.
    wf_smod = wf_smod + 1.
    select single modtext into wf_txt
    from modsapt
    where sprsl = sy-langu
    and name = wa_tadir-obj_name.
    format color col_normal intensified off.
    when 'SXSD'.
    For BADis
    wf_badi = wf_badi + 1 .
    select single text into wf_txt
    from sxs_attrt
    where sprsl = sy-langu
    and exit_name = wa_tadir-obj_name.
    format color col_normal intensified on.
    endcase.
    write:/1 sy-vline,
    2 wa_tadir-obj_name hotspot on,
    41 sy-vline ,
    42 wf_txt,
    105 sy-vline.
    at end of object.
    write : /(105) sy-uline.
    endat.
    endloop.
    write:/(105) sy-uline.
    skip.
    format color col_total intensified on.
    write:/ 'No.of Exits:' , wf_smod.
    write:/ 'No.of BADis:' , wf_badi.
    else.
    format color col_negative intensified on.
    write:/(105) 'No userexits or BADis exist'.
    endif.
    else.
    format color col_negative intensified on.
    write:/(105) 'Transaction does not exist'.
    endif.
    at line-selection.
    data : wf_object type tadir-object.
    clear wf_object.
    get cursor field field1.
    check field1(8) eq 'WA_TADIR'.
    read table jtab with key obj_name = sy-lisel+1(20).
    move jtab-object to wf_object.
    case wf_object.
    when 'SMOD'.
    set parameter id 'MON' field sy-lisel+1(10).
    call transaction 'SMOD' and skip first screen.
    when 'SXSD'.
    set parameter id 'EXN' field sy-lisel+1(20).
    call transaction 'SE18' and skip first screen.
    endcase.
    reward for useful answers
    regards
    Nagesh.Paruchuri

  • Badi for check tax number field

    Hi guys!
    Can anyone tell if exists a badi that ckecks the field 'TAXNUM' in transaction 'BP' after we put a value there.
    I've already check in the transaction 'Bus7' and i only find the function for the event 'check before saving' -'BUP_BUPA_EVENT_DCHCK'.
    Thanks in advance.
    Hugo.

    Hi everybody!
    I need understand how implement check of taxnum using transaction BUS3 - view BUTX01.
    I need check tax number in transaction FPP2.
    I see a post very interesting:
    Badi for check tax number field
    I create a module function but inside of module function i don't have data for my validation. I think i make a mistake. Help please!
    If somebody have a tutorial would be great!!
    Thanks!

  • User exit or a badi for checking the vendor email id in me22n on me29n

    hi all,
    can anybody suggest me a user exit or a badi  for checking the email id of the vendor in me21n or me22n or me29n.
    i.e. a user exit or a BADI which gets hit either at the time of creation or release of a purchase order.
    plz suggest me a solution its urgent.
    regards,
    santosh

    Hi Santosh,
    Have you looked BADI <b>ME_PROCESS_PO_CUST</b> or user exits <b>EXIT_SAPMM06E_016</b> / <b>EXIT_SAPMM06E_017</b>?
    Hope this will help.
    Regards,
    Ferry Lianto
    Please reward points if helpful.

  • WRITE_BACK BADI for Parent Level Data Save

    Hi Experts,
    I am using write back badi for Parent level data saving in BPC 10, but my requirement is to save data at parent level for time period 2007.Q1 without segregating at corresponding base members level.
    Is it possible so? if yes , please suggest.
    I will highly appreciate for your quick response.
    Regards,
    Dipesh Mudras

    Hi Dipesh,
    BPC NetWeaver related questions should be posted in the corresponding forum, cf.
    SAP Planning and Consolidation, version for SAP NetWeaver
    Regards,
    Gregor

  • BADI for check tax numbers in BP

    Hi,
    I need a BADI for check that the user pick two types of tax numbers (ES0 and ES1) in BP when createa a new IC.
    All BADIs that I find only execute on update and don't send exception.
    Anyone can I help me??
    Thanks

    Thanks Micheal
    but I need some additional information.
    I need to know how to get an error message in the function module I created.
    Thanks a lot

  • ME31K BADI for checking Data in Commitment Plan/ Acct assignment

    I am trying to find a BADI or User Exit to check Account Assignment / Commitment Plan Data, to work in TCodes ME31k or ME32K.
    I tried using ME_PROCESS_OUT_CUST , But its only for BAPI.
    Any Similar BADI to check in ME31K or ME32K.
    Appricate any help

    alex ice wrote:
    Hi.
    > 'Can we do any derivation or check to get the account assignment populated automatically in the Commitment Plan ?
    >  Account assignments screens are avaliable in the commitment plan so i think we dont want to apply this note.'-i don't think so, because as said in this note it's coding error.
    Thank you. I will impliment the Corrections
    >
    > 'We have alaready activated the Fields to be transferred. I dont have a clue where we will set the account assignemnt specifically for contracts (in the case of PR and PO it comes automatically as per the derivation rule mainted)'-it derives not from contract,but from  Earmarked fund,which generates from Com. plan.
    Ok.Then i think some issue in the Earmarked fund.. How we can check this. Please guide.
    >
    > 'One more error : While running transaction FM_MRP_PR if the budget exceed the PR not pupulating the account assignment filed (if it is in the budget it is populating) and we are getting error message "Instance 10000120 of object type Purchase Requisition could not be changed ,Message no. BAPI003" Please advice how we can overcome this error.' when you get this error(also put it's number), if while changing, then check PR item number,if it's=0 then customize in OMI5
    Message is  PR No  "10000120     10     Annual budget exceeded by 560,400.00 QAR (FM PB Availability Control) for document item 00010 ,
    "Instance 10000120 of object type Purchase Requisition could not be changed ,Message no. BAPI003"
    I have checked transaction OMI5 and Plant with Item PR 10 and Item no stock trans Res is 100. and hope this is correct.
    Please Guide.
    Regards
    Hari

  • Badi  for ME51N Item changes

    Hi ,
      Is there any Badi or user exit to make changes to the line item data in the purchase requisition create/change ME51N or ME52N transactions. We would want to populate few fields automatically on the item data, so would request if any of you have worked on any Badi for this transaction, please do post in immediately.
    Thanks,
    Sowmya

    Hi,
    1)BADI to be implemented: ME_PROCESS_REQ_CUST.
    Method to be used: PROCESS_ITEM.
    Place the below code in your implementation.
    data : l_item type MEREQ_ITEM.
    CALL METHOD im_item->get_data
    receiving
    re_data = l_item.
    *C-- L_ITEM-BEDNR is requirement tracking number
    2)Exit in ME51N
    MEREQ001 Customers' Own Data in Purchase Requisition
    You can implemet by this way
    You add your customer fields, which should be saved in the database, to
    the include CI_EBANDB (in table EBAN). You can also add customer fields
    that you want to use during the program run to the include CI_EBANMEM
    (in structure MEREQ_ITEM) These fields are not stored in database table
    EBAN.
    <b>Reward points</b>
    Regards

  • Need a BADI for Change Own Data Application to implement customer needs

    Hi All,
      I wanted to know the specific BADI which could be used for doing customer specific coding for 'Change Own Data" application.
    Here the need is to do some business specific checks to suit the the customer needs
    Best Regards,
    Sowmya

    Hi Sowmya,
    We are also having same kind of requirement so I was wondering if you can help me with the kind of solution that you implemented. BADI name or Implementation code etc.,
    Appreciate any inputs on this...
    Thanks,
    Rgds,
    Lakshmi

  • BADI for inserting items in ME51N

    Hi
    Which BADI do I use to insert items creating a purchase requisition (ME51N)?
    Thanks in advance.

    Check this badi..
    ME_BAPI_PO_CUST      Customer BAdI for BAPI_PO_CREATE1 and BAPI_PO_CHANG
    ME_BAPI_PR_CUST      Customer BAdI for Enjoy Purchase Requisition BAPIs
    next go to t-code Se15>expand the enhacement tab>enter package(ME) under Badi's tab and
                                                         execute you will get the list of Badi's
                                                         available...
    Prabhu
    Edited by: Prabhu Das on Jun 1, 2009 7:17 PM

  • User exit/BADI for PO item blocking

    Hi All,
    Is there any userexit/BADI available for blocking PO item?
    We want block PO item based on some header and item data validations. We need an exit which will be triggered before displaying the first screen(In case of PO change-ME22N). While creating/changing existing the item we got the BADI ME_PROCESS_PO_CUST. Here we can set im_item-loekz to value S so that item will be blocked. This is working fine only for creation/Change of item. Because this BADI will be triggered when ever we make some change in existing PO item/Creating new item.
    But say we have blocked a PO item now. later we have maintained necessary data which is used in validations. Then when we enter into same PO for next time it should automatically unblock that item.
    So we need exit which will be triggered before displaying first screen. If one exit is not available the we can use EXPORT/IMPORT logic to get all the data at one place. Hope there is no confusion in the requirement.
    Please let me know if there is any EXIT/BADI available for this scenario.
    Thanks for your help in Advance.
    Does any one has some solution for this?
    Thanks,
    Vinod.
    Edited by: Vinod Reddy Vemuru on Dec 10, 2008 12:37 PM

    Hi vinod,
    I have come accross similar issue of blocking PO at item level. but we wanted to do it using Tcode MEMASSPO .Can you please give any suggestion in this regard.

  • BADI for PM Order data change

    Dear all,
    In one of our requirements, we need to update the data present on the CAUFVD structure before AUFK is updated.
    There is an existing Z bespoke field on the table AUFK added through an include. As a part of the Order creation, this field remains empty and is generally filled in through a workflow that runs after the order is saved.
    The requirement now is to update this field as a part of the Order creation process and it has to be calculated using a Function Module.
    I was trying to see if we can use WORKORDER_UPDATE BADI for this purpose, but seems like this BADI doesn't allow users to Modify/Update the contents of CAUFVD structure. And we haven't found any user exits for the same purpose.
    Is there any way I can update the Z field on the CAUFVD structure through a BADI or an User Exit please?
    Warm regards,
    Vijay.

    Hi,
    After upgardeecc5.0 to ecc 6.0  BADI_SD_SALES_ITEM badi is migrated to spot with same name,so now this spot not working and its saying SAP internal use,but in ecc5.0 we have a code its not effecting on ecc6.0.
    Please help on this .
    Regards
    Mahesh

  • Exit/BADi for GR Posting Date =PO date

    Hi all ,
    Is there any Exit or BAdi for restricting users to post GR date greater than PO creation date.
    Regards
    Gibi Philip

    Hii,
    Check the below exit
    MB_CF001 Updating of material document data upon posting
    or
    BADI
    MB_DOCUMENT_BADI
    Ask the abaper to check the above exits
    Regards,
    Kumar

  • User exit for PO Item data update

    Hello All,
    At time of creation of PO using ME21N / ME58, we want to update PO item data . We want to update Over and Under delivery tolerances values from corressponding sales order rather than purchase info record.
    Please let me know if anyone has worked on similar requirement or any pointers for relevant user exits in SAP Release 4.6C .
    Regards,
    Manu.

    Hello ,
    Would you please check the below Userexits in 4.6C .
    EXIT_SAPLV50E_001
    EXIT_SAPLV50E_002
    EXIT_SAPLV50E_003
    EXIT_SAPLV50E_004
    EXIT_SAPLV50E_005
    EXIT_SAPLV50E_006
    In which I hope 2 and 4th were usefull.
    Regards,

Maybe you are looking for