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

NEED HELP.

Former Member
0 Likes
675

I have three table eban, ebkn, anla.

eban has four fields,

ebkn has one fields,

anla has one fields to retreive,

I hv created one structure for that.

Now I am in confusion that hw i will write select statement......

plz tell me hw to write select statement for that...

thanks....

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
639

Hi,

You can use the Inner join and also use the For all entries ....

select EBAN-Field1 EBAN-Fiel2 EBAN-Fiel3 EBAN-Field4

EBKN-FIELD1 EBKN-FIELD2 EBKN-FIELD3

ANLA-FIELD1 ANLA-FIELD2 ANLA-FIELD3 ANLA-FIELD4

into it_lista

from EBAN inner join EBKN

on EBAN-Field1 = EBKN-FIELD1

and EBKN-FIELD2 = EBKN-FIELD2

inner join ANLA

on EBAN-Field1 = EBAN-Field1

where ANLA-FIELD4 = '04'.

Regards

Sudheer

4 REPLIES 4
Read only

Former Member
0 Likes
640

Hi,

You can use the Inner join and also use the For all entries ....

select EBAN-Field1 EBAN-Fiel2 EBAN-Fiel3 EBAN-Field4

EBKN-FIELD1 EBKN-FIELD2 EBKN-FIELD3

ANLA-FIELD1 ANLA-FIELD2 ANLA-FIELD3 ANLA-FIELD4

into it_lista

from EBAN inner join EBKN

on EBAN-Field1 = EBKN-FIELD1

and EBKN-FIELD2 = EBKN-FIELD2

inner join ANLA

on EBAN-Field1 = EBAN-Field1

where ANLA-FIELD4 = '04'.

Regards

Sudheer

Read only

Former Member
0 Likes
639

Hi,

You can use the following selects for better performance

select fld1 fld2 from itab_eban

where....

if sy-subrc = 0.

select fld 1 ..

from ebkn

for all entries in itab_eban

where banfn =itab_eban-banfn

and bnfpo = itab_eban-bnfpo

endif.

... similarly with the rest of the tables

Please reward it it helps

Regards

Read only

Former Member
0 Likes
639

select ff1 ff2 ff3 ff4 gf5 hf6 into table itab from eban as f inner join ebkn as g on eban-abcd = ebkn-abcd inner join enla as h on ebkn-abcd = enla-abcd.

wher abcd are the common fields in the given tables.

Cheers.

Read only

former_member189629
Active Contributor
0 Likes
639

Hi Chang,

You may use JOINS in this case, using the keys BANFN and BNFPO to relate the tables EBAN & EBKN. Coming to ANLA, you will have to look for the relevant PK/FK to relate it with these tables.

samlpe code using joins

select

eban~f1

eban~f2

eban~f3

eban~f4

ebkn~f1

ebkn~f2

ebkn~f3

from eban as eban

inner join ebkn as ebkn

for all entries in <comparision tab>

where <your where condition>.

if sy-subrc = 0.

  • Check if the SELECT is successful

endif.

Please Close this thread.. when your problem is solved

Reward if Helpful

Regards

Karthik