‎2007 Jun 12 6:09 AM
Hi,
I waned to use read table as follows :
read table ITAB with key kschl = 'JOCM' kschl = 'JOC1'
kschl = 'JET1'.
But its not possible.
Any alternative??
reagrds,
‎2007 Jun 12 6:11 AM
Hi,
You can use LOOP AT ..EXIT..ENDLOOP..
LOOP AT ITAB WHERE kschl = 'JOCM' OR kschl = 'JOC1' OR
kschl = 'JET1'.
EXIT.
ENDLOOP.
IF SY-SUBRC = 0.
** Record found.
ELSE.
** record not found..
ENDIF.
Thanks,
Naren
‎2007 Jun 12 6:11 AM
Hi,
You can use LOOP AT ..EXIT..ENDLOOP..
LOOP AT ITAB WHERE kschl = 'JOCM' OR kschl = 'JOC1' OR
kschl = 'JET1'.
EXIT.
ENDLOOP.
IF SY-SUBRC = 0.
** Record found.
ELSE.
** record not found..
ENDIF.
Thanks,
Naren
‎2007 Jun 12 6:12 AM
loop at itab where kschl = 'JOCM' OR
kschl = 'JOC1' OR
kschl = 'JET1'.
endloop.
‎2007 Jun 12 6:13 AM
hi sachin,
try like this,
read table ITAB with key kschl = 'JOCM' 'JOC1' 'JET1'.
regards,
seshu.
‎2007 Jun 12 6:14 AM
Hi,
We can not use the Read table with more than 1 equality for a Field, instead of this you can use the LOOP statment, if the loop success then use the exit statment to exit from the loop to aviod more loopings.
Regards
Sudheer
‎2007 Jun 12 6:14 AM
loop at itab.
if itab-kschl = 'JOCM' or
itab-kschl = 'JOC1' or
itab-kschl = 'JET1'.
,,,,,,,,,,,,,,,,,,,,,,,,<write ur code here based on the validation>
endif.
endloop.Regards
Gopi
‎2007 Jun 12 6:14 AM
hi,
Use Loop statment ...
i.e,
LOOP AT ITAB WHERE KSCHL = 'JOCM' OR
KSCHL = 'JOC1' OR
KSCHL = 'JET1'.
ENDLOOP.
‎2007 Jun 12 6:17 AM
hi,
You can use
loop at itab into wa_itab where kschl in( 'JOCM' , 'JOC1' , 'JET1' ).
regards,
sudha
‎2007 Jun 12 6:18 AM
LOOP AT ITAB .
if ITAB-kschl = 'JOCM' OR ITAB -kschl = 'JOC1' OR ITAB-kschl = 'JET1'.
Endif .
ENDLOOPGirish
‎2007 Jun 12 6:20 AM
hi,
try like this
read table ITAB with key kschl = 'JOCM' [and/or] kschl = 'JOC1'
[and/or] kschl = 'JET1'.
or
loop at itab where kschl = 'JOCM' [or] kschl = 'JOC1'
[or] kschl = 'JET1'.
if sy-subrc eq 0.
write:/10 itab-kschl.
endif.
endloop.
if helpful reward some points.
with regards,
suresh.
‎2007 Jun 12 6:20 AM
read table ITAB with key kschl = 'JOCM'.
if sy-subrc <> 0.
read table ITAB with key kschl = 'JOC1'.
if sy-subrc <> 0.
read table ITAB with key kschl = 'JET1'.
endif.
endif.
‎2007 Jun 12 6:24 AM
Hi,
You cannot use 3 or more values for a single field in a read statement. Looping at the table can be some times very expensive if the size of the table is very large. One more alternative is..
read table ITAB with key kschl = 'JOCM'.
if sy-subrc <> 0.
read table ITAB with key kschl = 'JOC1'.
if sy-subrc <> 0.
read table ITAB with key kschl = 'JET1'.
endif.
endif.Using Binary search in this case will be very helpful.
Regards,
Richa