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

read ( or) loop stements

Former Member
0 Likes
483

hi abapers,

iam select some data base tables.

and

select quries completed for every tables and joined by for all entries conditions.

my problem is ?

move the all table fields values into final table at that time some tables contains so many no of records based

on different types of conditions.

so thats why i used read statement or loop statement.

please explain some example codeing.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
462

Hi Raj Ram,

You can do it in this way also:

Move all the entries of any of internal table to final report table and then read all other internal tables inside loop. Before ENDLOOP statement use modify statement to update the final report table. Modify statement is combination of update and insert both,if same entry will be in final table then it will update it otherwise it will create a new entry.

Hope this will help you.

4 REPLIES 4
Read only

Former Member
0 Likes
462

Hello,

If you have a problem that you do not know which table will fetch you the maximum number of records then use the DESCRIBE command to get the number of entries in your each internal table and store them in different variables. Now you need to find out which variable is the highest amoung them (build a if elseif endif logic for that).

After you find this use the DO X times ... ENDDO loop with X = Maximum value which you get from internal table which hold maximum records.

Read all the tables inside this Do.. Enddo loop.

Hope it helps.

Thanks,

Jayant

Read only

Former Member
0 Likes
462

Use loop and read.

Loop at i_table into wa_i_table.

  • If you have validations with others i_tables

read i_tableb into wa_i_tableb with key key_a = wa_i_table-key_a.

check sy-subrc is initial

endloop.

Read only

Former Member
0 Likes
463

Hi Raj Ram,

You can do it in this way also:

Move all the entries of any of internal table to final report table and then read all other internal tables inside loop. Before ENDLOOP statement use modify statement to update the final report table. Modify statement is combination of update and insert both,if same entry will be in final table then it will update it otherwise it will create a new entry.

Hope this will help you.

Read only

0 Likes
462

>

Modify statement is combination of update and insert both,if same entry will be in final table then it will update it otherwise it will create a new entry.

this is true in case of database table, but NOT in case of internal tables... MODIFY does not create new entries in internal tables (that is done by INSERT), only changes existing ones.