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

problem in code

Former Member
0 Likes
1,028

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
996

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

8 REPLIES 8
Read only

Former Member
0 Likes
996

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

Read only

Former Member
0 Likes
996

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

Read only

Former Member
0 Likes
996

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

Read only

Former Member
0 Likes
996

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

Read only

Former Member
0 Likes
996

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').

Read only

former_member222860
Active Contributor
0 Likes
996

Hi,

Check ur itab name in where

W_ITPO1-AUFNR

Read only

Former Member
0 Likes
998

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

Read only

Former Member
0 Likes
996

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