‎2009 Jan 20 8:50 AM
Hi all,
I am trying to compile the below code, but I get the compile error message.
Anyone know why after I added the field E070~TRSTATUS, compile is not successful.
I need the field TRSTATUS selected into ITAB.
How should I solve this select statement error?
Thanks for the advice.
.
.
.
DATA BEGIN OF DATASTRUC.
DATA OBJECT_NAME LIKE TADIR-OBJ_NAME.
DATA OBJECT_TYPE LIKE TADIR-OBJECT.
DATA PROGRAM_ID LIKE TADIR-PGMID.
DATA PACKAGE LIKE TADIR-DEVCLASS.
DATA TRSTATUS LIKE E070-TRSTATUS.
DATA END OF DATASTRUC.
DATA ITAB LIKE SORTED TABLE OF DATASTRUC
WITH NON-UNIQUE KEY OBJECT_NAME.
SELECT TADIR~OBJ_NAME TADIR~OBJECT TADIR~PGMID TADIR~DEVCLASS E070~TRSTATUS
INTO TABLE ITAB
FROM TADIR
WHERE TADIR~AUTHOR = USER
AND TADIR~OBJ_NAME NOT IN
( SELECT E071~OBJ_NAME E070~TRSTATUS FROM E071
JOIN E070 ON E071~TRKORR = E070~TRKORR
WHERE E070~AS4USER = USER ).
.
.
.
Use meaningful subject line
Edited by: Vijay Babu Dudla on Jan 22, 2009 6:02 AM
‎2009 Jan 20 8:54 AM
Hi, the table TADIR does not have field E070~TRSTATUS in line
SELECT TADIROBJ_NAME TADIROBJECT TADIRPGMID TADIRDEVCLASS E070~TRSTATUS
INTO TABLE ITAB
FROM TADIR
. Please check your select statement
‎2009 Jan 20 8:55 AM
hi
kindly check the syntax for ur select query .
I think u gone wrong in the syntax of ur select statement u r using two different table fields ..but u mentioned only one table name in the query.Try resolving the pbm using Join condition,
thank you
regards.
rajye
pls close the thread if its resolved
Edited by: Rajeshwari P on Jan 20, 2009 9:56 AM
Edited by: Rajeshwari P on Jan 20, 2009 11:23 AM
‎2009 Jan 20 8:57 AM
Hi Wong,
you do not have TRSTATUS field in TADIR, yet you are using that column name in your from clause.
SELECT TADIROBJ_NAME TADIROBJECT TADIRPGMID TADIRDEVCLASS e070~TRSTATUS
INTO TABLE ITAB
FROM TADIR.
This statement is trying to fetch the column TRSTATUS with alias name E070 from table TADIR.
You have to rephrase the query.
If you need to fetch based on the change request try the below code.
SELECT tadirobj_name tadirobject tadirpgmid tadirdevclass e070~trstatus
INTO TABLE itab
FROM tadir JOIN e070
ON tadirkorrnum = e070trkorr "change request based join
AND tadir~author = user
AND tadir~obj_name NOT IN
( SELECT e071obj_name e070trstatus FROM e071
JOIN e070 ON e071trkorr = e070trkorr
WHERE e070~as4user = user ).
Edited by: prosenjit chaudhuri on Jan 20, 2009 10:08 AM
‎2009 Jan 20 8:57 AM
When You use two table to select data , you need to specify the join condition.
SELECT tadir~obj_name tadir~object tadir~pgmid tadir~devclass
e070~trstatus
INTO TABLE itab
FROM tadir INNER JOIN e070
ON tadir~author = e070~as4user
WHERE tadir~author = user
AND tadir~obj_name NOT IN
( SELECT e071~obj_name e070~trstatus FROM e071
JOIN e070 ON e071~trkorr = e070~trkorr
WHERE e070~as4user = user ).Regards,
Shailaja
‎2009 Jan 20 8:58 AM
The error being is because of multiple fields (OBJ_NAME, TRSTATUS) in the right hand query assigned to single field (TADIR~OBJ_NAME) in the left hand query, which is wrong.
SELECT TADIROBJ_NAME TADIROBJECT TADIRPGMID TADIRDEVCLASS E070~TRSTATUS
INTO TABLE ITAB
FROM TADIR
WHERE TADIR~AUTHOR = USER
AND TADIR~OBJ_NAME NOT IN
( SELECT E071OBJ_NAME E070TRSTATUS FROM E071
JOIN E070 ON E071TRKORR = E070TRKORR
WHERE E070~AS4USER = USER ).
‎2009 Jan 20 9:01 AM
Hi,
In ur main select statement u didnt use join . but u pick value from two tables. Thats y it showing error.
Check E070~TRSTATUS in ur main select statement.
Hope this will help u.
Thanks.