11-10-2005 4:03 AM
I try to use BAPI_GOODSMVT_CREATE to post GR with D/O no, I use the following parameters for calling BAPI
gm_code = 01
mvt_ind = 'B'
goodsmvt_header
goodsmvt_item-deliv_num = '80760728'
goodsmvt_item-deliv_item = '00010'
goodsmvt_item-move_type = '101'
According to SAP documentation, I only need to put fill in delivery, delivery number and movement type for GR for PO unknown: Shipping notification known.
However, when I run the BAPI, the return code show error:
E: EM7 018Enter Purchase order
Anybody know what parameters need to put in for GR for PO unknown: Shipping notification known ??
11-10-2005 4:09 AM
I hope the docu ment which you gave is inbound delivery. So for that you may require the PO#.
11-10-2005 4:11 AM
Hi,
Check this link for sample code.
http://www.sap-img.com/abap/bapi-goodsmvt-create-to-post-goods-movement.htm
Kindly reward points by clicking the star on the left of reply,if it helps.
11-10-2005 4:18 AM
See below code
DESCRIBE TABLE I_BAPI_GM_ITEM LINES L_ITEM_LINES.
IF L_ITEM_LINES GT 0.
L_BAPI_GM_HEAD-PSTNG_DATE = SY-DATUM.
L_BAPI_GM_HEAD-DOC_DATE = SY-DATUM.
L_BAPI_GM_HEAD-REF_DOC_NO = IMP_VBELN.
L_BAPI_GM_CODE-GM_CODE = '06'. "Goods Issue
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
GOODSMVT_HEADER = L_BAPI_GM_HEAD
GOODSMVT_CODE = L_BAPI_GM_CODE
IMPORTING
GOODSMVT_HEADRET = L_WA_GOODS_RECEIPT_NBR
TABLES
GOODSMVT_ITEM = I_BAPI_GM_ITEM
RETURN = I_BAPI_GM_RET.
IF L_WA_GOODS_RECEIPT_NBR IS INITIAL. "Error
11-10-2005 4:23 AM
Hi...
If you process the inbound delivery,you can decide the PO#.
PO# is selected the table LIPS-vgbel.
ex.
SELECT SINGLE vgbel
INTO po_num
FROM LIPS
WHERE vbeln = '80760728'
AND posnr = '00010'.
Good Luck.
Regards MSLee
11-10-2005 8:55 AM
hi ,
For creating goods receipt for inbound delivery this bapi BAPI_GOODSMVT_CREATE will not support.
Here in this bapi you are giving GM code 01 that is for MB01 transaction and that is goodsrecipt with respect to purchase order only.But you have to do post goods receipt for inbound delivery.
try for another function module which can do this post goods recipt for inbound delivery.
thanks and regards
rajkumar abbu
11-12-2005 4:57 AM
I'm trying to do GR for outbound delivery, can BAPI_GOODSMVT_CREATE do the job? If can't, is there any ways to do it? or I have to use BDC?
11-12-2005 5:05 PM
For outbound deliveries, you will do a GI at the source destination, not a GR. Are you doing a GR in your system for the target destination?
Also, give delivery number in internal format, i.e with leading zeros. You will give a 'B' only if you are supplying the PO, if not don't give that.
If these changes do not help you, post your entire code where you fill the BAPI structures so that we can help.
Srinivas
11-14-2005 1:26 AM
In MIGO, I choose A01-Goods Receipt, then choose R05-Outbound Delivery, then key in the D/O. I can actually do a GR for outbound delivery in MIGO, but I can't do it in BAPI_GOODSMVT_CREATE.
The D/O is from another internal company. Any advice?
11-14-2005 2:37 AM
In that case, as I mentioned, can you remove the 'B' that you are passing and send the D/O in the internal format, with leading zeros.
11-14-2005 2:38 AM
Here is how your code should be
gm_code = 01
goodsmvt_header
goodsmvt_item-deliv_num = '0080760728'
goodsmvt_item-deliv_item = '00010'
goodsmvt_item-move_type = '101'
11-15-2005 2:14 AM
I put in the following parameters:
gm_code = 01
goodsmvt_header
goodsmvt_item-deliv_num = '0080740728'
goodsmvt_item-deliv_item = '90001'
goodsmvt_item-move_type = '101'
but the return table shows me error:
E |M7 |264 |Qty and / or "delivery completed" ind. or "delivery completed" ind. or final issue ind. are missing.
after I put in goodsmvt_item-entry_ant = 2, return table shows error:
E |M7 |018 |Enter Plant
I put in goodmvt_item-plant = '0110', return table shows error:
E |M7 |097 |No stock posting possible for this material
Any advice on this issue?
11-15-2005 2:54 AM
Earlier you had item 00001, now you put 90001. Is that correct? The error message tells me that your delivery item cannot be received, may be because of its item category or may be it is already delivered or the delivery complete indicator set or may be the final issue indicator is set... it could be anything. Go to VL03N, enter the delivery number and see the document flow at the item level. See if it says completed or something like that. Try to do a MIGO manually for it and see if the system gives you the same message.
Srinivas
02-13-2007 4:19 PM
Yean,
I realize this posting was quite some time ago, but I am facing the exact scenario you described. If you cared to, and can remember, would you mind to share with me your outcome?
Kind Regards,
Dennis.
03-27-2007 9:26 PM
Dear all
Bapi BAPI_GOODSMVT_CREATE could be used to post goods receipt against inbound delivery but in consequence no Delivery document flow is updated. This is official SAP explaination.
But there is solution to accomplish it. After posting goods movements you should update Inbound Delivery using fm SD_DELIVERY_UPDATE.
Check following coding:
*&---------------------------------------------------------------------*
form process_0112.
clear post_status.
post_status-delivery = wa_likp-vbeln.
* posting
perform post_goodsreceipt changing post_status.
perform post_delivery_hist changing post_status.
perform post_transferorder changing post_status.
* reversal posting if necessary
perform reverse_goodsreceipt changing post_status.
perform reverse_delivery_hist changing post_status.
* display message in case of error
perform issue_message changing post_status.
* leave transaction
leave to transaction sy-tcode.
endform. " process_0112
*&---------------------------------------------------------------------*
form post_goodsreceipt changing post_status structure post_status.
*-----------------------------------------
* DATA DECLARATION
*-----------------------------------------
* material document header
data: begin of it_head.
include structure bapi2017_gm_head_01.
data: end of it_head.
* T158G special code
data: begin of it_code.
include structure bapi2017_gm_code.
data: end of it_code.
* material document returned data
data: begin of it_rthead.
include structure bapi2017_gm_head_ret.
data: end of it_rthead.
* material document items
data: begin of it_pos occurs 100.
include structure bapi2017_gm_item_create.
data: end of it_pos.
* error table
data: begin of it_errmsg occurs 10.
include structure bapiret2.
data: end of it_errmsg.
* return data
data: post_mat_doc type bapi2017_gm_head_ret-mat_doc,
post_doc_year type bapi2017_gm_head_ret-doc_year.
*-----------------------------------------
* FILL DATA
*-----------------------------------------
* material document header
it_head-pstng_date = sy-datum.
it_head-doc_date = sy-datum.
it_head-header_txt = 'RF'.
it_head-pr_uname = sy-uname.
* T158G code
it_code-gm_code = '01'.
* material document items
loop at it_lips into wa_lips where posnr <> space.
it_pos-mvt_ind = 'B'.
it_pos-deliv_numb_to_search = wa_lips-vbeln.
it_pos-deliv_item_to_search = wa_lips-posnr.
it_pos-po_number = wa_lips-vgbel.
it_pos-po_item = wa_lips-vgpos.
it_pos-move_type = '985'.
it_pos-entry_qnt = wa_lips-rv_lfimg.
append it_pos.
endloop.
*-----------------------------------------
* CALL BAPI
*-----------------------------------------
refresh: it_errmsg.
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = it_head
goodsmvt_code = it_code
importing
materialdocument = post_mat_doc
matdocumentyear = post_doc_year
tables
goodsmvt_item = it_pos
return = it_errmsg.
* check result
if post_mat_doc is initial.
post_status-post_mat_doc = space.
post_status-post_doc_year = space.
rollback work.
else.
post_status-post_mat_doc = post_mat_doc.
post_status-post_doc_year = post_doc_year.
commit work and wait.
endif.
endform. " post_goodsreceipt
*&---------------------------------------------------------------------*
form post_delivery_hist changing post_status structure post_status.
*-----------------------------------------
* DATA DECLARATION
*-----------------------------------------
data: it_vbfa like vbfa occurs 0,
wa_vbfa like vbfa.
*-----------------------------------------
* CHECK IF UPDATE DELIVERY IS ESSENTIAL
*-----------------------------------------
check not post_status-post_mat_doc is initial
and not post_status-post_doc_year is initial.
*-----------------------------------------
* POPULATE TABLE
*-----------------------------------------
loop at it_lips into wa_lips where posnr <> space.
clear wa_vbfa.
wa_vbfa-vbelv = wa_lips-vbeln.
wa_vbfa-posnv = wa_lips-posnr.
wa_vbfa-vbeln = post_status-post_mat_doc.
wa_vbfa-vbtyp_n = 'R'.
wa_vbfa-vbtyp_v = '7'.
wa_vbfa-plmin = '+'.
select single zeile waers menge dmbtr meins matnr bwart
from mseg
into (wa_vbfa-posnn, wa_vbfa-waers,
wa_vbfa-rfmng, wa_vbfa-rfwrt,
wa_vbfa-meins, wa_vbfa-matnr,
wa_vbfa-bwart)
where mblnr = post_status-post_mat_doc
and mjahr = post_status-post_doc_year
and ebeln = wa_lips-vgbel
and ebelp = wa_lips-vgpos.
append wa_vbfa to it_vbfa.
endloop.
*-----------------------------------------
* UPDATE DELIVERY
*-----------------------------------------
data: begin of yvbfa occurs 0.
include structure vbfavb.
data: end of yvbfa.
data: begin of xvbfa occurs 0.
include structure vbfavb.
data: end of xvbfa.
data: begin of xvttk occurs 0.
include structure vttkvb.
data: end of xvttk.
sort it_vbfa by mandt vbelv posnv vbeln posnn vbtyp_n.
loop at it_vbfa into xvbfa.
xvbfa-rfmng_flt = xvbfa-rfmng.
xvbfa-updkz = 'I'.
append xvbfa.
at end of vbelv.
call function 'SD_DELIVERY_UPDATE'
exporting
i_vbtyp = '7'
nicht_sperren = 'Y'
no_imseg_refresh = 'X'
tables
zxvbfa = xvbfa
zyvbfa = yvbfa
zxvttk = xvttk
exceptions
others = 1.
if sy-subrc <> 0.
exit.
endif.
refresh xvbfa.
endat.
endloop.
* check result
if sy-subrc <> 0.
post_status-post_deli_hist = 'R'.
rollback work.
else.
post_status-post_deli_hist = 'C'.
commit work and wait.
endif.
endform. " post_delivery_hist
05-13-2010 1:18 PM
Hello Srinivas
I see that you had a solution for my question.
My issue
Now i want to post GR against inbound delivery in MIGO transaction for movement type 101. i am using bapi_goodsmvt_create for this. now i want to know what are the parameters, i need to pass to that bapi.
for example
GMCODE
KZBEW - Movement Indicator
when i see there in table T158G there is no code avialable for MIGO transaction. And parallely i want to know what parameters i need to pass to header and item segemnts etc. please help me in this issue.
I got stuck up and it is very priority issue for me.
Regards
Raj
05-14-2010 2:09 AM
For those who experience this issue:
I solve this problem by using BDC method for transaction MB0A to GR inbound delivery order, I think it is not possible to use BAPI_GOODSMVT_CREATE to do GR inbound delivery.
05-06-2011 1:36 PM
Yean Nean Yong ,
I have Created a Goods Movement Against the Inbound delivery through FM BAPI_GOODSMVT_CREATE and it is working Fine for me.
It is updating the Docflow and PO History. My code is :
DATA : ls_header TYPE bapi2017_gm_head_01,
ls_mvt_code TYPE bapi2017_gm_code,
ls_return TYPE bapiret2,
ls_item TYPE bapi2017_gm_item_create.
DATA : lt_item TYPE STANDARD TABLE OF bapi2017_gm_item_create,
lt_return TYPE STANDARD TABLE OF bapiret2.
ls_mvt_code-gm_code = '01'. " through Tcode MB01
ls_header-pstng_date = sy-datum.
ls_item-material = <Materail Number>.
ls_item-plant = <Plant>
ls_item-stge_loc = <Storage Location>'.
ls_item-move_type = '101'.
ls_item-entry_qnt =<Quantity>.
ls_item-entry_uom = <PIcking Quantity Unit>.
ls_item-mvt_ind = 'B'. " Goods Movement Against PO
ls_item-deliv_numb_to_search = <Delivery Number>.
ls_item-deliv_item_to_search =<Delivery Number Item>.
APPEND ls_item TO lt_item.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = ls_header
goodsmvt_code = ls_mvt_code
TABLES
goodsmvt_item = lt_item
return = lt_return
.
IF lt_return IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = ls_return.
ENDIF.
02-06-2015 2:12 PM
I know it's an old thread, but update it anyway, since it might help to others in the future
It seems for inbound delivery/shipping notification you have to pass these fields in the item table:
According my tests (in ECC 6.05 system) you need to pass the "to_search" fields also, otherwise it dumps.
Also customizing from this OSS note is also necessary, then it works fine:
1993787 - MESSAGE_TYPE_X with error VL143 during goods receipt against inbound delivery in MIGO
Peter
03-03-2016 7:04 AM