Skip to Content
0
Former Member
Jun 01, 2006 at 04:40 AM

help to change the price in sales order create bapi

26 Views

hi all,

my requirement is to change the price of an item when i am creating a sales order using bapi salesordercreatedat2. so i am submitting the code i wrote and the error i am getting . some of u please help me to slove this issue.

thanks in advance

<b>report zmybapi1 .

data : my_order_header_in like bapisdhd1 occurs 0 with header line,

my_order_header_ix like bapisdhd1x.

data : my_orderitemsin like bapisditm occurs 0 with header line,

my_orderitemsix like bapisditmx occurs 0 with header line.

data : my_order_partners like bapiparnr occurs 0 with header line.

data : my_return like bapiret2 occurs 0 with header line.

data : w_vbeln like bapivbeln-vbeln.

data:

my_orderschedulesin like bapischdl occurs 0 with header line,

my_orderschedulesinx like bapischdlx occurs 0 with header line.

data : my_orderconditionsin like bapicond occurs 0 with header line,

my_orderconditionsinx like bapicondx occurs 0 with header line.

start-of-selection.

  • this is to assign values to internal table my_order_header_in

my_order_header_in-doc_type = 'TA'.

my_order_header_in-sales_org = 'JNJ1'.

my_order_header_in-distr_chan = '02'.

my_order_header_in-division = 'J1'.

my_order_header_in-sales_off = 'JNJ1'.

my_order_header_in-purch_no_c = 'testbapipo'.

my_order_header_in-purch_date = sy-datum.

my_order_header_in-req_date_h = sy-datum.

append my_order_header_in.

  • this is to assign values to internal table my_orderitemsin

my_orderitemsin-material = '000000000000000727'.

my_orderitemsin-plant = 'JNJ1'.

my_orderitemsin-target_qu = 'EA'.

  • my_orderitemsin-target_qty = '50'.

append my_orderitemsin.

  • this is to assign values to internal table my_order_partners

my_order_partners-partn_role = 'AG'.

my_order_partners-partn_numb = '0000000011'.

append my_order_partners.

my_order_partners-partn_role = 'WE'.

my_order_partners-partn_numb = '0000000011'.

append my_order_partners.

  • This is to assign values to internal table my_orderschedulesin

my_orderschedulesin-itm_number = '10'.

my_orderschedulesin-req_qty = '10'.

append my_orderschedulesin.

  • This is to assign values to internal table my_orderconditionin

  • my_orderconditionsin-cond_value = '40'.

  • append my_orderconditionsin.

my_order_header_ix-updateflag = 'I'.

my_order_header_ix-doc_type = 'X'.

my_order_header_ix-sales_org = 'X'.

my_order_header_ix-distr_chan = 'X'.

my_order_header_ix-division = 'X'.

my_order_header_ix-sales_off = 'X'.

my_order_header_ix-purch_no_c = 'X'.

my_order_header_ix-purch_date = 'X'.

my_order_header_ix-req_date_h = 'X'.

my_orderitemsix-updateflag = 'I'.

my_orderitemsix-material = 'X'.

  • my_orderitemsix-target_qty = 'X'.

my_orderitemsix-plant = 'X'.

my_orderitemsix-division = 'X'.

my_orderitemsix-target_qu = 'X'.

append my_orderitemsix.

my_orderschedulesinx-updateflag = 'I'.

my_orderschedulesinx-itm_number = 'X'.

my_orderschedulesinx-req_qty = 'x'.

append my_orderschedulesinx.

  • my_orderconditionsinx-updateflag = 'I'.

  • my_orderconditionsinx-cond_value = 'x'.

  • append my_orderconditionsinx.

call function 'BAPI_SALESORDER_CREATEFROMDAT2'

exporting

  • SALESDOCUMENTIN =

order_header_in = my_order_header_in

order_header_inx = my_order_header_ix

  • SENDER =

  • BINARY_RELATIONSHIPTYPE =

  • INT_NUMBER_ASSIGNMENT =

  • BEHAVE_WHEN_ERROR =

  • LOGIC_SWITCH =

  • TESTRUN =

  • CONVERT = ' '

importing

salesdocument = w_vbeln

tables

return = my_return

order_items_in = my_orderitemsin

order_items_inx = my_orderitemsix

order_partners = my_order_partners

ORDER_SCHEDULES_IN = my_orderschedulesin

order_schedules_inx = my_orderschedulesinx

ORDER_CONDITIONS_IN = my_orderconditionsin

ORDER_CONDITIONS_INX = my_orderconditionsinx

  • ORDER_CFGS_REF =

.

if sy-subrc ne 0.

write: my_return-message, my_return-number, my_return-type.

else.

call function 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT =

  • IMPORTING

  • RETURN =

.

write: my_return-message, my_return-number, my_return-type.

endif.</b>

And the error is

<b>sales document was not changed 219 E</b>

thanks

pavan