‎2009 Feb 12 4:52 AM
Hi,
I am working on a code in which i am using inner join and for all entries in the same select query but it giving the error:-
The where condition does not refer to the FOR ALL ENTRIES table
SELECT DAUFNR DBWART DMENGE DMEINS DBLDAT DWERKS DMATNR ENTGEW
FROM AUFM AS D
INNER JOIN MARA AS E ON EMATNR = DMATNR
INTO TABLE T_ITPO4
FOR ALL ENTRIES IN T_ITPO1
WHERE DAUFNR = W_ITPO1-AUFNR AND EMTART IN ('ROH','ZSCR','HALB','FERT')
AND D~BWART IN ('101','261','531').
But when i am using the Like method and types declarations it does not give the error .
I want to know that the method of using types in program is latest method used today or by using OOPS concept.
‎2009 Feb 12 5:06 AM
Hi Ricx,
In the code by mistake you have given the work area in the where condition instead of table due to which its giving you problem....
please make the following changes..
SELECT DAUFNR DBWART DMENGE DMEINS DBLDAT DWERKS DMATNR ENTGEW
FROM AUFM AS D
INNER JOIN MARA AS E ON EMATNR = DMATNR
INTO TABLE T_ITPO4
FOR ALL ENTRIES IN T_ITPO1
WHERE DAUFNR = T_ITPO1-AUFNR AND EMTART IN ('ROH','ZSCR','HALB','FERT')
AND D~BWART IN ('101','261','531').
because the select query gets executed at the database interface and there it does not recognize w_itpo1 as it is not used in the query.... it only takes the variables used in the query and also the fields which are there in the database table..
Regards,
Siddarth
‎2009 Feb 12 4:56 AM
Hello,
while u r using the FOR ALL ENTRIES u need check 1st the internal table is INITIAL or not.
its the pre condition for that...
Thank u,
santhosh
‎2009 Feb 12 4:56 AM
Hi please refer this
u should compare t_itpo1 or w_itpo1.
SELECT DAUFNR DBWART DMENGE DMEINS DBLDAT DWERKS DMATNR ENTGEW
FROM AUFM AS D
INNER JOIN MARA AS E ON EMATNR = DMATNR
INTO TABLE T_ITPO4
FOR ALL ENTRIES IN T_ITPO1
WHERE DAUFNR = T_ITPO1-AUFNR AND EMTART IN ('ROH','ZSCR','HALB','FERT')
AND D~BWART IN ('101','261','531').
Regards
ABAPEr
‎2009 Feb 12 4:57 AM
Hi,
FOR ALL ENTRIES IN T_ITPO1
WHERE D~AUFNR = W_ITPO1-AUFN
here for all entries refers to a different table and where condition refers to a different table .
Both should be same . Chande it and should work
‎2009 Feb 12 4:58 AM
Hi ,
You need to add AND AUFNR = T_ITPO1-AUFNR in where clause -
SELECT D~AUFNR D~BWART D~MENGE D~MEINS D~BLDAT D~WERKS D~MATNR E~NTGEW
FROM AUFM AS D
INNER JOIN MARA AS E ON E~MATNR = D~MATNR
INTO TABLE T_ITPO4
FOR ALL ENTRIES IN T_ITPO1
WHERE D~AUFNR = W_ITPO1-AUFNR AND E~MTART IN ('ROH','ZSCR','HALB','FERT')
AND D~BWART IN ('101','261','531')
AND AUFNR = T_ITPO1-AUFNR.Regards
Pinaki
‎2009 Feb 12 5:02 AM
Hi,
Give table name( T_ITPO1) in where condition instead of work area( W_ITPO1).
SELECT DAUFNR DBWART DMENGE DMEINS DBLDAT DWERKS DMATNR ENTGEW
FROM AUFM AS D
INNER JOIN MARA AS E ON EMATNR = DMATNR
INTO TABLE T_ITPO4
FOR ALL ENTRIES IN T_ITPO1
WHERE DAUFNR = T_ITPO1-AUFNR AND EMTART IN ('ROH','ZSCR','HALB','FERT')
AND D~BWART IN ('101','261','531').
‎2009 Feb 12 5:04 AM
‎2009 Feb 12 5:06 AM
Hi Ricx,
In the code by mistake you have given the work area in the where condition instead of table due to which its giving you problem....
please make the following changes..
SELECT DAUFNR DBWART DMENGE DMEINS DBLDAT DWERKS DMATNR ENTGEW
FROM AUFM AS D
INNER JOIN MARA AS E ON EMATNR = DMATNR
INTO TABLE T_ITPO4
FOR ALL ENTRIES IN T_ITPO1
WHERE DAUFNR = T_ITPO1-AUFNR AND EMTART IN ('ROH','ZSCR','HALB','FERT')
AND D~BWART IN ('101','261','531').
because the select query gets executed at the database interface and there it does not recognize w_itpo1 as it is not used in the query.... it only takes the variables used in the query and also the fields which are there in the database table..
Regards,
Siddarth
‎2009 Feb 12 5:41 AM
Hi,
I think the solution given by experts will solve your problem,
In the select for all entries the system will not recognize work area as you are reffering internal table.
Once resolved please close the thread.
Regards,
Edited by: jyoti sahu on Feb 12, 2009 6:41 AM