Skip to Content
0
Former Member
Dec 02, 2005 at 04:01 PM

performance tuning of this report

25 Views

Hello friends iam attaching my report give the performance tuning for this report to avoid nested endloops. how to do without using nested endloops.

give me the reply urgent.

-


*

REPORT ZDEMO9 NO STANDARD PAGE HEADING

LINE-SIZE 250

LINE-COUNT 22(3). .

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

  • TABLES DECLARATION *

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

TABLES : MARA, "general material data

MAKT, "material description

MARC, "plant data for material

VBAP, "sales document for item data

EKKO, "purchasing document header

EKPO, "purchasing document item

KNA1. "customer master details

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

  • INTERNAL TABLE DECLARATION *

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

DATA : BEGIN OF T_MARA OCCURS 0,

MATNR LIKE MARA-MATNR,

MTART LIKE MARA-MTART,

MEINS LIKE MARA-MEINS,

END OF T_MARA.

DATA : BEGIN OF T_MAKT OCCURS 0,

MATNR LIKE MAKT-MATNR,

MAKTX LIKE MAKT-MAKTX,

SPRAS LIKE MAKT-SPRAS,

END OF T_MAKT.

DATA : BEGIN OF T_MARC OCCURS 0,

MATNR LIKE MARC-MATNR,

WERKS LIKE MARC-WERKS,

END OF T_MARC.

DATA : BEGIN OF T_KNA1 OCCURS 0,

KUNNR LIKE KNA1-KUNNR,

NAME1 LIKE KNA1-NAME1,

LAND1 LIKE KNA1-LAND1,

END OF T_KNA1.

DATA : BEGIN OF T_VBAP OCCURS 0,

MATNR LIKE VBAP-MATNR,

POSNR LIKE VBAP-POSNR,

MATKL LIKE VBAP-MATKL,

VBELN LIKE VBAP-VBELN,

END OF T_VBAP.

DATA : BEGIN OF T_EKPO OCCURS 0,

EBELN LIKE EKPO-EBELN,

EBELP LIKE EKPO-EBELP,

BUKRS LIKE EKPO-BUKRS,

WERKS LIKE EKPO-WERKS,

LGORT LIKE EKPO-LGORT,

MATNR LIKE EKPO-MATNR,

MANDT LIKE EKPO-MANDT,

END OF T_EKPO.

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

  • FINAL INTERNAL TABLE *

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

DATA : BEGIN OF T_FINAL OCCURS 0,

MATNR LIKE MARA-MATNR,

MTART LIKE MARA-MTART,

MEINS LIKE MARA-MEINS,

WERKS LIKE MARC-WERKS,

MAKTX LIKE MAKT-MAKTX,

SPRAS LIKE MAKT-SPRAS,

VBELN LIKE VBAP-VBELN,

POSNR LIKE VBAP-POSNR,

MATKL LIKE VBAP-MATKL,

EBELN LIKE EKPO-EBELN,

EBELP LIKE EKPO-EBELP,

BUKRS LIKE EKPO-BUKRS,

KUNNR LIKE KNA1-KUNNR,

LAND1 LIKE KNA1-LAND1,

NAME1 LIKE KNA1-NAME1,

LGORT LIKE EKPO-LGORT,

END OF T_FINAL.

*DATA: BEGIN OF V_matnr OCCURS 0,

  • matnr LIKE mara-matnr,

  • END OF t_matnr.

data:

a(32) type c.

a = 'IBT000000000000000001000000000000000050'.

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

  • SELECTION SCREEN *

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

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS : S_BUKRS FOR EKPO-BUKRS,

S_KUNNR FOR KNA1-KUNNR,

S_WERKS FOR MARC-WERKS,

S_MATNR FOR MARA-MATNR obligatory.

SELECTION-SCREEN END OF BLOCK B1.

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

  • START OF SELECTION *

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

START-OF-SELECTION.

SELECT MATNR mtart meins

FROM MARA

INTO CORRESPONDING FIELDS OF TABLE T_MARA

WHERE MATNR IN S_MATNR.

SELECT MATNR WERKS

FROM MARC

INTO CORRESPONDING FIELDS OF TABLE T_MARC

FOR ALL ENTRIES IN T_MARA

WHERE MATNR = T_MARA-MATNR

and werks in s_werks.

select matnr maktx spras

from makt

into corresponding fields of table t_makt

for all entries in t_mara

where matnr = t_mara-matnr

and spras = sy-langu.

select matnr posnr matkl vbeln

from vbap

into corresponding fields of table t_vbap

for all entries in t_mara

where matnr = t_mara-matnr.

select matnr werks bukrs ebeln ebelp lgort

from ekpo

into corresponding fields of table t_ekpo

for all entries in t_mara

where matnr = t_mara-matnr

and werks in s_werks.

LOOP AT T_MARA.

MOVE T_MARA-matnr TO T_FINAL-matnr.

move t_mara-mtart to t_final-mtart.

move t_mara-meins to t_final-meins.

loop at t_marc where matnr eq t_mara-matnr.

move t_marc-werks to t_final-werks.

loop at t_makt.

move t_makt-maktx to t_final-maktx.

move t_makt-spras to t_final-spras.

loop at t_vbap.

move t_vbap-posnr to t_final-posnr.

move t_vbap-matkl to t_final-matkl.

move t_vbap-vbeln to t_final-vbeln.

loop at t_ekpo.

move t_ekpo-bukrs to t_final-bukrs.

move t_ekpo-ebeln to t_final-ebeln.

move t_ekpo-ebelp to t_final-ebelp.

move t_ekpo-lgort to t_final-lgort.

append t_final.

endloop.

endloop.

endloop.

endloop.

endloop.

SELECT werks KUNNR LAND1 NAME1

INTO CORRESPONDING FIELDS OF TABLE T_KNA1

FROM KNA1.

  • WHERE WERKS in s_werks.

loop at t_kna1.

move t_kna1-kunnr to t_final-kunnr.

move t_kna1-name1 to t_final-name1.

move t_kna1-land1 to t_final-land1.

append t_final.

endloop.

"endloop.

loop at t_final.

write : 4 t_final-matnr,

20 t_final-mtart,

28 t_final-meins,

46 t_final-werks,

58 t_final-maktx,

71 t_final-spras,

78 t_final-posnr,

100 t_final-matkl,

115 t_final-vbeln,

130 t_final-kunnr,

142 t_final-name1,

156 t_final-land1,

168 t_final-bukrs,

190 t_final-ebeln,

205 t_final-ebelp,

208 t_final-lgort.

endloop.

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

  • TOP-OF-PAGE *

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

top-of-page.

uline.

write : /60 'G E N E R A L D E T A I L S' COLOR 2 INVERSE OFF.

ULINE.

write :/ SY-VLINE, 'MATERIAL' COLOR 4, "12 SY-VLINE,

13 SY-VLINE, 'IND SECTOR',

28 SY-VLINE, 'UNITS',

43 SY-VLINE, 'PLANT',

55 SY-VLINE, 'MAT DESC',

68 SY-VLINE, 'LANGU',

70 SY-VLINE, 'SALES DOC ITEM',

95 SY-VLINE, 'MAT GROUP',

110 SY-VLINE, 'SALES DOC',

125 SY-VLINE, 'CUST ID',

140 SY-VLINE, 'NAME',

155 SY-VLINE, 'COUNTRY',

165 sy-vline, 'company code',

205 sy-vline, 'storge loc'.