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
2,361

I want to upload flat file to my report.Due to this i used GUI_UPLOAD.

MY problem

1)when i access GUI_UPLOAD, by entering

filename through selection screen.I got short dump.

syntax:

parameter: P_PFP type rlgrap-filename.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'P_PFP'

FILETYPE = 'ASC'

TABLES

DATA_TAB = I_TRANSFER

shortdump for above method:

Exception condition "FILE_OPEN_ERROR" raised.

Short description of exception condition:

File Does not Exist and Cannot be Opened

For detailed documentation of the exception condition, use

Transaction SE37 (Function Library). You can take the called

function module from the display of active calls.

2) when i access GUI_UPLOAD, by entering

filename directly.I uploaded

successfully.

syntax:

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'D:/PS_DISTRIBUTOR.TXT'

FILETYPE = 'ASC'

TABLES

DATA_TAB =I_TRANSFER

Kindly solve my problem(1).

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,842

Hi

Check this below code,

because in GUI_UPLOAD fime name dat atype is String.

so you try in this way.

parameter: P_PFP type rlgrap-filename.

data : filename type string.

filename = P_PFP.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = filename

FILETYPE = 'ASC'

TABLES

DATA_TAB = I_TRANSFER

11 REPLIES 11
Read only

Former Member
0 Likes
1,842

do not hard code ur variable....

Try this..

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = P_PFP

FILETYPE = 'ASC'

TABLES

DATA_TAB = I_TRANSFER

Reward if useful....

Regards

Sugumar.G

Read only

0 Likes
1,842

HI ganesan,

Even though, I removed quotation to P_PFP.I got short dump.

syntax:

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = P_PFP

FILETYPE = 'ASC'

TABLES

DATA_TAB = I_TRANSFER

short dump:

Type conflict when calling a function module.

The function module interface allows you to specify only fields

of a particular type under "FILENAME". The field "P_PFP" specified here

has a different field type.

Read only

Former Member
0 Likes
1,842

>

> I want to upload flat file to my report.Due to this i used GUI_UPLOAD.

>

> MY problem

>

> 1)when i access GUI_UPLOAD, by entering

> filename through selection screen.I got short dump.

>

> syntax:

>

> parameter: P_PFP type rlgrap-filename.

>

> CALL FUNCTION 'GUI_UPLOAD'

>

> EXPORTING

Remove quotes...it'll work.


"FILENAME  = 'P_PFP'
FILENAME  = P_PFP

> FILETYPE = 'ASC'

> TABLES

> DATA_TAB = I_TRANSFER

>

> shortdump for above method:

>

> Exception condition "FILE_OPEN_ERROR" raised.

> Short description of exception condition:

>

> File Does not Exist and Cannot be Opened

>

> For detailed documentation of the exception condition, use

> Transaction SE37 (Function Library). You can take the called

> function module from the display of active calls.

>

> 2) when i access GUI_UPLOAD, by entering

> filename directly.I uploaded

> successfully.

>

> syntax:

>

> CALL FUNCTION 'GUI_UPLOAD'

>

> EXPORTING

>

> FILENAME = 'D:/PS_DISTRIBUTOR.TXT'

>

> FILETYPE = 'ASC'

> TABLES

> DATA_TAB =I_TRANSFER

>

>

> Kindly solve my problem(1).

Read only

0 Likes
1,842

HI friends,

Even though, I removed quotation to P_PFP.I got short dump.

syntax:

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = P_PFP

FILETYPE = 'ASC'

TABLES

DATA_TAB = I_TRANSFER

short dump:

Type conflict when calling a function module.

The function module interface allows you to specify only fields

of a particular type under "FILENAME". The field "P_PFP" specified here

has a different field type.

Read only

0 Likes
1,842

use the following declaration

data: P_PFP LIKE rlgrap-filename.

Regards

Sugumar.G

Read only

0 Likes
1,842

Hi ganesan,

I considered P_PFP as

RLGRAP-FILENAME.In selection screen

THAT IS.

parameters: P_PFP type rlgrap-filename.

regards,

saritha.

Read only

0 Likes
1,842

saritha try using like this..

parameters : p_pfp type localfile.

data: w_fname type string.

w_fname = p_pfp.

call function 'GUI_UPLOAD'

exporting

filename = w_fname

filetype = 'ASC'

  • has_field_separator = '#'

tables

data_tab = record.

Regards

Sugumar.G

Read only

Former Member
0 Likes
1,842

in filename u need to give entire path like c:/temp/filename

Read only

Former Member
0 Likes
1,842

Hi,

Try removing the quotes: FILENAME = 'P_PFP' ---> FILENAME = P_PFP

Kind regards,

Marcel Meuffels

Read only

Former Member
0 Likes
1,843

Hi

Check this below code,

because in GUI_UPLOAD fime name dat atype is String.

so you try in this way.

parameter: P_PFP type rlgrap-filename.

data : filename type string.

filename = P_PFP.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = filename

FILETYPE = 'ASC'

TABLES

DATA_TAB = I_TRANSFER

Read only

Former Member
0 Likes
1,842

data : C_FILE1 TYPE STRING.

selection-screen begin of block b1 with frame title text-001.

selection-screen skip.

parameters : H_FILE type rlgrap-filename.

selection-screen end of block b1.

at selection-screen on value-request for H_FILE.

CALL FUNCTION 'F4_FILENAME'

  • EXPORTING

  • PROGRAM_NAME = SYST-CPROG

  • DYNPRO_NUMBER = SYST-DYNNR

  • FIELD_NAME = ' '

IMPORTING

FILE_NAME = H_FILE

.

start-of-selection.

*********For uploading header items

move H_FILE TO C_FILE1.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = C_FILE1

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

tables

data_tab = IT_XK01

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.

Reward if helpful

Rgds

Umakanth