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
1,316

Hi,

In BDC report i am getting one runtime error while using Gui_ipload FM saying that filename is not specified but no error if i use the obsolete FM: UPLOAD.

Please tell me how do rectify this error.

Thanks,

Ahmed

11 REPLIES 11
Read only

Former Member
0 Likes
1,282

Hi,

Can you post your code?

Regards,

Ankur Parab

Read only

0 Likes
1,282

can u please send the sample code for GUI_DOWNLOAD.

for notepad

Read only

0 Likes
1,282

Hi,

Have a look at this and see if this helps

DATA: gv_fname TYPE string.

PARAMETERS: p_fname TYPE RLGRAP-FILENAME OBLIGATORY.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SY-REPID

  • DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = 'P_FNAME'

IMPORTING

FILE_NAME = P_FNAME

.

GV_FNAME2 = P_FNAME.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = GV_FNAME

filetype = 'ASC'

has_field_separator = 'X'

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.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Read only

Former Member
0 Likes
1,282

hi

check ur file name data type

gui_upload accept string data type not 'c'.

check out this code

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = 'p_file'

IMPORTING

FILE_NAME = P_FILE.

START-OF-SELECTION.

  • DATA: Y_V_FILE TYPE STRING.

MOVE P_FILE TO Y_V_FILE.

CALL FUNCTION 'GUI_UPLOAD' "gui_upload accept only the string thats

"why we create y_v_file and assign p_file to it

EXPORTING

FILENAME = Y_V_FILE

  • FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • VIRUS_SCAN_PROFILE =

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = Y_I_FILE

  • 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

Edited by: mayank jain on Jun 3, 2009 12:02 PM

Read only

Former Member
0 Likes
1,282

Check the type of variable u r passing to FM....lv_file_name...

And debug to see whether ur variable contain value while passing to FM!

Read only

0 Likes
1,282

I am not passing any filename .

In execution it asks for file uploading then i ll select the file.

Read only

0 Likes
1,282

To FM u have to pass the path...

check the variable before passing to FM...whether it contains path...

p_file TYPE rlgrap-filename . --- >> declare like this to get the path

Read only

0 Likes
1,282

Hi

Once you have selected the file name, that has to be passed to the Fumction Module Gui_Upload in the export parameter filename.

If you are first storing the selected filename in a local variable then check the data type of the variable. It should be of type C.

If you are directly passing that filename to FM, try passing it in between inverted comas(' ').

Regards

Gaurav.

Read only

Former Member
0 Likes
1,282

hi,

try to use this for F4 help

FORM get_F4_help CHANGING e_file TYPE RLGRAP-FILENAME.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

DEF_PATH = 'C:\ '

MASK = ',,.,..'

MODE = 'O'

IMPORTING

FILENAME = e_file

EXCEPTIONS

INV_WINSYS = 1

NO_BATCH = 2

SELECTION_CANCEL = 3

SELECTION_ERROR = 4

OTHERS = 5.

IF SY-SUBRC <> 0.

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

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

ENDIF.

Read only

Former Member
0 Likes
1,282

Dear Ahmed,

Check your file type. It should be of type string. But when you select file path from f4 functinality for that file type should RLgrap-filename. In this case you can transfer date to string type file.

or else if your path is fix. try with hard coded path in FM.

Regards,

Vijay

Read only

former_member209217
Active Contributor
0 Likes
1,282

Hi,

UPLOAD fm expects an input file name which is of type rlgrap-filename which is of character128 datatype.But the file name length may exceed 128.

Whereas in GUI_UPLOAD the type of the filename is string.

Hence declare the filename as string type.

Regards,

Lakshman