‎2008 Nov 13 6:46 AM
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.
‎2008 Nov 13 6:53 AM
Hi,
Instead of using two select statements, you can use INNER JOIN ON tables 'MARC' and 'AUFM'.
Regards,
Ravi Kiran.
‎2008 Nov 13 6:53 AM
Hi,
Instead of using two select statements, you can use INNER JOIN ON tables 'MARC' and 'AUFM'.
Regards,
Ravi Kiran.
‎2008 Nov 13 7:15 AM
Hi Ravi,
But I want to use For all entries instead of inner join.
So is the query correct or modification is needed?
‎2008 Nov 13 7:23 AM
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
‎2008 Nov 13 7:27 AM
‎2008 Nov 13 7:34 AM
plz close the thread once ur problem is solved.
Regards,
Srinivas