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: 

Running .EXE file issue

Former Member
0 Kudos

Hello fellow developers.

I am rather new to ABAP and I have an issue with running an exe file from a bat file.

Let's say i have the following:

     - a bat file: execute.bat with the command line: " test wr 37 199.166.0.99" (199.166.0.99 is a random ip)

     - an exe file: test.exe

If I run execute.bat it will run the test.exe . The test.exe returns a file named "return" which contains the ip number and a result number (something like: 199.166.0.99:-5 )

The problem is when I run execute.bat with ABAP with the function:

      CALL FUNCTION 'GUI_EXEC'

        EXPORTING

          command = 'D:\execute.bat'

I don't get the return file .

I am mentioning that I don't know exactly what the .exe contains, just that it returns the file "return" with the specified information.

I don't know if the issue is from the files or from the ABAP code. If someone with more knowledge on this matter could help me it would be much appreciated.

Thank you,

Alex

1 ACCEPTED SOLUTION

adam_krawczyk1
Contributor
0 Kudos

Hi Andu,

I see two possible problems here:

1) Problem may be with "test" command in the bat file. Try to specify full file path to test.exe file in the batch file, like:

D:\test.exe wr 37 199.166.0.99

If there is some output on the console, you can try to redirect it with " > D:\log.txt" addition in the bat file.

2) Even if test.exe is being executed, result file is downloaded to other default directory on your PC and not to same location as execute.bat file is (D:\). As GUI_EXEC is obsolete statement, try to use modern version which allows you to specify default directory:

CL_GUI_FRONTEND_SERVICES=>EXECUTE.

Hope it helps.

Regards

Adam

2 REPLIES 2

adam_krawczyk1
Contributor
0 Kudos

Hi Andu,

I see two possible problems here:

1) Problem may be with "test" command in the bat file. Try to specify full file path to test.exe file in the batch file, like:

D:\test.exe wr 37 199.166.0.99

If there is some output on the console, you can try to redirect it with " > D:\log.txt" addition in the bat file.

2) Even if test.exe is being executed, result file is downloaded to other default directory on your PC and not to same location as execute.bat file is (D:\). As GUI_EXEC is obsolete statement, try to use modern version which allows you to specify default directory:

CL_GUI_FRONTEND_SERVICES=>EXECUTE.

Hope it helps.

Regards

Adam

0 Kudos

Hi Adam,

With your help I have managed to observe that the if I ran execute.bat manually , the return file would be created in the same directory as execute.bat (in my case: D:\). If I ran execute.bat from SAP it would be created in the SAP directory (in my case: C:\Users\User\Documents\SAP ).

Thank you though for telling me about the obsolete statement which i have replaced as you indicated, and for telling me that I should write the full path of the file which made the program run correctly.

Best regards,

Alex