10-28-2007 11:27 PM
Hi Gurus,
I need to create an abap program that takes i/p a database table(dbtable contains list of table names).The expected o/p is a DB table with tablename,co_code,total amt in local curr,amount in doc curr.
the following is my logic:
Select * from zmatlist into table it_tablist where zmatlist~tflag like ''. "condition to get list of table names from DB table
Loop at it_tablist into wa_tablist.
Select [distinct]co_code from (wa_tablist-tabname) into table it_cocode.
Loop at it_cocode into wa_cocode.
select amount curtype from (wa_tablist-tabname) into table it_amount where co_code = wa_cocode-cocode.
loop at it_amount into wa_amount.
if curtype eq '00'.
sum = sum + wa_amount-amount.
else.
total = total + wa_amount-amount.
endloop.
wa_result-tabname = wa_tablist-tabname.
wa_result-cocode = wa_cocode-cocode.
wa_result-AMTLC = sum.
wa_result-AMTDC = total.
Append wa_result to it_result.
Clear: sum,
total.
refresh: it_amount.
endloop.
refresh it_cocode.
Endloop.
when i am executing it,it is not able to recognise amount field.How to refer amount ,cocode here?
Am i writing it so complex?Is there any easy way to do it.Plz let me know if there is any.
Thanks,
Vijay.
10-28-2007 11:33 PM
Hi Vijay,
Welcome to SDN
Have you tried using field symbols for your requirement.
regards,
Atish
10-28-2007 11:44 PM
Hi Atish,
No i haven't tried with field symbols.I am not familiour with them.But i am wondering how come it is not able to identify amount,co_code when i am refering to a single table in each select stmt.
Thanks,
Vijay.