메뉴 건너뛰기

SAP 한국 커뮤니티

GUI_DOWNLOAD 펑션(메소드) 사용시 Leading Zero현상 해결방법

 

아래와 같이 FiletType을 'DBF'로 주게되면 Leading Zero현상을 해결 할 수 있습니다.

 

ex) 다운로드시 값의 앞에 0이 있는값이 아래와 같이 0이 빠져서 다운로드되는 문제를 해결합니다.

    00002000010   -> 2000010

 

FORM DOWLOAD .

 

 

  V_FILETYPE = '.xls'.                                                               " Excel File Extentation .xls

  V_FILENAME = P_FILE.                                                         " File Name

  CONCATENATE P_FILE V_FILETYPE INTO LV_FILENAME.

  CALL FUNCTION 'GUI_DOWNLOAD'

    EXPORTING

      FILENAME                              = LV_FILENAME                  " Excel File with path and extentation like "C:TempTest.Xls

      FILETYPE                              = 'DBF'

      WRITE_FIELD_SEPARATOR   = ' '

    TABLES

      DATA_TAB                              = I_FINAL     " Final Internal table with Data

      FIELDNAMES                          = INT_HEAD    " Technical Field Name

    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

      OTHERS                  = 22.

  IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  ENDIF.

ENDFORM.                    " DOWLOAD