*-----------------------------------------------------------------------
* This program generates a small Visual Basic Script file, which in
* turn shows a message box on the screen.
*-----------------------------------------------------------------------
REPORT ztest NO STANDARD PAGE HEADING.
DATA: mess_table LIKE STANDARD TABLE OF soli WITH HEADER LINE,
file_exe LIKE rlgrap-filename,
my_message(255).
*-----------------------------------------------------------------------
* This code creates the message box
*-----------------------------------------------------------------------
APPEND: 'Dim myolapp ' TO mess_table,
'Set myolapp = CreateObject("Access.Application") '
TO mess_table,
'Dim myVar' TO mess_table.
my_message = 'This is my message to the user'.
CONCATENATE 'myVar = MsgBox ("' my_message '", 0, "Warning")'
INTO my_message.
APPEND my_message TO mess_table.
*-----------------------------------------------------------------------
* Generated Script file must be downloaded into the TEMP folder of
* the Windows environment
*-----------------------------------------------------------------------
CALL FUNCTION 'WS_QUERY'
EXPORTING
environment = 'TEMP'
query = 'EN'
IMPORTING
return = file_exe
EXCEPTIONS
inv_query = 1
no_batch = 2
frontend_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
CONCATENATE file_exe '\my_script.vbs' INTO file_exe.
*-----------------------------------------------------------------------
* Script file is downloaded
*-----------------------------------------------------------------------
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
filename = file_exe
filetype = 'DAT'
mode = 'S'
TABLES
data_tab = mess_table
EXCEPTIONS
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_table_width = 4
invalid_type = 5
no_batch = 6
unknown_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
*-----------------------------------------------------------------------
* The Script file is executed
*-----------------------------------------------------------------------
CALL FUNCTION 'WS_EXECUTE'
EXPORTING
commandline = file_exe
program = 'WSCRIPT.EXE'
EXCEPTIONS
frontend_error = 1
no_batch = 2
prog_not_found = 3
illegal_option = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDIF.
02/08/2010
Generates a Small Visual Basic Script File
Assinar:
Postar comentários (Atom)
Nenhum comentário:
Postar um comentário