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: 

Short Dump

Former Member
0 Kudos

HI all,

I am working on an nterface where I need to update existing PO's , I have two internal tables it_tab2 and it_input, it_tab2 has po number, material no and item no. and it_input has material no. and updated price and now I need to update all the po's in it_tab2 with price it_input as per the material no and for this I have written the follwoing code, when I tried to run the following code...I got this short dump:" <b> Function parameter "POITEM" is unknown"</b>, can you please tell where the problem is and is rest everything fine??

data: purchaseorder LIKE BAPIMEPOHEADER-PO_NUMBER,

poheader LIKE bapimepoheader,

poheaderx LIKE bapimepoheaderx,

poitem LIKE bapimepoitem OCCURS 0 WITH HEADER LINE,

poitemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE,

return LIKE bapiret2 OCCURS 0 WITH HEADER LINE,

return2 LIKE bapiret2 OCCURS 0 WITH HEADER LINE,

exppurchaseorder LIKE bapimepoheader-po_number,

poschedule LIKE bapimeposchedule OCCURS 0 WITH HEADER LINE,

poschedulex LIKE bapimeposchedulx OCCURS 0 WITH HEADER LINE.

loop at it_tab2.

move: it_tab2-ebeln to poheader-PO_NUMBER.

loop at it_input.

if it_input-matnr = it_tab2-matnr.

move: it_input-mat_price to poitem-NET_PRICE.

move: 'X' to poitemx-NET_PRICE.

append : poitem,poitemx.

endif.

endloop.

CALL FUNCTION 'BAPI_PO_CHANGE'

EXPORTING

PURCHASEORDER = it_tab2-ebeln

  • POHEADER =

  • POHEADERX =

  • POADDRVENDOR =

  • IMPORTING

  • EXPHEADER =

  • EXPPOEXPIMPHEADER =

  • TABLES

RETURN = return

POITEM = poitem

POITEMX = poitemx

  • POADDRDELIVERY =

  • POSCHEDULE =

  • POSCHEDULEX =

  • POACCOUNT =

  • POACCOUNTPROFITSEGMENT =

  • POACCOUNTX =

  • POCONDHEADER =

  • POCONDHEADERX =

.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

IMPORTING

return = return2.

endloop.

thanks

Rajeev

Message was edited by:

Rajeev Gupta

11 REPLIES 11

Former Member
0 Kudos

See this statement

  • TABLES

Uncomment this statement and it should work.

ashish

Former Member
0 Kudos

Hi,

Make sure to populate the POITEM (po item ) field in the bapimepoitem..which means you have to populate the value from EKPO-EBELP to the internal table poitem-po line item ..

Thanks

Naren

0 Kudos

I have made the few changes to my code according to your suggestion. the return parameter states that the PO chnage is done succesfully but when I check the net_price it shows be the old price only, I am posting my changed code:

loop at it_tab2.

move: it_tab2-ebeln to poheader-PO_NUMBER.

loop at it_input.

if it_input-matnr = it_tab2-matnr.

move: it_input-mat_price to poitem-NET_PRICE.

move: it_tab2-ebelp to poitem-PO_ITEM.

move: 'X' to poitemx-NET_PRICE.

move: 'X' to poitemx-po_item.

append : poitem,poitemx.

endif.

endloop.

CALL FUNCTION 'BAPI_PO_CHANGE'

EXPORTING

PURCHASEORDER = it_tab2-ebeln

  • POHEADER =

  • POHEADERX =

  • POADDRVENDOR =

  • IMPORTING

  • EXPHEADER =

  • EXPPOEXPIMPHEADER =

TABLES

RETURN = return

POITEM = poitem

POITEMX = poitemx

  • POADDRDELIVERY =

  • POSCHEDULE =

  • POSCHEDULEX =

  • POACCOUNT =

  • POACCOUNTPROFITSEGMENT =

  • POACCOUNTX =

  • POCONDHEADER =

  • POCONDHEADERX =

.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

IMPORTING

return = return2.

endloop.

0 Kudos

hi,

Check the sample code below.

DATA: return TYPE bapiret2 OCCURS 0 WITH HEADER LINE,

poitem TYPE bapimepoitem OCCURS 0 WITH HEADER LINE,

poitemx TYPE bapimepoitemx OCCURS 0 WITH HEADER LINE,

poheader type BAPIMEPOHEADER occurs 0 with header line,

poheaderx type baPIMEPOHEADERX occurs 0 with header line.

clear: poitem,

poitem[],

poitemx,

poitemx[].

poitem-PO_ITEM = '00010'.

poitem-delete_ind = 'X'.

append poitem.

poitemx-po_item = '00010'.

poitemx-delete_ind = 'X'.

append poitemx.

poheader-po_number = '3000000004'.

append poheader.

poheaderx-po_number = '3000000004'.

append poheaderx.

data: l_ebeln type ebeln value '3000000004'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = l_ebeln

IMPORTING

OUTPUT = l_ebeln

.

CALL FUNCTION 'BAPI_PO_CHANGE'

EXPORTING

purchaseorder = l_ebeln

POHEADER = poheader

POHEADERX = poheaderx

  • POADDRVENDOR =

  • TESTRUN =

  • MEMORY_UNCOMPLETE =

  • MEMORY_COMPLETE =

  • POEXPIMPHEADER =

  • POEXPIMPHEADERX =

  • VERSIONS =

  • NO_MESSAGING =

  • NO_MESSAGE_REQ =

  • NO_AUTHORITY =

  • NO_PRICE_FROM_PO =

  • IMPORTING

  • EXPHEADER =

  • EXPPOEXPIMPHEADER =

TABLES

return = return

poitem = poitem

poitemx = poitemx

  • POADDRDELIVERY =

  • POSCHEDULE =

  • POSCHEDULEX =

  • POACCOUNT =

  • POACCOUNTPROFITSEGMENT =

  • POACCOUNTX =

  • POCONDHEADER =

  • POCONDHEADERX =

  • POCOND =

  • POCONDX =

  • POLIMITS =

  • POCONTRACTLIMITS =

  • POSERVICES =

  • POSRVACCESSVALUES =

  • POSERVICESTEXT =

  • EXTENSIONIN =

  • EXTENSIONOUT =

  • POEXPIMPITEM =

  • POEXPIMPITEMX =

  • POTEXTHEADER =

  • POTEXTITEM =

  • ALLVERSIONS =

  • POPARTNER =

.

commit work and wait.

0 Kudos

Hi Niyaz,

Thanks for the reply can you look into my code because I think I did the same thing but then also its not updating the PO's, although I am getting the message the PO has been successfully changed.

Thanks

Rajeev

Former Member
0 Kudos

Hi Rajeev,

I think you have not used FM correctly

  • TABLES

RETURN = return

POITEM = poitem

POITEMX = poitemx

It is always a best practise to do the extended check of your code. It will catch such errors.

Regards,

Atish

Former Member
0 Kudos

I have made the few changes to my code according to your suggestion. the return parameter states that the PO chnage is done succesfully but when I check the net_price it shows be the old price only, I am posting my changed code:

loop at it_tab2.

move: it_tab2-ebeln to poheader-PO_NUMBER.

loop at it_input.

if it_input-matnr = it_tab2-matnr.

move: it_input-mat_price to poitem-NET_PRICE.

move: it_tab2-ebelp to poitem-PO_ITEM.

move: 'X' to poitemx-NET_PRICE.

move: 'X' to poitemx-po_item.

append : poitem,poitemx.

endif.

endloop.

CALL FUNCTION 'BAPI_PO_CHANGE'

EXPORTING

PURCHASEORDER = it_tab2-ebeln

  • POHEADER =

  • POHEADERX =

  • POADDRVENDOR =

  • IMPORTING

  • EXPHEADER =

  • EXPPOEXPIMPHEADER =

TABLES

RETURN = return

POITEM = poitem

POITEMX = poitemx

  • POADDRDELIVERY =

  • POSCHEDULE =

  • POSCHEDULEX =

  • POACCOUNT =

  • POACCOUNTPROFITSEGMENT =

  • POACCOUNTX =

  • POCONDHEADER =

  • POCONDHEADERX =

.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

IMPORTING

return = return2.

endloop.

Former Member
0 Kudos

Hi,

Try this sample code


PARAMETERS: p_ebeln LIKE ekko-ebeln.

DATA: t_poitem LIKE bapimepoitem OCCURS 0 WITH HEADER LINE.
DATA: t_poitemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE.
DATA: t_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: t_cond LIKE bapimepocond OCCURS 0 WITH HEADER LINE.
DATA: t_condx LIKE bapimepocondx OCCURS 0 WITH HEADER LINE.


t_poitem-po_item = '00010'.
t_poitem-net_price = '17.00'.
APPEND t_poitem.

t_poitemx-po_item = '00010'.
t_poitemx-net_price = 'X'.
t_poitemx-po_itemx = 'X'.
APPEND t_poitemx.

t_cond-itm_number = '00010'.
t_cond-cond_type = 'P000'.    " Give the pricing condition type that derives netprice
t_cond-cond_value = '17.00'.
t_cond-currency = 'USD'.
t_cond-change_id = 'U'.
APPEND t_cond.

t_condx-itm_number = '00010'.
t_condx-itm_numberx = 'X'.
t_condx-cond_type = 'X'.
t_condx-cond_value = 'X'.
t_condx-currency = 'X'.
t_cond-change_id = 'X'.
APPEND t_condx.

CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = p_ebeln
TABLES
return = t_return
poitem = t_poitem
poitemx = t_poitemx
pocond = t_cond
pocondx = t_condx.

COMMIT WORK.

Thanks

Naren

0 Kudos

Thanks for the reply Narendran....

is this pricing condition 'P00' type standard ..I mean will it work for me as well.

Thanks

Rajeev

Former Member
0 Kudos

HI,

P000 is a standard pricing condition type which is used for determining the net price..But this is configurable..

In the line item ... go to the conditions tab..and check which has the value of the net price..and then give that condition type accordingly

Thanks

Naren

ferry_lianto
Active Contributor
0 Kudos

Hi,

You missed to populate field POITEMX-PO_ITEM with IT_TAB2-EBELP.


...

loop at it_tab2.
  move: it_tab2-ebeln to poheader-PO_NUMBER.
  
  loop at it_input.
    if it_input-matnr = it_tab2-matnr.
      move: it_input-mat_price to poitem-NET_PRICE.
      move: it_tab2-ebelp to poitem-PO_ITEM.
      move: it_tab2-ebelp to poitemx-PO_ITEM.             "Add here
     move: 'X' to poitemx-po_itemx.
     move: 'X' to poitemx-NET_PRICE.
     append : poitem,poitemx.
    endif.
  endloop.

...

Regards,

Ferry Lianto