‎2007 May 29 10:52 AM
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.
‎2007 May 29 11:00 AM
Hi,
the infile2 should be declared as type STRING.
Regards,
Vidya.
‎2007 May 29 11:00 AM
Hi,
the infile2 should be declared as type STRING.
Regards,
Vidya.
‎2007 May 29 11:02 AM
data: infile_up type string.
move infile1 to infile_up.
pass this to GUI_UPLOAD.
Regards,
Amit
Reward all helpful replies.
‎2007 May 29 11:09 AM
Hi,
As above said the filename for the FM is of String type.
Declare as below:
parameters : p_filename type string.
Regards
Shiva
‎2007 May 29 11:15 AM
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
‎2007 May 29 12:55 PM
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.