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

Free_Item in BAPI_PO_CHANGE

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Sep 20, 2007 at 06:12 PM

    Hi

    Try using the BADI to change the price.

    Implement BADI definition (ME_PROCESS_PO_CUST) and create a class and implemented the interface (IF_EX_ME_PROCESS_PO_CUST) and use the methods (PROCESS_ITEM) - GET_DATA and SET_DATA to change the price

    Pls let me know, whether it works

    Regards

    Madhan Doraikannan

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.