• SAP 文件操作类 CL_GUI_FRONTEND_SERVICES


    1 、文件下载。

    DATA: l_filename   TYPE string,        "file name
            l_path       TYPE string,        "file path
            l_fullpath   TYPE string,        "full path
            l_useraction TYPE i,             "user action
            l_encoding   TYPE abap_encoding. "endocding
    
    
      " get file to save as
      cl_gui_frontend_services=>file_save_dialog(
         EXPORTING
           default_extension    = gco_dot_txt
           default_file_name    = gco_def_namt
           with_encoding        = abap_true
           file_filter          = cl_gui_frontend_services=>filetype_text
        CHANGING
          filename             = l_filename
          path                 = l_path
          fullpath             = l_fullpath
          user_action          = l_useraction
          file_encoding        = l_encoding
         EXCEPTIONS
           cntl_error           = 1
           error_no_gui         = 2
           not_supported_by_gui = 3
           OTHERS               = 4
             ).
      IF sy-subrc IS INITIAL.
        CASE l_useraction.
          WHEN cl_gui_frontend_services=>action_cancel.
            CLEAR l_fullpath.
            MESSAGE i001(00) WITH text-010.
          WHEN cl_gui_frontend_services=>action_ok OR
               cl_gui_frontend_services=>action_replace.
            cl_gui_frontend_services=>gui_download(
              EXPORTING
                filename                  = l_fullpath
                append                    = space
                write_field_separator     = space
                trunc_trailing_blanks     = gco_true
                confirm_overwrite         = space
                no_auth_check             = gco_true
                codepage                  = l_encoding
              CHANGING
                data_tab                  = git_etab
              EXCEPTIONS
                file_write_error          = 1
                no_batch                  = 2
                gui_refuse_filetransfer   = 3
                invalid_type              = 4
                no_authority              = 5
                unknown_error             = 6
                header_not_allowed        = 7
                separator_not_allowed     = 8
                filesize_not_allowed      = 9
                header_too_long           = 10
                dp_error_create           = 11
                dp_error_send             = 12
                dp_error_write            = 13
                unknown_dp_error          = 14
                access_denied             = 15
                dp_out_of_memory          = 16
                disk_full                 = 17
                dp_timeout                = 18
                file_not_found            = 19
                dataprovider_exception    = 20
                control_flush_error       = 21
                not_supported_by_gui      = 22
                error_no_gui              = 23
                OTHERS                    = 24
                   ).
            IF NOT sy-subrc IS INITIAL.
              MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                         WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
              CLEAR l_fullpath.
            ENDIF.
          WHEN cl_gui_frontend_services=>action_append.
            " no header required
          WHEN OTHERS.
            CLEAR l_fullpath.
        ENDCASE.
      ENDIF.
    
      CONCATENATE p_path g_seqno gco_bpt INTO g_path.
      cl_gui_frontend_services=>gui_download(
      EXPORTING
        filename     = g_path
    *    bin_filesize = lv_binary_leng
        filetype     = gco_bin
      CHANGING
        data_tab     = git_etab
      EXCEPTIONS
        OTHERS   = 1
    ).
      IF sy-subrc <> 0..
    
      ENDIF.
  • 相关阅读:
    chrony软件使用说明
    使用cobbler批量安装操作系统(基于Centos7.x )
    kickstart模式实现批量安装centos7.x系统
    uCGUI字符串显示过程分析和uCGUI字库的组建
    Network boot from AMD Am79C970A
    关于TFTLCD硬件接口和驱动的问题
    (转)关于模拟地和数字地分开的问题解释!
    获取单片机代码运行时间的方法
    stm32类型cl、vl、xl、ld、md、hd的含义
    RS232转RS485电路图分析
  • 原文地址:https://www.cnblogs.com/JackeyLove/p/13070692.html
Copyright © 2020-2023  润新知