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

help needed in rewriting the code using inner joins

Former Member
0 Likes
828

Hi all,

I need help in rewriting this code

DATA : FLD LIKE ZTABLE-ZFLD,

FLD1 LIKE ZTABLE2-ZFLD2.

select single ZFLD from zTABLE1 into FLD

where MATNR = '123' and

werks = 'ABC'.

select single ZFLD1 from zTABLE2 into FLD1

where zFLD = FLD.

iS there way that we can write this with inner joins

Thanks

6 REPLIES 6
Read only

Former Member
0 Likes
795

ONLY if there is any common field in both the dtabase tables. like as below

SELECT aZFLB bZFLD1 from ZTABLE1 As a

INNER JOIN ZTABLE2 AS b ON aFIELDNAME EQ bFIELDNME.

otherwise he query u have written is correct.

hope this will help

Thanks

Ashwani

Read only

Former Member
0 Likes
795

Hello,

Do like this


SELECT SINGLE A~ZFLD B~ZFLD1 INTO ( FLD,FLD1) from ZTABLE1 AS A 
INNER JOIN ZTABLE2 AS B on A~FLD EQ B~FLD
WHERE MATNR EQ 123
and         WERKS EQ ABC

If useful reward

Read only

0 Likes
795

Hi,

help me out

TABLE 1 HAS

MATNR , WERKS , FLD1.

TABLE 2 HAS

FLD1, FLD2.

I KNOW MATNR AND WERKS BASED ON THAT I HAVE TO GET FLD2

I WANT IT BE WRITTEN WITH INNEWR JOINS

WITH FOLLOWING COD E I GET AN ERROR MESSAGE SAYING

comma without preccing colon (after select?)

data : FLD1 like zTABLE1-ZFLD1.

data : FLD2 like ZTABLE2-ZFLD2.

SELECT FZFLD1 BZFLD2

INTO ( FLD1, FLD2)

FROM ZTABLE1 AS F INNER JOIN ZTABLE2 AS B

ON FZFLD1 = BFLD2

WHERE F~MATNR = '123'

AND F~WERKS = 'ABC' .

Thanks

Read only

0 Likes
795

use

SELECT FZFLD1 BZFLD2

INTO (FLD1, FLD2)

FROM ZTABLE1 AS F INNER JOIN ZTABLE2 AS B

ON FZFLD1 = BFLD2

WHERE F~MATNR = '123'

AND F~WERKS = 'ABC' .

~Suresh

Read only

0 Likes
795

Hi Deepthi,

You need to give a comma after field by giving a space.

Try with this code.

SELECT FZFLD1 BZFLD2

INTO<b> ( FLD1 , FLD2 )</b>

FROM ZTABLE1 AS F INNER JOIN ZTABLE2 AS B

ON FZFLD1 = BFLD2

WHERE F~MATNR = '123'

AND F~WERKS = 'ABC' .

Thanks,

Vinay

Read only

Former Member
0 Likes
795

Hi,

Please try this.

SELECT FZFLD1 BZFLD2

<b>INTO (FLD1, FLD2)</b>

FROM ZTABLE1 AS F INNER JOIN ZTABLE2 AS B

ON FZFLD1 = BFLD2

WHERE F~MATNR = '123'

AND F~WERKS = 'ABC' .

Regards,

Ferry Lianto