ABAP Call Vbscript Program…

ABAP Call Vbscript Program…

VBS 程序部分,这里先给一个简单的vbs 程序,存在一个网络共享文件夹内,是供在abap 中调用的。

这个vbs 是显示本地IP的一个小程序,内容如下

eg: IP.VBS

Dim WS

Set WS=CreateObject("MSWinsock.Winsock")

IPAddress=WS.LocalIP

MsgBox "Local IP=" & IPAddress

ABAP 程序部分,通过Call function WS_EXECUTE, 调过程序WSCRIPT.EXE 执行ip.vbs 脚本程序

*-----------------------------------------------------------------------

* Company XXX Company Limited

*

* Report Name: ZZW_CALL_VBS

*

* Author: Lilo.Zhu

*

* Date: 2009.10.20

*-----------------------------------------------------------------------

* Description:

* =============

* This report is to show how to call vbscript in abap

*-----------------------------------------------------------------------

* Change History:

* ===============

* Task# Date By Description

* xxxxx 2009.10.20 wei_zhu Initial Implementation

* Transport Request : ---

*----------------------------------------------------------------------

REPORT ZZW_CALL_VBS .

PARAMETER: P_SVPATH LIKE RLGRAP-FILENAME.

START-OF-SELECTION.

DATA: COMMANDLINE(1000).

COMMANDLINE = P_SVPATH. "Full path of vbs file

CALL FUNCTION 'WS_EXECUTE'

EXPORTING

COMMANDLINE = COMMANDLINE

PROGRAM = 'WSCRIPT.EXE'

EXCEPTIONS

FRONTEND_ERROR = 1

NO_BATCH = 2

PROG_NOT_FOUND = 3

ILLEGAL_OPTION = 4

OTHERS = 5.

IF SY-SUBRC NE 0.

*MESSAGE 'Error.....' TYPE 'I'.

RAISE EXECUTION_FAILED.

ENDIF.

---程序运行结果部分---

clip_image002

你可能感兴趣的:(脚本,VBScript)