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

reading data from presentation server.

Former Member
0 Likes
1,023

I have a text file in which records are space seperated.I will be entering the file name in selection screen in a parameter 'infile1' and I am trying to upload these records into a internal table using function module GUI_UPLOAD.but i get a message saying that the filename given has a different field type .function module allows you to specify only fields of particualar type under filename. my code is.

data: begin of period_rec,

pval01(3), "version

pval04(4), " fiscal year

pval06(10), " cost centre

pval12(10), " cost element

bdc0301(15), " fixed cost period 01

bdc0302(15), " fixed cost period 02

bdc0303(15), " fixed cost period 03

bdc0304(15), " fixed cost period 04

bdc0305(15), " fixed cost period 05

bdc0306(15), " fixed cost period 06

bdc0307(15), " fixed cost period 07

bdc0308(15), " fixed cost period 08

bdc0309(15), " fixed cost period 09

bdc0310(15), " fixed cost period 10

bdc0311(15), " fixed cost period 11

bdc0312(15), " fixed cost period 12

end of period_rec.

parameters : infile1 like rlgrap-filename.

data: tab like period_rec occurs 10 with header line.

call function 'GUI_UPLOAD'

exporting

filename = infile2

FILETYPE = 'ASC'

tables

data_tab = tab

  • EXCEPTIONS

if sy-subrc <> 0.

endif.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
917

Hi,

the infile2 should be declared as type STRING.

Regards,

Vidya.

5 REPLIES 5
Read only

Former Member
0 Likes
918

Hi,

the infile2 should be declared as type STRING.

Regards,

Vidya.

Read only

amit_khare
Active Contributor
0 Likes
917

data: infile_up type string.

move infile1 to infile_up.

pass this to GUI_UPLOAD.

Regards,

Amit

Reward all helpful replies.

Read only

Former Member
0 Likes
917

Hi,

As above said the filename for the FM is of String type.

Declare as below:

parameters : p_filename type string.

Regards

Shiva

Read only

Former Member
0 Likes
917

Hi KURUVELLA ,

DATA:file1 type STRING.

file1 = infile1.

call function 'GUI_UPLOAD'

exporting

filename = file1

FILETYPE = 'ASC'

tables

data_tab = tab

  • EXCEPTIONS

if sy-subrc <> 0.

endif.

why because GUI_upload accepts only string type of var for parameter Filename in exporting.

hope this solves ur problem.

Thanks

Ravinder

Read only

Former Member
0 Likes
917

Hi,

Chk ths:

as above posts just change infile1 to string and secondly u r giving infile2 which is not declared.


*&---------------------------------------------------------------------*
*& Report  ZMBJ_GUI_UPLOAD
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  zmbj_gui_upload.

DATA: BEGIN OF period_rec,
pval01(3), "version
pval04(4), " fiscal year
pval06(10), " cost centre
pval12(10), " cost element
bdc0301(15), " fixed cost period 01
bdc0302(15), " fixed cost period 02
bdc0303(15), " fixed cost period 03
bdc0304(15), " fixed cost period 04
bdc0305(15), " fixed cost period 05
bdc0306(15), " fixed cost period 06
bdc0307(15), " fixed cost period 07
bdc0308(15), " fixed cost period 08
bdc0309(15), " fixed cost period 09
bdc0310(15), " fixed cost period 10
bdc0311(15), " fixed cost period 11
bdc0312(15), " fixed cost period 12
END OF period_rec.
PARAMETERS : infile1 type string.
DATA: tab LIKE period_rec OCCURS 10 WITH HEADER LINE.

CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    filename = infile1
    filetype = 'ASC'
  TABLES
    data_tab = tab.
* EXCEPTIONS
IF sy-subrc <> 0.
ENDIF.