ABAP-Download/Upload text element into local file

Some times we want to download/upload the text symbol of text element into/from local file, we can use below report, It's very useful.

 

**********************************************************

report zz_download_text_pool.

 

parameters:

  p_report like sy-repid,      "report name handled

  p_file like rlgrap-filename,    "local file path

  p_lang like sy-langu,        "Langauge version

  p_up type c  radiobutton group 1,    "Upload

  p_down type c radiobutton group 1 default 'X'.    "Download

 

data: it_text like textpool occurs 100 with header line.

start-of-selection.

************************

*     Download

************************

If p_down = 'X'.

  read textpool p_report into it_text language p_lang.

 

  if sy-subrc = 0.

    call function 'WS_DOWNLOAD'

        exporting

             filename            = p_file

             filetype            = 'DAT'

         tables

              data_tab            = it_text

         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.

    write: / 'ws_download : ', sy-subrc.

  else.

    write: / 'read textpool : ', sy-subrc.

  endif.

else.

*************************

**     Upload

*************************

  call function 'WS_UPLOAD'

       exporting

            filename            = p_file

            filetype            = 'DAT'

       tables

            data_tab            = it_text

       exceptions

            conversion_error    = 1

            file_open_error     = 2

            file_read_error     = 3

            invalid_table_width = 4

            invalid_type        = 5

            no_batch            = 6

            unknown_error       = 7

            others              = 8.

 

  if sy-subrc = 0.

    insert textpool p_report from it_text language p_lang.

    write: / 'insert textpool : ', sy-subrc.

  else.

    write: / 'ws_upload : ', sy-subrc.

  endif.

 

endif.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值