‎2009 Feb 05 3:52 PM
Hi All,
I have a following select statement.
SELECT TSTC~PGMNA
TSTC~TCODE
TSTCT~TTEXT
TRDIR~SECU
INTO CORRESPONDING FIELDS OF TABLE IT_TEST
FROM ( TSTC inner join tstct on tstcttcode = tstctcode
INNER JOIN TRDIR ON TRDIRNAME = TSTCPGMNA )
WHERE PGMNA IN S_PGNAME
and SPRSL IN S_LKEY.
in the above code I need to enter a condition that it should look out for only those Tcodes in the table TSTC where TSTC~PGMNA = ' ' " (space) ... so can you please tell me how can I do that.
thanks,
Rajeev
‎2009 Feb 05 3:57 PM
Is S_PGNAME on your selection screen? If yes, then the desired condition can be entered there.
The INNER JOIN TRDIR needs to be changed to an LEFT OUTER JOIN, since there will not be an entry in TRDIR for these cases.
Thomas
P.S. include SPRSL = SY-LANGU in your join of TSTCT, otherwise there could be duplicates due to multi-language descriptions.
‎2009 Feb 05 3:57 PM
Is S_PGNAME on your selection screen? If yes, then the desired condition can be entered there.
The INNER JOIN TRDIR needs to be changed to an LEFT OUTER JOIN, since there will not be an entry in TRDIR for these cases.
Thomas
P.S. include SPRSL = SY-LANGU in your join of TSTCT, otherwise there could be duplicates due to multi-language descriptions.
‎2009 Feb 05 4:06 PM
Thanks for the reply thomas.... now I am not worried about the TRDIR table... as you are right TRDIR table will not hold good in this case:
but can you please explain a more how to take care of that TSTC~PGMNA = ' ' condition? as I don't user to add this conditon.. what I want when ever a user execute this report he should see only those T-cdoes whch don't have program names.
my updated code is :
SELECT TSTC~PGMNA
TSTC~TCODE
TSTCT~SPRSL
TSTCT~TTEXT
INTO CORRESPONDING FIELDS OF TABLE IT_TCODELISTING
FROM ( TSTC inner join tstct on tstcttcode = tstctcode)
WHERE PGMNA IN S_PGNAME
and SPRSL IN S_LKEY.
Thanks,
Rajeev
‎2009 Feb 05 4:14 PM
Hi Rajeev,
SELECT TSTC~PGMNA
TSTC~TCODE
TSTCT~SPRSL
TSTCT~TTEXT
INTO CORRESPONDING FIELDS OF TABLE IT_TCODELISTING
FROM ( TSTC inner join tstct on tstcttcode = tstctcode)
WHERE PGMNA IN S_PGNAME
and SPRSL IN S_LKEY.
In your code you are checking using S_PGNAME, if input is not specified in Selection screen it will fectch all records.
So you can do
1) check WHERE PGMNA = ' '
why you are checking using S_PGNAME?
If you want to use S_PGNAME then
S_PGNAME-LOW = ' '.
S_PGNAME-OPTION = 'EQ'.
S_PGNAME-SIGN = 'I'.
APPEND S_PGNAME.
Regards,
Sunil
Edited by: Sunil Reddy Sibbala on Feb 5, 2009 5:25 PM
‎2009 Feb 05 4:14 PM
Well, then either
> WHERE PGMNA = SPACE
or
> WHERE PGMNA IN S_PGNAME
and filling S_PGNAME before for selecting blank values: OPTION = "EQ", SIGN = "I", LOW = SPACE.
Thomas
‎2009 Feb 05 4:29 PM
Thanks for the reply Sunil... basically what I am looking for is the ability for the user to see all the Custom T_codes which doesn't have any program name assigned to it. So can you please tell me how can I get that.
THanks,
Rajeev
‎2009 Feb 05 4:34 PM
Hi,
This query could help you.
SELECT TSTC~PGMNA
TSTC~TCODE
TSTCT~SPRSL
TSTCT~TTEXT
INTO CORRESPONDING FIELDS OF TABLE IT_TCODELISTING
FROM TSTC
JOIN TSTCT
ON TSTCTTCODE = TSTCTCODE
WHERE TSTC~PGMNA = ' '
AND TSTC~TCODE = 'Z#'
AND TSTCT~SPRSL = S_LKEY.
Thanks,
Pranav
‎2009 Feb 05 4:39 PM
Hi Pranav,
It didn't work.... it didn't fetch any data in the internal table
‎2009 Feb 05 4:51 PM
Hi,
Sorry you have to put LIKE there. Try this.
SELECT TSTC~PGMNA
TSTC~TCODE
TSTCT~SPRSL
TSTCT~TTEXT
INTO CORRESPONDING FIELDS OF TABLE IT_TCODELISTING
FROM TSTC
JOIN TSTCT
ON TSTCTTCODE = TSTCTCODE
WHERE TSTC~PGMNA = ' '
AND TSTC~TCODE LIKE 'Z%' (or 'Y%')
AND TSTCT~SPRSL = S_LKEY.
Thanks,
Sudha
‎2009 Feb 05 5:01 PM
It's still behaving the same and not fetching anything in the internal table... somehow it's just skipping the whole select statement
tahnks,
Rajeev
‎2009 Feb 05 5:04 PM
It is working to me. Do you have any conditions before the select query?
Pranav
‎2009 Feb 05 5:15 PM
Rajeev - rather than just cutting and pasitng the code, do some desk checking to see if you can find the error before posting back to the forum.
Rob
‎2009 Feb 06 2:48 AM
Hi Pranav...
thanks for the reply... the conditon for tstc - pgmna = ' '... is not working!!!