Query on PO Deletion at Header Level

Hello Everybody,
We are using SRM 4.5 system (standalone without any MM backend). Our business needs to Delete POs which have already been ordered. Currently SAP is allowing us to delete the PO items once a PO is Ordered. But our requirement is to delete the PO from the header level itself, i.e., even if the PO is in ordered status, the Delete option at PO Header level should be present and allowed. Is there any way to achieve this requirement?
Kindly help.
Thanks and Regards,
Debanjan

Hi,
There is no option to configure at header.
Thanks

Similar Messages

  • Deletion of  the Purchase order at the item level and header level

    Hi Gurus,
    We are using SRM 7.0 system.
    In standard SRM 7.0, the PO can be deleted at header level and at line item level. I need to know the differnce between these deletions. I found that if the PO is deleted at the line item level the  deletion indicator (DEL_IND) field in BBP_PDIGP table is 'X'.
    But i could not find any clue to find the PO which is deleted at the header level. I need to code this logic in a report .
    Kindly provide your valuable inputs.
    Thanks,
    RK

    There are two ways:
    1. From the Header by clicking the DELETE button. And this is only possible when the PO is not yet output to Vendor.
    2. The second way is to delete all the items in the PO. This is possible any time irrespective of the output sent to the vendor. But provided if there are no follow-on documents for this.
    Some times we could see the Deletion icon active in Header  , it is because there is change version existing.
    When a PO is created and ordered, this is the first version of the PO. And this PO is sent to the backend and output is sent to
    the vendor.
    Now when you make a change and hold it, SRM creates the 2ndversion of this PO. Then when you delete this PO, SRM marks this 2nd
    version of PO to closed. Also you receive the pop-op confirmation that PO was deleted at this point. However, this PO deletion is never sent to the backend and output is not sent to the vendor since this PO has never been ordered. This version is the Change Version. This is shown after the PO number field if you pay attention on the screen.
    When you search for the PO, it will show you the ordered PO (No change version shown after the PO number). The system does not show you the deleted version which is version 2. That is why you see status is 'ordered'.

  • How to manually delete Po at header level ?

    Hi,
    I can delete PO line items in my ECC60 system
    However, i would like to delete PO at header level.
    In EKKO , i can see the deletion flag in LOEKZ field.
    BUT in ME22N, i cannot find any button to delete PO at header level...
    Could somebody clarify the PO deletion at header level and the LOEKZ deletion flag in EKKO ?
    Kind regards,
    Yann

    Yann,
    To my knowledge you cannot directly delete PO from the system. You need to follow the archiving steps...
    1. Program: RM06EV47 - For setting Deletion Indicator
    2.  Program: RM06EW47 - For archiving the document.
    3. Program: RM06ED47 - For Deletion from the system.
    If you need further details you can go through this link <a href="http://help.sap.com/saphelp_47x200/helpdata/en/8d/3e4b63462a11d189000000e8323d3a/frameset.htm">Archiving Purchase documents</a>
    Hope this helps....Reward your points and close the thread if so,
    Regards,
    Prasobh

  • How to delete approved shopping carts at header level in SRM 5 ?

    Hi All
    We are using SRM 5 (Classic Scenario) and we have a requirement in which we need to delete the approved shopping carts at header level. Here we are referring the case where SC lies in approved state in SRM but no PO generated in back end.
    We assume that if PO has been created for SC then shopping cart can not be deleted at all.
    I have seen advices like deleting approved shopping carts at item level but this would not suffice. As well we have seen that if we delete the SC at item level still SC shows complete value in header.
    Please advise on this.
    Regards
    Pranay Gupta
    +919711120111

    Hello,
    As far as I know, cart can be deleted at header level when its status is held.
    You can try to archive your carts, since item can be deleted.
    Check the archiving criteria here:
    http://help.sap.com/saphelp_srm50/helpdata/en/3c/f8f03bb8e88109e10000000a11402f/frameset.htm
    And shopping cart archiving procedure here:
    http://wiki.sdn.sap.com/wiki/display/SRM/ShoppingCartArchiving
    Regards,
    Ricardo

  • Purchase Register - Header level query issue

    Hi Guru's,
    I tried the following query for Purchase Register (Header Level) but I am not able to get the following details -                              1) AP Invoices which are without PO
    2) Freight amount not getting reflected
    SELECT T0.DocNum as 'PO. No.',
    T0.DocDate as 'PO. Date',
    M.DocNum as 'A/P Invoice No.',
    M.DocDate as 'Inv. Date',
    M.CardName as 'Vendor Name',
    M.NumAtCard as 'Bill No. & Date',
    (Select Sum(LineTotal) FROM PCH1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=-90 and DocEntry=M.DocEntry) as 'ED (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=-60 and DocEntry=M.DocEntry) as 'EDCS (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=8 and DocEntry=M.DocEntry) as 'HECS (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=-80 and DocEntry=M.DocEntry) as ' CVD (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=5 and DocEntry=M.DocEntry) as ' Ser.Tax (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=6 and DocEntry=M.DocEntry) as 'CS on Ser.Tax (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=7 and DocEntry=M.DocEntry) as 'HECS_ST (Rs.)',
    (Select Sum(LineTotal) From PCH3 Q Where Q.DocEntry=M.DocEntry) AS 'Freight (Rs.)',
    M.WTSum AS 'TDS (Rs.)',
    M.DocTotal as 'Total (Rs.)'
    FROM OPOR T0 INNER JOIN POR1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN OPDN T2 ON T2.DocEntry = T1.TrgetEntry
    INNER JOIN PDN1 T3 on T3.DocEntry = T2.Docentry
    INNER JOIN OPCH M ON M.DocEntry = T3.TrgetEntry
    LEFT OUTER JOIN PCH1 L on L.DocEntry=M.DocEntry
    LEFT OUTER JOIN PCH4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum
    LEFT OUTER JOIN PCH5 J ON M.DocEntry = J.AbsEntry
    LEFT OUTER JOIN PCH3 Q ON M.DocEntry = Q.DocEntry
    WHERE M.DocDate >= '[%0]' AND M.DocDate <= '[%1]'
    GROUP BY
    T0.DocNum,T0.DocDate,M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.[DiscSum],M.WTSum,M.DocTotal
    ORDER BY
    T0.DocNum,T0.DocDate,M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.[DiscSum],M.WTSum,M.DocTotal
    Regards,
    Abhishek

    Hi Abhishek,
    Try this Query Report, you will be get the exact result in  this Query.
    your requirement.
    1. A/P Invoice with Purchase Order.
    2. The Freight amount will display the Freight Column in the query.
    Try this below Query,
    SELECT T0.DocNum as 'PO. No.',
    T0.DocDate as 'PO. Date',
    M.DocNum as 'A/P Invoice No.',
    M.DocDate as 'Inv. Date',
    M.CardName as 'Vendor Name',
    M.NumAtCard as 'Bill No. & Date',
    (Select Sum(LineTotal) FROM PCH1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=-90 and DocEntry=M.DocEntry) as 'ED (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=-60 and DocEntry=M.DocEntry) as 'EDCS (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=7 and DocEntry=M.DocEntry) as 'HECS (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=10 and DocEntry=M.DocEntry) as ' CVD (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=5 and DocEntry=M.DocEntry) as ' Ser.Tax (Rs.) ',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=6 and DocEntry=M.DocEntry) as 'CS on Ser.Tax (Rs.)',
    (SELECT Sum(TaxSum) FROM PCH4 where statype=8 and DocEntry=M.DocEntry) as 'HECS_ST (Rs.)',
    (Select Sum(LineTotal) From PCH3 Q Where Q.DocEntry=M.DocEntry) AS 'Freight (Rs.)',
    M.WTSum AS 'TDS (Rs.)',
    M.DocTotal as 'Total (Rs.)'
    FROM OPOR T0 INNER JOIN POR1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN OPDN T2 ON T2.DocEntry = T1.TrgetEntry
    INNER JOIN PDN1 T3 on T3.DocEntry = T2.Docentry
    INNER JOIN OPCH M ON M.DocEntry = T3.TrgetEntry
    LEFT OUTER JOIN PCH1 L on L.DocEntry=M.DocEntry
    LEFT OUTER JOIN PCH4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum
    LEFT OUTER JOIN PCH5 J ON M.DocEntry = J.AbsEntry
    LEFT OUTER JOIN PCH3 Q ON M.DocEntry = Q.DocEntry
    WHERE M.DocDate >= '[%0]' AND M.DocDate <= '[%1]'
    GROUP BY
    T0.DocNum,T0.DocDate,M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.[DiscSum],M.WTSum,M.DocTotal
    ORDER BY
    T0.DocNum,T0.DocDate,M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.[DiscSum],M.WTSum,M.DocTotal
    Regards,
    Madhan.

  • Delete sales employee in header level with BAPI_CUSTOMERQUOTATION_CHANGE

    hi  experts,
    I try to delete sales employee in header level, but i always get the error message:
    FB call: insufficient parameters
    The sales document is not yet complete: Edit data
    Sales document 0007002015 was not changed
    Please give a light  how to delete sales employee successfully . Thank you very much!!
    My program:
    REPORT z_test_change_partner .
    DATA:
          order_header_inx LIKE bapisdh1x,
          order_header_in LIKE bapisdh1,
          return LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
          quotation_item_inx LIKE bapisditmx OCCURS 0 WITH HEADER LINE,
          partners LIKE bapiparnr OCCURS 0 WITH HEADER LINE,
          partnerchanges LIKE bapiparnrc OCCURS 0 WITH HEADER LINE
    order_header_inx-updateflag = 'U'.
    quotation_item_inx-updateflag = 'U'.
    quotation_item_inx-itm_number = '000010'.
    APPEND quotation_item_inx.
    CLEAR partners.
    partners-partn_role = 'VE'.
    partners-partn_numb = '00001000'.
    APPEND partners.
    CLEAR partnerchanges.
    partnerchanges-document = '0007002015'.
    partnerchanges-itm_number = '000000'.
    partnerchanges-updateflag = 'D'.
    partnerchanges-partn_role = 'VE'.
    *partnerchanges-p_numb_old = '00001111'.
    *partnerchanges-p_numb_new = '00001000'.
    APPEND partnerchanges.
    CALL FUNCTION 'BAPI_CUSTOMERQUOTATION_CHANGE'
      EXPORTING
        salesdocument                = '0007002015'
       quotation_header_in          = order_header_in
        quotation_header_inx         = order_header_inx
      SIMULATION                   =
      BEHAVE_WHEN_ERROR            =
      INT_NUMBER_ASSIGNMENT        =
      LOGIC_SWITCH                 =
      NO_STATUS_BUF_INIT           = ' '
      TABLES
        return                       = return
      QUOTATION_ITEM_IN            =
       quotation_item_inx           = quotation_item_inx
       partners                     = partners
       partnerchanges               = partnerchanges
      PARTNERADDRESSES             =
      CONDITIONS_IN                =
      CONDITIONS_INX               =
      QUOTATION_CFGS_REF           =
      QUOTATION_CFGS_INST          =
      QUOTATION_CFGS_PART_OF       =
      QUOTATION_CFGS_VALUE         =
      QUOTATION_CFGS_BLOB          =
      QUOTATION_CFGS_VK            =
      QUOTATION_CFGS_REFINST       =
      SCHEDULE_LINES               =
      SCHEDULE_LINESX              =
      QUOTATION_TEXT               =
      QUOTATION_KEYS               =
      EXTENSIONIN                  =
    LOOP AT return.
      WRITE / return-message.
    ENDLOOP.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
       wait          = 'X'
    IMPORTING
      RETURN        =

    Hi Edith,
    Thank you very much for your reply.
    I changed my program by following your steps in the reply. Now the BAPI is showing error messages: "Instance 7200000060 of object type PurchaseOrder could not be changed" and "Price without service not allowed".
    Please refer my code below.
    poitem-po_item = '0010'.
    poitem-pckg_no = '0000001964'.
    poitem-item_cat = '9'.
    APPEND poitem.
    poitemx-po_item = '10'.
    poitemx-po_itemx = 'X'.
    poitemx-pckg_no = 'X'.
    poitemx-item_cat = 'X'.
    APPEND poitemx.
    Parent line
    poservices-pckg_no = '0000001964'.
    poservices-line_no = '0000000001'.
    poservices-ext_line = '0000000000'.
    poservices-subpckg_no = '0000001965'.
    poservices-matl_group = '01040107'.
    *poservices-delete_ind = 'X'.
    *poservices-quantity = ' '.
    *poservices-base_uom = ' '.
    *poservices-gr_price = ' '.
    APPEND poservices.
    CLEAR: poservices.
    Child line.
    poservices-pckg_no = '0000001965'.
    poservices-line_no = '0000000002'.
    poservices-ext_line = '0000000010'.
    poservices-quantity = '1'.
    poservices-service = '000000000005000010'.
    poservices-base_uom = 'EA'.
    poservices-gr_price = '150'.
    poservices-subpckg_no = '0000000000'.
    poservices-matl_group = '01040107'.
    poservices-delete_ind = 'X'.
    APPEND poservices.
    CALL FUNCTION 'BAPI_PO_CHANGE'
      EXPORTING
        purchaseorder = '7200000060'
      TABLES
        return        = return[]
        poitem        = poitem[]
        poitemx       = poitemx[]
        poservices    = poservices[]
        posrvaccessvalues = posrvaccessvalues[].
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    Regards,
    Revanth

  • How to delete a PO at header level - Restrict to a specific order type

    Hi,
    Deletetion of PO at header level is not recomended but still in my project they are using it to delete a particular PO type and should not allow to delete the other PO types. Recently Support Pack upgrade was done. After this activity deletion is not happening. Hope the relevent code got over writed with the original.
    Here creation and change of PO will be done from a third party system through IDOC. Deletion of PO at header level should be possible only through IDOC.
    Can some one give me the idea where(BAdI/Enhancement) we need to write the code to allow the deletion of PO of a particular type?
    Regards,
    Balaram Devineni

    Hope you are referring to "setting of deletion indicator at header level of PO" (EKKO-LOEKZ = 'L').  Standard method CL_PO_HEADER_HANDLE_MM->PO_CANCEL may be helpful (you may have to integrate this with IDOC processing function module).  Wiki post [Purchase Order Cancellation (Header) using ABAP Classes|http://wiki.sdn.sap.com/wiki/display/ABAP/PurchaseOrderCancellation%28Header%29usingABAPClasses] will be a good reference.

  • Delete the PO at the header level after it has been output sucessfully

    Can we change the status of a Purchase order in SRM from 'ordered' to 'deleted' ?
    It seems we can do it only if the PO has not been output successfully.
    I have checked for a few POs and found for such POs if you go ti change mode , the delete button at the header level
    does not become enabled.
    But I have found a PO in the system which was output suceessfully but its status is deleted. The PO has not been transfered to ECC .
    Please help .
    I do not want to forcibly change the status from the backend.

    We have some BI reports which requires the POs to be deleted at the header level

  • Deleting multiple POs are header level

    Hi,
    We are in SRM 5.0, is there any function module by which we can delete old POs at header level.
    Rgds,
    Madhan

    See the foll link:
    Re: How to delete a PO in SRM

  • Deletion of  Accounting view at Header level

    How can I delete only Accounting view at Header level ??? i.e Valuation type is blank .

    WHY? just to have a nice looking material master?
    It is not possible to delete views. It is only possible to delete organisation levels.
    So your possible way would be to set deletion indicator at plant level.
    Then you would need to archive this material master in SARA object MM_MATNR
    There are numerous preconditions for archiving, e.g. no stock in last 2 years
    After a successful archiving, you can then create the plant level without accounting view again.
    Edited by: Jürgen L. on Jun 5, 2009 9:33 AM

  • Goods recipient field at the header level when reservation is created.

    Hi Experts,
    In SRM, when shopping cart is created and a reservation is created in the backend ECC system, the Goods Recipient field is updated only at the item level but not at the header level. That is, when I go to the transaction mb23 and check the values for the particular reservation, the Recipient field is updated only for the item and not for the header.
    On the other hand when I create a reservation manually, Goods recipient can be filled at header level as well.  Is there any way in which the Goods recipient value will reflect at the header level as well when I am creating a shopping cart and a reservation is created in the backend?
    Thanks in advance.
    Regards,
    Janhavi.

    Dear Poster,
    As no response has been provided to the thread in some time I must assume the issue is resolved, if the question is still valid please create a new thread rephrasing the query and providing as much data as possible to promote response from the community.
    Best Regards,
    SDN SRM Moderation Team

  • How can I have the pricing conditions at the item and header level of the d

    How can I have the pricing conditions at the item and header level of the delivery? There exist "condition" tabs both the header and the item level of the delivery but the contents of the tabs are empty. I'll be happy if you can help me. Thanks in advance....

    Hi
    If you want to have the pricing procedure at delivery level then you need to assign a pricing procedure at delivery level also
    Just go through the path to maintain the pricing procedure at delivery level.
    IMG -> Logistics execution -> Shipping -> Basic Shipping Functions -> Pricing -> Pricing Procedure. for Delivery.
    But can you be more clear if the above one is not your query ?
    Regards
    Srinath

  • BADI enhancement for Enjoy PO Tcodes at "header level".

    I could successfully add an item level tab to MEXXN PO tcodes. Somebody help me with the ME_GUI_PO_CUST and ME_PROCESS_PO implementations to add a customer field , say ZZ_ETYP in a separate header level tab "Expense type".
    Do I need to add subscreen2 attribute to the implementing class ?
    Will one structure do for both header and item level data ?
    Do I need to create a separate table ( like ZMEPO_BADI_EXAMPL for items ) for the header also ?
    It would be gr8 if i could get the code for the above BADIs and MEPOBADIEX's function modules.

    Dear Iyer,
    Kindly go through the code.. hope this will help you...
    <b>DETAILED DATABASE DESIGN SPECIFICATIONS</b>
    <b>1. ZTPTP_HEADER</b>
    Header: Expense Type
    Field Name     Field Type     Key Information     Field Description
    MANDT     MANDT     X     Client
    EBELN     EBELN     X     Purchasing Document Number
    ZZ_EXPTYPE     ZZEXPTYPE          Expense Type
    <b>2. ZTPTP_ITEM</b>
    Item: Retainage
    Field Name     Field Type     Key Information     Field Description
    MANDT     MANDT     X     Client
    EBELN     EBELN     X     Purchasing Document Number
    EBELP     EBELP     X     Item Number of Purchasing Document
    ZZ_RETAINAGE      ZZRETAINAGE           Retainage
    <b>3. ZSPTP_HEADER</b>
    PO Enhancement structure: Header
    Field Name     Field Type     Key Information     Field Description
    EBELN     EBELN          Purchasing Document Number
    ZZ_EXPTYPE     ZZEXPTYPE          Expense Type
    <b>4. ZSPTP_ITEM</b>
    PO Enhancement structure: Item
    Field Name     Field Type     Key Information     Field Description
    EBELN     EBELN          Purchasing Document Number
    EBELP     EBELP          Item Number of Purchasing Document
    ZZ_RETAINAGE      ZZRETAINAGE           Retainage
    Detailed logic
    <b>LZPTP_PORETAINAGETOP (TOP INCLUDE) FG: ZPTP_PORETAINAGE</b>
    persistent item data
    data: git_persistent_data type sorted table of ztptp_item
                             with unique key mandt ebeln ebelp,
    actual item data
          git_data            type sorted table of ztptp_item
                             with unique key mandt ebeln ebelp.
    persistent header data
    data: git_persistent_head type sorted table of ztptp_header
                             with unique key mandt ebeln ,
    actual header data
          git_head            type sorted table of ztptp_header
                             with unique key mandt ebeln .
    dynpro output structure
    tables: zsptp_item,
            zsptp_header.
    definitions required for dynpro/framework integration
    data: ok-code type sy-ucomm.
    Following is a SAP include.
    include lmeviewsf01.
    <b>1. ZPTP_COMMIT_HEADER FG: ZPTP_PORETAINAGE</b>
    Get the sample function module code from the standard FM: MEPOBADIEX_COMMIT. In this Function module we update the database table ZTPTP_HEADER i.e. as per a change / insert or delete command at the header level. This database table’s size will always be low. It just contains the PO s data just being edited or created.
    The interface would look like:
         TABLES
          IMT_DATA_NEWHD STRUCTURE ZTPTP_HEADER
          IMT_DATA_OLDHD STRUCTURE ZTPTP_HEADER
          Comparing the old and new data we update 3 different internal tables and using these we can update the internal tables ZTPTP_HEADER before actually updating the database table EKKO.A similar logic is coded in the sample FM : MEPOBADIEX_COMMIT
    <b>
    2. ZPTP_COMMIT_ITEM FG: ZPTP_PORETAINAGE</b>
    Get the sample function module code from the standard FM: MEPOBADIEX_COMMIT. In this Function module we update the database table ZTPTP_HEADER i.e. as per a change / insert or delete command at the item level. This database table’s size will always be low. It just contains the PO s latest data just being edited or created.
    The interface would look like :
         TABLES
           IMT_DATA_NEW STRUCTURE  ZTPTP_ITEM
      IMT_DATA_OLD STRUCTURE  ZTPTP_ITEM
          Comparing the old and new data we update 3 different internal tables and using these we can update the internal tables ZTPTP_HEADER before actually updating the database table EKPO. A similar logic is coded in the sample FM : MEPOBADIEX_COMMIT
    <b>3. ZPTP_GET_DATA_HEADER FG: ZPTP_PORETAINAGE</b>
    Get the sample function module code from the standard FM: MEPOBADIEX_GET_DATA. This FM is responsible for updating an internal table (git_head) which would hold the data the user has changed or created or displayed till the current point of time. It would also hold the latest customer header data that is to be displayed in case of a change transaction.
    The interface would be as follows:
    Local Interface:
    IMPORTING
         REFERENCE(IM_EBELN) TYPE  EBELN
         REFERENCE(IM_EBELP) TYPE  EBELP OPTIONAL
    EXPORTING
         REFERENCE(EX_HEAD) TYPE  ZTPTP_HEADER
    Read expense type from git_header. If not found, get expense value from EKKO.
    <b>4. ZPTP_GET_DATA_ITEM FG: ZPTP_PORETAINAGE</b>
    Get the sample function module code from the standard FM: MEPOBADIEX_GET_DATA. This FM is responsible for updating an internal table (git_data) which would hold the data the user has changed or created or displayed till the current point of time. It would also hold the latest customer item data that is to be displayed in case of a change transaction.
    The interface would be as follows:
    Local Interface:
      IMPORTING
         REFERENCE(IM_EBELN) TYPE  EBELN
         REFERENCE(IM_EBELP) TYPE  EBELP
      EXPORTING
         VALUE(EX_DATA) TYPE  ZTPTP_ITEM
    Read Retainage from git_data. If not found, get Retainage value from EKPO.
    <b>5.  ZPTP_INIT FG: ZPTP_PORETAINAGE</b>
    Get the sample function module code from the standard FM: MEPOBADIEX_INIT. This FM is responsible for clearing the header and item internal tables.
    clear: git_persistent_data[], git_data[],git_persistent_head[],git_head[].
    <b>6. ZPTP_OPEN FG: ZPTP_PORETAINAGE</b>
    Get the sample function module code from the standard FM: MEPOBADIEX_OPEN.  This FM is responsible for existing information from respective database tables.
    The interface would be as follows:
    Local Interface:
    IMPORTING
    REFERENCE(IM_EBELN) TYPE  EBELN
    Get Expense type and Retainage from customer created Tables and assign it to respective global internal tables.
    <b>7.  ZPTP_POP_HEADER FG: ZPTP_PORETAINAGE</b>
    Get the sample function module code from the standard FM: MEPOBADIEX_POP. This FM is responsible for getting header values from screen fields.
    The interface would be as follows:
    Local Interface:
    EXPORTING
       REFERENCE(EX_DYNP_DATAHD) TYPE  ZSPTP_HEADER
    get dynpro data
      ex_dynp_datahd = zsptp_header.
    <b>8.  ZPTP_POP_ITEM FG: ZPTP_PORETAINAGE</b>
    Get the sample function module code from the standard FM: MEPOBADIEX_POP. This FM is responsible for getting item values from screen fields.
    The interface would be as follows:
    Local Interface:
    EXPORTING
       REFERENCE(EX_DYNP_DATA) TYPE  ZSPTP_ITEM
    get dynpro data
      ex_dynp_data = zsptp_item.
    <b>9.  ZPTP_POST_HEADER FG: ZPTP_PORETAINAGE</b>
    Get the sample function module code from the standard FM: MEPOBADIEX_POST. This FM is responsible for preparing header data for posting.
    Local Interface:
    IMPORTING
       VALUE(IM_EBELN) TYPE  EBELN
    prepare customers data for posting
      check not im_ebeln is initial.
      lit_data_newhd[] = git_head.
      lit_data_oldhd[] = git_persistent_head.
      lwa_head-mandt = sy-mandt.
      lwa_head-ebeln = im_ebeln.
      modify lit_data_newhd from lwa_head transporting mandt ebeln where ebeln is initial.
    Commit data in Database ztptp_header.
      call function 'ZPTP_COMMIT_HEADER'
        tables
          imt_data_newhd = lit_data_newhd
          imt_data_oldhd = lit_data_oldhd.
    <b>10. ZPTP_POST_ITEM FG: ZPTP_PORETAINAGE</b>
    Get the sample function module code from the standard FM: MEPOBADIEX_POST. This FM is responsible for preparing item data for posting.
    "Local Interface:
    IMPORTING
        VALUE(IM_EBELN) TYPE  EBELN
      data: lwa_data like line of git_data,
            lit_data_new type standard table of ztptp_item,
            lit_data_old type standard table of ztptp_item.
    prepare customers data for posting
      check not im_ebeln is initial.
      lit_data_new[] = git_data.
      lit_data_old[] = git_persistent_data.
      lwa_data-mandt = sy-mandt.
      lwa_data-ebeln = im_ebeln.
      modify lit_data_new from lwa_data transporting mandt ebeln where ebeln is initial.
    Commit data in Database ztptp_item.
      call function 'ZPTP_COMMIT_ITEM' in update task
        tables
          imt_data_new = lit_data_new
          imt_data_old = lit_data_old.
    <b>11.  ZPTP_PUSH_HEADER FG: ZPTP_PORETAINAGE</b>
    Get the sample function module code from the standard FM: MEPOBADIEX_PUSH. This FM is responsible for populating header values to screen fields.
    Local Interface:
      IMPORTING
         REFERENCE(IM_DYNP_DATAHD) TYPE  ZSPTP_HEADER
    set dynpro data
      zsptp_header = im_dynp_datahd .
    <b>12.  ZPTP_PUSH_ITEM FG: ZPTP_PORETAINAGE</b>
    Get the sample function module code from the standard FM: MEPOBADIEX_PUSH. This FM is responsible for populating item values to screen fields.
    Local Interface:
    IMPORTING
       REFERENCE(IM_DYNP_DATA) TYPE  ZSPTP_ITEM
    set dynpro data
      zsptp_item = im_dynp_data .
    <b>13. ZPTP_SET_DATA_HEADER FG: ZPTP_PORETAINAGE</b>
    Get the sample function module code from the standard FM: MEPOBADIEX_SET_DATA. This FM is responsible for keep update header  information in git_header.
    delete a line from git_data
        delete table git_head with table key mandt = sy-mandt
                                            ebeln = im_datahd-ebeln.
    update customer data
        read table git_head assigning <lf_datahd> with table key
                                            mandt = sy-mandt
                                            ebeln = im_datahd-ebeln.
        if sy-subrc is initial.
    update existing data
          <lf_datahd>-zz_exptype = im_datahd-zz_exptype.
        else.
    make a new entry into the data table
          lwa_head = im_datahd.
          lwa_head-mandt = sy-mandt.
          insert lwa_head into table git_head.
        endif.
    <b>14. ZPTP_SET_DATA_ITEM FG: ZPTP_PORETAINAGE</b>
    Get the sample function module code from the standard FM: MEPOBADIEX_SET_DATA. This FM is responsible for keep update item information in git_data.
    delete a line from git_data
        delete table git_data with table key mandt = sy-mandt
                                            ebeln = im_data-ebeln
                                            ebelp = im_data-ebelp.
    update customer data
        read table git_data assigning <lf_data> with table key
                                            mandt = sy-mandt
                                            ebeln = im_data-ebeln
                                            ebelp = im_data-ebelp.
        if sy-subrc is initial.
    update existing data
          <lf_data>-zz_retainage = im_data-zz_retainage.
        else.
    make a new entry into the data table
          lwa_data = im_data.
          lwa_data-mandt = sy-mandt.
          insert lwa_data into table git_data.
        endif.
    <b>DETAILED SCREEN DESIGN SPECIFICATIONS</b>
    <b>screen 0002</b>
    Item Retainage
    ZSPTP_ITEM-ZZ_RETAINAGE     DEC     5     Retainage
    Screen Logic / Process before Output
      call method call_view->handle_event( 'PBO' ).
    Screen Logic / Process after Input
    call method call_view->handle_event( 'PAI' )
    <b>Screen 0003</b>
    Header: Expense type
    ZSPTP_HEADER-ZZ_EXPTYPE     NUMC     4     Expense Type
    Screen Logic / Process before Output
      call method call_view->handle_event( 'PBO' ).
    Screen Logic / Process after Input
    call method call_view->handle_event( 'PAI' )
    <b>DETAILED CLASS DESIGN SPECIFICATIONS</b>
    <b>A. ZCL_IM_ME_GUI_PO_CUST</b>
    Description
    Imp. Class ZME_GUI_PO_CUST
    Attributes
    Name     Level     Visibility     Type
    SUBSCREEN1     Constant     Public     MEPO_NAME
    SUBSCREEN2     Constant     Public     MEPO_NAME
    DYNP_DATA_PBO     Instance Attribute     Private     ZSPTP_ITEM
    DYNP_DATA_PAI     Instance Attribute     Private     ZSPTP_ITEM
    DYNP_DATA_PBOHD     Instance Attribute     Private     ZSPTP_HEADER
    DYNP_DATA_PAIHD     Instance Attribute     Private     ZSPTP_HEADER
    Methods
    Name     Level     Visibility
    IF_EX_ME_GUI_PO_CUST~SUBSCRIBE     Instance Attribute     Public
    IF_EX_ME_GUI_PO_CUST~MAP_DYNPRO_FIELDS     Instance Attribute     Public
    IF_EX_ME_GUI_PO_CUST~TRANSPORT_FROM_MODEL     Instance Attribute     Public
    IF_EX_ME_GUI_PO_CUST~TRANSPORT_TO_DYNP     Instance Attribute     Public
    IF_EX_ME_GUI_PO_CUST~TRANSPORT_FROM_DYNP     Instance Attribute     Public
    IF_EX_ME_GUI_PO_CUST~TRANSPORT_TO_MODEL     Instance Attribute     Public
    <b>1. SUBSCRIBE</b>
    Description
    Publisch Customer's Own Screens
    Detailed logic
      when lc_item.
    the name is a unique identifier for the subscreen and defined in this class definition
      lwa_subscriber-name = subscreen1.
    the dynpro number to use
      lwa_subscriber-dynpro = '0002'.
    the program where the dynpro can be found
      lwa_subscriber-program = 'SAPLZPTP_PORETAINAGE'.
    each subscreen needs his own DDIC-Structure
      lwa_subscriber-struct_name = 'ZSPTP_ITEM'.
    a label can be defined
      lwa_subscriber-label = text-001.
    the position within the tabstrib can be defined
      lwa_subscriber-position = 1.
      lwa_subscriber-height = 7.
      append lwa_subscriber to re_subscribers.
    Header subscreen
      when lc_header.
    the name is a unique identifier for the subscreen and defined in this class definition
      lwa_subscriber-name = subscreen2.
    the dynpro number to use
      lwa_subscriber-dynpro = '0003'.
    the program where the dynpro can be found
      lwa_subscriber-program = 'SAPLZPTP_PORETAINAGE'.
    each subscreen needs his own DDIC-Structure
      lwa_subscriber-struct_name = 'ZSPTP_HEADER'.
    a label can be defined
      lwa_subscriber-label = text-002.
    the position within the tabstrib can be defined
      lwa_subscriber-position = 1.
      lwa_subscriber-height = 7.
      append lwa_subscriber to re_subscribers.
      endcase.
    <b>2. MAP_DYNPRO_FIELDS</b>
    Description
    Build Up Field Catalog
    Detailed logic
      loop at ch_mapping assigning <lf_mapping>.
    *Assignment of metafields to the customer fields.
        case <lf_mapping>-fieldname.
          when 'EBELN'.       <lf_mapping>-metafield = mmmfd_preq_no_po.
          when 'EBELP'.       <lf_mapping>-metafield = mmmfd_preq_item_po.
          when 'ZZ_RETAINAGE'. <lf_mapping>-metafield = mmmfd_cust_01.
          when 'ZZ_EXPTYPE'.   <lf_mapping>-metafield = mmmfd_cust_02.
        endcase.
      endloop.
    <b>
    3. TRANSPORT_FROM_MODEL</b>
    Description
    Data Transport from Business Object
    Detailed logic
        when subscreen1.
    Get the item object
          mmpur_dynamic_cast lif_item im_model.
          check not lif_item is initial.
          lwa_mepoitem = lif_item->get_data( ).
    transport customer fields
          call function 'ZPTP_GET_DATA_ITEM'
            exporting
              im_ebeln = lwa_mepoitem-ebeln
              im_ebelp = lwa_mepoitem-ebelp
            importing
              ex_data  = lwa_customer.
    store info for later use
          move-corresponding lwa_mepoitem to dynp_data_pbo.
          move lwa_customer-zz_retainage to dynp_data_pbo-zz_retainage.
        when subscreen2.
    Get the header object
          mmpur_dynamic_cast lif_header im_model.
          check not lif_header is initial.
    transport standard fields
          lwa_mepohead = lif_header->get_data( ).
    transport customer fields
          call function 'ZPTP_GET_DATA_HEADER'
            exporting
              im_ebeln = lwa_mepohead-ebeln
            importing
              ex_head  = lwa_customerhd.
    store info for later use
          move-corresponding lwa_mepohead to dynp_data_pbohd.
          if not lwa_customerhd-zz_exptype is initial.
            move lwa_customerhd-zz_exptype to dynp_data_pbohd-zz_exptype.
          else.
            move dynp_data_paihd-zz_exptype to dynp_data_pbohd-zz_exptype.
          endif.
        when others.
      endcase.
    <b>4. TRANSPORT_TO_DYNP</b>
    Description
    Data Transport to Screen
    Detailed logic
    case im_name.
        when subscreen1 .
       Pushing item data to screen fields
          call function 'ZPTP_PUSH_ITEM'
            exporting
              im_dynp_data = dynp_data_pbo.
        when subscreen2 .
       Pushing header data to screen fields
          call function 'ZPTP_PUSH_HEADER'
            exporting
              im_dynp_datahd = dynp_data_pbohd.
        when others.
      endcase.
    <b>5. TRANSPORT_FROM_DYNP</b>
    Description
    Data Transport from Screen
    Detailed logic
    case im_name.
        when subscreen1.
    Getting item data from screen fields
          call function 'ZPTP_POP_ITEM'
            importing
              ex_dynp_data = dynp_data_pai.
          if dynp_data_pai ne dynp_data_pbo
           or dynp_data_paihd ne dynp_data_pbohd.
    If data  changed we have to notify the framework
    to transport data to the model
            re_changed = mmpur_yes.
        endif.
        when subscreen2.
    Getting header data from screen fields
          call function 'ZPTP_POP_HEADER'
            importing
              ex_dynp_datahd = dynp_data_paihd.
          if dynp_data_paihd ne dynp_data_pbohd
          or dynp_data_pai ne dynp_data_pbo.
    If data changed we have to notify the framework
    to transport data to the model
            re_changed = mmpur_yes.
          endif.
        when others.
      endcase.
    <b>6. TRANSPORT_TO_MODEL</b>
    Description
    Treatment of Function Codes
    Detailed logic
      case im_name.
        when subscreen1.
    is it an item? im_model can be header or item.
          mmpur_dynamic_cast lif_item im_model.
          check not lif_item is initial.
          lwa_mepoitem = lif_item->get_data( ).
    standard fields changed?
          if dynp_data_pbo-ebeln ne dynp_data_pai-ebeln  or
             dynp_data_pbo-ebelp ne dynp_data_pai-ebelp or
             dynp_data_pbo-zz_retainage ne dynp_data_pai-zz_retainage.
    update standard fields
            lwa_mepoitem-ebeln = dynp_data_pai-ebeln.
            lwa_mepoitem-ebelp = dynp_data_pai-ebelp.
            lwa_mepoitem-zzretainage = dynp_data_pai-zz_retainage.
            call method lif_item->set_data( lwa_mepoitem ).
          endif.
    customer fields changed?
          if dynp_data_pbo-zz_retainage ne dynp_data_pai-zz_retainage.
            call function 'ZPTP_GET_DATA_ITEM'
              exporting
                im_ebeln = lwa_mepoitem-ebeln
                im_ebelp = lwa_mepoitem-ebelp
              importing
                ex_data  = lwa_customer.
            lwa_customer-zz_retainage = dynp_data_pai-zz_retainage.
    Commit changes to database.
            call function 'ZPTP_SET_DATA_ITEM'
              exporting
                im_data = lwa_customer.
          endif.
        when subscreen2.
    is it an header? im_model can be header or item.
          mmpur_dynamic_cast lif_header im_model.
          check not lif_header is initial.
          lwa_mepohead = lif_header->get_data( ).
    standard fields changed?
          if dynp_data_pbohd-ebeln ne dynp_data_paihd-ebeln or
          dynp_data_pbohd-zz_exptype ne dynp_data_paihd-zz_exptype.
    update standard fields
            lwa_mepohead-ebeln = dynp_data_paihd-ebeln.
            lwa_mepohead-zzexptype = dynp_data_paihd-zz_exptype.
            call method lif_header->set_data( lwa_mepohead ).
          endif.
    customer fields changed?
          if dynp_data_pbohd-zz_exptype ne dynp_data_paihd-zz_exptype.
            call function 'ZPTP_GET_DATA_HEADER'
              exporting
                im_ebeln = lwa_mepohead-ebeln
              importing
                ex_head  = lwa_customerhd.
            lwa_customerhd-zz_exptype = dynp_data_paihd-zz_exptype.
    Commit changes to database.
            call function 'ZPTP_SET_DATA_HEADER'
              exporting
                im_datahd = lwa_customerhd.
          endif.
        when others.
      endcase.
    <b>
    B. ZCL_IM_ME_PROCESS_PO_CUST</b>
    Description
    Imp. Class for BAdI imp. ZME_PROCESS_PO_CUST
    Methods
    Name     Level     Visibility
    IF_EX_ME_PROCESS_PO_CUST~INITIALIZE     Instance Attribute     Public
    IF_EX_ME_PROCESS_PO_CUST~OPEN     Instance Attribute     Public
    IF_EX_ME_PROCESS_PO_CUST~PROCESS_HEADER     Instance Attribute     Public
    IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM     Instance Attribute     Public
    IF_EX_ME_PROCESS_PO_CUST~POST     Instance Attribute     Public
    IF_EX_ME_PROCESS_PO_CUST~CLOSE     Instance Attribute     Public
    <b>
    1. INITIALIZE</b>
    Description
    Initializations (Invoked Once Only)
    Detailed logic
    initializations
      call function 'ZPTP_INIT'.
    <b>2. OPEN</b>
    Description
    Open a Purchase Order
    Detailed logic
    data: lwa_mepoheader type mepoheader.
    read customer data
    this has to be done when we open a persistent object
      check im_trtyp eq 'V' or im_trtyp eq 'A'.
      lwa_mepoheader = im_header->get_data( ).
    read customer data from database
      call function 'ZPTP_OPEN'
        exporting
          im_ebeln = lwa_mepoheader-ebeln.
    <b>3. PROCESS_HEADER</b>
    Description
    Processing of Header Data
    Detailed logic
    data: lwa_mepohead type mepoheader,
            lwa_customerhd type ztptp_header.
      include mm_messages_mac. "useful macros for message handling
    here we check customers data
      lwa_mepohead = im_header->get_data( ).
      if lwa_mepohead-loekz eq 'D'.
    a physical deletion of the header was carried out.
        lwa_customerhd-ebeln = lwa_mepohead-ebeln.
        call function 'ZPTP_SET_DATA_HEADER'
          exporting
            im_datahd                  = lwa_customerhd
            im_physical_delete_request = 'X'.
      endif.
    <b>4. PROCESS_ITEM</b>
    Description
    Processing of Item Data
    Detailed logic
    data: lwa_mepoitem type mepoitem,
            lwa_customer type ztptp_item.
      include mm_messages_mac. "useful macros for message handling
    here we check customers data
      lwa_mepoitem = im_item->get_data( ).
      if lwa_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
        lwa_customer-ebeln = lwa_mepoitem-ebeln.
        lwa_customer-ebelp = lwa_mepoitem-ebelp.
        call function 'ZPTP_SET_DATA_ITEM'
          exporting
            im_data                    = lwa_customer
            im_physical_delete_request = 'X'.
      endif.
    <b>5. POST</b>
    Description
    Post
    Detailed logic
    *Posting header data
          call function 'ZPTP_POST_HEADER'
            exporting
              im_ebeln       = im_ebeln.
    *Posting item data
          call function 'ZPTP_POST_ITEM'
            exporting
              im_ebeln       = im_ebeln.
    <b>
    6. CLOSE</b>
    Description
    Closing Processing
    Detailed logic
    close customer data
      call function 'ZPTP_INIT'.

  • To get PO number against invoices at header level only

    hi
    I have this query to retireve payments against invoices
    SELECT ai.gl_date, aca.amount paymentamount, aca.bank_account_name,aca.check_number,aca.DOC_SEQUENCE_VALUE voucher_num,
           aca.payment_method_lookup_code, aca.vendor_name suppliername,ai.base_amount functional_amount,   pha.segment1 po_num,
           aca.check_date paymentdate, aida.period_name, aida.creation_date
      FROM ap_invoices_all ai,
           ap_vendors_v avv,
           ap_invoice_payments_all aipa,
           ap_checks_all aca,
           ap_invoice_distributions_all aida,
           po_distributions_all pda,
           po_headers_all pha,
             HR_ORGANIZATION_UNITS_V hrov
    WHERE ai.vendor_id = avv.vendor_id
       AND aca.vendor_id = ai.vendor_id
       AND aipa.check_id = aca.check_id
       AND aipa.invoice_id = ai.invoice_id
       AND ai.invoice_id = aida.invoice_id
       ANd pda.po_distribution_id=aida.po_distribution_id(+)
       AND pda.po_header_id = pha.po_header_id(+)
       AND pda.destination_organization_id=hrov.organization_id
        and aca.STATUS_LOOKUP_CODE !='VOIDED'
         and  aca.DOC_SEQUENCE_VALUE='212366'
    order by to_char(ai.gl_date,'MM')
    18 records are shown
    for aca.doc_sequence_value='212244 no rows returned
    i found the reason as to this 212244 has no PO number
    so i had to rewrite the query using ANSI JOINS
    SELECT ai.gl_date, aca.amount paymentamount, aca.bank_account_name,aca.check_number,aca.DOC_SEQUENCE_VALUE voucher_num,
           aca.payment_method_lookup_code, aca.vendor_name suppliername,ai.base_amount functional_amount,   pha.segment1 po_num,
           aca.check_date paymentdate, aida.period_name, aida.creation_date
      FROM ap_invoices_all ai
         join  ap_vendors_v avv on(ai.vendor_id = avv.vendor_id)
          join ap_invoice_payments_all aipa on (aipa.invoice_id = ai.invoice_id)
          join ap_checks_all aca on (  aipa.check_id = aca.check_id  and aipa.invoice_id = ai.invoice_id)
           join ap_invoice_distributions_all aida on (  ai.invoice_id = aida.invoice_id)
        left join  po_distributions_all pda on (pda.po_distribution_id=aida.po_distribution_id)
          left join po_headers_all pha on(  pda.po_header_id = pha.po_header_id)
            left join HR_ORGANIZATION_UNITS_V hrov on  (pda.destination_organization_id=hrov.organization_id)
        where aca.STATUS_LOOKUP_CODE !='VOIDED'
         and  aca.DOC_SEQUENCE_VALUE='212366'
    order by to_char(ai.gl_date,'MM')
    now i get the correct data for 212244 
    but when i run the same query for 212366 i get 19 records  as one invoice in this 076998 has 3 line items and one line item dont have PO
    BUT the requirement is to get  only PO information at the header level not line levelkindly guide
    thanking in advance

    When you need only PO numbers, link only the 3 tables to make your query simpler.
    ap_invoice_distributions_all aida,
    po_distributions_all pda,
    po_headers_all poh
    Only po based invoices will be selected for these tables

  • How to close a PO at the header level

    Is it possible to close a PO at the header level or a way to deactivate the PO so that no new items can be added? Thanks in advance for any suggestions.

    > Is it possible to close a PO at the header level
    Po can be closed at Item level and not Header level. You can set Deletion Indicator and further can be archived thru SARA MM_EKKO
    or a way to deactivate the PO so that no new items can be added?
    You can activate Release strategy and Choose a Proper Release indicatory so that no new changes to be carried out.
    Else go for User Exits

Maybe you are looking for