Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Closing POs

Former Member
0 Likes
364

Hi ppl,

I am working on closing all the open POs(ekpo-delivery complete indicator is blank) along with some more validations from other db tables using for all entries(select query). finally i have the open POs in an internal table.

within a loop i have passed this table-po_number to bapi_po_change along with DCI field marked as 'X' at last i am displaying the return struct of the bapi but all are 'E' no PO z closed or changed.


DATA: li_item   TYPE bapimepoitem OCCURS 0 WITH HEADER LINE,
        li_header TYPE bapimepoheader OCCURS 0 WITH HEADER LINE,
        li_return_values TYPE bapiret2 OCCURS 0 WITH HEADER LINE,
        lw_purchase_item LIKE LINE OF gi_purchase_item,
  li_itemx TYPE bapimepoitemx OCCURS 0 WITH HEADER LINE.

  li_item-no_more_gr = 'X'.
  LOOP AT gi_purchase_item.
    li_item-po_item     = li_itemx-po_item  = gi_purchase_item-ebelp.
    li_item-material    = gi_purchase_item-matnr.
    li_item-plant       = gi_purchase_item-werks.
    li_header-po_number = gi_purchase_item-ebeln.
    APPEND li_item.
    APPEND li_itemx.
    APPEND li_header.
    CALL FUNCTION 'BAPI_PO_CHANGE'
      EXPORTING
        purchaseorder                = li_header-po_number
 TABLES
       return                       = li_return_values
       poitem                       = li_item
       poitemx                      = li_itemx
ENDLOOP.

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
*    EXPORTING
*      WAIT          =
*    IMPORTING
*      RETURN        =
            .

  LOOP AT li_return_values.
    WRITE : / li_return_values-type,
            / li_return_values-message.
 ENDLOOP.

Now what my specification is there are so many items for a single PO number i need to close even tat..... How can i pass many item numbers(EBELP) for a single po_number(EBELN)????

can anyone suggest something on this at the earliest........

Hi ppl,

I am working on closing all the open POs(ekpo-delivery complete indicator is blank) along with some more validations from other db tables using for all entries(select query). finally i have the open POs in an internal table.

within a loop i have passed this table-po_number to bapi_po_change along with DCI field marked as 'X' at last i am displaying the return struct of the bapi but all are 'E' no PO z closed or changed.


DATA: li_item   TYPE bapimepoitem OCCURS 0 WITH HEADER LINE,
        li_header TYPE bapimepoheader OCCURS 0 WITH HEADER LINE,
        li_return_values TYPE bapiret2 OCCURS 0 WITH HEADER LINE,
        lw_purchase_item LIKE LINE OF gi_purchase_item,
  li_itemx TYPE bapimepoitemx OCCURS 0 WITH HEADER LINE.

  li_item-no_more_gr = 'X'.
  LOOP AT gi_purchase_item.
    li_item-po_item     = li_itemx-po_item  = gi_purchase_item-ebelp.
    li_item-material    = gi_purchase_item-matnr.
    li_item-plant       = gi_purchase_item-werks.
    li_header-po_number = gi_purchase_item-ebeln.
    APPEND li_item.
    APPEND li_itemx.
    APPEND li_header.
    CALL FUNCTION 'BAPI_PO_CHANGE'
      EXPORTING
        purchaseorder                = li_header-po_number
 TABLES
       return                       = li_return_values
       poitem                       = li_item
       poitemx                      = li_itemx
ENDLOOP.

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
*    EXPORTING
*      WAIT          =
*    IMPORTING
*      RETURN        =
            .

  LOOP AT li_return_values.
    WRITE : / li_return_values-type,
            / li_return_values-message.
 ENDLOOP.

Now what my specification is there are so many items for a single PO number i need to close even tat..... How can i pass many item numbers(EBELP) for a single po_number(EBELN)????

can anyone suggest something on this at the earliest........

1 REPLY 1
Read only

Former Member
0 Likes
332

pass the items in an internal table and passit to the function module.

reward this with points.