03-15-2013 7:23 AM
Hi Experts,
Good day,
Can anybody help me out in finding out or to tell how many SELECT quires are there in a given program
or
How to trace out all the SELECT for a given program.
any logic would be really appreciated.
Regards
SAMUEL
03-15-2013 10:52 AM
Hi Sam,
Do you want to write a program to do this search or externally also its fine? If its fine externaly then you can do a global search for SELECT and then you can count. The number of SELECT queries differ from program to program so please specify your requirement clearly.
03-15-2013 11:00 AM
Hi,
Thank you for the reply,
I just want to write a SE38 report program which accepts the PROGRAM NAME as input,
and gives output as all the SELECT quires present in that given program.
If i do with STRING operations, there may be a string with
1. 'SELECTION-SCREEN'
2. write / 'please select the radio button below'.
3. etc
so please suggest me how can write my logic...
Regards
SAM
03-18-2013 5:09 AM
Hi Sam ,
Check this below Code .
DATA : BEGIN OF SOURCE OCCURS 1000,
LINE(256),
END OF SOURCE.
DATA: P_STATEMENTS LIKE SSTMNT OCCURS 100 WITH HEADER LINE.
DATA: P_TOKENS LIKE STOKEN OCCURS 100 WITH HEADER LINE,
WA TYPE STOKEN .
PARAMETERS: PROGRAM LIKE SY-REPID DEFAULT SY-REPID, " Pass Program Name
SSTRING LIKE TUCHK3-OBJECT . " Search String example : SELECT
READ REPORT PROGRAM INTO SOURCE .
SCAN ABAP-SOURCE SOURCE STATEMENTS INTO P_STATEMENTS "Comment in chain
TOKENS INTO P_TOKENS.
WRITE : / 'String' , 'Row Number' ,'Column Number' , 'Length'.
LOOP AT P_TOKENS INTO WA .
IF WA-STR = SSTRING.
WRITE 😕 WA-STR ,WA-ROW, WA-COL , WA-LEN .
ENDIF.
ENDLOOP.
Regard's
Smruti
03-15-2013 11:13 AM
Hi,
I think this will help you.
http://saptechnical.com/Tutorials/ABAP/SQLTrace/page1.htm
Please do let us know if you are still facing the issue.
Regards
Purnand
03-15-2013 11:19 AM
Hi Sam,
There is an standard option to see all the SELECT queries in a given program.
GOTO SE38 ->UTILITIES -> INTERNAL PROGRAM ENVIRONMENT -> choose SELECT.
It will show you all the SELECT staments used in the program.
Regards,
Santanu Mohapatra.
03-15-2013 11:30 AM
Hi Sam,
Check this SAP Standard Program "RPR_ABAP_SOURCE_SCAN" .
Input Parameter :
Program Name : your ABAP Program Name
Find string : what you want to search for the particular program
Regard's
Smruti
03-15-2013 11:38 AM
Hi Smruthi,
Thank you for immediate response...
I am using the same program but i am facing the issue, what i was discussing earlier.
if i give input search as SELECT it give me the output as lines like
SELECTION-SCREEN SKIP.
SELECTION-SCREEN COMMENT /1(20) TEXT-049.
if i give input search as SELECT * FROM .....i miss the queries with other format..
any specific logic to trace out all SELECT quires would be really appreciated....
Regards
SAM
03-18-2013 5:52 AM
Use the program RS_ABAP_SOURCE_SCAN or RPR_ABAP_SOURCE_SCAN (there's no difference; the latter calls the former), but specify that the search is via "string is a standard expression". Then you enter a regular expression (regex) that exactly matches your requirements - which really is SELECT as an individual word.
You can read http://www.regular-expressions.info for details on how to use regex. In your case /bSELECT/b is probably what you need.
03-15-2013 11:34 AM
Hi,
Writing a new program to find the select queries in a given program is not required and SAP has laready provided the SQL Trace tool for this.
BR
Nitin
03-15-2013 11:37 AM
03-15-2013 1:30 PM
Hi,
I think that the best way to work for this issue is submit standard report RPR_ABAP_SOURCE_SCAN.
Details:
into String searched for insert SELECT
into Program Name insert name of your report
flag 'X' into Ignore Comment Lines
Regard
Ivan
03-15-2013 1:52 PM
Hi Sam,
Using SQl trace (ST05) we can find right or ctrl+g or f (simply find ).
Regards
Mahesh