BADI while PO Creation

Hello Freinds,
Hello Freinds,
I am using BADI ME_PURCHDOC_POSTED method Posted for updating a ztable for the PO.
This BADI is getting called through ME21N and ME22N.
My problem is that when it gets called from ME21N, all the internal tables of EKKO, EKPO does not have PO numbers as it has not yet got created. I need to update the Ztable and hence I need the PO number.
Can anyone help me with a BADI which can give me the value of PO number in the creation mode itself.
Kindly help.

Hi,
Please check the parameter im_ekko .
For BADI , ME_PURCHDOC_POSTED , As the name of the BAdI  method implies we have already passed the posting of the document.
If you requirement is to modify the purchase order BEFORE posting then you should have a look at BAdI ME_PROCESS_PO_CUST.
Thanks and Regards,
P.Bharadwaj
Edited by: Bharadwaj p on Jun 14, 2010 1:16 PM

Similar Messages

  • Changing the Profit Center while PO creation

    Hi All,
    I am trying to update the Profit Center(EKKN-PRCTR) while PO creation using the transactions ME21N and ME22N. I used ME_PROCESS_PO_CUST which is not even triggering and include ZXM06U22, ZXM06U43 which also are not working. Can you please guide me which EXIT or BADI can be used to achieve this requirement.
    Thanks in Advance.

    Hi
    Check the BADI  ME_PROCESS_PO_CUST with PROCESS_ACCOUNT AND POST methods. 
    Refere the link
    Re: BADI for Purchase  Order
    Regards
    Sanil Bhandari

  • Parameters not gettin passed while lead creation..........

    Hi...
                 I am passing the values of the fields SOURCE and IMPORTANCE in the exporting parameter IT_LEAD_H to the FM CRM_ORDER_MAINTAIN while lead creation...When I check the CRM_LEADH table I find that these values arent gettin reflected ...The guid and the leadtype are gettin saved but the values of these two fields are not present...This is the code I'm using.....
    CT_ORDERADM_H
        ls_orderadm_h-handle        = '1'.
    .   ls_orderadm_h-PROCESS_TYPE  = 'LEAD'.
        ls_orderadm_h-mode          = 'A'.
        INSERT ls_orderadm_h INTO TABLE lt_orderadm_h.
      build table with change fields
        FREE lt_input_field_names.
        ls_input_field_names-fieldname = 'PROCESS_TYPE'.
        INSERT ls_input_field_names INTO TABLE lt_input_field_names.
        ls_input_field_names-fieldname = 'MODE'.
        INSERT ls_input_field_names INTO TABLE lt_input_field_names.
        CLEAR ls_input_fields.
        ls_input_fields-ref_handle  = '1'.
      ls_input_fields-objectname  = 'ORDERADM_H'.
        ls_input_fields-field_names = lt_input_field_names.
        INSERT ls_input_fields INTO TABLE ct_input_fields.
    CRMT_LEAD_H_COMT
      IF IT_LEAD_H IS INITIAL.
        ls_lead_h-ref_handle     = '1'.
        ls_lead_h-SOURCE         = '002'.
        ls_lead_h-IMPORTANCE     = '2'.
      ENDIF.
        INSERT ls_lead_h INTO TABLE lt_lead_h.
      build table with change fields
        FREE lt_input_field_names.
        IF ls_lead_h-SOURCE IS NOT INITIAL.
          ls_input_field_names-fieldname = 'SOURCE'.
          INSERT ls_input_field_names INTO TABLE lt_input_field_names.
        ENDIF.
        IF ls_lead_h-IMPORTANCE IS NOT INITIAL.
          ls_input_field_names-fieldname = 'IMPORTANCE'.
          INSERT ls_input_field_names INTO TABLE lt_input_field_names.
        ENDIF.
        CLEAR ls_input_fields.
        ls_input_fields-ref_handle  = '1'.
        ls_input_fields-ref_kind    = 'A'.
        ls_input_fields-objectname  = 'LT_LEAD_H'.
        ls_input_fields-field_names = lt_input_field_names.
        INSERT ls_input_fields INTO TABLE ct_input_fields.
    IT_STATUS
      IF is_status IS INITIAL.
        ls_status-ref_handle     = '1'.
        ls_status-status         = STATUS.
       ls_status-user_stat_proc = 'CRMLEAD'.
        ls_status-activate       = 'X'.
       ls_status-process        = 'ACCI'.
      ENDIF.
        INSERT ls_status INTO TABLE lt_status.
      build table with change fields
        FREE lt_input_field_names.
        IF ls_status-status IS NOT INITIAL.
          ls_input_field_names-fieldname = 'STATUS'.
          INSERT ls_input_field_names INTO TABLE lt_input_field_names.
        ENDIF.
        IF ls_status-activate IS NOT INITIAL.
          ls_input_field_names-fieldname = 'ACTIVATE'.
          INSERT ls_input_field_names INTO TABLE lt_input_field_names.
        ENDIF.
        CLEAR ls_input_fields.
        ls_input_fields-ref_handle  = '1'.
        ls_input_fields-ref_kind    = 'A'.
        ls_input_fields-objectname  = 'STATUS'.
        ls_input_fields-field_names = lt_input_field_names.
        INSERT ls_input_fields INTO TABLE ct_input_fields.
    ENDIF.
    bring changed fields with values to object layer
      CALL FUNCTION 'CRM_ORDER_MAINTAIN'
        EXPORTING
          it_lead_h         = lt_lead_h
          it_survey         = it_survey
          it_status         = lt_status
        CHANGING
          ct_orderadm_h     = lt_orderadm_h
          ct_orderadm_i     = lt_orderadm_i
          ct_input_fields   = ct_input_fields
        EXCEPTIONS
          error_occurred    = 1
          document_locked   = 2
          no_change_allowed = 3
          no_authority      = 4
          OTHERS            = 5.
    Are there any other parameters that I have to pass?Plz suggest a solution for this......

    Hi Francois,
    Thank you for looking into the issue. Your first response was did you try get_form_field. Yes I did, and it did not work. I realised later (hopefully correctly) that get_form_field will work only if the field below is treated as an input field within <htmlb:form> and </htmlb:form>.
    I shall re-explain the scenario. In default.htm, I enter an IDoc Number(input field) and click submit button. In the <form action > I have mentioned idoc.htm page. In idoc.htm, in On Initialization , I create a tree.
    Method of creating tree
    a) I create a table of type TVIEWNODE and populate the relevant details, except for the link field. The parameters that needs to be passed to the next page is a structure. In order to achieve this(I found this method in one of the posts in the forum),
    Step I -- Serialize the structure data using CL_BSP_UTILITY=>SERIALIZE_DATA and fill a table LT_PARAMETER_LIST.
    Step II -- I then construct a URL using CL_BSP_RUNTIME=>IF_BSP_RUNTIME~CONSTRUCT_BSP_URL passing APPLICATION NAME, 'SEGMENT.HTM' and table LT_PARAMETER_LIST.
    Step III -- This method returns a URL which is then appended in the TVIEWNODE table and the tree is created.
    The tree is created perfectly and the links are perfect as well.
    However as mentioned in my earlier post when I click on the link, the URL shows all the attributes but I am not able to fetch the same using GET_ATTRIBUTE method or GET_FORM_DATA method.
    Next point mentioned was create an attribute. This is an interesting point that you have mentioned. In page attributes, when I try pa_s_idoc-segnam, it mentions special characters not allowed.
    I will explore the possibility of creating fields of internal table as page attributes i.e. using SEGNAM instead of pa_s_idoc-SEGNAM and then pass values to these.
    If there are any other solutions do let me know.
    Thanks again, Francois.

  • What is the BADI  while SAVING purchase order using me22n?

    what is the BADI  while SAVING purchase order using me22n?
    while i will save purchase order through me22n, badi should be fire what is badi for that?
    regards,
    dushyant.

    Dushyant,
    Hopefully you know how to implement the BADI ME_PROCESS_PO_CUST now.
    The following are the codes that you can put in the method "Post".
      DATA: LW_HEADER        TYPE MEPOHEADER,
            LW_POSTED_HEADER TYPE MEPOHEADER,
            LW_VALID         TYPE MMPUR_BOOL,
            ITAB_ITEM        TYPE PURCHASE_ORDER_ITEMS,
            LW_ITEM          TYPE MEPOITEM,
            ITEM_INTERFACE   TYPE PURCHASE_ORDER_ITEM,
            ITAB_ACCT        TYPE PURCHASE_ORDER_ACCOUNTINGS,
            ACCT_INTERFACE   TYPE PURCHASE_ORDER_ACCOUNTING,
            LW_ACCT          TYPE MEPOACCOUNTING,
            LW_POSTED_ACCT   TYPE MEPOACCOUNTING,
            W_ACCT_CHANGED  TYPE C,
            W_GRANT_AMT      TYPE EKPO-NETWR,
            W_FINANCE_AMT    TYPE EKPO-NETWR,
            W_FLAG           TYPE C.
    Check if PO header data is valid
      CLEAR LW_VALID.
      CALL METHOD IM_HEADER->IS_VALID
        RECEIVING
          RE_VALID = LW_VALID.
      CHECK LW_VALID = 'X'.
    PO header data is valid
    Get the newly updated PO header data
      CLEAR LW_HEADER.
      CALL METHOD IM_HEADER->GET_DATA
        RECEIVING
          RE_DATA = LW_HEADER.
    Get the posted PO header data
      CLEAR LW_POSTED_HEADER.
      CALL METHOD IM_HEADER->GET_PERSISTENT_DATA
        IMPORTING
          EX_DATA = LW_POSTED_HEADER
        EXCEPTIONS
          NO_DATA = 1.
      IF SY-SUBRC <> 0.
        CLEAR LW_POSTED_HEADER.
      ENDIF.
    Get PO line items
      REFRESH ITAB_ITEM.
      CALL METHOD IM_HEADER->GET_ITEMS
        RECEIVING
          RE_ITEMS = ITAB_ITEM.
      LOOP AT ITAB_ITEM INTO ITEM_INTERFACE.
    Check if PO line item is valid
        CLEAR LW_VALID.
        CALL METHOD ITEM_INTERFACE-ITEM->IS_VALID
          RECEIVING
            RE_VALID = LW_VALID.
        IF LW_VALID <> 'X'.
    This PO line item is not valid
          CLEAR W_ACCT_CHANGED.
          EXIT.
        ENDIF.
        CLEAR LW_ITEM.
        CALL METHOD ITEM_INTERFACE-ITEM->GET_DATA
          RECEIVING
            RE_DATA = LW_ITEM.
    Get the account interface
        REFRESH ITAB_ACCT.
        CALL METHOD ITEM_INTERFACE-ITEM->GET_ACCOUNTINGS
          RECEIVING
            RE_ACCOUNTINGS = ITAB_ACCT.
        LOOP AT ITAB_ACCT INTO ACCT_INTERFACE.
          CLEAR LW_ACCT.
    Get the newly updated PO item data
          CALL METHOD ACCT_INTERFACE-ACCOUNTING->GET_DATA
            RECEIVING
              RE_DATA = LW_ACCT.
          CLEAR LW_POSTED_ACCT.
    Get the posted PO item data
          CALL METHOD ACCT_INTERFACE-ACCOUNTING->GET_PERSISTENT_DATA
            IMPORTING
              EX_DATA = LW_POSTED_ACCT
            EXCEPTIONS
              NO_DATA = 1.
          IF SY-SUBRC > 0.
            CLEAR LW_POSTED_ACCT.
          ENDIF.
          IF LW_ACCT-LOEKZ <> LW_POSTED_ACCT-LOEKZ OR
             LW_ACCT-KOSTL <> LW_POSTED_ACCT-KOSTL OR
             LW_ACCT-PRCTR <> LW_POSTED_ACCT-PRCTR OR
             LW_ACCT-PS_PSP_PNR <> LW_POSTED_ACCT-PS_PSP_PNR.
    Account assignment was changed
    We will force this PO to go through workflow
            W_ACCT_CHANGED = 'Y'.
          ENDIF.
        ENDLOOP.
      ENDLOOP.

  • Error while delivery creation

    hi,
      i am getting an error while delivery creation for qty 2.The error is "Only 0 EA of material xxxx available".
    The schedule line cat in this case is cp and avalibility check is carried out and confirmed qty is given on some date ahead.
    User then runs the MRP and PR is created .
    Then the user creates a PO but not with ref to the PR created from above,instead the user creates a SO assigned PO and then creates GR which is SO assigned.
    Now when the user is trying to create delivery the erroe is "Only 0 EA of material xxxx available".
    Pl tell me why am i getting this error inspite of having the qty against the SO?
    Is it because a PR is generated from the MRP run for tht order and we have no GR agaist tht PR?Where do u i check this setting

    Hi,
    In SAP there is no stock available for that material. That is the reason it is showing that message..
    Please check MMBE t.code  stock overview for that material. I  think sales order scheduleline date is showing some other date.becuase today there is no stock so u will be not able to create any delvery. So please create delivery only on confirmed schdulines date....
    Other wise do stock posting and then do availability check then try to create delivery...
    Regards
    sankar
    Edited by: sankar sankar on Jul 1, 2008 1:10 PM

  • User Exit or BADI while posting GRs.

    HI all,
    I am looking for a User Exit or BADI while posting Goods Receipts for Purchase Orders.
    I need to change the <b>POSTING DATE</b> on the receipt for certain document types.
    i found a user exit : MB_CF001, but this is not allowing me to change the posting date on the material document.
    Thanks for your help in advance.

    Hi Ravi,
                      This is ULitity program which takes Tcode or program name as a input and gives the BADI existing in the program. Please Allocate me the point if it is usefully to you
    REPORT ZBADI_CHECK .
    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.

  • How to maintain consistance in muliple badi while we are creating

    hi
    1)how to maintain consistance in multiple badis
    while we are doing this how we wil maintain

    multiple implementation badis are governed by filter keys...please google 'multiple implementation badi' and you would get enough material.
    Regards,
    BJ

  • IHC errors valid clearing partner not found and no header details found while idoc creation after f110

    IHC errors :valid clearing partner not found and no header details found while idoc creation after f110
    Please let me know where the config is missing for ihc automatic payment program.in we02 status is not 53.
    Please help

    Hi
    Please share the error message in the IDOC.
    If the error message is IHC204 "No valid clearing partner was found", it may be due to the missing correct configuration in Set Up Creation of Payment Requests for Inbound IDoc in FI, which links the clearing partner, ALE logical system partner type and IHC account number.
    Cheers
    taro

  • Problem while SO creation through BDC

    Hi Experts,
    The follow problem  came in log file of SM35 ,while SO creation through BDC for some sales org.
      Runtime error COMPUTE_BCD_OVERFLOW has occurred.
    could you please tell me what is problem.
    Thanks
    jai

    Hi
    It could be the following reasons,
    1. Too many orders
    2. Mismatch in the field, like fields skip a line so data not matching.
    Check these
    <b>Reward if it helped!</b>
    Chandru

  • User exit or BADI while saving purchase order

    Hello,
    I want to use an user exit or BADI while saving of purchase order. The objective is to check the material group of the line item while saving. We don´t want to allow to save purchase orders for one material group.
    Can you please guide me.
    Thanks
    Srinivasan

    Hi
    The Business Add-In (BAdI) ME_PROCESS_PO_CUST enables you to extend the business logic of the Enjoy purchase order on an individual basis.
    You can thus influence the dialog transactions ME21N, ME22N, ME23N, and ME29N, and the BAPIs BAPI_PO_CREATE1 and BAPI_PO_CHANGE.
    Typical applications for this BAdI include:
    Processing of own objects
    Processing of additional data on standard objects
    Implementation of additional checks and derivationsChange of data in standard fields
    Change in field selection
    you can use this BADI for checking the material group
    Thanks & Regards
    Kishore

  • Facing error while invoice creation in AR.

    Facing error while invoice creation in AR as Please complete your tax accounting flexfield. We are creating invoice through API.
    Regards
    Sridhar

    Hi,
    Please go through the below Note ID.
    Autoinvoice Error On Tax Codes - Please Complete Your Tax Accounting Flexfield [ID 1469285.1]
    Regards,
    Raju.

  • Userexit / BADI while cancelling a material document in MIGO.

    Hi all,
    I am searching for an userexit/badi while i'am cancelling a Mat.Doc(MBLNR). the whole idea is to cancel the delivery document if it not picked.
    Thanks and Regards.

    Please Be Specific By Providing Screen Number in MIGO transaction.
    Meanwhile  I think Implementation of BADI : MB_MIGO_BADI will solve your poblem.
    Contact me incase u want more help on BADI.

  • Different storage section  get picks while TO creation

    Dear expert
    Different storage section ( not which has been assigned in strategy) get picks while TO creation
    Regards
    Karan

    Different storage section ( not which has been assigned in strategy) get picks while TO creation
    You probably didn't activate the section determination for the storage type. If don't activate this, he ignores your configured strategy.
    IMG: Logistics Execution -> Warehouse Management -> Strategies -> Activate Storage Section Search -> Activate, and then check the setting for your storage type.

  • User exit/BADI for delivery creation in VL10B

    Hi,
    Is there any exits available for restricting the document type while the deliveries are selected/processed using VL10B/VL10G - delivery creation in background.
    Scenario is when deliveries are created for STO's,thedelivery is to be created for a selected document types(EKKO - BSART).Other types of document types have to be ignored when the delivery is created in background.
    Regards
    Deepak

    Check this exit.
    BADI LE_SHP_DELIVERY_PROC
    Method IF_EX_LE_SHP_DELIVERY_PROC~DELIVERY_FINAL_CHECK

  • BADI for restrict creation of business transaction independently

    Hello Experts,
    I have a requirement where I need to check if the Business activity (say any 'Z' transaction) has a opportunity follow-up document then only that business transaction need to be executed else should give the error that "Z transaction need to be created through opportunity only and can not be created individually".
    I found one BADI CRM_ORDERADM_H_BADI where I can check for the condition but the issue is that as soon as I entered to CRMD_ORDER this BADI gets triggered where I need to trigger this BADI only when the user is trying to create the 'Z' business transaction individually.
    Any Suggestion will be highly appreciated.
    Thanks in Advance & Best Regards,
    Deepak Gupta

    Deepak, there is a parameter called CRM_MODE and this has the following values depending upon the transaction context:
    A - Create
    B - Change
    C - Display and
    D - Delete
    Now, in the same BAdI, since you are restricting the creation of the activity, check the CRM_MODE for the Activity, if it is A, then, call the function module CRM_ORDER_READ with the GUID of the activity and extract only the document flow ET_DOC_FLOW. Check this export table and see if the parent is an opportunity (BUS2000111). If your condition is not met, add an Error message in the transaction.

Maybe you are looking for