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: 

Execute Batch file present in Application Server

venkat_aileni
Contributor
0 Kudos

Hello Experts,

I want to run the batch file present on the Application server not on the Presentation server.

I know if it is in presentation server we can use the below methods:

'GUI_EXEC  or WS_EXECUTE or by using method CL_GUI_FRONTEND_SERVICES=>EXECUTE '

By using OPEN DATASET we can read/write/change normal file present in application server but how to run the batch file present on the Application Server.

Thanks in advance,

Venkat

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

Look at SM49 for external commands executed on AS. You can execute those commands with FMs like SXPG_CALL_SYSTEM or SXPG_COMMAND_EXECUTE.

Regards,

Raymond

5 REPLIES 5

raymond_giuseppi
Active Contributor
0 Kudos

Look at SM49 for external commands executed on AS. You can execute those commands with FMs like SXPG_CALL_SYSTEM or SXPG_COMMAND_EXECUTE.

Regards,

Raymond

Former Member
0 Kudos

You can use SXPG_COMMAND_EXECUTE to execute command for your operating system for the application server. You can use SM69/SM49 to create command.

venkat_aileni
Contributor
0 Kudos

Thanks Raymond and Roy for your quick responses.

I just want to know whether do we have any other option rather than creating external commands.

Like specifying the batch file path so that it(FM or Class) triggers all the commands in the file like we do for batch files present on the presentation server.

Thanks,

Venkat

0 Kudos

This depends mostly on the OS of the AS, some have some "command.com" like command that execute a script.

Regards,
Raymond

venkat_aileni
Contributor
0 Kudos

Conclusion:

As suggested by Raymond and Roy i have created External Command using transaction code SM69.

In the Operating system command i have placed my Batch file path which consists of multiple commands.

And i have passed this external command name as import parameter to FM 'SXPG_COMMAND_EXECUTE'.

Thanks all for your support,

Venkat