Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

regarding read statement

Former Member
0 Kudos

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..........

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

6 REPLIES 6

former_member386202
Active Contributor
0 Kudos

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

former_member223537
Active Contributor
0 Kudos


read table itab into watab index 1.
if watab is initial.
read table itab into watab index 2.
endif.

naimesh_patel
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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.