美文网首页SAP技术干货SAP
导入(EXCEL、TXT)选择路径

导入(EXCEL、TXT)选择路径

作者: Mmm_余安 | 来源:发表于2017-10-31 16:51 被阅读20次
SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
PARAMETERS: MATERIAL LIKE RLGRAP-FILENAME OBLIGATORY DEFAULT 'C:\Users\jg\Desktop\新建文本文档 (3).txt'. "物料导入摸版
PARAMETERS: P_TEST AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK BLK1.


*&---------------------------------------------------------------------*
*& INITIALIZATION
*&---------------------------------------------------------------------*


INITIALIZATION.



*&---------------------------------------------------------------------*
*& AT SELECTION-SCREEN
*&---------------------------------------------------------------------*


AT SELECTION-SCREEN ON VALUE-REQUEST FOR MATERIAL.
  PERFORM SELECT_PATH."选择路径

* 方法一
    CALL FUNCTION 'TB_LIMIT_WS_FILENAME_GET'
    IMPORTING
      FILENAME         = MATERIAL
    EXCEPTIONS
      SELECTION_CANCEL = 1
      SELECTION_ERROR  = 2
      OTHERS           = 3.
  IF SY-SUBRC <> 0.
* Implement suitable error handling here
  ENDIF.


* 方法二
  DATA V_MATERIAL LIKE RLGRAP-FILENAME.

  CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
      MASK             = ',*.* ,*.*.'
      MODE             = '0'
      TITLE            = '请选择要上传的信息文件'
    IMPORTING
      FILENAME         = V_MATERIAL
    EXCEPTIONS
      INV_WINSYS       = 1
      NO_BATCH         = 2
      SELECTION_CANCEL = 3
      SELECTION_ERROR  = 4
      OTHERS           = 5.
  IF SY-SUBRC <> 0.
  ENDIF.

  MATERIAL = V_MATERIAL.

相关文章

网友评论

    本文标题:导入(EXCEL、TXT)选择路径

    本文链接:https://www.haomeiwen.com/subject/sqwbpxtx.html