Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

standard program on good received statement

Former Member
0 Likes
886

Hi all,

can anyone tell me any standard program on good received statement .

6 REPLIES 6
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
810

Table EKBE holds all the entris based on GR..

pas the relevant MOvement type (BWART)

po no (EBELN)

ITEm (EBELP)

GRn NO (BELNR)

MENGE (GR QTY)

Read only

0 Likes
810

Hi keshu,

thank u for ur information but i need any sap standard program on good received statement or related to that.

regards,

Bipasha

Read only

0 Likes
810

hi,

ckeck transactions

IW3M List of Goods Movements for Order

LM71 Goods Receipt by Delivery.

reward if hlpful.

Read only

0 Likes
810

MB51...enter needed movement types and execute

Read only

0 Likes
810

Hi

check this code

report zmmgnrep0001

line-count 58

line-size 234

no standard page heading

message-id zpp.

                                                              • TABLES *********************************

tables : mseg,

mkpf,

bkpf,

ekbe,

bseg,

rseg,

rbkp.

                                                    • DATA DECLARATION ****************************

*data xekbe like ekbe occurs 0 with header line.

*data zxekbe like ekbe occurs 0 with header line.

*data :mirodoc like ekbe-belnr,

  • mbudat like ekbe-budat.

data xekbe like ekbe occurs 0 with header line.

data zxrbkp like rbkp occurs 0 with header line.

data zrseg like rseg occurs 0 with header line.

data :mirodoc like rseg-belnr,

mbudat like rbkp-budat.

data : begin of icheck occurs 0,

checkdoc like rseg-belnr,

end of icheck.

data: begin of itab occurs 0,

mblnr like mkpf-mblnr,

mjahr like mkpf-mjahr,

budat like mkpf-budat,

bldat like mkpf-bldat,

xblnr like mkpf-xblnr,

zeile like mseg-zeile,

bwart like mseg-bwart,

ebeln like mseg-ebeln,

ebelp like mseg-ebelp,

lifnr like mseg-lifnr,

lfbnr like mseg-lfbnr,

lfbja like mseg-lfbja,

lfpos like mseg-lfpos,

belnr like bkpf-belnr,

bxblnr like bkpf-xblnr,

bbudat like bkpf-budat,

wrbtr like bseg-wrbtr,

dmbtr like bseg-dmbtr,

kursf like bkpf-kursf,

grri like bseg-hkont,

accn like bkpf-belnr,

  • mirodoc like ekbe-belnr,

  • mbudat like ekbe-budat,

mirodoc like rseg-belnr,

mbudat like rbkp-budat,

end of itab.

data : xmseg like mseg occurs 0 with header line,

xmkpf like mkpf occurs 0 with header line.

            • Modifed by Raja Robinson,TTIL pune *****************************

data: counter(10),

counter1(10),

************************************************************************

flag,

belnr like bkpf-belnr,

xblnr like bkpf-xblnr,

budat like bkpf-budat,

totlc like bseg-dmbtr,

totfc like bseg-wrbtr,

kursf like bkpf-kursf,

grri like bseg-hkont,

nilcount(5).

data: begin of hdg occurs 10,

f1 type c value '|',

line(232),

f2 type c value '|',

end of hdg.

                                                    • SELECTION SCREEN ****************************

selection-screen begin of block input with frame.

select-options: pos_date for mkpf-budat,

mat_no for mseg-matnr,

mv_type for mseg-bwart,

vend_cd for mseg-lifnr,

po_no for mseg-ebeln,

hkont for bseg-hkont.

selection-screen end of block input.

                                                      • BEGIN OF CODE ******************************

                                                  • BEGIN OF MAIN CODE ***************************

start-of-selection.

perform initialization.

perform get_data_for_input.

perform filter_data.

perform getmirodata.

perform format_data.

perform print_data.

&----


*& Form INITIALIZATION

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form initialization.

endform. " INITIALIZATION

&----


*& Form GET_DATA_FOR_INPUT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form get_data_for_input.

select a~mblnr " Material Document (GRN No.)

a~mjahr " Material Document Year

a~budat " Material Document Posting Date

a~bldat " Material Document Date

a~xblnr " Reference Document (Invoice No.)

b~zeile " Material Document Item No.

b~bwart " Movement Type (101 - GR Iss., 102 - GR Reverse)

b~ebeln " Purchase Order

b~ebelp " Purchase Order Line Number

b~lifnr " Vendor Code

b~lfbnr " Reference Document No(Contains 101 No in case of 102)

b~lfbja " Reference Document Year

b~lfpos " Reference Document Item No.

into corresponding fields of table itab

from mkpf as a

inner join mseg as b

on amblnr = bmblnr

and amjahr = bmjahr

where a~budat in pos_date

and b~bwart in mv_type

and b~ebeln in po_no

and b~matnr in mat_no

and b~lifnr in vend_cd.

if sy-subrc <> 0.

message e000(zpp) with 'No Data Found for the Input Criteria.'.

endif.

endform. " GET_DATA_FOR_INPUT

&----


*& Form GETMIRODATA

&----


form getmirodata.

select * from rseg into table zrseg for all entries in itab

where ebeln = itab-ebeln

and ebelp = itab-ebelp.

select * from rbkp into table zxrbkp for all entries in zrseg

where belnr = zrseg-belnr.

endform.

&----


*& Form FILTER_DATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form filter_data.

sort itab by lifnr mblnr ebeln.

loop at itab.

if itab-bwart = '102'.

delete itab where mblnr = itab-lfbnr

and mjahr = itab-lfbja

and zeile = itab-lfpos.

delete itab.

endif.

endloop.

endform. " FILTER_DATA

&----


*& Form FORMAT_DATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form format_data.

loop at itab.

clear : ekbe,bkpf.

*select * from ekbe

  • into corresponding fields of table zxekbe

  • where ebeln = itab-ebeln "xmseg-ebeln

  • and ebelp = itab-ebelp "xmseg-ebelp

  • and bewtp in ('R', 'Q').

select * from ekbe

into corresponding fields of table xekbe

where ebeln = itab-ebeln "xmseg-ebeln

and ebelp = itab-ebelp "xmseg-ebelp

and lfbnr = itab-mblnr "xmseg-mblnr

and lfgja = itab-mjahr "xmseg-mjahr

and lfpos = itab-zeile "xmseg-zeile

and bewtp in ('E', 'R').

if sy-subrc = 0.

loop at xekbe.

case xekbe-bewtp.

when 'E'.

select single * from bkpf

where bukrs = 'GMI'

  • and belnr like '%'

  • and gjahr like '%'

and bstat = space

and xblnr = xekbe-xblnr

and blart = 'WE'.

  • and budat = xekbe-budat

  • and bldat = xekbe-bldat and blart = 'WE'.

itab-wrbtr = xekbe-wrbtr.

itab-dmbtr = xekbe-dmbtr.

itab-kursf = bkpf-kursf.

itab-accn = bkpf-belnr.

when 'R'.

select single * from bkpf

where bukrs = 'GMI'

and belnr = xekbe-belnr

and gjahr = xekbe-gjahr.

move bkpf-belnr to itab-belnr.

move bkpf-xblnr to itab-bxblnr.

move bkpf-budat to itab-bbudat.

endcase.

select single * from bseg where bukrs = bkpf-bukrs and gjahr =

bkpf-gjahr and belnr = bkpf-belnr and buzid = 'W'.

itab-grri = bseg-hkont.

clear bkpf.

endloop.

endif.

read table zrseg with key ebeln = itab-ebeln

ebelp = itab-ebelp.

on change of zrseg-belnr.

if not icheck[] is initial.

read table icheck with key checkdoc = zrseg-belnr.

if sy-subrc <> 0.

icheck-checkdoc = zrseg-belnr.

append icheck.

move zrseg-belnr to itab-mirodoc.

read table zxrbkp with key belnr = zrseg-belnr.

if zxrbkp-budat >= itab-budat.

move zxrbkp-budat to itab-mbudat.

endif.

endif.

else.

move zrseg-belnr to itab-mirodoc.

icheck-checkdoc = zrseg-belnr.

append icheck.

endif.

read table zxrbkp with key belnr = zrseg-belnr.

if zxrbkp-budat >= itab-budat.

move zxrbkp-budat to itab-mbudat.

endif.

endon.

  • read table zxekbe with key ebeln = itab-ebeln

  • ebelp = itab-ebelp.

  • move zxekbe-belnr to itab-mirodoc.

  • move zxekbe-budat to itab-mbudat.

  • clear: zxekbe.

********- SZ398R on 22.04.2008

modify itab.

endloop.

sort itab by mblnr.

counter = 0.

endform. " FORMAT_DATA

&----


*& Form PRINT_DATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form print_data.

if hkont <> ''.

delete itab where not grri in hkont.

endif.

loop at itab.

clear flag.

mirodoc = itab-mirodoc.

mbudat = itab-mbudat.

on change of itab-mblnr.

counter = counter + 1.

write:/0(12) itab-lifnr, " to out-line+0(12).

13(10) itab-mblnr, " to out-line+13(10).

24(10) itab-budat, " to out-line+24(10).

36(16) itab-xblnr, " to out-line+36(16).

53(10) itab-bldat, " to out-line+53(10).

64(10) itab-ebeln, " to out-line+64(10),

160(12) itab-accn,

180(15) itab-grri.

flag = 1.

endon.

if belnr = ' '.

belnr = itab-belnr.

xblnr = itab-bxblnr.

budat = itab-bbudat.

kursf = itab-kursf.

endif.

totlc = totlc + itab-dmbtr.

totfc = totfc + itab-wrbtr.

counter1 = counter1 + 1.

at end of mblnr.

if belnr = ' '.

belnr = 'Nil'.

nilcount = nilcount + 1.

endif.

write: 75(16) totlc no-zero,

92(16) totfc no-zero,

109(8) kursf no-zero,

118(10) belnr,

129(16) xblnr,

146(10) budat,

198 mirodoc,

215 mbudat.

CLEAR:mirodoc,mbudat .

clear: totlc, totfc, belnr, xblnr, budat.

endat.

endloop.

uline.

write : / counter, 'GRNs Selected'.

  • write : / counter1, 'records selected.'.

write : / nilcount, 'GRNs have no JV attached'.

write : 69 '***END OF REPORT*****'.

endform. " PRINT_DATA

                                                        • TOP OF PAGE *******************************

top-of-page.

uline.

clear hdg-line.

write : 'General Motors India Confidential' to hdg-line+90.

write : hdg color col_heading intensified.

clear hdg-line.

write : 'Report : ZMM4' to hdg-line+1.

write : hdg color col_heading intensified.

clear hdg-line.

write : 'Date :' to hdg-line+10.

write : sy-datum to hdg-line+20.

write : sy-uzeit to hdg-line+39.

write : 'Requested By :' to hdg-line+55.

write : sy-uname to hdg-line+70.

write : hdg color col_heading intensified.

clear hdg-line.

write : 'Goods Receiving Report' to hdg-line+45,

'Page No. : ' to hdg-line+75,

sy-pagno to hdg-line+91(3).

write : hdg color col_heading intensified off.

uline.

clear hdg-line.

write :/0(12) 'Vendor', " to hdg-line+0,

13(10) 'GRN No.', " to hdg-line+13,

24(10) 'GRN Date', " to hdg-line+24,

36(16) 'Invoice No.', " to hdg-line+36,

53(10) 'Inv. Dt.', " to hdg-line+53,

64(10) 'PO No.', " to hdg-line+64,

75(16) 'Amount in LC' right-justified, " to hdg-line+153,

92(16) 'Amount in FC' right-justified, " to hdg-line+179,

109(8) 'Exchg Rt' right-justified, " to hdg-line+167,

118(10) 'JV No.', " to hdg-line+193,

129(16) 'JV.Reference', " to hdg-line+204,

146(10) 'Post.date', " to hdg-line+221.

160 'Account No',

180 'Acc Post',

198 'MIRO Document',

215 'MIRO Post'.

                                                        • END OF CODE *******************************

thanks

sitaram

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
810

ME2m

ME2k

ME2l