Skip to Content


Few day before I found an interesting Blog on SAP Java Connector outbound connection by Gregor wolf . .  I then thought of creating Java Editor inside ABAP! I have created one using simple ABAP programs which will run using the JDK stored locally. The theme of this blog is to Create, Modify, Compile and Execute java programs inside ABAP particularly inside ABAP editor.


Part1: Creating java File:

Part1 uses program zjavacreate.


 In Part 1 java file is created. Using the editor-call function for Itab we can call a blank text area in which we can write our java program. On saving the program in the editor area the Itab gets upload which is saved into the local disk as .java file using Function module GUI_DOWNLOAD.


                                      Getting Class File Name


               Editor with default PSVM


Code is entered for and saved (ctrl+s)


                                    Program logic for java file Creation.


Part 2

Part2 uses program zjavamodify

2.1: Modification.


   We can modify an existing java file. The java file is loaded into an Itab using Function module GUI_UPLOAD. The editor-call for this itab will fill the editor area with the existing java file which is modified and then saved back in the same location using GUI_DONLOAD.

Modify existing java file:


                   Sample File is selected for modification

image is modified and saved

(Note the error System.out.println (“Modify here);



                                Program logic for modification


2.2: Compilation


    Compilation is the most important step. Initially a batch file is created with the content as in the following image. The jCompiler class file and class path is created and stored in the working directory of sapgui logon which is responsible for the creation of error and output file for the newly created java file. The Function module dsvas_ws_execute_50 is used to invoke the batch file which will create an error report file and an output report file. On execution the batch file appears and disappears.


                 Batch file in the notepad mode


                        Bat file pops up during compilation and disappears


                                   Program logic for compilation

2.3: Output Display


 The content of error or output file is put into an Itab using GUI_UPLOAD and displayed in the list area.


Sample. java with Error After correction and recompilation


                              Program logic for output display

Program zjavacreate:

Program zjavamodify:


Note: While using these programs be cautious in setting the path for java file and also store the jCompiler file, class path and class file in the sapgui logon working directory also your batch file need to be created in that directory only. Also please note that awt is not handled!

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

      1. Community User
        This could easily be turned into an editor for several languages – not bad.

        Don’t forget there is a whole community here that might be willing to help you out!

      2. Sravya Talanki
        One tip is not to store the files in GUI.Instead try to store in APP server and try wether you can store the versions of java files just as abap versions.
        Just see if you can simulate the minor version of ABAP editor functionalities.
        This will be very useful when you want to test java and abap from the same stack.This will be very useful to the community with the WAS supporting JAVA and ABAP stacks.

Leave a Reply