‎2008 Oct 29 3:16 PM
Hi,
I am sap abap/4 consultant working ina small firm in new delhi India. I am working on the fnancial report generation program ion abap/4.I am using the tables 'ska1','skat','bseg' tables. I am finding problem in fetching data from bseg table because the field 'saknr' i.e, G/L A/c number which primary key in both tables ska1 and skat but not in bseg. My question is how to fetch records from the two tables when no common primary key is exists? This is my first problem.
My second problem is I find the field hkont in bseg table which is reference from the table skb1 with key saknr.but the values in hkont in bseg table didnot match with values in saknr of ska1 table.
Please give me the solution of these two tables mentioned above.
I am very greatful to you.
<<removed by moderator>>
‎2008 Oct 29 3:36 PM
‎2008 Oct 29 3:46 PM
Hi Pankaj,
Hearty Welcome to SDN.
There will be link between the tables that you mentioned, currently i am not having SAP system to tell the links... but the concept i can make you clear.
Start searching such that in one table primary key field which is present has to be present in another table as normal field so that by using FOR ALL ENTRIES in the select statement you can fetch the data.
Cheers!!
VEnk@
‎2008 Oct 30 3:28 AM
Hi,
As i understand u want the common data between the 3 tables
use like this....
Select * from databse table into table internal table 1 (ska1)
Select * from databse table into table internal table 2 (s--)
Now two internal tables get populated with key field ,
in order to keep only common data b/w them use
Loop at table 1
Read table 2 with key table2-key field = table1-keyfield.
if sy-subrc <> 0.
Delete from internal table 2.
endif.
endloop.
With this peace of code u get common key fields in internal table 2. now
select from database table 3 into table internal table 3
for all entries in internal table 2
where (fields to be matched)
-
For the second problem u can directly refer database tables
table 1-field = table2-field.
Thanks & regards
Ruchi Tiwari
Edited by: Ruchi Tiwari on Oct 30, 2008 4:31 AM
‎2008 Oct 30 3:37 AM