01-21-2010 9:27 AM
Dear All,
I am calling BAPI_GOODSMVT_CREATE (Goods Issue: 261) to issue goods to production order. No error returned from the function and unrestricted use stocks are reduced as expected. The only problem I have is that the withdrawal quantity for that material is not updated. (increased)
I also tried doing the same thing in MIGO -> Good Issue / Production Order and found no such problem.
Anyone know have any idea about this?
tks in advance
l_input_code = '03'.
l_input_header-pstng_date = sy-datum.
l_input_header-doc_date = sy-datum.
l_input_header-header_txt = l_header_txt.
LOOP AT t_report INTO w_report WHERE linecolor IS INITIAL AND iss_menge IS NOT INITIAL.
CLEAR: l_input_item, l_input_sku.
IF g_kdauf IS NOT INITIAL.
l_input_item-spec_stock = 'E'.
l_input_item-val_sales_ord = g_kdauf. "Slaeas order no.
l_input_item-val_s_ord_item = g_kdpos. "Sale Order Item
ENDIF.
l_input_sku-matdoc_itm = l_line.
l_input_sku-grid_value = w_report-j_3asize. "Grid Value
l_input_sku-move_grid_value = w_report-j_3asize. "Grid Value
l_input_sku-stock_cat = w_report-j_4kscat. "Stock Category
l_input_sku-move_stock_cat = w_report-j_4kscat_req. "Stock Category
APPEND l_input_sku.
l_line = l_line + 1.
l_input_item-orderid = g_aufnr. "ORDER NUMBER
l_input_item-move_type = '261'. "Movement Type
l_input_item-material = w_report-matnr. "Material No.
l_input_item-batch = w_report-charg. "Batch
l_input_item-entry_uom_iso = w_report-meins. "Unit
l_input_item-entry_qnt = w_report-iss_menge. "New Qty
l_input_item-entry_uom = w_report-meins.
l_input_item-plant = w_report-werks. "Plant
l_input_item-stge_loc = w_report-lgort. "Location
APPEND l_input_item.
ENDLOOP.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = l_input_header
goodsmvt_code = l_input_code
IMPORTING
goodsmvt_headret = l_output_header
TABLES
goodsmvt_item = l_input_item
return = l_output_return
afs_goodsmvt_sku = l_input_sku
.
Edited by: George Sung on Jan 21, 2010 10:49 AM
01-21-2010 9:50 AM
01-21-2010 10:17 AM
Hi Sam,
Thanks for your reply. Sorry for terrible format maybe it's because i was not posting with IE.
In fact I called BAPI_TRANSACTION_COMMIT at the end. Unrestricted use stock reduced but withdrawal quantity was still not changed. That's the problem I have. Also I tried your method, still the same result.
I wonder it's becuase I didn't pass RSNUM and RSPOS (Reservation no. and item no.). Since when I check the Material Doc genereated by BAPI and MIGO, there's no Reserve no. in the one from BAPI. However, I get "Internal Error" message when I add these 2 numbers.
06-16-2014 4:20 AM
Hello George.
You guessed it right.
You need to pass RSNUM and RSPOS to update Withdrawn Qty field in production order.
If you don't pass, it will be booked into that production order (Menu -> Goto -> Documented goods movements) but will not be reflected in Withdrawn qty field. Material costs will be booked into that production order without any issues.
06-14-2014 7:58 AM
Hi,
You sould do :
1. select RESB where aufnr = prod order you will use and matnr = material you will issue
2. put RSNUM and RSPOS in selected RSEB
3. take it into resb_num and item in goodsmvt_item
tks
from Indonesia