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

Select count (*)

Former Member
0 Likes
666

Hi all,

I have got 3 tables to select data from, how can I join them, and also need to check a field on each table,get the total count of the records!

Regards,

Bharat

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
620

Here is how you Join 3 tables.

MARA. MAKT, MARC are the tables to join.

select amatnr baedat bmaktx cwerks

from ( mara as a inner join makt as b

on bmatnr = amatnr )

inner join marc as c

on cmatnr = amatnr

into table itab.

For joining more than two tables, the result set of a join of two tables has to be joined to the third and the same continues for more tables.

To get the total number of records of field, you can use the System defined data object SY-DBCNT after the select statement.

4 REPLIES 4
Read only

sudhindra_chandrashekar
Product and Topic Expert
Product and Topic Expert
0 Likes
620

Hi,

Use this to get used to joins:

http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb39c4358411d1829f0000e829fbfe/frameset.htm

To get the total count of the records you can use the system field SY-TABIX.

Hpoe this helps,

Sudhi

Read only

Former Member
0 Likes
621

Here is how you Join 3 tables.

MARA. MAKT, MARC are the tables to join.

select amatnr baedat bmaktx cwerks

from ( mara as a inner join makt as b

on bmatnr = amatnr )

inner join marc as c

on cmatnr = amatnr

into table itab.

For joining more than two tables, the result set of a join of two tables has to be joined to the third and the same continues for more tables.

To get the total number of records of field, you can use the System defined data object SY-DBCNT after the select statement.

Read only

former_member194669
Active Contributor
0 Likes
620

If you have proper key for select then go for join

other wise

make 3 separate select and

use describe command to count.

aRs

Read only

Former Member
0 Likes
620

Thats done. Thanks for all inputs.