‎2007 Jun 26 11:12 AM
hi experts,
i wan to know how cud i fetch data from more than one table.should i use views for this..
regards
raman
‎2007 Jun 26 11:39 AM
hi
as per requirement u can access more than one table through join commands
there is 2 types of join, one inner join and another is outer join. this will solve the problem. if u need I can send the code also.
thanks
Roopesh
‎2007 Jun 26 11:16 AM
Hi,
U can fetch the data from more than one dbtable using select statement or creating a view.
Views are logical views on more than one table..
Check this link...
http://help.sap.com/saphelp_webas620/helpdata/en/cf/21ec5d446011d189700000e8322d00/content.htm
Look at the below link to create the Database view
http://help.sap.com/saphelp_40b/helpdata/en/cf/21ed06446011d189700000e8322d00/content.htm
Regards,
Priyanka.
‎2007 Jun 26 11:25 AM
thanx priyanka,
tell me how can i declare views in my program.
regards,
raman.
‎2007 Jun 26 11:37 AM
Hi Raman,
In the first link they have shown a example.Pls go through it, if doesn't help, reply back.
Best Regards
Kusum
PS: Reward all helpful answers.
‎2007 Jun 26 11:37 AM
Hi
You can fetch data from more than one table using JOINS
you join the table using key fields and fetch data
select amatnr amtart bwerks clgort
into table itab
from mara as a Join marc as b
on amatnr = bmatnr join MARD as d
on bmatnr = cmatnr and
bwerks = cwerks
where matnr in s_matnr.
Again You can create database View with more than one table and write a select to that view, again in that view tables are to be linked with key fields.
- Database View (SE11)
Database views are implement an inner join, that is, only records of the primary table (selected via the join operation) for which the corresponding records of the secondary tables also exist are fetched. Inconsistencies between primary and secondary table could, therefore, lead to a reduced selection set.
In database views, the join conditions can be formulated using equality relationships between any base fields. In the other types of view, they must be taken from existing foreign keys. That is, tables can only be collected in a maintenance or help view if they are linked to one another via foreign keys.
<b>Reward points for useful Answers</b>
Regards
Anji
‎2007 Jun 26 11:39 AM
hi
as per requirement u can access more than one table through join commands
there is 2 types of join, one inner join and another is outer join. this will solve the problem. if u need I can send the code also.
thanks
Roopesh
‎2007 Jun 26 11:55 AM