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: 

BAPI_SALESORDER_CHANGE does not make changes

marco_sposa
Participant
0 Kudos

Hello Folk's i'm struggiling with the bapi in object. I need to changed the edatu at item level, the return of the bapi is that the sales order is changed but no changed is made...

i'm comitting after calling the bapi.

here's my sample code:

  ls_header_x-updateflag = 'U'.


  assign ls_schdl to <schdl>.
  assign ls_schdlx to <schdlx>.
  assign ls_items to <items2>.
  assign ls_itemsx to <items2x>.

  <schdl>-itm_number = '000010'.
  <schdlx>-itm_number = '000010'.


  <schdl>-sched_line = '0001'.
  <schdlx>-sched_line = '0001'.

  <items2>-itm_number = '000010'.
  <items2x>-itm_number = '000010'.

  <schdlx>-itm_number = '000010'.
   <schdl>-dlv_date = '20181111'.

  append <schdl> to lt_schdl.



  <schdlx>-dlv_date = 'U'.
  <schdlx>-updateflag = 'U'.
  append <schdlx> to lt_schdlx.

  <items2x>-updateflag = 'U'.
  append <items2> to lt_items.
 append <items2x> to lt_itemsx.



*update the data

  call function 'BAPI_SALESORDER_CHANGE'

    exporting

      salesdocument    = p_vbeln

      order_header_inx = ls_header_x

    tables

      order_item_in    = lt_items
      order_item_inx   = lt_itemsx
      return           = lt_return
      schedule_lines   = lt_schdl
      schedule_linesx  = lt_schdlx.

  read table lt_return assigning <return> with key type = 'E'.

  if sy-subrc ne 0.

    call function 'BAPI_TRANSACTION_COMMIT'
      exporting
        wait   = 'X'
      importing
       return = ls_return.

  endif.
1 ACCEPTED SOLUTION

marco_sposa
Participant

thanx y'all but i couldn't solve the issue so i made it by using a batch input 😞 , for now is ok but i will return on it...

10 REPLIES 10

rameez_khan
Active Participant
0 Kudos

Pass <schdlx>-dlv_date ='X'. instead of <schdlx>-dlv_date ='U'.

marco_sposa
Participant
0 Kudos

thanx for you reply, but no effects.

the strange things is that even by testing the bapi in se37 (in a sequence with the bapi_commit), i have the same issue.

0 Kudos

pass 'X' on <schdlx>-Field which you pass into this structure <schdl>

0 Kudos
thanx for your replu
<schdlx>-dlv_date ='X'.
But no effects.

0 Kudos

Used Code Like below code With all Mandatory Field E.g : SO , Item , Qty , plant , etc

<schdl>-itm_number ='000010'.

<schdlx>-itm_number ='X'.

<schdl>-dlv_date ='20181111'.

<schdlx>-dlv_date ='X'.

<schdlx>-updateflag ='X;. This field also 'X'

append<schdl>to lt_schdl.

pjl
Participant

Hi Marco,

I must admit your code is a little confusing to me but from what I see I cannot see any obvious mistakes other than the on already mentioned.

But I looked up some of my own code, where I am changing a schedule line. I would try to just change the schedule and not the order item.

Cheers,

Peter

marco_sposa
Participant
0 Kudos

hello Peter, thanx for ur reply can please show me a piece of your code in order to understand where am i missing please?

Thanx again

SimoneMilesi
Active Contributor

Hi Marco,

Check your LT_RETURN: maybe the bapi returns no error but you have some message explaining what's going on.

marco_sposa
Participant

thanx y'all but i couldn't solve the issue so i made it by using a batch input 😞 , for now is ok but i will return on it...

0 Kudos

Hola, disculpa por la tardanza, pero me he topado con el mismo error. 
A mí me funcionó pasarle el VGBEL en el SALESDOCUMENT

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        salesdocument    wa_lips-vgbel
        order_header_inx ls_u_header_x
      TABLES
        return           lt_return
        order_item_in    lt_items
        order_item_inx   lt_items_x
        schedule_lines   lt_schedule_lines
        schedule_linesx  lt_schedule_linesx.