‎2010 Aug 05 8:51 PM
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
‎2010 Aug 05 9:52 PM
Item category should be determined automatically from configuration. It cannot be changed after the item has been created. Check with your SD consultant.
‎2010 Aug 06 2:05 PM
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
‎2010 Aug 07 5:59 AM
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
‎2010 Aug 09 11:28 AM
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
‎2010 Aug 09 11:31 AM
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.
‎2010 Aug 10 1:38 PM
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