Skip to Content
0
Former Member
Sep 20, 2007 at 10:23 AM

Free_Item in BAPI_PO_CHANGE

78 Views

Hi,

I want to make price = 0 in PO line Item. I'm using BAPI_PO_CHANGE with this code:

DATA: gs_ekpo TYPE ekpo.

DATA: gt_return TYPE TABLE OF bapiret2.

DATA: gs_return TYPE bapiret2.

DATA: gt_bapimepoitem TYPE TABLE OF bapimepoitem.

DATA: gt_bapimepoitemx TYPE TABLE OF bapimepoitemx.

DATA: gs_bapimepoitem TYPE bapimepoitem.

DATA: gs_bapimepoitemx TYPE bapimepoitemx.

PARAMETERS: p_ebeln LIKE ekpo-ebeln DEFAULT '1000901140'.

PARAMETERS: p_ebelp LIKE ekpo-ebelp DEFAULT '1'.

CLEAR: gs_ekpo,

gs_return,

gt_return[],

gs_bapimepoitem,

gs_bapimepoitemx,

gt_bapimepoitem[],

gt_bapimepoitemx[].

SELECT SINGLE * FROM ekpo INTO gs_ekpo

WHERE

ebeln = p_ebeln AND

ebelp = p_ebelp.

IF sy-subrc = 0.

gs_bapimepoitem-po_item = gs_ekpo-ebelp.

gs_bapimepoitem-free_item = 'X'.

APPEND gs_bapimepoitem TO gt_bapimepoitem.

gs_bapimepoitemx-po_item = gs_ekpo-ebelp.

gs_bapimepoitemx-free_item = 'X'.

APPEND gs_bapimepoitemx TO gt_bapimepoitemx.

CALL FUNCTION 'BAPI_PO_CHANGE'

EXPORTING

purchaseorder = gs_ekpo-ebeln

TABLES

return = gt_return

poitem = gt_bapimepoitem

poitemx = gt_bapimepoitemx.

READ TABLE gt_return INTO gs_return WITH KEY type = 'E'.

IF sy-subrc EQ 0.

*- errors

WRITE:/ 'E', gs_ekpo-ebeln, gs_ekpo-ebelp, 'BAPI',

gs_return-message.

ELSE.

*- success

CLEAR: gs_return,

gt_return[].

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'

IMPORTING

return = gs_return.

ENDIF.

ENDIF.

*******************

The program run succsefely, but it does not update the price on the line item to value 0.

Any Help please? i have SAP 4.72 with SAPKH47016.

Thanks.