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

Selecting Valid Materials .

Former Member
0 Likes
809

Hi All,

I have the following things in Selection screen:

Plant(werks )

Posting date(BUDAT from AUFM table)

and

Material(MATNR),

Now I want to select Material if it has an entry in AUFM Based on

AUFM-BWART = '101 u2018. and posting date (AUFM-BUDAT) and plant (AUFM-WERKS)

is within the user defined range.

I have wrote this selection query:

SELECT matnr werks

FROM marc INTO TABLE i_marc where matnr IN s_matnr

AND werks in s_werks.

if not i_marc is initial.

SELECT matnr

FROM aufm INTO TABLE i_aufm

FOR ALL ENTRIES IN i_marc where matnr = i_marc-matnr

and werks = i_marc-werks AND BWART = '101' and budat IN s_budat.

Can any one tell me whwther it is correct or wrong and help me in the same.

Thanks

Debrup.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
766

Hi,

Instead of using two select statements, you can use INNER JOIN ON tables 'MARC' and 'AUFM'.

Regards,

Ravi Kiran.

5 REPLIES 5
Read only

Former Member
0 Likes
767

Hi,

Instead of using two select statements, you can use INNER JOIN ON tables 'MARC' and 'AUFM'.

Regards,

Ravi Kiran.

Read only

0 Likes
766

Hi Ravi,

But I want to use For all entries instead of inner join.

So is the query correct or modification is needed?

Read only

Former Member
0 Likes
766

Hi Debrup,

Since there are only 2 tables you can use either for all entries or inner join.....

but if you are using for all entries the statement should be

if not i_marc[] is initial.

-


> not........( if not i_marc is initial.) here we are checking only the header line or table work area

SELECT matnr

FROM aufm INTO TABLE i_aufm

FOR ALL ENTRIES IN i_marc where matnr = i_marc-matnr

and werks = i_marc-werks AND BWART = '101' and budat IN s_budat.

endif.

Please correct it...Rest looks fine

If you are having problem with data fetched just debugg and see always

Hope it helps

Regards

Byju

Read only

0 Likes
766

Hi Byju,

Thanks a lot byju.

Read only

0 Likes
766

plz close the thread once ur problem is solved.

Regards,

Srinivas