Application Development and Automation 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: 
Read only

Update error in BAPI_SALESORDER_CHANGE

Former Member
0 Likes
625

Hi,

I have to add new line items to the existing sales order, so I have created a BDC for t-code VA02, when I run the program after I save the Sales order I got update error which says "Item status (document 2123455, item 20) is missing".

Then I converted the BDC into BAPI_SALESORDER_CHANGE, but still I have the same problem.

Below are the parameters which I'm passing to function module. Please suggest me what could be the problem?

lw_headx-updateflag = 'U'.

  LOOP AT p_lt_final_item.
    lv_itemno = lv_itemno + 10.

    MOVE: lv_itemno     TO lw_item-itm_number,
          gv_material TO lw_item-material,
          p_lt_final_item-ismnw TO lw_item-target_qty,
          p_lt_final_item-werks TO lw_item-plant,
          'hello'    TO lw_item-short_text.
    APPEND lw_item TO lt_item.

    MOVE: lv_itemno TO lw_itemx-itm_number,
          'I'     TO lw_itemx-updateflag,
          'X'     TO lw_itemx-material,
          'X'     TO lw_itemx-target_qty,
          'X'     TO lw_itemx-plant,
          'X'     TO lw_itemx-short_text.
    APPEND lw_itemx TO lt_itemx.

    MOVE: lv_itemno TO lw_sched-itm_number,
          '1' TO lw_sched-sched_line,
          p_lt_final_item-ismnw TO lw_sched-req_qty,
          sy-datum TO lw_sched-req_date.
          APPEND lw_sched TO lt_sched.


   MOVE: lv_itemno TO lw_schedx-itm_number,
         '1' TO   lw_schedx-sched_line,
          'I'     TO lw_schedx-updateflag,
          'X'     TO lw_schedx-req_qty,
          'X'     TO lw_schedx-req_date.
          APPEND lw_schedx TO lt_schedx.
  ENDLOOP.

  CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
      SALESDOCUMENT               = p_salesorder
*     ORDER_HEADER_IN             =
      ORDER_HEADER_INX            = lw_headx
    TABLES
     RETURN                      = lt_return
     ORDER_ITEM_IN               = lt_item
     ORDER_ITEM_INX              = lt_itemx
     SCHEDULE_LINES              = lt_sched
     SCHEDULE_LINESX             = lt_schedx
            .
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' .

Regards

Jaker.

Edited by: Rob Burbank on Feb 9, 2009 5:20 PM

(Per suggestion from Jelena Perfiljeva, added code tags)

Hi,

I have to add new line items to the existing sales order, so I have created a BDC for t-code VA02, when I run the program after I save the Sales order I got update error which says "Item status (document 2123455, item 20) is missing".

Then I converted the BDC into BAPI_SALESORDER_CHANGE, but still I have the same problem.

Below are the parameters which I'm passing to function module. Please suggest me what could be the problem?

lw_headx-updateflag = 'U'.

  LOOP AT p_lt_final_item.
    lv_itemno = lv_itemno + 10.

    MOVE: lv_itemno     TO lw_item-itm_number,
          gv_material TO lw_item-material,
          p_lt_final_item-ismnw TO lw_item-target_qty,
          p_lt_final_item-werks TO lw_item-plant,
          'hello'    TO lw_item-short_text.
    APPEND lw_item TO lt_item.

    MOVE: lv_itemno TO lw_itemx-itm_number,
          'I'     TO lw_itemx-updateflag,
          'X'     TO lw_itemx-material,
          'X'     TO lw_itemx-target_qty,
          'X'     TO lw_itemx-plant,
          'X'     TO lw_itemx-short_text.
    APPEND lw_itemx TO lt_itemx.

    MOVE: lv_itemno TO lw_sched-itm_number,
          '1' TO lw_sched-sched_line,
          p_lt_final_item-ismnw TO lw_sched-req_qty,
          sy-datum TO lw_sched-req_date.
          APPEND lw_sched TO lt_sched.


   MOVE: lv_itemno TO lw_schedx-itm_number,
         '1' TO   lw_schedx-sched_line,
          'I'     TO lw_schedx-updateflag,
          'X'     TO lw_schedx-req_qty,
          'X'     TO lw_schedx-req_date.
          APPEND lw_schedx TO lt_schedx.
  ENDLOOP.

  CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
      SALESDOCUMENT               = p_salesorder
*     ORDER_HEADER_IN             =
      ORDER_HEADER_INX            = lw_headx
    TABLES
     RETURN                      = lt_return
     ORDER_ITEM_IN               = lt_item
     ORDER_ITEM_INX              = lt_itemx
     SCHEDULE_LINES              = lt_sched
     SCHEDULE_LINESX             = lt_schedx
            .
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' .

Regards

Jaker.

Edited by: Rob Burbank on Feb 9, 2009 5:20 PM

(Per suggestion from Jelena Perfiljeva, added code tags)

1 REPLY 1
Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
394

Switching from transaction to BDC or BAPI will not help you. There is clearly a data issue in this order. Read the long text for the message - it might have some additional information.

I'm guessing that there is some kind of a custom status maintained in your system on item level (see VA03 -> item data -> Status tab). You might want to check with your SD specialist on the status configuration.

P.S. Also do use the Code tags when posting any code. Although in this case you might as well just delete the code since it has nothing to do with this problem anyway.

Edited by: Jelena Perfiljeva on Feb 9, 2009 5:06 PM