Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Method or Function Module for Syntax Checks

Former Member
0 Kudos

Hi Abapers,

         

     I am trying to find the FM or Class which can return me with all the syntax errors present in that object.(Object can be a FUnction Group,Report,Class,Function Module). Is there any Function Module which can return back all the errors present in the object. I tried with RS_SYNTAX_CHECK, but it didn't worked. It is not returning all the errors present.

Thanks in advance.

3 REPLIES 3

Former Member
0 Kudos

...and the purpose of this would be?

matt
Active Contributor
0 Kudos

Open the abap editor. Type SYNTAX. Place your cursor within the word. Press F1.

ivan_shadrin
Participant
0 Kudos

As it was mentioned in the previous answer, you can use a special ABAP statement - SYNTAX-CHECK FOR ...

If you don't want to code error handling by yourself, you can consider using method CL_ABAP_ERROR_ANALYZE=>GET_MINIMAL_INCLUDE_SET.

You can pass the name of the program (e.g. the report, the main program of function group, etc) and this method will return all the errors your program contains. There is an example in the report RS_ABAP_ERROR_ANALYZE.

Please note that this method always checks the active version of the program. Internally it calls READ REPORT statement without a STATE clause. Hence, only active state is taken into account. If you want to check an inactive version, you should write your own code and use in it READ REPORT ... STATE 'I' and SYNTAX-CHECK statements. The rest you can copy from the implementation of CL_ABAP_ERROR_ANALYZE. It that case you should be aware of that STATE addition is internal. And there are some limitations. You should refer to the documentation.