Application Development 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: 

Select query

Former Member
0 Kudos

Hi in my requirement i want to get the o/p which contains the fields bukrs,belnr,gjahr,koart,shkzg,anln2,bzdat and also waers and hwae2.All the fields are present in bseg table except the 2 fields waers and hwae2.For the field dmbtr the ref field is waers and for the field BDIF2 the ref field is hwae2.How to write the select query to fetch these 2 fields.Please help

1 ACCEPTED SOLUTION

Former Member
0 Kudos

select bsegbukrs......bsegbzdat <tablename>waers <tablename>haew2 into table itab from bseg inner join table <tablename> on condition

where input condition also u need to mention

hope this will help u

but the thing is both table should have a common field with same domain check

and u should now the table name

here all <tablename> are same

8 REPLIES 8

Former Member
0 Kudos

pls explain it again..

will try to help u

0 Kudos

Hi in my o/p i want to fetch waers and hwae2 fields along with some other fields from bseg table.The fields waere and hwae2 is not present in bseg table but when you look in the bseg table these are the fields DMBTR and BDIF2 which contains waers and hwae2 as ref field(inorder to see the ref field you can double click on the fields dmbtr and bdif2.

0 Kudos

what are the selection parameters so i can add it in the where clause.

0 Kudos

in the where codn I have to put the report date which I have fetched.Can you please tell the select query part excluding the where codn.

0 Kudos

Hi,

Refer this link , Gautham Chakraverthi clearly given the select statements how to fetch waers and hwae2 from different tables

former_member585060
Active Contributor
0 Kudos

Hi,

Try to look at this message it might help you, it gives you the alternate tables to fetch all the fields you specified.

Regards

Bala Krishna

Former Member
0 Kudos

select bsegbukrs......bsegbzdat <tablename>waers <tablename>haew2 into table itab from bseg inner join table <tablename> on condition

where input condition also u need to mention

hope this will help u

but the thing is both table should have a common field with same domain check

and u should now the table name

here all <tablename> are same

0 Kudos

>

> select bsegbukrs......bsegbzdat <tablename>waers <tablename>haew2 into table itab from bseg inner join table <tablename> on condition

> where input condition also u need to mention

> hope this will help u

unfortunately it won't...

BSEG is cluster table, which means you cannot use in JOIN

waers and hwae2 will come from BKPF table: you either select from BSEG and BKPF in two separate steps (and merge the data later into one internal table) or instead of BSEG you can join BSIS/BSAS, BSID/BSAD, BSIK/BSAK (depending on your exact needs) with BKPF.