‎2006 Jul 18 7:59 AM
Hi,
I am trying to write a coding scan tool that is able to find out all SQL Statements.
Therefore I am using the sytax
SCAN ABAP-SOURCE lt_code
TOKENS INTO tokens
STATEMENTS INTO statements
LEVELS INTO levels
STRUCTURES INTO structures
PROGRAM FROM ls_trdir-name
MESSAGE INTO message
INCLUDE INTO include
LINE INTO line
WORD INTO word
WITH ANALYSIS
WITH INCLUDES
WITH COMMENTS.
After that, I have to scan all the tokesn for commands like INSERT, MODIFY, SELECT,...
One of my problems is, that it is very hard to distinguish between an INSERT to a local table and a database table. Is there any easy way to find out if it is an SQL statement or not (maybe a type)?
Best regards,
Fabian
‎2006 Jul 18 11:22 AM
Hi Fabian,
have you take a look to the Code-Inspector (transaction SCI )? This tool works also with the "SCAN ABAP-SOURCE" command and provide also some checks for SQL-Statements.
If there is not a check routine that you are looking for, you can extend this tool with own routines:
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/f5d9a790-0201-0010-dd8c-baff999f8197">How to Build a New Check</a>
Regards,
Stefan
‎2006 Jul 18 8:04 AM
Hi,
There are some standard programs that can SCAN the source code and return the suggestions, you can refer RPR_ABAP_SOURCE_SCAN program, this might give some clue about how to go about doing this,
Hope this helps,
Rgds,
‎2006 Jul 18 8:21 AM
hi,
you can validate the found table from the token
with db-table DD02L (tabclass <> INTTAB).
A.
‎2006 Jul 18 10:28 AM
Hi,
unfortunately, the function module RPR_ABAP_SOURCE_SCAN does not exist in my system (Basis 6.40). Could you please tell me, where you found this module?
Best regards,
Fabian
‎2006 Jul 18 10:30 AM
Hi,
It is not the function module, you can check in SE38 transaction, it is a report program,
Rgds,
‎2006 Jul 18 10:30 AM
Hi,
what about dynamic INSERTs like
INSERT (<variable>) FROM ls_sflight.
‎2006 Jul 18 10:37 AM
Thank you.. that was my fault.
Unfortunately this report just does the same like I am able to do. It only scans the coding for a certain string but it does not differentiate between internal tables and database tables.
Best regards,
Fabian
‎2006 Jul 18 11:22 AM
Hi Fabian,
have you take a look to the Code-Inspector (transaction SCI )? This tool works also with the "SCAN ABAP-SOURCE" command and provide also some checks for SQL-Statements.
If there is not a check routine that you are looking for, you can extend this tool with own routines:
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/f5d9a790-0201-0010-dd8c-baff999f8197">How to Build a New Check</a>
Regards,
Stefan
‎2006 Jul 18 11:45 AM
Fabian,
haven't you read my 1st post
-> here's another possibility:
look fm RS_CROSSREFERENCE and esp. prog. <b>LSEUWU02</b>
-line 300ff.
Andreas
‎2006 Jul 18 11:49 AM
hi.
If you know standard transaction or program for purchase order or for any function . you can know the affected tables by that transaction or program USING TRANSACTION
'SE49'.
I am working on 4.6c it does exist in this version.
if does not exist on ur version
then other way to find affected tables by a transaction or program is--
first find the development class for that transaction (like Va01) then goto se80 and enter that development class .it will show all the tables affected .
steps to find Development class for example (Va01).
press F1 to any field then click on tech. info
(ii) double click on program name(SAPMV45B).
(iii) click on object directory entry in GOTO menu.
(iv) from here u will get Development class (VA).
now in se80 u will get all the databasec tables under the node object entry.
hope this will help.
Regards .
vikas