2012 Jun 25 6:46 AM
Dear friends,
I am in the process of finding how to check the syntax errors in a programatic way .
The scenario is :
I would get the Development objects like Class , Report, Function module in a table which will exist in the system.
I would like to run syntax check on each of these objects seperately and collect all the issues if exists and display.
Please suggest.
Thanks
MGR
Moderator Message: Please search before posting your question. This concept has been discussed in forums before. There is a class available to do this( Search & get it )
Message was edited by: Kesavadas Thekkillath
2012 Jun 25 6:57 AM
Use syntax:
Example below from ABAPHelp.
DATA: itab TYPE STANDARD TABLE OF string,
mess TYPE string,
lin TYPE i,
wrd TYPE string,
dir TYPE trdir.
APPEND 'PROGRAM test.' TO itab.
APPEND 'DATA dat TYPE d.' TO itab.
APPEND 'DATA len TYPE i.' TO itab.
APPEND 'DESCRIBE FIELD dat LENGTH len.' TO itab.
SELECT SINGLE *
FROM trdir
INTO dir
WHERE name = sy-repid.
dir-uccheck = ' '.
SYNTAX-CHECK FOR itab MESSAGE mess LINE lin WORD wrd
DIRECTORY ENTRY dir.
IF sy-subrc = 4.
MESSAGE mess TYPE 'I'.
ENDIF.
dir-uccheck = 'X'.
SYNTAX-CHECK FOR itab MESSAGE mess LINE lin WORD wrd
DIRECTORY ENTRY dir.
IF sy-subrc = 4.
MESSAGE mess TYPE 'I'.
ENDIF.
Moderator Message: Please refer to the SAP documentation ( URL ) instead of pasting the code here.
Message was edited by: Kesavadas Thekkillath
2012 Jun 25 11:45 AM
Hi ,
can you please send the source code for the CL_RECA_RS_SERVICES this would be helpful.
this is not available.
Thanks
MGR
2012 Jun 25 11:48 AM
Its available in Wiki Section , authored by Vinod Kumar. Just search using this name and class name .
I'm glad you did a search
Please note that this class has a limitation that the syntax check can be only done for "programs". The keyword "SYNTAX CHECK" must not be used by developers( its sap internal command ). There are some functions like RS_SYNTAX_CHECK,EDITOR_SYNTAX_CHECK etc. You can do a work around.
Kesav
2012 Jun 26 1:34 AM
Kesavadas Thekkillath wrote:
The keyword "SYNTAX CHECK" must not be used by developers( its sap internal command ).
That is not entirely correct. SYNTAX-CHECK FOR itab is NOT a SAP internal language element.