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

Join statement with for all entries

Former Member
0 Likes
833

Hi

Can I write a Inner join with for all entires of some X itab?

Thanks

Kiran

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
816

Yes

Hi

Can I write a Inner join with for all entires of some X itab?

Thanks

Kiran

5 REPLIES 5
Read only

Former Member
0 Likes
817

Yes

Read only

0 Likes
816

My Local Kunnr itab structure:

TYPES: BEGIN OF l_t_kunnr,

kunnr TYPE kna1-kunnr,

END OF l_t_kunnr,

My normal kunnr tab structure:

TYPES: BEGIN OF t_kna1, " Customer Master data

kunnr TYPE kna1-kunnr,

adrnr TYPE kna1-adrnr,

ktokd TYPE kna1-ktokd,

loevm TYPE kna1-loevm,

cstat TYPE knkk-crblb,

END OF t_kna1,

My Join Stmt:

SELECT a~kunnr " Customer no

a~adrnr " Address no

a~ktokd " Customer type

a~loevm " deletion key

FROM kna1 as a inner join knvv as b

on akunnr eq bkunnr

INTO TABLE i_kna1

for all entries in l_i_kunnr[]

WHERE a~kunnr IN l_i_kunnr

and b~vkorg in s_vkorg.

It gives me an error that line structure of my local kunnr itab is incorrect.

Pl lemme know

Thanks

Kiran

Read only

0 Likes
816

hi,

Change your code ... as shown below

SELECT a~kunnr " Customer no

a~adrnr " Address no

a~ktokd " Customer type

a~loevm " deletion key

FROM kna1 as a inner join knvv as b

on akunnr eq bkunnr

INTO TABLE i_kna1

for all entries in l_i_kunnr

WHERE a~kunnr = l_i_kunnr-kunnr

and b~vkorg in s_vkorg.

Read only

0 Likes
816

hi,

Also check if the table is empty or not statement ...

if not i_kna1[] is initial.

SELECT a~kunnr " Customer no

a~adrnr " Address no

a~ktokd " Customer type

a~loevm " deletion key

FROM kna1 as a inner join knvv as b

on akunnr eq bkunnr

INTO TABLE i_kna1

for all entries in l_i_kunnr

WHERE a~kunnr = l_i_kunnr-kunnr

and b~vkorg in s_vkorg.

endif.

Read only

Former Member
0 Likes
816

yes it is possible, you can combine joins and for all entries together. make sure when you are using the for all entries , you check the table initial condition, and also take temp table , assign all value to it. delete the duplicates and use this in for all entries.