Coproducts with BAPI_GOODSMVT_CREATE
Hi all
We are working with Process Industry, with some coproducts in the bill of material.
We are trying to do the material movements (Goods Recipt) with the bapi BAPI_GOODSMVT_CREATE.
It works only for finished product of the order. With all the other co products in the orders, we get the following error:
Error M7 349: Content of order XXX: 421 transferred to interface (IMSEG): S24.
The material 421 is the finished product of the order and S24 is coproduct. BUT, the only one material that allows me to move with the bapi is the 421.
Anyone knows how to customize the Process Order to allow me to make the Good Recipt of all the Coproducts with this BAPI?
With the transaction MB31, it works perfectly.
Srinivas
Instead of just adding to a 4 year old discussion " I have the same problem" you could have taken the chance to explain what you have done, I assume you tried it yourself, maybe explain the issue better as done by the other poster.
What do you think why he did not get any answer in 4 years?
Similar Messages
-
Post Goods Receipt for Inbound Delivery with BAPI_GOODSMVT_CREATE
Hello,
I try to post GR for an Inbound Delivey with BAPI_GOODSMVT_CREATE and it is not working.
I know delivery number and PO number and give both to the bapi.
I am not sure how to set the movement indicator in the item.
When I set it to B.
I do get a shortdump from MB_POST_GOODS_MOVEMENT numer 143, stating that this type of movement is not allowed with this transaction
when setting to L I do get an error stating
"Update control of movement type is incorrect (entry 101 X X _ L)" from message class M7.
Below is the coding for it.
Thank you very much for your help
Michael
* Füllen der Kopfdaten
ls_gm_header-pstng_date = sy-datum.
ls_gm_header-doc_date = sy-datum.
ls_gm_header-ref_doc_no = delivery_header-lifex.
ls_gm_header-bill_of_lading = delivery_header-bolnr.
ls_gm_header-gr_gi_slip_no = delivery_header-xabln.
ls_gm_header-pr_uname = sy-uname.
ls_gm_header-ref_doc_no_long = delivery_header-lifex.
ls_gm_header-bill_of_lading_long = delivery_header-bolnr.
lv_gm_code = '01'.
* Füllen der Positionsdaten
LOOP AT selected_delivery_items INTO ls_delivery_item.
ls_gm_items-material = ls_delivery_item-matnr.
ls_gm_items-plant = ls_delivery_item-werks. " 0001
ls_gm_items-stge_loc = ls_delivery_item-lgort.
ls_gm_items-move_type ='101'. "101
ls_gm_items-entry_qnt = ls_delivery_item-lfimg. " 10,000
ls_gm_items-entry_uom = ls_delivery_item-vrkme.
ls_gm_items-po_number = ls_delivery_item-vgbel. "55001582
ls_gm_items-po_item = ls_delivery_item-vgpos. "00010
ls_gm_items-mvt_ind = 'B'.
ls_gm_items-expirydate = sy-datum + 30 .
ls_gm_items-deliv_numb = ls_delivery_item-vbeln.
ls_gm_items-deliv_item = ls_delivery_item-posnr.
APPEND ls_gm_items TO lt_gm_items.
ENDLOOP.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = ls_gm_header
goodsmvt_code = lv_gm_code
* testrun = 'X'
* GOODSMVT_REF_EWM =
IMPORTING
goodsmvt_headret = ls_gm_header_ret
materialdocument = lv_mat_docno
matdocumentyear = lv_mat_year
TABLES
goodsmvt_item = lt_gm_items
goodsmvt_serialnumber = lt_gm_serial_numbers
return = lt_return
if lt_return is INITIAL.
endif.Hello Pranav,
the input for the business data is correct.
When performing the goods receipt with Migo it works.
I think the B in the movement indicator is correct, but there might be something wrong with the other data.
Best regards
Michael -
Transfer QI stk to blocked stk with BAPI_GOODSMVT_CREATE (Error msg QA495)
Hy,
I would like to create an mass udpate stock program which transfer the QI stock to blocked (because shelf expiration date is passed).
So, i use the BAPI_GOODSMVT_CREATE with movement type 350.
But the following error message appears : "Change the inspection stock of material XXXXXXX to QM only"
Does anyone can suggest me an another solution ?
Thanks in advanceDear LudovicBento
You cannot run this FM as QM stock can be moved only by QA11 tcode. You may try to create a BDC to post the material
from Quality
Regards
Gajesh -
Goods Issue on Process Order with BAPI_GOODSMVT_CREATE
Hi together,
I want to post a goods issue on an process order (some of them are networks) but I have some problem with filling the structures.
Could you please help me?
Book material
ls_bapi_head-pstng_date = ls_booking-budat.
ls_bapi_head-doc_date = sy-datum.
ls_bapi_head-pr_uname = sy-uname.
ls_bapi_item-material = ls_booking-idnrk.
ls_bapi_item-plant = p_werks.
ls_bapi_item-stge_loc = ls_booking-lgort.
ls_bapi_item-entry_qnt = ls_booking-dmeng.
ls_bapi_item-entry_uom = ls_booking-meins.
ls_bapi_item-orderid = ls_booking-aufnr.
ls_bapi_item-mvt_ind = gc_mvt_ind.
IF ls_bapi_item-entry_qnt > 0.
ls_bapi_item-move_type = '261'.
ELSE.
ls_bapi_item-move_type = '262'.
ENDIF.
APPEND ls_bapi_item TO lt_bapi_item.
CLEAR: lt_bapi_ret, ls_bapi_item.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = ls_bapi_head
goodsmvt_code = '03'
testrun = p_test
IMPORTING
materialdocument = ls_mat_bel
TABLES
goodsmvt_item = lt_bapi_item
return = lt_bapi_ret.Here send a example:
DATA: RTR LIKE BAPIRET2.
DATA: G_HEADER LIKE BAPI2017_GM_HEAD_01,
G_CODE LIKE BAPI2017_GM_CODE,
TESTRUN LIKE BAPI2017_GM_GEN-TESTRUN,
G_HEADRET LIKE BAPI2017_GM_HEAD_RET,
MATDOCUMENT TYPE BAPI2017_GM_HEAD_RET-MAT_DOC,
MATYEAR TYPE BAPI2017_GM_HEAD_RET-DOC_YEAR,
G_ITEM TYPE STANDARD TABLE OF BAPI2017_GM_ITEM_CREATE WITH HEADER LINE,
RETURN TYPE STANDARD TABLE OF BAPIRET2 WITH HEADER LINE.
TOMO DATOS DE LA TABLA Z
SELECT * FROM ZCOTT_ACT_VOLUM
INTO CORRESPONDING FIELDS OF TABLE TI_VOLUMEN.
CLEAR: RETURN. REFRESH: RETURN.
CLEAR: WA_MJES.
WA_MJES-ICONID = '@DH@'.
WA_MJES-TYPE = 'S'.
WA_MJES-MSGTXT = 'Errores del Proceso Nro 2'.
APPEND WA_MJES TO TI_MJES.
LOOP AT TI_VOLUMEN INTO WA_VOL.
CLEAR: G_HEADER, G_CODE, TESTRUN, G_HEADRET, MATDOCUMENT,
MATYEAR, G_ITEM.
REFRESH: G_ITEM.
G_HEADER-PSTNG_DATE = WA_VOL-BUDAT. " Fecha de contabilización en el documento
G_HEADER-DOC_DATE = WA_VOL-BLDAT. " Fecha de documento en documento
G_HEADER-REF_DOC_NO = 'REF NRO:'. " Número de documento de referencia
G_HEADER-PR_UNAME = SY-UNAME. " Nombre de usuario
G_HEADER-HEADER_TXT = WA_VOL-BKTXT. " Texto de cabecera de documento
G_CODE = '04'. " Traspaso
Emisor
G_ITEM-MATERIAL = WA_VOL-DE_MATNR. " Nro de Material
G_ITEM-PLANT = WA_VOL-DE_WERKS. " Centro
G_ITEM-STGE_LOC = WA_VOL-DE_LGORT. " Almacen
G_ITEM-MOVE_TYPE = WA_VOL-BWART. " Clase de Mov.
G_ITEM-COSTCENTER = WA_VOL-KOSTL. " Centro de Costo.
G_ITEM-ENTRY_QNT = WA_VOL-MENGE. " Cantidad en unidad de medida de entrada
G_ITEM-ENTRY_UOM = WA_VOL-UNIT. " Unidad de medida de entrada
G_ITEM-ENTRY_UOM_ISO = WA_VOL-UNIT. " Código ISO p.unidad de medida
G_ITEM-BATCH = WA_VOL-DE_LGORT. " Lote
Receptor
G_ITEM-MOVE_MAT = WA_VOL-A_MATNR. " Nro de Material.
G_ITEM-MOVE_PLANT = WA_VOL-A_WERKS. " Centro
G_ITEM-MOVE_STLOC = WA_VOL-A_LGORT. " Almacen
G_ITEM-MOVE_BATCH = WA_VOL-A_LGORT. " Lote
APPEND G_ITEM.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
GOODSMVT_HEADER = G_HEADER
GOODSMVT_CODE = G_CODE
TESTRUN = ' ' "TESTRUN
IMPORTING
GOODSMVT_HEADRET = G_HEADRET
MATERIALDOCUMENT = MATDOCUMENT
MATDOCUMENTYEAR = MATYEAR
TABLES
GOODSMVT_ITEM = G_ITEM
RETURN = RETURN.
CLEAR: RTR.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = RTR.
LOOP AT RETURN.
CLEAR: WA_MJES.
WA_MJES-TYPE = RETURN-TYPE.
CASE WA_MJES-TYPE.
WHEN 'S'.
WA_MJES-ICONID = '@08@'.
WHEN 'W'.
WA_MJES-ICONID = '@09@'.
WHEN 'E'.
WA_MJES-ICONID = '@0A@'.
ENDCASE.
WA_MJES-MSGTXT = RETURN-MESSAGE.
APPEND WA_MJES TO TI_MJES.
ENDLOOP.
ENDLOOP. -
Problem with BAPI_GOODSMVT_CREATE not updating Reservation
Hi,
When i do a manual MB1A 'Goods issue' with reference to Work Order it is posting the goods issue and updating the RESB ,but when i do the same through the bapi code 03 Table i was not able to post the goods issue at all. am i missing a input field in the bapi .Plz help me out.
My code.
gf_goodsmvt_code-gm_code = '03'. "GI
gf_goodsmvt_header-pstng_date = sy-datum.
gf_goodsmvt_header-doc_date = sy-datum.
LOOP AT it_details INTO gf_details .
MOVE :gf_details-matnr TO gf_goods-material,
gf_details-werks TO gf_goods-plant,
rm07m-lgort TO gf_goods-stge_loc,
gf_details-charg TO gf_goods-batch,
rm07m-bwart TO gf_goods-move_type.
MOVE gf_details-issue_qty TO gf_goods-entry_qnt .
MOVE gf_details-meins TO gf_goods-entry_uom.
gf_goods-mvt_ind = 'F'.
gf_goods-reserv_no = gf_details-rsnum.
gf_goods-res_item = gf_details-posnr.
gf_goods-res_type = gf_details-rsart.
gf_goods-withdrawn = 'X'.
gf_goods-orderid = rm07m-aufnr.
gf_goods-order_itno = 1.
APPEND gf_goods TO it_goodsmvt_item.
CLEAR gf_goods.
ENDLOOP.
IF NOT it_goodsmvt_item[] IS INITIAL.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = gf_goodsmvt_header
goodsmvt_code = gf_goodsmvt_code
TESTRUN = ' '
IMPORTING
GOODSMVT_HEADRET =
materialdocument = g_mat_doc
MATDOCUMENTYEAR =
TABLES
goodsmvt_item = it_goodsmvt_item
GOODSMVT_SERIALNUMBER = 'X'
return = it_return.check below Threads :
Issue related to EXIT statement
and see the sample program :
Structures for BAPI
data: gdsmt_header like bapi2017_gm_head_01.
data: gdsmt_code like bapi2017_gm_code.
data: gdsmt_headret like bapi2017_gm_head_ret.
data: gdsmt_item like bapi2017_gm_item_create occurs 1 with header line.
data: return like bapiret2 occurs 0.
data: retmatdoc like bapi2017_gm_head_ret-mat_doc.
Setup BAPI header data.
gdsmt_header-pstng_date = sy-datum.
gdsmt_header-doc_date = sy-datum.
gdsmt_code-gm_code = '06'. " MB11
Write 262 movement to table.
clear gdsmt_item.
move '262' to gdsmt_item-move_type.
move i_resb-matnr to gdsmt_item-material.
move p_bdmng to gdsmt_item-entry_qnt.
move i_resb-meins to gdsmt_item-entry_uom.
move i_resb-werks to gdsmt_item-plant.
move i_resb-lgort to gdsmt_item-stge_loc.
move i_afko-aufnr to gdsmt_item-orderid.
append gdsmt_item.
Determine cost center
move '0000041430' to gdsmt_item-costcenter.
append gdsmt_item.
Call goods movement BAPI
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = gdsmt_header
goodsmvt_code = gdsmt_code
importing
goodsmvt_headret = gdsmt_headret
materialdocument = retmatdoc
tables
goodsmvt_item = gdsmt_item
return = return.
Reward Points if it is helpful
Thanks
Seshu -
Solved Create goodsmovement with BAPI_GOODSMVT_CREATE
Hello,
I want to create a goods movement with the BAPI 'BAPI_GOODSMVT_CREATE'. Buth when I fill in the parameters I got the error message "No goods receipt possible for purchase order 4076601 00001". But when I book the PO in the MIGO I don't get anny errors?
So what could bewrong on my code:
FORM insert_best
TABLES P_IT_ONTV_BEST LIKE it_ontv_best[]
USING P_TSTRUN TYPE c.
DATA: p_wa_ontv_best TYPE t_ontv_best.
BAPI TYPES
DATA: BAPIGMHEAD LIKE BAPI2017_GM_HEAD_01,
BAPIGMCODE LIKE BAPI2017_GM_CODE,
BAPIGMHEADRET LIKE BAPI2017_GM_HEAD_RET.
DATA: BEGIN OF XIMSEG OCCURS 1.
INCLUDE STRUCTURE BAPI2017_GM_ITEM_CREATE.
DATA: END OF XIMSEG.
DATA: BEGIN OF XEMSEG OCCURS 1.
INCLUDE STRUCTURE BAPIRET2.
DATA: END OF XEMSEG.
DATA: l_prev_ebeln LIKE EKPO-EBELN. " Voorgaande bestelnummer
LOOP AT p_it_ontv_best into p_wa_ontv_best.
" Per bestelling worden de ontvangsten ingeboekt.
IF not l_prev_ebeln is initial
and l_prev_ebeln <> p_wa_ontv_best-ebeln.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
GOODSMVT_HEADER = BAPIGMHEAD
GOODSMVT_CODE = BAPIGMCODE
TESTRUN = P_TSTRUN
IMPORTING
GOODSMVT_HEADRET = BAPIGMHEADRET
MATERIALDOCUMENT =
MATDOCUMENTYEAR =
TABLES
GOODSMVT_ITEM = XIMSEG
GOODSMVT_SERIALNUMBER =
RETURN = XEMSEG
LOOP AT XEMSEG.
g_ERROR_IN_MODUL_ABLAUF_IW8W = 'X'.
MESSAGE ID XEMSEG-ID TYPE XEMSEG-TYPE
NUMBER XEMSEG-NUMBER
WITH XEMSEG-MESSAGE_V1
XEMSEG-MESSAGE_V2
XEMSEG-MESSAGE_V3
XEMSEG-MESSAGE_V4.
ENDLOOP.
clear BAPIGMHEAD. " Maak de header items schoon
clear XIMSEG. " Maak de item regels schoon
ELSE.
" Initiele waarden
BAPIGMHEAD-pstng_date = sy-datum.
BAPIGMHEAD-doc_date = sy-datum.
BAPIGMHEAD-pr_uname = sy-uname.
BAPIGMHEAD-header_txt = 'Goederenontvangst gasflessen.'.
BAPIGMHEAD-ref_doc_no = p_wa_ontv_best-xblnr.
BAPIGMHEAD-bill_of_lading = p_wa_ontv_best-frbnr.
BAPIGMHEAD-gr_Gi_slip_no = p_wa_ontv_best-xabln.
ENDIF.
Met deze fuctie worden alleen goederenbewegingen 101
gedaan voor bestellingen.
BAPIGMCODE-GM_CODE = '01'. " Voorbestellingen
XIMSEG-MOVE_TYPE = '101'. " Goederenontvangst
XIMSEG-PLANT = '0010'.
XIMSEG-PO_NUMBER = 4076601. "p_wa_ontv_best-ebeln.
XIMSEG-PO_ITEM = 1. "p_wa_ontv_best-ebelp.
XIMSEG-MVT_IND = 'B'. " Goodsreceipt for
" Purchase order.
XIMSEG-ENTRY_QNT = 1. "p_wa_ontv_best-menge.
XIMSEG-ENTRY_UOM = 'CIL'. "p_wa_ontv_best-meins.
XIMSEG-UNLOAD_PT = p_wa_ontv_best-ablad.
XIMSEG-PROD_DATE = p_wa_ontv_best-prod_dat.
XIMSEG-EXPIRYDATE = p_wa_ontv_best-keur_dat.
append XIMSEG.
" bewaar het voorgaande bestelnummer
l_prev_ebeln = p_wa_ontv_best-ebeln.
ENDLOOP.
clear XEMSEG.
IF not l_prev_ebeln is initial.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
GOODSMVT_HEADER = BAPIGMHEAD
GOODSMVT_CODE = BAPIGMCODE
TESTRUN = P_TSTRUN
IMPORTING
GOODSMVT_HEADRET = BAPIGMHEADRET
MATERIALDOCUMENT =
MATDOCUMENTYEAR =
TABLES
GOODSMVT_ITEM = XIMSEG
GOODSMVT_SERIALNUMBER =
RETURN = XEMSEG
LOOP AT XEMSEG.
g_ERROR_IN_MODUL_ABLAUF_IW8W = 'X'.
MESSAGE ID XEMSEG-ID TYPE XEMSEG-TYPE
NUMBER XEMSEG-NUMBER
WITH XEMSEG-MESSAGE_V1
XEMSEG-MESSAGE_V2
XEMSEG-MESSAGE_V3
XEMSEG-MESSAGE_V4.
ENDLOOP.
clear XEMSEG.
ENDIF.
ENDFORM. " insert_best
Many thanks in advanced.
Kind regards,
Richard Meijn
Message was edited by: R. MeijnYou could do a conversion routine against. Use the function module
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = p_wa_ontv_best-ebeln
IMPORTING
OUTPUT = p_wa_ontv_best-ebeln
I wondering why p_it_ontv_best/p_wa_ontv_best doesn't have the formatted version to begin with. I would need to see all your code to tell.
Regards,
Rich Heilman
Message was edited by: Rich Heilman -
Problem with BAPI_GOODSMVT_CREATE and MAA
Hi experts,
I'm trying to GR a PO with MAA (Multiple Account Assingment) by using BAPI_GOODSMVT_CREATE.
My problem is that, as is a return delivery, BAPI is checking wether the reference doc, position and year have been populated for the MAA related positions.
This is done in method CL_MMIM_MAA_2 --> MAA_ITEM_DUPLICATOR_BAPI. As ain't populating those fields, BAPI returns error message M7 465 and not EM document is created.
But, when doing the same by using MIGO transaction, document is created as there is not validation for reference document, because MIGO is using method CL_MMIM_MAA_2 --> MAA_ITEM_DUPLICATOR_MIGO.
I've ssearched fot SAP NOTES (1654305) and SCN posts, with no results.
Can someone explain how to do a return delivery with MAA by using BAPI_GOODSMVT_CREATE?. Is there any way to avoid the validation when using the BAPI?.
Thank you so much in advance.
Regards,
Carlos.Hi,
I think the reason and the solution for the error M7 465 is well explained in the note: 1654305 - MAA2 error M7 599 during return delivery GR with BAPI
If the note is applicable for you and still the problem is not solved with the note, you may cross check the changes mentioned in the note and you may raise an OSS ticket to SAP.
Regards,
AKPT -
Help with BAPI_GOODSMVT_CREATE
I am trying to post a goods receipt from a PO using BAPI_GOODSMVT_CREATE. The material document gets created, but no output form gets generated. If I do the goods receipt through MB01, everything works correctly. I have gv_bapi2017_gm_head-ver_gr_gi_slip = '1' and gt_bapi2017_gm_item-nb_slips = 1. Any thoughts?
HI,
See the below program, you may get solutions,
<b>BAPI_GOODSMVT_CREATE to post Goods Movement :-</b>
* BAPI TO Upload Inventory Data
* GMCODE Table T158G - 01 - MB01 - Goods Receipts for Purchase Order
* 02 - MB31 - Goods Receipts for Prod Order
* 03 - MB1A - Goods Issue
* 04 - MB1B - Transfer Posting
* 05 - MB1C - Enter Other Goods Receipt
* 06 - MB11
* Domain: KZBEW - Movement Indicator
* Goods movement w/o reference
* B - Goods movement for purchase order
* F - Goods movement for production order
* L - Goods movement for delivery note
* K - Goods movement for kanban requirement (WM - internal only)
* O - Subsequent adjustment of "material-provided" consumption
* W - Subsequent adjustment of proportion/product unit material
report zbapi_goodsmovement.
parameters: p-file like rlgrap-filename default
'c:sapdataTEST.txt'.
parameters: e-file like rlgrap-filename default
'c:sapdatagdsmvterror.txt'.
parameters: xpost like sy-datum default sy-datum.
data: begin of gmhead.
include structure bapi2017_gm_head_01.
data: end of gmhead.
data: begin of gmcode.
include structure bapi2017_gm_code.
data: end of gmcode.
data: begin of mthead.
include structure bapi2017_gm_head_ret.
data: end of mthead.
data: begin of itab occurs 100.
include structure bapi2017_gm_item_create.
data: end of itab.
data: begin of errmsg occurs 10.
include structure bapiret2.
data: end of errmsg.
data: wmenge like iseg-menge,
errflag.
data: begin of pcitab occurs 100,
ext_doc(10), "External Document Number
mvt_type(3), "Movement Type
doc_date(8), "Document Date
post_date(8), "Posting Date
plant(4), "Plant
material(18), "Material Number
qty(13), "Quantity
recv_loc(4), "Receiving Location
issue_loc(4), "Issuing Location
pur_doc(10), "Purchase Document No
po_item(3), "Purchase Document Item No
del_no(10), "Delivery Purchase Order Number
del_item(3), "Delivery Item
prod_doc(10), "Production Document No
scrap_reason(10), "Scrap Reason
upd_sta(1), "Update Status
end of pcitab.
call function 'WS_UPLOAD'
exporting
filename = p-file
filetype = 'DAT'
* IMPORTING
* FILELENGTH =
tables
data_tab = pcitab
* EXCEPTIONS
* FILE_OPEN_ERROR = 1
* FILE_READ_ERROR = 2
* NO_BATCH = 3
* GUI_REFUSE_FILETRANSFER = 4
* INVALID_TYPE = 5
* OTHERS = 6
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
exit.
endif.
gmhead-pstng_date = sy-datum.
gmhead-doc_date = sy-datum.
gmhead-pr_uname = sy-uname.
gmcode-gm_code = '01'. "01 - MB01 - Goods Receipts for Purchase Order
loop at pcitab.
itab-move_type = pcitab-mvt_type.
itab-mvt_ind = 'B'.
itab-plant = pcitab-plant.
itab-material = pcitab-material.
itab-entry_qnt = pcitab-qty.
itab-move_stloc = pcitab-recv_loc.
itab-stge_loc = pcitab-issue_loc.
itab-po_number = pcitab-pur_doc.
itab-po_item = pcitab-po_item.
concatenate pcitab-del_no pcitab-del_item into itab-item_text.
itab-move_reas = pcitab-scrap_reason.
append itab.
endloop.
loop at itab.
write:/ itab-material, itab-plant, itab-stge_loc,
itab-move_type, itab-entry_qnt, itab-entry_uom,
itab-entry_uom_iso, itab-po_number, itab-po_item,
pcitab-ext_doc.
endloop.
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = gmhead
goodsmvt_code = gmcode
* TESTRUN = ' '
* IMPORTING
goodsmvt_headret = mthead
* MATERIALDOCUMENT =
* MATDOCUMENTYEAR =
tables
goodsmvt_item = itab
* GOODSMVT_SERIALNUMBER =
return = errmsg
clear errflag.
loop at errmsg.
if errmsg-type eq 'E'.
write:/'Error in function', errmsg-message.
errflag = 'X'.
else.
write:/ errmsg-message.
endif.
endloop.
if errflag is initial.
commit work and wait.
if sy-subrc ne 0.
write:/ 'Error in updating'.
exit.
else.
write:/ mthead-mat_doc, mthead-doc_year.
perform upd_sta.
endif.
endif.
* FORM UPD_STA *
form upd_sta.
loop at pcitab.
pcitab-upd_sta = 'X'.
modify pcitab.
endloop.
call function 'WS_DOWNLOAD'
exporting
filename = p-file
filetype = 'DAT'
* IMPORTING
* FILELENGTH =
tables
data_tab = pcitab
* EXCEPTIONS
* FILE_OPEN_ERROR = 1
* FILE_READ_ERROR = 2
* NO_BATCH = 3
* GUI_REFUSE_FILETRANSFER = 4
* INVALID_TYPE = 5
* OTHERS = 6
endform.
Regards
Sudheer -
Prob with BAPI_GOODSMVT_CREATE when creating wrt Reservation Number
Hi to all,
I have to create Goods Issue with reference to a reservation.I am using the BAPI BAPI_GOODSMVT_CREATE .
But when I am running the BAPI, It is giving the Error 'For reservation 0000001395 0001, no movements can be posted'.
I have pased all the parameters as per the Documentation of the FM, But still I am not able to create Goods Issue. Can any One help me How to achieve this.
GOODSMVT_HEADER
PSTNG_DATE 10.08.2009
DOC_DATE 10.08.2009
REF_DOC_NO 1394
GOODSMVT_CODE-GM_CODE = 03
GOODSMVT_ITEM
MATERIAL MAT1
PLANT 2001
STGE_LOC 0001
MOVE_TYPE 201
ENTRY_QNT 2
ENTRY_UOM EA
ENTRY_UOM_ISO EA
RESERV_NO 1394
RES_ITEM 0001
RES_TYPE X
Can any one help me whether the data I have Provided is Correct or not.If not Plese help me in Succesfully creating the Goods Issue.
Thanks and Regards
Meshack Appikatla.Hi,
If you want to do Goods Issue against Reservation, try below mentioned:
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = wa_header
goodsmvt_code = c_mvt_code "Movement code-03
IMPORTING
materialdocument = v_matdoc
TABLES
goodsmvt_item = it_items
return = it_return.
where :
wa_header-pstng_date = sy-datum. "Posting Date
wa_header-doc_date = sy-datum. "Document Date
wa_header-ref_doc_no = <Reservation Number >. "Reference Doc number
In item data:
wa_items-material = < Material Number >. "Material Number
wa_items-plant = <Plant>. "Plant
wa_items-stge_loc = <Storage Location > "Storage Location
wa_items-move_type =261. "Movement Type - '261'
wa_items-orderid = <Order Number from Reservation RESB-AUFNR>
wa_items-reserv_no = <Reservation Number RESB-RSNUM>
wa_items-res_item = <Reservation Item No RESB-RSPOS>
wa_items-res_type = < Record Type RESB-RSART >
wa_items-entry_qnt = quantity
append wa_items to it_items
Hope it helps.
Regards
Hiren K.Chitalia -
Posting Subcontracting PO with BAPI_GOODSMVT_CREATE
Hi Guru's,
I'm using the BAPI "BAPI_GOODSMVT_CREATE" to do the GR using Purchase Order.
For Sub Contracting PO also we are using the same BAPI and we are doing it successfully, but my requirement is when we do the posting for subcontracting, the SAP system automatically creating the 2nd line item and doing the movement with the same amout of the quantity of the first item.
In Standard SAP, we have an option to enter the 2nd line item quantity, is there any option like that is available in this BAPI??
Or is there any enhancement option / BADI option to change the quantity of the 2nd line item when we posting the document???
Thanks,
Adi.Hi,
Thanks for your link, but i know how to use that BAPI (Passing Parameters),
i want to know the Exit/Enhancement point where can we change the 2nd line item quantity while doing MIGO with the BAPI
BAPI_GOODSMVT_CREATE.
The system is automatically calculating the Quantity for the 2nd line item and doing the 543 movement.
I want to change the quantity in 2nd Line of PO.
Thanks,
Adi. -
Locking issue with BAPI_GOODSMVT_CREATE
Hello,
Has anybody ran across a problem of lock objects (related to materials) not getting released when BAPI_GOODSMVT_CREATE fails?
Here is the sequence of events:
1. I run my function (which calls BAPI_GOODSMVT_CREATE) in SE37 and force an error (i.e. return table contains entries). I do NOT leave SE37.
2. In another session I run the same test again (but with correct data). I get error M3 897 (The plant data of the material 3319 is locked by user USCLXH90).
By looking in SM12 after step 1 is finished, I have noticed that 2 lock entries do not get released. These lock entries subsequently cause the error in step 2.
Lock Object: ENQARRAY
Tables: MARC, MBEW
Arguments: material and plant used in my test
IMPORTANT NOTES:
A. These lock objects do finally get released once I completely exit SE37.
B. These lock objects get released immediately and automatically if step 1 is successful (in other words, it's only when there is an error do the lock objects remain!)
C. I do call BAPI_TRANSACTION_COMMIT. I have also tried using SET UPDATE TASK LOCAL. Neither makes any difference (I think these are irrelevant b/c there are no db updates anyway in step 1 b/c of the error I force).
D. We have seen this specific problem occur when calling the function via RFC from our web front end.
I couldn't find any OSS note that describes this problem. Anybody know how to guarantee that all lock objects get released in the case where BAPI_GOODSMVT_CREATE fails?
p.s. I am a doing a 541 movement type (although I don't think this problem is specific to movement types).
Thanks for any suggestions or insights anybody might have.
Regards,
LeeThanks Rich... this make work for me, but one question -
Do you know if this function releases all lock objects for the user system wide or only for the current session? My concern is that if it is system wide, then I could be releasing lock objects for other sessions unintentionally. For example, if there are multiple RFC calls in parallel for the same function and same user then I could be destroying lock entries that I shouldn't be! I am hoping that it removes lock entries only for the current session...
any ideas?
Regards,
Lee
> I've used this BAPI in many of my programs, and
> always after the call, I code.....
>
>
>
> commit work and wait.
> call function 'DEQUEUE_ALL'.
>
>
>
> The DEQUEUE_ALL show release any/all locks.
>
>
> Regards,
> Rich Heilman -
Probelm with BAPI_GOODSMVT_CREATE
Hi Experts,
I am trying to create a goods reciept with reference to a purchase order, while creating that using BAPI_GOODSMVT_CREATE, I am getting an error "PL Stock in transit exceeded by 100 LB : LC-1114 3000 0001". What does this indicate and how can I resolve it.
I have tried with lesser number of quantaty as well but getting the same error with lesser LB.
Thanks & Regards,
SumaHi Suma,
The PO item which u r using in BAPI is already GR'd. Check whether there is any open quantity to be GR'd for material LB : LC-1114 in ME23N PO -> purchase order history tab.
If u find goods receipt document for this line then calculate the remaining open qty = qty in GR document - qty specified in PO line.
if no qty is remaining then use another PO for your testing.
R's,
savitha
Edited by: Savitha Madhavagiri on Mar 11, 2008 3:04 AM
Edited by: Savitha Madhavagiri on Mar 11, 2008 3:04 AM -
Problem with bapi_goodsmvt_create
hi all,
iam using bapi_goodsmvt_create to do a goods recipt for a PO. while running the error message iam getting is
"No goods receipt possible for PO 2200000065 010". But i can do it manually the recipt using MIGO for that PO & if i delete that Goods Recipt manually and if i run the program again, the program is picking that PO and its recipting properly as expected.
the requirement is it should do it for the first time itself, rather than receipting manually & deleting that receipt & running the program again
Help me in this issue,
Cheers,
Prem.here is the program...
The following is an abap program making used of the BAPI function BAPI_GOODSMVT_CREATE to do Goods Receipts for Purchase Order after importing the data from an external system.
BAPI TO Upload Inventory Data
GMCODE Table T158G - 01 - MB01 - Goods Receipts for Purchase Order
02 - MB31 - Goods Receipts for Prod Order
03 - MB1A - Goods Issue
04 - MB1B - Transfer Posting
05 - MB1C - Enter Other Goods Receipt
06 - MB11
Domain: KZBEW - Movement Indicator
Goods movement w/o reference
B - Goods movement for purchase order
F - Goods movement for production order
L - Goods movement for delivery note
K - Goods movement for kanban requirement (WM - internal only)
O - Subsequent adjustment of "material-provided" consumption
W - Subsequent adjustment of proportion/product unit material
report zbapi_goodsmovement.
parameters: p-file like rlgrap-filename default
'c:\sapdata\TEST.txt'.
parameters: e-file like rlgrap-filename default
'c:\sapdata\gdsmvterror.txt'.
parameters: xpost like sy-datum default sy-datum.
data: begin of gmhead.
include structure bapi2017_gm_head_01.
data: end of gmhead.
data: begin of gmcode.
include structure bapi2017_gm_code.
data: end of gmcode.
data: begin of mthead.
include structure bapi2017_gm_head_ret.
data: end of mthead.
data: begin of itab occurs 100.
include structure bapi2017_gm_item_create.
data: end of itab.
data: begin of errmsg occurs 10.
include structure bapiret2.
data: end of errmsg.
data: wmenge like iseg-menge,
errflag.
data: begin of pcitab occurs 100,
ext_doc(10), "External Document Number
mvt_type(3), "Movement Type
doc_date(8), "Document Date
post_date(8), "Posting Date
plant(4), "Plant
material(18), "Material Number
qty(13), "Quantity
recv_loc(4), "Receiving Location
issue_loc(4), "Issuing Location
pur_doc(10), "Purchase Document No
po_item(3), "Purchase Document Item No
del_no(10), "Delivery Purchase Order Number
del_item(3), "Delivery Item
prod_doc(10), "Production Document No
scrap_reason(10), "Scrap Reason
upd_sta(1), "Update Status
end of pcitab.
call function 'WS_UPLOAD'
exporting
filename = p-file
filetype = 'DAT'
IMPORTING
FILELENGTH =
tables
data_tab = pcitab
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
OTHERS = 6
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
exit.
endif.
gmhead-pstng_date = sy-datum.
gmhead-doc_date = sy-datum.
gmhead-pr_uname = sy-uname.
gmcode-gm_code = '01'. "01 - MB01 - Goods Receipts for Purchase Order
loop at pcitab.
itab-move_type = pcitab-mvt_type.
itab-mvt_ind = 'B'.
itab-plant = pcitab-plant.
itab-material = pcitab-material.
itab-entry_qnt = pcitab-qty.
itab-move_stloc = pcitab-recv_loc.
itab-stge_loc = pcitab-issue_loc.
itab-po_number = pcitab-pur_doc.
itab-po_item = pcitab-po_item.
concatenate pcitab-del_no pcitab-del_item into itab-item_text.
itab-move_reas = pcitab-scrap_reason.
append itab.
endloop.
loop at itab.
write:/ itab-material, itab-plant, itab-stge_loc,
itab-move_type, itab-entry_qnt, itab-entry_uom,
itab-entry_uom_iso, itab-po_number, itab-po_item,
pcitab-ext_doc.
endloop.
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = gmhead
goodsmvt_code = gmcode
TESTRUN = ' '
IMPORTING
goodsmvt_headret = mthead
MATERIALDOCUMENT =
MATDOCUMENTYEAR =
tables
goodsmvt_item = itab
GOODSMVT_SERIALNUMBER =
return = errmsg
clear errflag.
loop at errmsg.
if errmsg-type eq 'E'.
write:/'Error in function', errmsg-message.
errflag = 'X'.
else.
write:/ errmsg-message.
endif.
endloop.
if errflag is initial.
commit work and wait.
if sy-subrc ne 0.
write:/ 'Error in updating'.
exit.
else.
write:/ mthead-mat_doc, mthead-doc_year.
perform upd_sta.
endif.
endif.
FORM UPD_STA *
form upd_sta.
loop at pcitab.
pcitab-upd_sta = 'X'.
modify pcitab.
endloop.
call function 'WS_DOWNLOAD'
exporting
filename = p-file
filetype = 'DAT'
IMPORTING
FILELENGTH =
tables
data_tab = pcitab
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
OTHERS = 6
endform.
*--- End of Program
points please... -
No material document created with BAPI_GOODSMVT_CREATE
Hi all,
I try to perform an IM transfer with 323 movement from BAPI_GOODSMVT_CREATE.
It works with IM to IM storage location.
It doesn't work when IM target storage location is connected to WM warehouse number and schould create an inbound delivery :
the return code from the bapi is 0, there is no message in return table and no document number generated.
(same data in MB1B works witout any problem)
can you help me please ?thanks for your answers !
I already try to find an OSS note (213 notes about this BAPI)...
the call to the bapi is not performed directly, i use an intermediate storage in a table "ZGOODSMVT" which i use for other movements without any problem (same fields than BAPI parameters).
(the 323 works when IM destination storage location is not connected to WM warehouse number).
here is the code from first prog :
form mvt_323.
clear zgoodsmvt.
zgoodsmvt-ref_doc_yr = mkpf-budat(4).
zgoodsmvt-ref_doc = mkpf-mblnr.
zgoodsmvt-ref_doc_it = mseg-zeile.
zgoodsmvt-nseq = 0.
zgoodsmvt-pstng_date = mkpf-budat.
zgoodsmvt-doc_date = mkpf-budat.
zgoodsmvt-ref_doc_no = mkpf-mblnr.
zgoodsmvt-header_txt = 'Transfert automatique'.
zgoodsmvt-gm_code = '04'. " Transfert
zgoodsmvt-material = mseg-matnr.
zgoodsmvt-plant = mseg-werks.
zgoodsmvt-stge_loc = mseg-lgort.
zgoodsmvt-batch = mseg-charg.
zgoodsmvt-move_type = '323'.
zgoodsmvt-entry_qnt = mseg-erfmg.
zgoodsmvt-entry_uom = mseg-erfme.
zgoodsmvt-item_text = 'Transfert automatique'.
zgoodsmvt-move_plant = mseg-werks.
zgoodsmvt-move_stloc = 'BVSG'.
zgoodsmvt-batch = mseg-charg.
zgoodsmvt-udate = sy-datum.
zgoodsmvt-uname = sy-uname.
zgoodsmvt-utime = sy-uzeit.
INSERT zgoodsmvt.
IF sy-subrc ne 0.
retco = sy-subrc.
EXIT.
ENDIF.
endform.
here is the code from second prog :
SELECT * FROM zgoodsmvt APPENDING CORRESPONDING FIELDS OF TABLE t
WHERE type NE 'S'.
LOOP AT t.
CLEAR : ti, tr, ir.
REFRESH: ti, tr.
FREE : ti, tr.
MOVE-CORRESPONDING: t TO w_goodsmvt_header, t TO w_goodsmvt_code.
MOVE-CORRESPONDING: t TO ti, t TO ir.
APPEND ti. " item
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = w_goodsmvt_header
goodsmvt_code = w_goodsmvt_code
testrun = ptestrun
IMPORTING
GOODSMVT_HEADRET =
materialdocument = w_materialdocument
matdocumentyear = w_matdocumentyear
TABLES
goodsmvt_item = ti
GOODSMVT_SERIALNUMBER =
return = tr.
IF sy-subrc NE 0. " tjr à 0, les erreurs sont ds TR
WRITE:/ text-250, sy-subrc.
ENDIF.
Thank you for your help,
regards
Eric -
Problem with BAPI_GOODSMVT_CREATE FM - intersting Issue
HI all,
I need to do the GR for an open inbound delivery. At the item level of precessing document i.e PO 'No goods receipt' check is marked. Same thing is copied to my inbound delivery 'No goods Movement' is marked in Adminstrative tab of my inbound delivery item.
When I use the BAPI BAPI_GOODSMVT_CREATE to do GR for this Inbound delivery, it throws an error saying that 'No goods receipt possible for the PO item'.
But when I do the same thing manually it happened successfully by creating a "service confirmation document" and changed the goods movement status as C (fully completed) without creating an material document as these items are no relevant items for goods movement.
As we are moving goods directly from Vendor to customer, just we want to do service confirmation to vendor without any goods movement. It happening manually but not through BAPI. Please suggest.
Helpful anwers are certainly rewared
Thanks,
Raggs.Hi,
Incase a goods movement document is not getting created then it will not be possible to use the BAPI BAPI_GOODSMVT_CREATE.
Although your process is interesting but its a widely used process.
I think there should be a service order in this scenario against which the confirmation may be happening.
Check any BAPI is available for creating the service order document and then confirming teh same
Check with your functional consultant to explain you the entire cycle and then check for some BAPI or FM available.
Regards,
Ankur Parab
Maybe you are looking for
-
Connect MacBook to LG LCD TV?
Hi! I am trying to figure out what cables I need to connect my MacBook (about 2 yrs old) to my new LG 42" LCD TV (I think the model # is 42LD450?) Not sure if an HDMI cable would work or if I need an adapter for the laptop. I had also had a recommend
-
Can't edit connection in JReport
Sorry if this is in the wrong forum, but I couldn't find a forum for JReport so I'm posting this here. I am using JReport 9.1. I am trying to edit the database connection for the report. However, at the connection information screen, the JDBC URL is
-
What are Apple's rules on refunding price difference ?
Just bought a MacBook Air last Friday and didn't know that the price would drop less than a week later. Will I be able to get the difference back?
-
FCPX: Inserted Images become Fuzzy when Played
Sometimes I have this problem (like now) and I don't know what causes. I am creating a very short video with 14 images (faces). I just inserted an additional image between two existing images. It looks fine but when I play the video the inserted imag
-
Runtime parsing of policy.file - from source
Hi All Decided to post here sinceI did not find any similar topic on forums and googling did not solve this. Is there any way to parse polic.file like input at runtime? PolicyTool. PolicyFile are classes that do that but: 1. all methods are private s