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 with join / explicit field declaration does not work

Former Member
0 Likes
504

Hello together,

there is something I do not understand about the join. I have a join over two tables (see below). The field AENAM exists in both tables but I want to have it coming from ZDPP_VERBRAUCEFF.

BUT the system gives me the values from MARA although I define the source ZDPP_VERBRAUCEFF.

SELECT zdpp_verbrauceff~mandt

zdpp_verbrauceff~matnr

zdpp_verbrauceff~zzmdv01

zdpp_verbrauceff~begda

zdpp_verbrauceff~endda

zdpp_verbrauceff~vmeng

zdpp_verbrauceff~vmeng_m

zdpp_verbrauceff~aenam "Problem

zdpp_verbrauceff~aedat

zdpp_verbrauceff~aezet

zdpp_verbrauceff~prfdt

zdpp_verbrauceff~prfzt

FROM zdpp_verbrauceff

INNER JOIN mara

ON zdpp_verbrauceffmatnr = maramatnr

INTO TABLE lt_ver_db

WHERE zdpp_verbrauceff~zzmdv01 IN s_mdv01

AND zdpp_verbrauceff~begda <= s_datum-high

AND zdpp_verbrauceff~endda >= s_datum-low

AND mara~mtart IN s_mtart

AND mara~matnr IN s_matnr.

Can anybody tell me what I doing wrong?

Thanks in advance,

Sebastian

3 REPLIES 3
Read only

Former Member
0 Likes
475

hi,

Please check the link.

[http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ec77446011d189700000e8322d00/content.htm]

Read only

Former Member
0 Likes
475

Hi,

Add this below in where condition.

SELECT zdpp_verbrauceff~mandt

.

.

.

ON zdpp_verbrauceffmatnr = maramatnr

INTO TABLE lt_ver_db

WHERE zdpp_verbrauceff~matnr IN s_matnr

AND zdpp_verbrauceff~zzmdv01 IN s_mdv01

AND zdpp_verbrauceff~begda <= s_datum-high

AND zdpp_verbrauceff~endda >= s_datum-low

AND mara~matnr IN s_matnr

AND mara~mtart IN s_mtart.

Regards,

Srini.

Read only

former_member201275
Active Contributor
0 Likes
475

Can you try change the statment sequence as I have below and see if this works i.e:

SELECT zdpp_verbrauceff~mandt

zdpp_verbrauceff~matnr

zdpp_verbrauceff~zzmdv01

zdpp_verbrauceff~begda

zdpp_verbrauceff~endda

zdpp_verbrauceff~vmeng

zdpp_verbrauceff~vmeng_m

zdpp_verbrauceff~aenam "Problem

zdpp_verbrauceff~aedat

zdpp_verbrauceff~aezet

zdpp_verbrauceff~prfdt

zdpp_verbrauceff~prfzt

FROM zdpp_verbrauceff

INTO TABLE lt_ver_db "LINE MOVED to here

INNER JOIN mara

ON zdpp_verbrauceffmatnr = maramatnr

WHERE zdpp_verbrauceff~zzmdv01 IN s_mdv01

AND zdpp_verbrauceff~begda <= s_datum-high

AND zdpp_verbrauceff~endda >= s_datum-low

AND mara~mtart IN s_mtart

AND mara~matnr IN s_matnr.

Regards,

Warren.