cancel
Showing results for 
Search instead for 
Did you mean: 

Running a VB script in SAP

aditya_niyogi
Participant
0 Kudos

Hi ,

I would like to know if it is possible to run a .VBS file through SAP. Currently I am using the GUI_EXEC function module to execute a .bat file located in my system.

However I would like to make a job which will run and execute the .VBS script automatically.

Thanks & Regards,

Aditya

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

It is possible. If you run the script recorder (ALT+F12, etc) it will save the code as vbs. Then you can run it from the same SAP menu, Windows Explorer or the Windows Task Scheduler.

Edited by: mrappi on Feb 4, 2010 2:01 AM

aditya_niyogi
Participant
0 Kudos

Hi,

Since my requirement was in executing a query which accesses LDAP server - I used the SAP standard function modules for LDAP. This resolved my issues. Basically the VBscript cannot be executed in the background, hence the script had to be converted to a corresponding ABAP development.

Thanks,

Aditya

0 Kudos

hi

Why is that some people say that VBscript can't be executed in the background mode?

Of course it can if you do it right

When calling function "WS_EXECUTE" just add the "In Background Task" at the end to execute the VBscript or other scripts.

This  extra line "In backround task" should not raise the exception

CL_GUI_FRONTEND_SERVICES======CP.

it should look like this.

data: commandline(1000).

commandline = 'P:\sapfrontend.vbs'.

  call function 'WS_EXECUTE' in BACKGROUND TASK
       exporting
            commandline    = commandline
            program        = 'WSCRIPT.EXE'
       exceptions
            frontend_error = 1
            no_batch       = 2
            prog_not_found = 3
            illegal_option = 4
            others         = 5.