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

Credit note comparison report

Former Member
0 Likes
533

hi friends , iam new sap/reports got a assigment

credit note compare report i have to display

mblnr,matnr.charg,menge ,vbeln,fkdat,matnr,charg,batch.

till menge its from mseg and rest from vbrk and vbrp.

to display all records for line itmes also .

i selected all the fields from mseg one itab and distinct vbeln in one itab

and all the vrecords from vbrp.

my report had now is verrrrrrrrrrrrrry slow .

pls help me with code.

SELECT mkpf~bldat

mseg~werks

mseg~mblnr

mseg~matnr

mseg~charg

mseg~menge

INTO CORRESPONDING FIELDS OF TABLE imseg

FROM mkpf

INNER JOIN mseg

ON msegmblnr = mkpfmblnr

WHERE mkpf~bldat IN s_bldat

AND mseg~werks IN s_werks

AND mseg~mblnr IN s_mblnr

AND mseg~bwart = '972'.

SELECT DISTINCT vbeln

fkdat

FROM vbrk INTO CORRESPONDING FIELDS OF TABLE icnot.

SELECT vbrp~vbeln

vbrp~matnr

vbrp~charg

vbrp~fkimg

FROM vbrp INTO TABLE icnq.

LOOP AT icnot.

CLEAR icno.

icno-vbeln = icnot-vbeln.

icno-fkdat = icnot-fkdat.

READ TABLE icnq WITH KEY vbeln = icno-vbeln.

IF sy-subrc = 0.

icno-matnr = icnq-matnr.

icno-charg = icnq-charg.

icno-fkimg = icnq-fkimg.

ENDIF. "if sy-subrc

APPEND icno.

ENDLOOP." LOOP AT icnot

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
468

Hi Farukh,

Avoid using Into-Corresponding Fields. Try declaring the internal table with only the required fields instead.

alos instead of inner join use View for selecting from mseg & mkpf..u can use WB2_V_MKPF_MSEG or WB2_V_MKPF_MSEG2

Regards

bikash

hi friends , iam new sap/reports got a assigment

credit note compare report i have to display

mblnr,matnr.charg,menge ,vbeln,fkdat,matnr,charg,batch.

till menge its from mseg and rest from vbrk and vbrp.

to display all records for line itmes also .

i selected all the fields from mseg one itab and distinct vbeln in one itab

and all the vrecords from vbrp.

my report had now is verrrrrrrrrrrrrry slow .

pls help me with code.

SELECT mkpf~bldat

mseg~werks

mseg~mblnr

mseg~matnr

mseg~charg

mseg~menge

INTO CORRESPONDING FIELDS OF TABLE imseg

FROM mkpf

INNER JOIN mseg

ON msegmblnr = mkpfmblnr

WHERE mkpf~bldat IN s_bldat

AND mseg~werks IN s_werks

AND mseg~mblnr IN s_mblnr

AND mseg~bwart = '972'.

SELECT DISTINCT vbeln

fkdat

FROM vbrk INTO CORRESPONDING FIELDS OF TABLE icnot.

SELECT vbrp~vbeln

vbrp~matnr

vbrp~charg

vbrp~fkimg

FROM vbrp INTO TABLE icnq.

LOOP AT icnot.

CLEAR icno.

icno-vbeln = icnot-vbeln.

icno-fkdat = icnot-fkdat.

READ TABLE icnq WITH KEY vbeln = icno-vbeln.

IF sy-subrc = 0.

icno-matnr = icnq-matnr.

icno-charg = icnq-charg.

icno-fkimg = icnq-fkimg.

ENDIF. "if sy-subrc

APPEND icno.

ENDLOOP." LOOP AT icnot

2 REPLIES 2
Read only

Former Member
0 Likes
469

Hi Farukh,

Avoid using Into-Corresponding Fields. Try declaring the internal table with only the required fields instead.

alos instead of inner join use View for selecting from mseg & mkpf..u can use WB2_V_MKPF_MSEG or WB2_V_MKPF_MSEG2

Regards

bikash

Read only

Former Member
0 Likes
468

Hi Farukh,

Check the time consumed by each query first in debug mode.

If you find that the first one is consume most of processing time (which i assume to be) then try to use exsitng <b>view on both "WB2_V_MKPF_MSEG2"</b> instead of writing your own inner join on MSEG and MKPF .

Also try to avoid using the clause INTO CORRESPONDING FIELDS OF internal table.

these two shall enhance the performance considerably,

Lakshmi