Application Development 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: 

explain select statemtent

Former Member
0 Kudos

Hi,

Please explain me below select statement.

SELECT s~aufnr

s~bismt

s~gmein

s~plnbez

FROM ZMat AS s

INTO TABLE it_afko

FOR ALL ENTRIES IN it_mara

WHERE plnbez EQ it_mara-matnr

AND exists ( SELECT a~aufnr FROM aufk AS a JOIN jest AS b ON

aobjnr = bobjnr

WHERE aaufnr EQ saufnr

AND a~werks EQ p_werks)

Regards,

Suresh

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

SELECT s~aufnr

s~bismt

s~gmein

s~plnbez

FROM ZMat AS s

INTO TABLE it_afko

FOR ALL ENTRIES IN it_mara

WHERE plnbez EQ it_mara-matnr

AND exists ( SELECT a~aufnr FROM aufk AS a JOIN jest AS b ON

aobjnr = bobjnr

WHERE aaufnr EQ saufnr

AND a~werks EQ p_werks)

Getting the entries from Zmat only if the entry corresponding to the aufnr exist in the aufk and jest tables.

2 REPLIES 2

Former Member
0 Kudos

hi,

SELECT s~aufnr

s~bismt

s~gmein

s~plnbez

FROM ZMat AS s

INTO TABLE it_afko

FOR ALL ENTRIES IN it_mara

WHERE plnbez EQ it_mara-matnr

AND exists ( SELECT a~aufnr FROM aufk AS a JOIN jest AS b ON

aobjnr = bobjnr

WHERE aaufnr EQ saufnr

AND a~werks EQ p_werks)

Getting the entries from Zmat only if the entry corresponding to the aufnr exist in the aufk and jest tables.

Former Member
0 Kudos

Hi,

The above query specifies that it will select data from the table ZMat

if the data for the below query i.e getting data from AUFK and Jest will exist on the given condition

SELECT a~aufnr FROM aufk AS a JOIN jest AS b ON

aobjnr = bobjnr

WHERE aaufnr EQ saufnr

AND a~werks EQ p_werks.

Hope it helps u.

Thanks & Regards