Skip to Content
author's profile photo Former Member
Former Member

PO item deletion

Hello All,

I use BAPI_PO_CHANGE to delete a Item in PO.

And i do a Commit, it deletes PO item.

That is fine, after some checks i need to undelete/ Unblock the item which i have deleted earlier.

unfortunetly i cannot do the checks prior to deletion.

Inforeground i can use the unlock to undlete a deleted item, how do it do it with FM or BAPI.

Are theer any BAPI's or FM to do UNDELETE / UNBLOCK a deleted item?

Best Regards.

Add comment
10|10000 characters needed characters exceeded

2 Answers

  • Best Answer
    Posted on Aug 30, 2005 at 03:48 PM

    Can you not do what you did to delete the item, but in reverse? I mean, you probably set the DELETE_IND flag, right? Try setting it to SPACE.

    Regards,

    Rich Heilman

    Add comment
    10|10000 characters needed characters exceeded

    • This sample program is working good for me. It deletes the line and undeletes it.

      
      report zrich_0002 .
      
      data:     return type table of  bapiret2 with header line,
                poitem type table of   bapimepoitem with header line,
                poitemx type table of   bapimepoitemx with header line.
      
      parameters: p_ebeln type bapimepoheader-po_number,
                  p_dflag as checkbox.
      
      poitem-po_item = '000001'.
      poitem-delete_ind = p_dflag.
      append poitem.
      
      poitemx-po_item   = '000001'.
      poitemx-delete_ind = 'X'.
      append poitemx.
      
      call function 'BAPI_PO_CHANGE'
        exporting
          purchaseorder                = p_ebeln
      *   POHEADER                     =
      *   POHEADERX                    =
      *   POADDRVENDOR                 =
      *   TESTRUN                      =
      *   MEMORY_UNCOMPLETE            =
      *   MEMORY_COMPLETE              =
      * IMPORTING
      *   EXPHEADER                    =
       tables
         return                       = return
         poitem                       = poitem
         poitemx                      = poitemx
      *   POADDRDELIVERY               =
      *   POSCHEDULE                   =
      *   POSCHEDULEX                  =
      *   POACCOUNT                    =
      *   POACCOUNTPROFITSEGMENT       =
      *   POACCOUNTX                   =
      *   POCONDHEADER                 =
      *   POCONDHEADERX                =
      *   POCOND                       =
      *   POCONDX                      =
      *   POLIMITS                     =
      *   POCONTRACTLIMITS             =
      *   POSERVICES                   =
      *   POSRVACCESSVALUES            =
      *   POSERVICESTEXT               =
      *   EXTENSIONIN                  =
      *   EXTENSIONOUT                 =
      *   POTEXTHEADER                 =
      *   POTEXTITEM                   =
                .
      
      commit work.
      
      check sy-subrc = 0.
      
      

      Regards,

      Rich Heilman

  • author's profile photo Former Member
    Former Member
    Posted on Aug 30, 2005 at 04:07 PM

    Have a look at FM WB2_PO_ITEM_MAINTAIN.

    Rob

    Add comment
    10|10000 characters needed characters exceeded