2007 Dec 27 2:22 PM
Hi Friends,
Please share your suggestions for better performance of the following code,
Please let me know where and all i need to change the code for better performance..
Note: The main object of the code is : we have three tables ( ztables) and we have to get some fields from all these three tables in to an internal table and to we have to write that internal table for display.
TO get the data u have some select options and parameters
(i mean where conditions..)
Thank you...
REPORT zmmtest.
TYPES: BEGIN OF ty_tab,
ss TYPE /glb/zgttroutval-sndsys,
if TYPE /glb/zgttroutval-interface,
ro TYPE /glb/zgttroutval-route_obj,
vl TYPE /glb/zgttroutval-value,
cg TYPE /glb/zgttroutval-cond_grp,
rl TYPE /glb/zgttroutval-rcv_list,
xp TYPE /glb/zgttroutobj-xpath,
fd TYPE /glb/zgttroutobj-field,
rn TYPE /glb/zgttrcvlist-rcv_num,
rs TYPE /glb/zgttrcvlist-rcvsys,
zod TYPE c,
END OF ty_tab.
DATA: ss, if, ro, vl, cg,rl, xp, fd, rn, rs.
DATA: wa_final TYPE ty_tab,
wa_output TYPE ty_tab,
wa_tab1 TYPE ty_tab,
wa_tab2 TYPE ty_tab,
wa_tab3 TYPE ty_tab.
DATA: int_tab1 TYPE STANDARD TABLE OF ty_tab,
int_tab2 TYPE STANDARD TABLE OF ty_tab,
int_tab3 TYPE STANDARD TABLE OF ty_tab.
SELECTION-SCREEN BEGIN OF BLOCK mysel WITH FRAME TITLE mm.
PARAMETERS: sndsys TYPE /glb/zgttroutval-sndsys,
intrface TYPE /glb/zgttroutval-interface,
routobj TYPE /glb/zgttroutval-route_obj,
value TYPE /glb/zgttroutval-value,
condgrp TYPE /glb/zgttroutval-cond_grp,
rcvlist TYPE /glb/zgttroutval-rcv_list.
PARAMETERS: x_path TYPE /glb/zgttroutobj-xpath,
field TYPE /glb/zgttroutobj-field.
PARAMETERS: rcvnum TYPE /glb/zgttrcvlist-rcv_num,
rcvsys TYPE /glb/zgttrcvlist-rcvsys.
SELECTION-SCREEN END OF BLOCK mysel.
**********************************************
SELECT SNDSYS INTERFACE ROUTE_OBJ VALUE COND_GRP RCV_LIST
FROM /glb/zgttroutval
INTO TABLE int_tab1.
SELECT xpath field
FROM /glb/zgttroutobj
INTO CORRESPONDING FIELDS OF TABLE int_tab2
FOR ALL ENTRIES IN int_tab1
WHERE route_obj = int_tab1-ro.
SELECT rcv_num rcvsys
FROM /glb/zgttrcvlist
INTO CORRESPONDING FIELDS OF TABLE int_tab3
FOR ALL ENTRIES IN int_tab1
WHERE rcv_list = int_tab1-rl.
loop at int_tab1
read table int_tab2.
WHERE int_tab2-route_obj = int_tab1-ro.
if sysubrc=0
read table int_tab2
WHERE int_tab2-rcv_list = int_tab1-rl
endif
Append
write itab1
endloop
SELECT aSNDSYS aINTERFACE aROUTE_OBJ aVALUE aCOND_GRP aRCV_LIST
bXPATH bFIELD
cRCV_NUM cRCVSYS
INTO CORRESPONDING FIELDS OF TABLE int_tab3
FROM ( ( /GLB/ZGTTROUTVAL AS a
INNER JOIN /GLB/ZGTTROUTOBJ AS b ON aROUTE_OBJ = bROUTE_OBJ )
INNER JOIN /GLB/ZGTTRCVLIST AS c ON aRCV_LIST = cRCV_LIST ).
***********************************************
WRITE: 5 'Sending_System', 25 'Sending_Interface', 50 'Rout_Object',
75 'Rout_Value', 100 'Condition_Group', 125 'Receiver_List',
150 'X_PATH', 175 'Field', 200 'Receiver_Number', 225 'Receiver_System'.
ULINE.
LOOP AT int_tab3 INTO wa_final.
IF ss IS NOT INITIAL.
IF wa_final-ss <> ss.
wa_final-zod = 'X'.
ENDIF.
ENDIF.
IF if IS NOT INITIAL.
IF wa_final-if <> if.
wa_final-zod = 'X'.
ENDIF.
ENDIF.
IF ro IS NOT INITIAL.
IF wa_final-ro <> ro.
wa_final-zod = 'X'.
ENDIF.
ENDIF.
IF vl IS NOT INITIAL.
IF wa_final-vl <> vl.
wa_final-zod = 'X'.
ENDIF.
ENDIF.
IF cg IS NOT INITIAL.
IF wa_final-cg <> cg.
wa_final-zod = 'X'.
ENDIF.
ENDIF.
IF rl IS NOT INITIAL.
IF wa_final-rl <> rl.
wa_final-zod = 'X'.
ENDIF.
ENDIF.
IF xp IS NOT INITIAL.
IF wa_final-xp <> xp.
wa_final-zod = 'X'.
ENDIF.
ENDIF.
IF fd IS NOT INITIAL.
IF wa_final-fd <> fd.
wa_final-zod = 'X'.
ENDIF.
ENDIF.
IF rn IS NOT INITIAL.
IF wa_final-rn <> rn.
wa_final-zod = 'X'.
ENDIF.
ENDIF.
IF rs IS NOT INITIAL.
IF wa_final-rs <> rs.
wa_final-zod = 'X'.
ENDIF.
ENDIF.
***********************************************
DELETE int_tab3 WHERE zod = 'X'.
LOOP AT int_tab3 into wa_output.
WRITE: / ss UNDER 'Sending_System',
if UNDER 'Sending_Interface',
ro UNDER 'Rout_Object',
vl UNDER 'Rout_Value',
cg UNDER 'Condition_Group',
rl UNDER 'Receiver_List',
xp UNDER 'X_PATH',
fd UNDER 'Field',
rn UNDER 'Receiver_Number',
rs UNDER 'Receiver_System'.
ENDLOOP.
ENDLOOP.
2007 Dec 27 4:08 PM
HI,
1.Dont use - INTO corresponding fields of table itab.
use- INTO table itab.
2.Dont use joins.
Regards,
Billa