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

Problem while updating Item category using Bapi_salesorder_change

Former Member
0 Likes
2,149

Hi,

Iam facing a probelm while updating item category using bapi Bapi_salesorder_change

In the Return table iam getting the folowing mesages.

Inforation mesage : Field 'PSTYV' cannot be changed, VBAPKOM 000010 ready for input

Error Message : Item 000010 cannot be processed.

Please find the code below



CLEAR wa_bapisdh1x.
  wa_bapisdh1x-updateflag = 'U'.

  CLEAR wa_order_item_inx.
  wa_order_item_inx-itm_number = wa_vbap-posnr.
  wa_order_item_inx-item_categ = 'X'.
  wa_order_item_inx-UPDATEFLAG = 'U'.
  APPEND  wa_order_item_inx TO it_order_item_inx.
  CLEAR wa_order_item_inx.

  CLEAR wa_order_item_in.
  wa_order_item_in-itm_number = wa_vbap-posnr.
  wa_order_item_in-item_categ = 'ABC'.
  APPEND wa_order_item_in TO it_order_item_in.
  CLEAR wa_order_item_in.

 CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
      salesdocument    = w_vbeln
      order_header_inx = wa_bapisdh1x
    TABLES
      return           = it_return
      order_item_in    = it_order_item_in
      order_item_inx   = it_order_item_inx


How can i correct it..

Regards

Kumar

6 REPLIES 6
Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
1,368

Item category should be determined automatically from configuration. It cannot be changed after the item has been created. Check with your SD consultant.

Read only

0 Likes
1,368

Hi,

Iam able to change it manually in the VA02 transaction.. But when i Run the program iam unable to change it..

How to correct it..?

Regards

Kumar

Read only

0 Likes
1,368

Hi,

Item category of line item cannot be changed if any subsequent documents are created against that line item. Check document flow of the document or table VBFA for the Sales order/Line item.

Regards

Vinod

Read only

Former Member
0 Likes
1,368

s_order_header_inx-updateflag = 'U'.
 i_order_item_in-itm_number = itab_ch-itm_number .
  i_order_item_in-material =   itab_ch-material.
  i_order_item_in-target_qty = itab_ch-target_qty.
  i_order_item_in-sales_unit = itab_ch-sales_unit.
  i_order_item_in-val_type = itab_ch-val_type.

  i_order_item_inx-updateflag = 'I'.

  i_order_item_inx-itm_number = itab_ch-itm_number .
  i_order_item_inx-material = itab_ch-material.
  i_order_item_inx-target_qty = 'X'.
  i_order_item_inx-sales_unit = itab_ch-sales_unit.
  i_order_item_inx-val_type =  'X'.

  APPEND: i_order_item_in, i_order_item_inx.

Edited by: kk.adhvaryu on Aug 9, 2010 12:30 PM

Read only

Former Member
0 Likes
1,368

Continue...


**  Fill schedule lines
  i_sched-itm_number = itab_ch-itm_number .
  i_sched-sched_line = '0001'.
  i_sched-req_qty    = itab_ch-target_qty.
  APPEND i_sched.

*   Fill schedule line flags
  i_schedx-itm_number  = itab_ch-itm_number .
  i_schedx-sched_line = '0001'.
  i_schedx-updateflag  = 'I'.
  i_schedx-req_qty     = 'X'.
  APPEND i_schedx.
ENDLOOP.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
  EXPORTING
    salesdocument     = p_vbeln
    order_header_in   = s_order_header_in
    order_header_inx  = s_order_header_inx
    behave_when_error = 'P'
  TABLES
    return            = it_return
    order_item_in     = i_order_item_in
    order_item_inx    = i_order_item_inx
    schedule_lines    = i_sched
    schedule_linesx   = i_schedx.


Read only

0 Likes
1,368

Actually iam facing a strange problem here.

When i copy the program into another sample program and execute it iam able to change both the item catgegory and delivery block for particular sales order and item number.

But in my main program i have BDC for MB1B transaction to create the material document.

Once the material document is created succesfully iam using BAPI Sales_order_change to change the item category and delivery block..

In my main program iam not to change the item catgeory getting an error field PSTYV cannot be changed.

But the same code is running percfectly in the copied one..

How can i correct that..

Regards

Kumar