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

CL_GUI_FRONTEND_SERVICES => EXECUTE doesn't execute a command.

Former Member
0 Likes
5,171

Hello!

Yesterday when using CL_GUI_FRONTEND_SERVICES => EXECUTE method I ran into a weird problem. The problem is that I cannot correctly run a .bat batch file that is located in a client computer. I created a .bat file with few input parameters and when running it from my Windows computer then everything works spectacularly but when I try to run this using EXECUTE then it just doesn't run correctly. For testing purposes I hardcoded these parameters into the batch file and when running from Windows it runs a java utility. (The reason why I don't use EXECUTE to run the java utility directly is that the parameter string to this utility is more than 255 characters long but most of the parameter string is just static information and really only 20 characters change every run and that's why I created a .bat file). The problem is that when I execute this batch file from SAP then a file has to be created as a result and then I upload this file to server. When running locally this file is created correctly without any hassle but when calling it from SAP then it calls this java utility at client computer but it stops at some place and doesn't create the required file. This utility wasn't created by me so I cannot locate the place where it stops.

The code I use to execute the .bat file is:

CONCATENATE '"' xml_dl_path '" ' PIN2 INTO sign_params RESPECTING BLANKS.

   CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE

     EXPORTING

       application            = 'launch.bat'

       default_directory      = 'C:\Tools\jdigidoc\'

        parameter              = sign_params

       synchronous            = 'X'

       minimized              = 'X'

     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.

Could it be that there are some weird authorization loopholes I have to jump thorugh before I can successfully run this bat file?

1 ACCEPTED SOLUTION
Read only

FredericGirod
Active Contributor
0 Likes
3,682

Hi Rauno,

did you have deactivate the security option of the SAPgui ?

regarsd

Fred

11 REPLIES 11
Read only

FredericGirod
Active Contributor
0 Likes
3,683

Hi Rauno,

did you have deactivate the security option of the SAPgui ?

regarsd

Fred

Read only

0 Likes
3,682

Yes I did that and nothing changed.

Read only

0 Likes
3,682

Do you have check about variable environment ?   example : the path of the executable prog, the directory ... 

Do you have created a log file to store some important value of the script .. ?

regards

Fred

Read only

0 Likes
3,682

As I said the execute command executes the .bat script. But it doesn't finish correctly. It searches for some dll files from the system and after that it stops working. Those dll files are essential to the java utility I'm acttivating from the batch script. When I run the same script from the client computer directly then it finds the dll files and runs as it should.

Read only

0 Likes
3,682

I'm not a Microsoft addict, but, when you create a batch, at first you have to define the environment variable. Because when you connect to a computer the system give you a set of variable. I'm not sure you have the same variable when you use the SAP method. 

try to open a commande prompt, and launch the "set" command, you will understand

regards

Fred

Read only

0 Likes
3,682

The thing is that this batch file finds the environment variable. When the java utility starts looking the dll then this thing pops up into the cmd screen:

JDigiDoc - 3.7.2.652

Reading config file: jdigidoc-pkcs11.cfg

Creating digidoc: DIGIDOC-XML / 1.3

Format: DIGIDOC-XML ver: 1.3

Adding data-file: C:\Users\Rauno Veberson\AppData\Local\SAP\SAP GUI\tmp\SEPA_PAYM0330.xml, text/xml, EMBEDDED_BASE64

Format: DIGIDOC-XML ver: 1.3

Signing digidoc

Format: DIGIDOC-XML ver: 1.3

2013-10-29 13:34:34 [PKCS11SignatureFactory,INFO] initPKCS11; Loading PKCS11 driver: eTPKCS11.dll libpath: C:\Program Files\Java\jdk1.7.0_25\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Estonian ID Card\;C:\RUBY193\BIN;C:\PROGRAM FILES (X86)\INTEL\ICLS CLIENT\;C:\PROGRAM FILES\INTEL\ICLS CLIENT\;C:\Windows\SYSTEM32;C:\Windows;C:\Windows\SYSTEM32\WBEM;C:\Windows\SYSTEM32\WINDOWSPOWERSHELL\V1.0\;C:\PROGRAM FILES\INTEL\INTEL(R) MANAGEMENT ENGINE COMPONENTS\DAL;C:\PROGRAM FILES\INTEL\INTEL(R) MANAGEMENT ENGINE COMPONENTS\IPT;C:\PROGRAM FILES (X86)\INTEL\INTEL(R) MANAGEMENT ENGINE COMPONENTS\DAL;C:\PROGRAM FILES (X86)\INTEL\INTEL(R) MANAGEMENT ENGINE COMPONENTS\IPT;C:\PROGRAM FILES (X86)\INTEL\OPENCL SDK\2.0\BIN\X86;C:\PROGRAM FILES (X86)\INTEL\OPENCL SDK\2.0\BIN\X64;C:\PROGRAM FILES\COMMON FILES\LENOVO;C:\PROGRAM FILES (X86)\LENOVO\ACCESS CONNECTIONS\;C:\SWTOOLS\READYAPPS;C:\PROGRAM FILES (X86)\SYMANTEC\VIP ACCESS CLIENT\;C:\PROGRAM FILES (X86)\COMMON FILES\LENOVO;C:\PROGRAM FILES (X86)\INTEL\OPENCL SDK\2.0\BIN\X86;C:\PROGRAM FILES (X86)\INTEL\OPENCL SDK\2.0\BIN\X64;C:\IDU0080TOOLS\ANT182\BIN;C:\CURL-7.28.1-WIN64-NOSSL;C:\PROGRAM FILES (X86)\ESTONIAN ID CARD DEVELOPMENT\LIBDIGIDOC;C:\PROGRAM FILES\APACHE SOFTWARE FOUNDATION\TOMCAT 7.0_CATALINA\BIN;C:\PROGRAM FILES\INTEL\WIFI\BIN\;C:\PROGRAM FILES\COMMON FILES\INTEL\WIRELESSCOMMON\;C:\Program Files\Java\jdk1.7.0_25\bin;C:\Program Files\ThinkPad\Bluetooth Software\;C:\Program Files\ThinkPad\Bluetooth Software\syswow64;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\SafeNet\Authentication\SAC\x64;C:\Program Files\SafeNet\Authentication\SAC\x32;C:\Program Files\Java\jdk1.7.0_25\bin;C:\Program Files (x86)\SSH Communications Security\SSH Secure Shell;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\SafeNet\Authentication\SAC\x32\BSecClient;.

I think it means that it found the environment variable it was looking for. However this is the last thing this batch file shows and after that - nothing.

When it's successful then these line should be printed out aswell:

GET Cert in slot: 0

Prepare signature, cert: OK status: true

Format: DIGIDOC-XML ver: 1.3

Finalize signature: S0 profile: TM sig-len: 256

Format: DIGIDOC-XML ver: 1.3

JDigiDoc end, time: 7 sec result: success


Read only

0 Likes
3,682

I finally thought I'd give it a try and it seems to work now. Adding the path into the beginning of this .bat file made all the difference.

SET PATH = %PATH%

Read only

0 Likes
3,682

Good news,

thank you for sharing your solution

regards

Fred

Read only

JimRadiantExplorer
Product and Topic Expert
Product and Topic Expert
0 Likes
3,682

Hello,

Have you tried with examples in note 77075?

Thanks.

Jim

Read only

0 Likes
3,682

That would be very useful note but this function is obsolete and as I stated in the question I don't even use it so I don't really see the importance of this note.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
3,682

Could you create a shortcut to your .bat file, and check the box "run as administrator", then execute this shortcut and not the .bat file ?

Regards,

Raymond