Application Development and Automation 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: 
Read only

Execution of command from SAP

Former Member
0 Likes
816

Hi,

There is a requirement wherein one folder is created on presentation server ( Desktop ) in which we are putting excel files from

SAP ABAP using FM GUI_DOWNLOAD and now that folder contain file in excel forma lets say that folder name is INPUT. We have also created one more folder named OUTPUT and now the requirement is there is one executable converter file .exe in another folder lets say CONVERTER . Now the requirement is i need to execute that .exe file on excel file which it will then convert into necessary format which can be uploaded in bank site. The command works fine from windows i need to incorporate and execute the same command from SAP Kindly suggest any Function module,syntax or class n method exists for same.

The command which executed successfully from windows command prompt is

c:\>CONVERTER\ converter.exe C:\INPUT\FILE.XLS C:\OUTPUT\

The same command i need to execute it from SAP Report

Thanks

Parag

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
714

Hi Parag,

It is advisable to use OO method of invoking these commands as mentioned above CL_GUI_FRONTEND_SERVICES=>EXECUTE.

Thanks and Best Regards,

Dinesh.

Hi,

There is a requirement wherein one folder is created on presentation server ( Desktop ) in which we are putting excel files from

SAP ABAP using FM GUI_DOWNLOAD and now that folder contain file in excel forma lets say that folder name is INPUT. We have also created one more folder named OUTPUT and now the requirement is there is one executable converter file .exe in another folder lets say CONVERTER . Now the requirement is i need to execute that .exe file on excel file which it will then convert into necessary format which can be uploaded in bank site. The command works fine from windows i need to incorporate and execute the same command from SAP Kindly suggest any Function module,syntax or class n method exists for same.

The command which executed successfully from windows command prompt is

c:\>CONVERTER\ converter.exe C:\INPUT\FILE.XLS C:\OUTPUT\

The same command i need to execute it from SAP Report

Thanks

Parag

4 REPLIES 4
Read only

marcin_cholewczuk
Active Contributor
0 Likes
714

Hi Parag,

Most of such actions can be done with use of class CL_GUI_FRONTEND_SERVICES. In your case

CL_GUI_FRONTEND_SERVICES=>EXECUTE with use of APPLICATION parameter.

BR

Marcin Cholewczuk

Read only

Former Member
0 Likes
714

Hi:

Try with this:

CALL METHOD cl_gui_frontend_services=>execute

EXPORTING

application = u2018C:\CONVERTER\converter.exeu2019

parameter = u2018C:\INPUT\FILE.XLS C:\OUTPUT\u2019

minimized = u2018Xu2019

  • EXCEPTIONS

  • cntl_error = 1

  • error_no_gui = 2

  • bad_parameter = 3

  • file_not_found = 4

  • path_not_found = 5

  • file_extension_unknown = 6

  • error_execute_failed = 7

  • synchronous_failed = 8

  • not_supported_by_gui = 9

  • others = 10.

Read only

syedashkar_rizvi
Explorer
0 Likes
714

Dear Parag

Try the code written below. I hope this will help you.

CALL FUNCTION 'WS_EXECUTE'

EXPORTING

commandline = 'converter.exe C:\INPUT\FILE.XLS C:\OUTPUT\' "filename

program = 'c:\>CONVERTER\' "prg_location

EXCEPTIONS

frontend_error = 1

no_batch = 2

prog_not_found = 3

illegal_option = 4

gui_refuse_execute = 5

OTHERS = 6.

Regards

Ashkar Rizvi

Read only

Former Member
0 Likes
715

Hi Parag,

It is advisable to use OO method of invoking these commands as mentioned above CL_GUI_FRONTEND_SERVICES=>EXECUTE.

Thanks and Best Regards,

Dinesh.