2010 Apr 07 11:06 AM
Hi All,
I am using BAPI_SALESORDER_CHANGE to add a new line item to SO. when a new line item is added the 'Order Quantity' is not displayed what im passing in Target_qty field of BAPI str. ORDER_ITEM_IN. Also i tried populating schedule line REQ_QTY field but no go.
Please suggest on this.
Thanks.
2010 Apr 07 11:25 AM
Yes im doing the same.....no go....is it mandatory to populate Schedule line str. for this?
tried even that but erroring....
Yes im doing the same.....no go....is it mandatory to populate Schedule line str. for this?
tried even that but erroring....
2010 Apr 07 11:09 AM
Hi
Did u set the update the flags in BAPISDITMX & BAPISCHDLX.
Regards,
Raghu.
2010 Apr 07 11:13 AM
I am leaving the UPDATEFLAG in itm and schd structures blank or (I) since I am adding a line item using the BAPI.
2010 Apr 07 11:17 AM
Hi
Set the UPDATEFLAG = 'I' and other for fields which are passing in item BAPISDITM ,for this case u need to set 'X' in BAPISDITMX.
Regards,
Raghu.
2010 Apr 07 11:21 AM
Try below code
order_header_inx-updateflag = 'U'.
order_item_in-itm_number = <item number>
order_item_inx-itm_number = <item number>.
order_item_inx-updateflag = 'I'.
order_item_in-target_qty = wa_vbap-kwmeng.
order_item_inx-target_qty = 'X'.
schedule_lines-itm_number = <item number>
schedule_lines-sched_line = <Schedule LIne No> .
schedule_lines-req_qty = <Quantity>.
schedule_linesx-itm_number = <item number>
schedule_linesx-sched_line = <Schedule LIne no>
schedule_linesx-updateflag = 'I'.
schedule_linesx-req_qty = 'X'.Regards
Vinod
2010 Apr 07 11:25 AM
Yes im doing the same.....no go....is it mandatory to populate Schedule line str. for this?
tried even that but erroring....
2010 Apr 07 11:33 AM
Schedule line structure is to be populated to update the target qty at item level.
Also check whether you are filling up the mandatory pricing conditions in "conditions_in" and "conditions_inx"
Regards
Vinod
Edited by: Vinod Kumar on Apr 7, 2010 4:05 PM
2010 Apr 07 11:44 AM
Well,
What should be the Schedule line number i need to be passing to add this line item....
2010 Apr 07 11:51 AM
2010 Apr 07 12:04 PM
It just gives erroe msg saying
E V1 335 System error: Schedule line 0001 for item 800000 does not exist
E V4 219 Sales document 0200000781 was not changed
2010 Apr 07 12:10 PM
Hope your code is as below
order_item_in-itm_number = '800000'
order_item_inx-itm_number = '800000'
order_item_inx-updateflag = 'I'.
order_item_in-target_qty = wa_vbap-kwmeng.
order_item_inx-target_qty = 'X'.
schedule_lines-itm_number = '800000'
schedule_lines-sched_line = '0001'
schedule_lines-req_qty = <Quantity>.
schedule_linesx-itm_number = '800000'
schedule_linesx-sched_line = '0001'
schedule_linesx-updateflag = 'I'.
schedule_linesx-req_qty = 'X'.Regards
Vinod
2010 Apr 07 12:21 PM
2010 Apr 07 12:25 PM
While creating the sales order through VA01 or changing SO through VA02, is the system generating schedule lines (VBEP Table)?
Regards
Vinod
2010 Apr 07 2:02 PM
Hi,
I implemented this simple abap in my trial system.
REPORT zsdnbapiordrchg.
DATA: lvbak TYPE vbak.
DATA:
v_vbeln TYPE bapivbeln-vbeln,
v_order_header_inx TYPE bapisdh1x,
i_item TYPE TABLE OF bapisditm WITH HEADER LINE,
i_itemx TYPE TABLE OF bapisditmx WITH HEADER LINE,
i_schedule_lines TYPE TABLE OF bapischdl WITH HEADER LINE,
i_schedule_linesx TYPE TABLE OF bapischdlx WITH HEADER LINE,
i_return TYPE TABLE OF bapiret2 WITH HEADER LINE.
DATA: lposnr TYPE vbap-posnr.
PARAMETERS: pvbeln TYPE vbak-vbeln OBLIGATORY.
SELECT SINGLE * FROM vbak INTO lvbak WHERE vbeln = pvbeln.
CHECK sy-subrc = 0.
SELECT MAX( posnr ) FROM vbap INTO lposnr
WHERE vbeln = pvbeln.
ADD 10 TO lposnr.
v_order_header_inx-updateflag = 'U'.
v_vbeln = pvbeln.
i_item-itm_number = lposnr.
i_item-material = 'T-FV100-EM'.
* i_item-sales_unit = 'KG'.
* i_item-plant = '1100'.
*i_itemx-itm_number = lposnr.
*i_itemx-updateflag = 'I'.
*i_itemx-material = 'X'.
*i_itemx-plant = 'X'.
*i_itemx-sales_unit = 'X'.
i_schedule_lines-itm_number = lposnr.
i_schedule_lines-sched_line = 1.
i_schedule_lines-req_date = sy-datum.
i_schedule_lines-req_qty = 1000.
i_schedule_linesx-itm_number = lposnr.
i_schedule_linesx-sched_line = 1.
i_schedule_linesx-updateflag = 'I'.
i_schedule_linesx-req_date = 'X'.
i_schedule_linesx-req_qty = 'X'.
APPEND i_item.
*APPEND i_itemx.
APPEND i_schedule_lines.
APPEND i_schedule_linesx.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = v_vbeln
order_header_inx = v_order_header_inx
TABLES
return = i_return
order_item_in = i_item
order_item_inx = i_itemx
SCHEDULE_LINES = i_schedule_lines
SCHEDULE_LINESX = i_schedule_linesx.
LOOP AT i_return WHERE type = 'A' OR type = 'E'.
EXIT.
ENDLOOP.
IF sy-subrc ne 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.
Now it should works.
Regards,
Andrea
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |