‎2007 May 03 10:20 AM
Hi Everyone,
If there anyway can help me to improve the performance to my below "FOR ALL ENTRIES "code.
How to I apply the following sample code in? Please kindly guide.Thanks.
Sample code...
<b>i_ausp2[]=i_ausp[]
delete i_ausp2 where atinn is initial.</b>
ausp tables
SELECT objek mafid klart atinn atwrt ataw1
INTO CORRESPONDING FIELDS OF TABLE i_ausp
FROM ausp
WHERE objek IN s_objek AND klart IN s_klart.
ksml tables
SELECT imerk clint FROM ksml
INTO TABLE i_ksml FOR ALL ENTRIES IN i_ausp
WHERE imerk = i_ausp-atinn.
SORT i_ksml BY imerk.
kssk tables
SELECT objek clint stdcl FROM kssk
INTO TABLE i_kssk FOR ALL ENTRIES IN i_ausp
WHERE objek = i_ausp-objek.
klah tables
SELECT clint class klart FROM klah
INTO TABLE i_klah FOR ALL ENTRIES IN i_kssk
WHERE clint = i_kssk-clint.
‎2007 May 03 11:03 AM
HI,
Last two select queries can be combined by using inner join for the tables<b> kssk</b> and <b>klah</b>.
if i_ausp[] is not initial.
select kssk~objek
kssk~clint
kssk~stdcl
klah~class
klah~klart
from kssk as kssk
inner join klah
as klah
on klahclint eq ksskclint
into table i_kssk_klah
for all entries in i_ausp
where ksskobjek eq i_auspobjek.
endif.
don't forgot to check wheather table is initial or not before using for all entries in select query.
‎2007 May 03 10:24 AM
ausp tables
<b>if s_klart[] is not initial.</b>
SELECT objek mafid klart atinn atwrt ataw1
INTO CORRESPONDING FIELDS OF TABLE i_ausp
FROM ausp
WHERE objek IN s_objek AND klart IN s_klart.
<b>endif.</b>
ksml tables
<b>if i_ausp[] is not initial.</b>
SELECT imerk clint FROM ksml
INTO TABLE i_ksml FOR ALL ENTRIES IN i_ausp
WHERE imerk = i_ausp-atinn.
<b>endif.</b>
SORT i_ksml BY imerk.
kssk tables
<b>if i_ausp[] is not initial.</b>
SELECT objek clint stdcl FROM kssk
INTO TABLE i_kssk FOR ALL ENTRIES IN i_ausp
WHERE objek = i_ausp-objek.
<b>endif.</b>
klah tables
<b>if i_kssk[] is not initial.</b>
SELECT clint class klart FROM klah
INTO TABLE i_klah FOR ALL ENTRIES IN i_kssk
WHERE clint = i_kssk-clint.
<b>endif.</b>
Regards
prabhu
‎2007 May 03 10:55 AM
Hi,
While i apply ur code in....i get the error message "Incorrect logical expression: comparison/Selec-option can oonly be followed by "AND", "OR", or ")".
Could I know wat goes wrong with it? thanks.
‎2007 May 03 11:03 AM
HI,
Last two select queries can be combined by using inner join for the tables<b> kssk</b> and <b>klah</b>.
if i_ausp[] is not initial.
select kssk~objek
kssk~clint
kssk~stdcl
klah~class
klah~klart
from kssk as kssk
inner join klah
as klah
on klahclint eq ksskclint
into table i_kssk_klah
for all entries in i_ausp
where ksskobjek eq i_auspobjek.
endif.
don't forgot to check wheather table is initial or not before using for all entries in select query.
‎2007 May 03 12:34 PM
Hi ,
It is always a good practice and improves the program performance , wether it is initial or not when your using for all entries.
regards,
sharath
‎2007 May 03 8:51 PM
&----
*& Report ZTEST1 *
*& *
&----
*& *
*& *
&----
REPORT ztest1 .
----
TABLES
----
TABLES: ausp.
----
DATA DECLARATION
----
DATA: BEGIN OF i_ausp OCCURS 0,
objek TYPE ausp-objek,
mafid TYPE ausp-mafid,
klart TYPE ausp-klart,
atinn TYPE ausp-atinn,
atwrt TYPE ausp-atwrt,
ataw1 TYPE ausp-ataw1,
END OF i_ausp,
BEGIN OF i_ksml OCCURS 0,
imerk TYPE ksml-imerk,
clint TYPE ksml-clint,
posnr TYPE ksml-posnr,
adzhl TYPE ksml-adzhl,
END OF i_ksml,
BEGIN OF i_kssk OCCURS 0,
objek TYPE kssk-objek,
clint TYPE kssk-clint,
stdcl TYPE kssk-stdcl,
mafid TYPE kssk-mafid,
klart TYPE kssk-klart,
adzhl TYPE kssk-adzhl,
END OF i_kssk,
BEGIN OF i_klah OCCURS 0,
clint TYPE klah-clint,
class TYPE klah-class,
klart TYPE klah-klart,
END OF i_klah,
i_ausp_tmp LIKE TABLE OF i_ausp,
i_kssk_tmp LIKE TABLE OF i_kssk.
----
SELECTION-SCREEN
----
SELECT-OPTIONS: s_objek FOR ausp-objek ,
s_klart FOR ausp-klart.
----
START-OF-SELECTION
----
START-OF-SELECTION.
SELECT objek
mafid
klart
atinn
atwrt
ataw1
FROM ausp
INTO TABLE i_ausp
WHERE objek IN s_objek
AND klart IN s_klart.
IF sy-subrc EQ 0.
SORT i_ausp BY objek.
i_ausp_tmp[] = i_ausp[].
DELETE ADJACENT DUPLICATES FROM i_ausp_tmp COMPARING objek.
kssk tables
SELECT objek
clint
stdcl
mafid
klart
adzhl
FROM kssk
INTO TABLE i_kssk
FOR ALL ENTRIES IN i_ausp_tmp
WHERE objek EQ i_ausp_tmp-objek.
IF sy-subrc EQ 0.
SORT i_kssk BY clint.
DELETE ADJACENT DUPLICATES FROM i_kssk_tmp COMPARING clint.
SELECT clint
class
klart
FROM klah
INTO TABLE i_klah
FOR ALL ENTRIES IN i_kssk_tmp
WHERE clint EQ i_kssk_tmp-clint.
IF sy-subrc EQ 0.
SORT i_klah BY clint.
ENDIF.
ENDIF.
i_ausp_tmp[] = i_ausp[].
SORT i_ausp_tmp BY atinn.
DELETE ADJACENT DUPLICATES FROM i_ausp_tmp COMPARING atinn.
ksml tables
SELECT imerk
clint
posnr
adzhl
FROM ksml
INTO TABLE i_ksml
FOR ALL ENTRIES IN i_ausp_tmp
WHERE imerk EQ i_ausp_tmp-atinn.
IF sy-subrc EQ 0.
SORT i_ksml BY imerk.
ENDIF.
ENDIF.