04-21-2006 10:09 AM
Guys,
In the below select statement in where clause i want add
object = 'prog' and object = 'tabl' and object = 'domain'
how i can add these conditions.
please help on this.
SELECT OBJECT
OBJ_NAME
SRCSYSTEM
FROM TADIR
INTO TABLE IT_TADIR_FIN
WHERE OBJECT = 'PROG'
AND ( OBJ_NAME LIKE 'Y%'
OR OBJ_NAME LIKE 'Z%' ).
Excellent reward is compulsary.
regards,
vijay
04-21-2006 10:17 AM
Hi,
SELECT OBJECT
OBJ_NAME
SRCSYSTEM
FROM TADIR
INTO TABLE IT_TADIR_FIN
WHERE ( OBJ_NAME LIKE 'Y%'
OR OBJ_NAME LIKE 'Z%' )
<b>AND ( ( OBJECT EQ 'PROG') OR
( OBJECT EQ 'TABL') OR
( OBJECT EQ 'DOMAIN') ).</b>
04-21-2006 10:12 AM
Vijay,
Are you sure it is AND, How can one record can have different values for the same field and for the same record.
If it is OR you can do the same as OBJ_NAME.
Regards,
Ravi
04-21-2006 10:17 AM
Actually 'object' field stores the prog,tabl,domn e.t.c.
Now i want to store the internal table where object = prog,tabl and domn only.
For this how i can write the condition in the select statement.
04-21-2006 10:14 AM
Hi Vjiay,
is it AND? or OR?
try this..
SELECT OBJECT
OBJ_NAME
SRCSYSTEM
FROM TADIR
INTO TABLE IT_TADIR_FIN
WHERE OBJECT in ('PROG','TABL','DOMAIN')
AND ( OBJ_NAME LIKE 'Y%'
OR OBJ_NAME LIKE 'Z%' ).
Regards,
Suresh Datti
04-21-2006 10:17 AM
Hi,
SELECT OBJECT
OBJ_NAME
SRCSYSTEM
FROM TADIR
INTO TABLE IT_TADIR_FIN
WHERE ( OBJ_NAME LIKE 'Y%'
OR OBJ_NAME LIKE 'Z%' )
<b>AND ( ( OBJECT EQ 'PROG') OR
( OBJECT EQ 'TABL') OR
( OBJECT EQ 'DOMAIN') ).</b>
04-21-2006 10:18 AM
SELECT OBJECT
OBJ_NAME
SRCSYSTEM
FROM TADIR
INTO TABLE IT_TADIR_FIN
WHERE ( OBJECT = 'PROG' or OBJECT = 'DOMAIN' or OBJECT = 'TABL' )
AND ( OBJ_NAME LIKE 'Y%'
OR OBJ_NAME LIKE 'Z%' ).
04-21-2006 10:18 AM
Hi kranthi,
we can't write SQL Query according to your requirement. but one way we can resolve it.
in select-options statemtn we can take the object field and assign single values into that field and check the same in where clause
SELECT OBJECT
OBJ_NAME
SRCSYSTEM
FROM TADIR
INTO TABLE IT_TADIR_FIN
WHERE OBJECT = 'PROG'
AND OBJ_NAME IN s_objnam
04-21-2006 10:19 AM
Hi,
Try following query
SELECT OBJECT
OBJ_NAME
SRCSYSTEM
FROM TADIR
INTO TABLE IT_TADIR_FIN
WHERE OBJECT <b>IN ('PROG','DOMA','TABL')</b>
AND ( OBJ_NAME LIKE 'Y%'
OR OBJ_NAME LIKE 'Z%' ).
Hope it helps.
Regards,
Shashank
04-21-2006 10:24 AM
What u can do is break the query into two parts.
1. extraction for program table and domain and then within that next level filtering.
tables: mara,tadir.
data: begin of it_tadir occurs 0,
object like tadir-object,
obj-name like tadir-obj_name,
srcsystem like tadir-srcsystem.
data: end of it_tadir.
select-options s_prdha for mara-prdha.
*parameters p_prdha like mara-prdha.
start-of-selection.
SELECT OBJECT
OBJ_NAME
SRCSYSTEM
FROM TADIR
INTO TABLE IT_TADIR
WHERE OBJECT = 'PROG' or
OBJECT = 'TABL' or
OBJECT = 'DOMA'.
loop at it_tadir.
within this loop u can filter out further.
endloop.
I would also suggest u fill in the first part of the key PGMID with R3TR if u are just intrested in getting the definations otherwise the performance could be an issue.
04-21-2006 10:27 AM
Hi Vijay,
To get only those records which have OBJECT = PROG,TABL,DOMN write the following select query:-
SELECT OBJECT OBJ_NAME SRCSYSTEM
FROM TADIR
INTO TABLE IT_TADIR_FIN
WHERE OBJECT IN ('PROG', 'TABL' , 'DOMN')
AND ( OBJ_NAME LIKE 'Y%'
OR OBJ_NAME LIKE 'Z%' ).
The field OBJECT is of length 4 so it will have any one of these values at anytime.
Regards,
Sameena
04-21-2006 10:32 AM
Hai
in TADIR Table OBJECT fields having the length of 4 char
so the select statement
SELECT OBJECT
OBJ_NAME
SRCSYSTEM
FROM TADIR
INTO TABLE IT_TADIR_FIN
WHERE OBJECT in ('XXXX' , 'YYYY', 'ZZZZ' )
AND ( OBJ_NAME LIKE 'Y%'
OR OBJ_NAME LIKE 'Z%' ).
Regards
Sreenivasulu P