2007 Sep 13 9:27 AM
Hey,
i have following code:
LOOP AT itab 1.
LOOP AT itab2.
CHECK itab1-object EQ itab2-object.
CHECK itab1-name NE itab2-name.
CHECK itab1-name(10) NE 'BCDE_BUKRS'.
CHECK itab1-name(10) NE 'BCDE_KRED_'.
CHECK itab1-name(10) NE 'BCDE_BLART'.
CHECK itab1-name(10) NE 'BCDE_DOKUA'.
CHECK itab1-name(10) NE 'BCDE_DEBI_'.
CHECK itab1-name(10) NE 'BCDE_SAKTO'.
Append something.
ENDLOOP.
ENDLOOP.
Is it better and possible to use case instead of check?
Or is it better to use if´s ?
Any idea?
2007 Sep 13 9:32 AM
I think.. it's better to use if..
If ( itab1-object EQ itab2-object ) and ( itab1-name NE itab2-name ) and ( itab1-name(10) NE 'BCDE_BUKRS' ) and ( itab1-name(10) NE 'BCDE_KRED_' ) and ( itab1-name(10) NE'BCDE_BLART' ) and ( itab1-name(10) NE 'BCDE_DOKUA' ) and ( itab1-name(10) NE 'BCDE_DEBI_' ) and ( itab1-name(10) NE 'BCDE_SAKTO').
append something.
endif.
But using check it's okay also..
Hey,
i have following code:
LOOP AT itab 1.
LOOP AT itab2.
CHECK itab1-object EQ itab2-object.
CHECK itab1-name NE itab2-name.
CHECK itab1-name(10) NE 'BCDE_BUKRS'.
CHECK itab1-name(10) NE 'BCDE_KRED_'.
CHECK itab1-name(10) NE 'BCDE_BLART'.
CHECK itab1-name(10) NE 'BCDE_DOKUA'.
CHECK itab1-name(10) NE 'BCDE_DEBI_'.
CHECK itab1-name(10) NE 'BCDE_SAKTO'.
Append something.
ENDLOOP.
ENDLOOP.
Is it better and possible to use case instead of check?
Or is it better to use if´s ?
Any idea?
2007 Sep 13 9:32 AM
I think.. it's better to use if..
If ( itab1-object EQ itab2-object ) and ( itab1-name NE itab2-name ) and ( itab1-name(10) NE 'BCDE_BUKRS' ) and ( itab1-name(10) NE 'BCDE_KRED_' ) and ( itab1-name(10) NE'BCDE_BLART' ) and ( itab1-name(10) NE 'BCDE_DOKUA' ) and ( itab1-name(10) NE 'BCDE_DEBI_' ) and ( itab1-name(10) NE 'BCDE_SAKTO').
append something.
endif.
But using check it's okay also..
2007 Sep 13 9:41 AM
loop at itab2
where itab1-object EQ itab2-object
and itab1-name NE itab2-name
and ...
and itab1-name(10) NE 'BCDE_SAKTO'.
endloop.
2007 Sep 13 9:45 AM
Hello Sascha,
If the nested loops are inevitable please do the following to improve performance
data : local1(10) type C value 'BCDE_BUKRS' ,
local2(10) type C value 'BCDE_KRED_' ,
local3(10) type C value 'BCDE_BLART' ,
local4(10) type C value 'BCDE_DOKUA' ,
local5(10) type C value 'BCDE_DEBI_' ,
local6(10) type C value 'BCDE_SAKTO'.,
LOOP AT itab1 where
itab1-name(10) NE local1 and
itab1-name(10) NE local2 and
itab1-name(10) NE local3 and
itab1-name(10) NE local4 and
itab1-name(10) NE local5 and
itab1-name(10) NE local6 .
loop at itab2 where
itab1-object = itab2-object and
itab1-name <> itab2-name .
append *.
endloop.
endloop.
Please check and revert..reward if helpful
Regards
Byju
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |