ABAP--编写下载(AS->PC)并在客户端打开的程序示例
report Z_TEST.
data: begin of mtab occurs 1,
text(72),
end of mtab.
data: winsys(2).
read report 'Z_TEST' into mtab.
*Read PC platform
call function 'WS_QUERY'
exporting
query = 'WS'
importing
return = winsys.
case winsys.
when 'MF'. "// Unix-Motif
call function 'WS_DOWNLOAD'
exporting
filename = 'mess.dat'
filetype = 'ASC'
tables
data_tab = mtab.
call function 'WS_EXECUTE'
exporting
inform = 'X'
program = '/usr/local/bin/xmessage'
commandline = '-file mess.dat'.
when 'PM'. "// OS/2-PM
call function 'WS_DOWNLOAD'
exporting
filename = 'C:/MESS.DAT'
filetype = 'ASC'
tables
data_tab = mtab.
call function 'WS_EXECUTE'
exporting
inform = 'X'
program = 'E'
commandline = 'C:/MESS.DAT'.
when 'WN'. "// Windows
call function 'WS_DOWNLOAD'
exporting
filename = 'C:/MESS.DAT'
filetype = 'ASC'
tables
data_tab = mtab.
call function 'WS_EXECUTE'
exporting
inform = 'X'
program = 'NOTEPAD'
commandline = 'C:/MESS.DAT'.
when 'MC'. "// Mac
data: path like rlgrap-filename, cd like rlgrap-filename.
call function 'WS_QUERY'
exporting
query = 'CD'
importing
return = cd.
path = cd.
data len type i.
len = strlen( path ).
write 'MESS.DAT' to path+len.
call function 'WS_DOWNLOAD'
exporting
filename = path
filetype = 'ASC'
tables
data_tab = mtab.
path ='open file "'.
len = strlen( path ).
write cd to path+len.
len = strlen( path ).
write 'MESS.DAT"' to path+len.
call function 'WS_EXECUTE'
exporting
program = 'ttxt'
commandline = path
osmac_creator = 'X'
osmac_script = 'X'.
when others.
write: / text-001. "// illegal frontend
endcase.