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.
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值