Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

GUI_UPLOAD

Former Member
0 Likes
570

I wanna use this Function Module in my program, but when I put 'DAT' in the parameter field 'FILETYPE', it gives me a message 'Wrong Parameter for FILETYPE'...I checked the long text of 'FILETYPE', it said that 'ASC' 'DAT' 'BIN' are available for this parameter...

who can tell me why? thx

5 REPLIES 5
Read only

Former Member
0 Likes
533

Dear Lupin

Please check the below code for some idea:

data: fname type string value 'C:test'.


CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
*   BIN_FILESIZE                    =
    FILENAME                        = fname
*   FILETYPE                        = 'DAT'
   APPEND                          = ' '
*   WRITE_FIELD_SEPARATOR           = ' '
*   HEADER                          = '00'
*   TRUNC_TRAILING_BLANKS           = ' '
*   WRITE_LF                        = 'X'
*   COL_SELECT                      = ' '
*   COL_SELECT_MASK                 = ' '
*   DAT_MODE                        = ' '
*   CONFIRM_OVERWRITE               = ' '
*   NO_AUTH_CHECK                   = ' '
*   CODEPAGE                        = ' '
*   IGNORE_CERR                     = ABAP_TRUE
*   REPLACEMENT                     = '#'
*   WRITE_BOM                       = ' '
*   TRUNC_TRAILING_BLANKS_EOL       = 'X'
*   WK1_N_FORMAT                    = ' '
*   WK1_N_SIZE                      = ' '
*   WK1_T_FORMAT                    = ' '
*   WK1_T_SIZE                      = ' '
* IMPORTING
*   FILELENGTH                      =
  TABLES
    DATA_TAB                        = itab
*   FIELDNAMES                      =
 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.

Guess you might be giving some file extension and giving filetype as DAT and that might be throwing an error. Please check.

Kind Regards

Eswar

Read only

Former Member
0 Likes
533

Hi,

The GUI_DOWNLOAD will accept only BIN or ASC as the file type..Try using the fm WS_DOWNLOAD..THis will accept DAT..But this FM is obselete..

  • filetype parameter valid ?

CASE filetype.

WHEN 'BIN' OR 'ASC'.

WHEN OTHERS.

RAISE INVALID_TYPE.

ENDCASE.

THanks,

Naren

Message was edited by: Narendran Muthukumaran

Read only

Former Member
0 Likes
533

Hi Lupin

You need to type ASC FOR TXT FILE NAME

DAT FOR EXCEL FILE.

I guess this should solve your problem.

Thanks

Venki

Read only

Former Member
0 Likes
533

give ASC if its text file ...give DBF if its excel file

Read only

Former Member
0 Likes
533

hi

good

Retrieve data file from presentation server(Upload from PC)

DATA: i_file like rlgrap-filename value '/usr/sap/tmp/file.txt'.

DATA: begin of it_datatab occurs 0,

row(500) type c,

end of it_datatab.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = i_file

filetype = 'ASC'

TABLES

data_tab = it_datatab "ITBL_IN_RECORD[]

EXCEPTIONS

file_open_error = 1

OTHERS = 2.

use like this i hope you might not have given any gap between = and 'dat', check that also.

thanks

mrutyun^