2007 Mar 23 1:25 PM
Hello, there.
I'm trying to create order, with some positions. I've populated field comp_quant as follows, but after sucessfull returning, Quantity field stays null. Please give me some direction to solve this problem.
**************************************************************************
LOOP AT it_bapi.
CLEAR gt_order_items_inx.
CLEAR gt_order_items_in.
gt_order_items_inx-updateflag = 'I'.
*Matnr
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = it_bapi-mabnr
IMPORTING
output = gt_order_items_in-material.
gt_order_items_inx-material = 'X'.
*Item Position
gt_order_items_in-itm_number = sy-tabix * 10.
gt_order_items_inx-itm_number = 'X'.
*Quantity
gt_order_items_in-comp_quant = it_bapi-kwmeng.
gt_order_items_inx-comp_quant = 'X'.
gt_order_items_inx-target_qty = 'X'.
APPEND gt_order_items_in.
APPEND gt_order_items_inx.
ENDLOOP.
**************************************************************************
*Description
gt_order_text-itm_number = ''.
gt_order_text-text_id = '0002'.
gt_order_text-langu = sy-langu.
gt_order_text-format_col = '*'.
gt_order_text-text_line = ctext.
APPEND gt_order_text.
**************************************************************************
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
order_header_in = gs_order_header_in
testrun = testrun
IMPORTING
salesdocument = gv_salesdocument
TABLES
return = messtab[]
order_items_in = gt_order_items_in[]
order_items_inx = gt_order_items_inx[]
order_partners = gt_order_partners[]
order_text = gt_order_text[].
2007 Mar 26 2:55 PM
Hi Long,
I had some "fights" with this FM. I beleive you are using the wrong quantity dield. Try to use TARGET_QTY and TARGET_QU (for units). I think I had to fill the schedule structure in a similar way to the Order_Items.
Try it out and tell me if it works better.
Alfonso
2007 Mar 26 3:02 PM