2006 Nov 05 11:34 AM
Hello,
I am looking for the latest goods receipt for a material and plant combination. Please provide me the SAP table name and the field for determining the latest GR.
Thanks,
-A.Singh.
Hello,
I am looking for the latest goods receipt for a material and plant combination. Please provide me the SAP table name and the field for determining the latest GR.
Thanks,
-A.Singh.
2006 Nov 05 11:45 AM
hi
u can check @ table level EKBE w.r.f PO number.
VGABE = 1 Goods receipt
2 Invoice receipt
Hope this helps and clarifies.
<b>BAPI FM for goods receipt - BAPI_GOODSMVT_CREATE</b>
<i>did u check the above BAPI</i>
regards
anver
if hlped pls mark points
2006 Nov 05 12:07 PM
Hello Anver,
I have Mat.no. and plant as input parameter for searching,
no PO.
Thanks,
A.Singh
2006 Nov 05 12:13 PM
hi,
check a samplde code.
You can go to BAPI BAPI_GOODSMVT_CREATE for this.
This piece of code may be helpful.
*
Structures for BAPI
data: gm_header type bapi2017_gm_head_01.
data: gm_code type bapi2017_gm_code.
data: gm_headret type bapi2017_gm_head_ret.
data: gm_item type table of
bapi2017_gm_item_create with header line.
data: gm_return type bapiret2 occurs 0.
data: gm_retmtd type bapi2017_gm_head_ret-mat_doc.
clear: gm_return, gm_retmtd. refresh gm_return.
* Setup BAPI header data.
gm_header-pstng_date = sy-datum.
gm_header-doc_date = sy-datum.
gm_code-gm_code = '06'. " MB11
* Write 551 movement to table
clear gm_item.
move '551' to gm_item-move_type .
move '000000000040001234' to gm_item-material.
move '1' to gm_item-entry_qnt.
move 'EA' to gm_item-entry_uom.
move '0004' to gm_item-plant.
move '4000' to gm_item-stge_loc.
move '201' to gm_item-move_reas.
* Determine cost center per plant
case xresb-werks.
when '0004'.
move '0000041430' to gm_item-costcenter.
when '0006'.
move '0000041630' to gm_item-costcenter.
when '0007'.
move '0000041731' to gm_item-costcenter.
when '0008'.
move '0000041830' to gm_item-costcenter.
endcase.
append gm_item.
* Call goods movement BAPI
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = gm_header
goodsmvt_code = gm_code
importing
goodsmvt_headret = gm_headret
materialdocument = gm_retmtd
tables
goodsmvt_item = gm_item
return = gm_return.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.Regards
anver
if helped pls mark points
2006 Nov 05 12:19 PM
hi,
mseg -matnr ,
mseg-werks,
mseg-WEUNB,
mseg-BSTMG,
and check in table MKPF for the latest Gr.
these are the two tables u need to look in ..
regards.
Vijay
2006 Nov 05 12:45 PM
Hello Vijay,
Thanks for the helpful reply.
I want to know the field out of the follwoing
which will give the latest GR
MSEG-BLDAT, MSEG-BUDAT, MSEG-CPUDT, MSEG-CPUTM.
Regards,
A.Singh
2006 Nov 05 12:46 PM
Hello Vijay,
Thanks for the helpful reply.
I want to know the field out of the follwoing
which will give the latest GR
MKPF-BLDAT, MKPF-BUDAT, MKPF-CPUDT, MKPF-CPUTM.
Regards,
A.Singh
2006 Nov 05 1:13 PM
Hi its <b>mkpf-BUDAT</b>
<b>mkpf-BUDAT</b> posting date
dont forget to add this time .. this is very important ..
<b>mkpf-CPUTM</b>
<b>now say that on 06/10/2006 i have 5 grs for the same material and plant</b>
now to get the latest gr ..
to get the latest GR what we have to do is find the GR numbers with in a day for ur plant and material
into the <b>itab</b> ..
now
<b>Sort itab by budat descending cputm desecending ..</b>
will give u the latest GR on Day and Time ..
regards,
Vijay