Application Development 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: 

BAPI_PO_CHANGE

Former Member
0 Kudos

Hello,

Has anyone used BAPI_PO_CHANGE to add new confirmation lines to a PO?

It looks like you should be able to do this as this BAPI contains a table structure called POCONFIRMATION (type BAPIEKES) but I can't get it work.

Thanks,

Ruby

6 REPLIES 6

Former Member
0 Kudos

Hi Ruby,

Do a where used list for this BAPI in se37 , u will get many examples in ur landscape.

Thanks

Amresh

Former Member
0 Kudos

Hi Ruby,

Check this example :-

[http://www.sap-img.com/abap/sample-abap-code-on-bapi-po-change.htm]

Regards

Abhii

p244500
Active Contributor
0 Kudos

hi


data : begin of t_poheader occurs 0,
       po like zvtls_sap-posap,
       end of t_poheader.

DATA : BEGIN OF t_bapi_poheader OCCURS 0.
        INCLUDE STRUCTURE bapimepoheader.
DATA : END OF t_bapi_poheader.

DATA : BEGIN OF t_bapi_poheaderx OCCURS 0.
        INCLUDE STRUCTURE bapimepoheaderx.
DATA : END OF t_bapi_poheaderx.


DATA : l_msgty      TYPE c,
         l_msgid(2)   TYPE c,
         l_msgno(3)   TYPE c,
         l_msgtx(100) TYPE c,
         l_errflag    TYPE c.

  CLEAR: t_bapireturn.
  REFRESH: t_bapireturn.

  CALL FUNCTION 'BAPI_PO_CHANGE'
    EXPORTING
      PURCHASEORDER = T_POHEADER-PO
      POHEADER      = T_BAPI_POHEADER
      POHEADERX     = T_BAPI_POHEADERX
    TABLES
      RETURN        = T_BAPIRETURN
      POITEM        = T_BAPI_POITEM
      POITEMX       = T_BAPI_POITEMX.

  READ TABLE t_bapireturn WITH KEY type = c_err TRANSPORTING NO FIELDS.
  IF sy-subrc NE 0.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        wait = c_x.
  ENDIF.
*C-- Write messages

  WRITE: / 'PO Number', t_poheader-po.
  clear : t_update,w_povtls.
  read table t_update with key posap = t_poheader-po.
  w_povtls = t_update-povtls.


regard

nawa

Former Member
0 Kudos

Check this code:

DATA: lt_poitem LIKE bapimepoitem OCCURS 0 WITH HEADER LINE.

DATA: lt_poitemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE.

DATA: lt_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.

DATA: lt_cond LIKE bapimepocond OCCURS 0 WITH HEADER LINE.

DATA: lt_condx LIKE bapimepocondx OCCURS 0 WITH HEADER LINE.

SELECT ebeln ebelp zekkn vbeln vbelp

FROM ekkn INTO TABLE lt_ekkn

WHERE ebeln = gv_ebeln.

IF sy-subrc EQ 0.

LOOP AT lt_ekkn.

READ TABLE gt_so_items WITH KEY ebeln = gv_ebeln

posnr = lt_ekkn-vbelp

BINARY SEARCH.

IF sy-subrc EQ 0.

READ TABLE gt_konv WITH KEY knumv = gt_so_items-knumv

kposn = gt_so_items-posnr

BINARY SEARCH.

IF sy-subrc = 0.

lt_poitem-po_item = lt_ekkn-ebelp.

APPEND lt_poitem.

lt_poitemx-po_item = lt_ekkn-ebelp.

lt_poitemx-po_itemx = 'X'.

APPEND lt_poitemx.

lt_cond-itm_number = lt_ekkn-ebelp.

lt_cond-cond_type = 'ZQCS'.

lt_cond-cond_value = gt_konv-kbetr.

lt_cond-currency = gt_konv-waers.

lt_cond-change_id = 'I'.

APPEND lt_cond.

lt_condx-itm_number = lt_ekkn-ebelp.

lt_condx-itm_numberx = 'X'.

lt_condx-cond_type = 'X'.

lt_condx-cond_value = 'X'.

lt_condx-currency = 'X'.

lt_condx-change_id = 'X'.

APPEND lt_condx.

ENDIF.

ENDIF.

ENDLOOP.

ENDIF.

IF NOT lt_poitem[] IS INITIAL.

CALL FUNCTION 'BAPI_PO_CHANGE'

EXPORTING

purchaseorder = gv_ebeln

TABLES

return = lt_return

poitem = lt_poitem

poitemx = lt_poitemx

pocond = lt_cond

pocondx = lt_condx.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

ENDIF.

Former Member
0 Kudos

what is the purpose of your program?

Former Member
0 Kudos

.