Application Development and Automation 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: 
Read only

reading data from an internal table

Former Member
0 Likes
351

Hi

I have an internal table with 4 columns and the second column has values like shown below

A

B

C

D

1

2

3

D

1

2

3

4

D

1

2

3

4

5

i want to loop throught this table and take the values starting from first D to next D ( i.e., D, 1,2,3 ) into another internal table and do some processing. Next time i want to take D,1,2,3,4 into the same internal table and next time D,1,2,3,4,5 into that internal table. how do i do this??

thanks

sankar

1 ACCEPTED SOLUTION
Read only

franois_henrotte
Active Contributor
0 Likes
329

LOOP AT wt_table1 INTO wa_table1.
  IF wa_table1-field = 'D'.
    IF wt_table2 IS NOT INITIAL.
      PERFORM f_do_something TABLES wt_table2.
      REFRESH wt_table2.
    ENDIF.
    APPEND wa_table1 TO wt_table2.
  ELSE.
    IF wt_table2 IS NOT INITIAL.
      APPEND wa_table1 TO wt_table2.
    ENDIF.
  ENDIF.
ENDLOOP.
IF wt_table2 IS NOT INITIAL.
  PERFORM f_do_something TABLES wt_table2.
ENDIF.
1 REPLY 1
Read only

franois_henrotte
Active Contributor
0 Likes
330

LOOP AT wt_table1 INTO wa_table1.
  IF wa_table1-field = 'D'.
    IF wt_table2 IS NOT INITIAL.
      PERFORM f_do_something TABLES wt_table2.
      REFRESH wt_table2.
    ENDIF.
    APPEND wa_table1 TO wt_table2.
  ELSE.
    IF wt_table2 IS NOT INITIAL.
      APPEND wa_table1 TO wt_table2.
    ENDIF.
  ENDIF.
ENDLOOP.
IF wt_table2 IS NOT INITIAL.
  PERFORM f_do_something TABLES wt_table2.
ENDIF.