cancel
Showing results for 
Search instead for 
Did you mean: 

how to change net Price by using BAPI_PO_change

Former Member
0 Kudos
3,858

Hi experts..

How i can change net price by using bapi_po_change.

What parameters i have to pass in this fm.

if possible please tell me , which table this FM will update.

Thanks.

I will award points for all help.

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Thanks for replying ....

My program is going into dump bcoz of the parameter POITEM.

I had declared and itab type poitem and changed the net_price against ebelp.But when passing it into FM, its getting dump

please suggest.

Former Member
0 Kudos

See the below code and have tested and it works great..

REPORT ZTEST_PG_07 NO STANDARD PAGE HEADING

MESSAGE-ID z9_msg_prash.

        • Tables Declaration ****

TABLES: ekpo.

        • Variables Declaration ****

DATA: v_purchaseorder TYPE bapimepoheader-po_number.

DATA: v_ebelp TYPE ekpo-ebelp.

        • Constants Declaration ****

CONSTANTS: x VALUE 'X'.

        • Internal Tables Declaration ****

DATA: it_return TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE.

DATA: it_poitem TYPE STANDARD TABLE OF bapimepoitem WITH HEADER LINE.

DATA: it_poitemx TYPE STANDARD TABLE OF bapimepoitemx WITH HEADER LINE.

DATA: wa_return TYPE bapiret2.

        • Selection Screen ****

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.

PARAMETERS: p_ebeln LIKE ekpo-ebeln OBLIGATORY.

PARAMETERS: p_ebelp LIKE ekpo-ebelp.

PARAMETERS: p_menge LIKE ekpo-menge.

SELECTION-SCREEN END OF BLOCK b1.

*----


  • AT SELECTION-SCREEN

*----


AT SELECTION-SCREEN ON p_ebeln.

IF p_ebeln IS NOT INITIAL.

SELECT SINGLE ebeln INTO v_purchaseorder FROM ekpo

WHERE ebeln = p_ebeln.

IF sy-subrc <> 0.

MESSAGE e002.

ENDIF.

ELSE.

MESSAGE e005.

ENDIF.

AT SELECTION-SCREEN ON p_ebelp.

if p_ebeln is not initial.

IF p_ebelp IS NOT INITIAL.

SELECT SINGLE ebelp INTO v_ebelp FROM ekpo

WHERE ebeln = p_ebeln AND ebelp = p_ebelp.

IF sy-subrc <> 0.

MESSAGE e003.

ENDIF.

ELSE.

MESSAGE e006.

ENDIF.

endif.

*----


  • START-OF-SELECTION

*----


START-OF-SELECTION.

v_purchaseorder = p_ebeln.

it_poitem-po_item = p_ebelp.

it_poitem-quantity = p_menge.

it_poitem-net_price = '20.00'.

APPEND it_poitem.

it_poitemx-po_item = p_ebelp.

it_poitemx-po_itemx = x.

it_poitemx-quantity = x.

APPEND it_poitemx.

*&----Calling BAPI function module

CALL FUNCTION 'BAPI_PO_CHANGE'

EXPORTING

purchaseorder = v_purchaseorder

  • testrun = x

TABLES

return = it_return

poitem = it_poitem

poitemx = it_poitemx.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = space

  • IMPORTING

  • RETURN =

.

*----


  • END-OF-SELECTION

*----


END-OF-SELECTION.

LOOP AT it_return INTO wa_return.

WRITE:/ wa_return-message.

ENDLOOP.

Thanks

Seshu

Former Member
0 Kudos

Dear Saurabh,

here is what you need to do

before calling this Function Module do this

Loop at ITEMDATA -Item data.

go to the Net Price field and change it accordingly

and modify the ITEMDATA table by changing only the NETPRICE field.

Endloop.

then pass the newly changes ITEMDATA table below.

CALL FUNCTION 'BAPI_PO_CHANGE'

EXPORTING

PURCHASEORDER = " Purchase order number"

POHEADER = "The PO header details through this strucuture"

TABLES

RETURN = "just pass an empty return table parameter" this is compusory.

POITEM = ALL the ITEM data through this table.

Only when RETURN Table is having a Successful message

call function 'BAPI_CALL_TRANSACTION_COMMIT'.

then it will COMMIT and store the new data in the DB.

then the tables EKKO and EKPO will get updated.

Hope this helps you out.

Thanks

Venugopal

Reward Accordingly

Former Member
0 Kudos

You need to pass PO Number and item number,then use below one to change net price

BAPIMEPOITEM-NET_PRICE

PURCHASEORDER - Import Parameter

POITEM-NET_PRICE - Table Parameter ,here need to pass Item number,Material Number,Qty

Thanks

Seshu

former_member188685
Active Contributor
0 Kudos

CALL FUNCTION 'BAPI_PO_CHANGE'

EXPORTING

purchaseorder = ebeln

poheader = poheader

poheaderx = poheaderx

TABLES

return = return

poitem = poitem

poitemx = poitemx

.

read table return with key type = 'S'.

if sy-subrc eq 0.

call function 'BAPI_CALL_TRANSACTION_COMMIT'.

else.

endif.

Regards

Vijay

Former Member
0 Kudos

Hi,

Paass the header and item data.

This will update Ekpo and Ekko tables and also other table realted to purchase information.

Reward if helpful..

Former Member
0 Kudos

IMPORTING

*" VALUE(PURCHASEORDER) LIKE BAPIMEPOHEADER-PO_NUMBER

*" VALUE(POHEADER) LIKE BAPIMEPOHEADER STRUCTURE BAPIMEPOHEADER

*" OPTIONAL

*" VALUE(POHEADERX) LIKE BAPIMEPOHEADERX STRUCTURE

*" BAPIMEPOHEADERX OPTIONAL

*" VALUE(POADDRVENDOR) LIKE BAPIMEPOADDRVENDOR STRUCTURE

*" BAPIMEPOADDRVENDOR OPTIONAL

*" VALUE(TESTRUN) LIKE BAPIFLAG-BAPIFLAG OPTIONAL

*" VALUE(MEMORY_UNCOMPLETE) LIKE BAPIFLAG-BAPIFLAG OPTIONAL

*" VALUE(MEMORY_COMPLETE) LIKE BAPIFLAG-BAPIFLAG OPTIONAL

*" VALUE(POEXPIMPHEADER) LIKE BAPIEIKP STRUCTURE BAPIEIKP

*" OPTIONAL

*" VALUE(POEXPIMPHEADERX) LIKE BAPIEIKPX STRUCTURE BAPIEIKPX

*" OPTIONAL

*" VALUE(VERSIONS) LIKE BAPIMEDCM STRUCTURE BAPIMEDCM OPTIONAL

*" VALUE(NO_MESSAGING) LIKE BAPIFLAG-BAPIFLAG OPTIONAL

*" VALUE(NO_MESSAGE_REQ) LIKE BAPIFLAG-BAPIFLAG OPTIONAL

*" VALUE(NO_AUTHORITY) LIKE BAPIFLAG-BAPIFLAG OPTIONAL

*" VALUE(NO_PRICE_FROM_PO) LIKE BAPIFLAG-BAPIFLAG OPTIONAL

*" EXPORTING

*" VALUE(EXPHEADER) LIKE BAPIMEPOHEADER STRUCTURE BAPIMEPOHEADER

*" VALUE(EXPPOEXPIMPHEADER) LIKE BAPIEIKP STRUCTURE BAPIEIKP

*" TABLES

*" RETURN STRUCTURE BAPIRET2 OPTIONAL

*" POITEM STRUCTURE BAPIMEPOITEM OPTIONAL

*" POITEMX STRUCTURE BAPIMEPOITEMX OPTIONAL

*" POADDRDELIVERY STRUCTURE BAPIMEPOADDRDELIVERY OPTIONAL

*" POSCHEDULE STRUCTURE BAPIMEPOSCHEDULE OPTIONAL

*" POSCHEDULEX STRUCTURE BAPIMEPOSCHEDULX OPTIONAL

*" POACCOUNT STRUCTURE BAPIMEPOACCOUNT OPTIONAL

*" POACCOUNTPROFITSEGMENT STRUCTURE BAPIMEPOACCOUNTPROFITSEGMENT

*" OPTIONAL

*" POACCOUNTX STRUCTURE BAPIMEPOACCOUNTX OPTIONAL

*" POCONDHEADER STRUCTURE BAPIMEPOCONDHEADER OPTIONAL

*" POCONDHEADERX STRUCTURE BAPIMEPOCONDHEADERX OPTIONAL

*" POCOND STRUCTURE BAPIMEPOCOND OPTIONAL

*" POCONDX STRUCTURE BAPIMEPOCONDX OPTIONAL

*" POLIMITS STRUCTURE BAPIESUHC OPTIONAL

*" POCONTRACTLIMITS STRUCTURE BAPIESUCC OPTIONAL

*" POSERVICES STRUCTURE BAPIESLLC OPTIONAL

*" POSRVACCESSVALUES STRUCTURE BAPIESKLC OPTIONAL

*" POSERVICESTEXT STRUCTURE BAPIESLLTX OPTIONAL

*" EXTENSIONIN STRUCTURE BAPIPAREX OPTIONAL

*" EXTENSIONOUT STRUCTURE BAPIPAREX OPTIONAL

*" POEXPIMPITEM STRUCTURE BAPIEIPO OPTIONAL

*" POEXPIMPITEMX STRUCTURE BAPIEIPOX OPTIONAL

*" POTEXTHEADER STRUCTURE BAPIMEPOTEXTHEADER OPTIONAL

*" POTEXTITEM STRUCTURE BAPIMEPOTEXT OPTIONAL

*" ALLVERSIONS STRUCTURE BAPIMEDCM_ALLVERSIONS OPTIONAL

*" POPARTNER STRUCTURE BAPIEKKOP OPTIONAL

*" POCOMPONENTS STRUCTURE BAPIMEPOCOMPONENT OPTIONAL

*" POCOMPONENTSX STRUCTURE BAPIMEPOCOMPONENTX OPTIONAL

*" POSHIPPING STRUCTURE BAPIITEMSHIP OPTIONAL

*" POSHIPPINGX STRUCTURE BAPIITEMSHIPX OPTIONAL

*" POSHIPPINGEXP STRUCTURE BAPIMEPOSHIPPEXP OPTIONAL

*" POHISTORY STRUCTURE BAPIEKBE OPTIONAL

*" POHISTORY_TOTALS STRUCTURE BAPIEKBES OPTIONAL

*" POCONFIRMATION STRUCTURE BAPIEKES OPTIONAL

rewrads point for useful answer.