Skip to Content
0
Jan 12, 2011 at 09:21 PM

JavaScript in ABAP Program

768 Views

hi folk,

I have some Javascript codes in my abap program as you can see below.

It does simple not work for me.

But in the debugger mode as I can see the message it says something about:

" ReferenceError: ActiveX Object is not defined "

It has something with Acticve XObject. What am I missing here? Do I need install any additional component?

data JS_CODE type STRING.

data RETURN_JS_VAR type STRING.

data JS_PROC type ref to CL_JAVA_SCRIPT.

JS_PROC = CL_JAVA_SCRIPT=>CREATE( ).

concatenate

'var filePath = "C:
Windows
notepad.exe"; '

'set fso = CreateObject("Scripting.FileSystemObject");'

'var string = fso.GetFileVersion(filePath); '

'function Set_String() '

' { string += ", this is a Blog!"; '

' } '

'Set_String(); '

'string; '

into JS_CODE separated by CL_ABAP_CHAR_UTILITIES=>CR_LF.

JS_PROC->COMPILE( SCRIPT_NAME = 'GETVERSION.JS'

SCRIPT = JS_CODE ).

RETURN_JS_VAR = JS_PROC->EXECUTE( 'GETVERSION.JS' ).

write RETURN_JS_VAR.