‎2008 Nov 11 1:29 PM
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.
‎2008 Nov 11 1:49 PM
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.
‎2008 Nov 11 1:34 PM
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
‎2008 Nov 11 1:37 PM
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.
‎2008 Nov 11 1:49 PM
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.
‎2008 Nov 11 2:02 PM
>
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.