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

problem inner join

Former Member
0 Likes
587

hi all,

i have join but some field are not populated in internal table lt_mseg (WERKS) .Here is join. Table MSEG contain value for werks.

 SELECT * FROM mseg
INNER JOIN mkpf ON mkpf~mblnr EQ mseg~mblnr AND mseg~mjahr EQ mkpf~mjahr
INNER JOIN mara ON mara~matnr EQ mseg~matnr
INNER JOIN lfa1 ON lfa1~lifnr EQ mseg~lifnr
INTO CORRESPONDING FIELDS OF TABLE lt_mseg
WHERE mkpf~budat IN datum
AND mseg~lifnr IN lifnr
AND mseg~bukrs IN bukrs
AND mseg~werks IN werks
AND mseg~matnr IN matnr
AND mara~mtart IN mtart
AND lfa1~land1 IN land1
AND ( bwart = '101' OR bwart = '105' ).

3 REPLIES 3
Read only

Former Member
0 Likes
548

I cant use select * from mseg

every field must me defined mseg.... mseg....

Read only

0 Likes
548

Right. If you have a join all the fields must be listed explicitly. If there's no join select * will work.

Read only

0 Likes
548

Not always, if the field names are unique across the joined tables OR always contain identical information anyway (like the fields used for the join conditions), then * will do.

OP had the problem because WERKS appears in both MSEG and LFA1, with probably different content.

Thomas