Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos
Following up on the PHP ABAP console from PHP ABAP console I updated my little PHP ABAP console (PHP ABAP console) to use the RFC_ABAP_INSTALL_AND_RUN function deprecating my own ZSTOYAN_RFC_EVAL. I also added syntax checking for the code typed into the console.

What is it?

In case you've missed the previous post, this little piece of code that I did is a web interace for you to type in some ABAP code and watch it execute. I did it with the idea that it could be useful for learning ABAP of just quickly trying out little code snippets.

How it's done?

Using PHP with SAPRFC to connect to an SAP system and call RFCs on it. Using AJAX to avoid page reloads and using Yahoo UI library to help with the JavaScript part (animations, async requests, events).

What's new?

In the previous version I've created an RFC function that takes an internal table containing ABAP code, executes it as a report and returns the screen result. Thanks to Blag, who pointed out in his comment that such an RFC already exists, I deprecated mine and used RFC_ABAP_INSTALL_AND_RUN instead. It's definitelly better, because it does auth checks on the user executing it, also a syntax check on the ABAP code passed to it and finally it cleans up the temp report created to execute the code.

The only problem with this RFC is that when it does the syntax check, it returns only a cut-off error message (50 chars) and no details on the line of code that contained an error and the string (word) that causes the error. So I went ahead and created a very simple RFC that only calls SYNTAX-CHECK FOR statement and returns everything this statement gives - full text of the error message, line of code and word. So now the way the console works is:
  1. Call RFC_ABAP_INSTALL_AND_RUN.
  2. If there is an error message, call ZSTOYAN_RFC_SYNTAX_CHECK to get the full details of the syntax error, then highlight the error.

Screenshots and code download

Here are two screenshot, one with code executed OK and one with code with a syntax error.

Evaluated and highlighted code Code with syntax error

The code is here (the custom RFC's source can be found in the _extras/ folder).
If you want to try the console out, you need to create the ZSTOYAN_RFC_SYNTAX_CHECK function module and then to edit /model/business.php changing the credentials to access your SAP system.

Thanks!

Thanks for reading, any comments are appreciated. And thanks again to Blag, please give this guy all SDN points he deserves 🙂
9 Comments