‎2007 Nov 15 5:01 AM
any one please help me to write a read statement for the following requirement.....
for example in an internal table we are having 10 records if first record is blank we should read from second record and if first record is not blank we should read it from first record.....
Thanks in advance..........
‎2007 Nov 15 5:07 AM
Hi Do Like this :
READ TABLE ITAB INDEX 1 INTO workarea1 .
READ TABLE ITAB INDEX 2 INTO workarea2 .
IF NOT workarea1 IS INITIAL .
PROCESS workarea1 .
ELSE.
PROCESS workarea2 .
ENDIF .
Please inform if there is some other req .
Hope this Helps .
Praveen
‎2007 Nov 15 5:03 AM
Hi,
No need to use read statement , loop on that internal table into work area
then check if work arear is initail or not.
Regards,
Prashant
‎2007 Nov 15 5:03 AM
read table itab into watab index 1.
if watab is initial.
read table itab into watab index 2.
endif.
‎2007 Nov 15 5:04 AM
You can do it with LOOP and CONTINUE combination
Loop at itab.
if itab-field1 is intial.
continue.
else.
* access data of itab.
exit.
endif.
endloop.Regards,
Naimesh Patel
‎2007 Nov 15 5:05 AM
loop at it into wa.
if wa is initial.
sy-index = s_index + 1.
read table it into wa sy-index s_index.
endif.
endloop.
‎2007 Nov 15 5:07 AM
Hi Do Like this :
READ TABLE ITAB INDEX 1 INTO workarea1 .
READ TABLE ITAB INDEX 2 INTO workarea2 .
IF NOT workarea1 IS INITIAL .
PROCESS workarea1 .
ELSE.
PROCESS workarea2 .
ENDIF .
Please inform if there is some other req .
Hope this Helps .
Praveen
‎2007 Nov 15 5:08 AM
U can loop at the internal table instead of using read statement......or still if u want to use read statement and want to consider first two records...then read by using index 1 and if it is blank then use index 2.
Regards,
Arun.