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
665

I'm running R/3 Enterprise (4.7).

I have an ABAP program that I changed to invoke function GUI_UPLOAD.But, it crashes if I use a variable to determine the FILENAME location.If I don't use the variable PATH the function works fine. That is, if Isay FILENAME = 'C:\MYFILE.TXT' for example, the program works OK.

Everything works fine in 4.5B where I am using WS_UPLOAD.

Any ideas what the problem might be?

Here is the code I have:

  • parameter PATH

PATH LIKE RLGRAP-UIFILENAME DEFAULT 'C:\temp\testupload.txt'.

....

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = PATH

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

HEADER_LENGTH = 0

TABLES

DATA_TAB = ITAB

EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_READ_ERROR = 2

NO_BATCH = 3

GUI_REFUSE_FILETRANSFER = 4

INVALID_TYPE = 5

NO_AUTHORITY = 6

UNKNOWN_ERROR = 7

BAD_DATA_FORMAT = 8

HEADER_NOT_ALLOWED = 9

SEPARATOR_NOT_ALLOWED = 10

HEADER_TOO_LONG = 11

UNKNOWN_DP_ERROR = 12

ACCESS_DENIED = 13

DP_OUT_OF_MEMORY = 14

DISK_FULL = 15

DP_TIMEOUT = 16

OTHERS = 17.

The old code in 4.5B looks like this:

\* CALL FUNCTION 'WS_UPLOAD'

*\ EXPORTING

\ CODEPAGE = ' '

*\ FILENAME = PATH

*\ FILETYPE = 'DAT'

\ HEADLEN = ' '

\ LINE_EXIT = ' '

\ TRUNCLEN = ' '

\ USER_FORM = ' '

\ USER_PROG = ' '

\ IMPORTING

\ FILELENGTH =

*\ TABLES

*\ DATA_TAB = ITAB

*\ 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

*\ GUI_REFUSE_FILETRANSFER = 8

*\ OTHERS = 9.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
602

FILENAME must be a STRING...You can check GUI_UPLOAD on SE37...Under IMPORT tab you can see the type of the parameters.

Greetings,

Blag.

3 REPLIES 3
Read only

Former Member
0 Likes
602

Hello Neelam,

I am guessing that the crash is a result of a type mismatch.

Try passing a variable of type string to GUI_UPLOAD for the FILENAME>

Regards

Greg Kern

Read only

Former Member
0 Likes
603

FILENAME must be a STRING...You can check GUI_UPLOAD on SE37...Under IMPORT tab you can see the type of the parameters.

Greetings,

Blag.

Read only

Former Member
0 Likes
602

Hi,

Please refer the code below:


PARAMETERS : p_file LIKE rlgrap-filename OBLIGATORY.

data : begin of itab1 occurs 0,
        values(1000) type c,
       end of itab1.


AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
  CLEAR p_file.

  CALL FUNCTION 'F4_FILENAME'
    IMPORTING
      file_name = p_file.

start-of-selection.

  filename = p_file.

  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
     FILENAME                      = filename
     FILETYPE                      = 'ASC'
     HAS_FIELD_SEPARATOR           = 'X'
    TABLES
      DATA_TAB                      = itab1
            .

Thanks,

Sriram Ponna.