‎2007 May 08 10:32 AM
Hi all,
i have data in my flat file in the following format:
0:2000:2029:34
now i have a module pool interface and i need to catch the figures into text boxes on the click of that button.if somebody can help i shall be delighted.
thanks and regards,
sachin
‎2007 May 08 10:37 AM
sachin ,
try this 1st upload the data into the internal table.using GUI_upload
Map the fields of the internal table to the fields of the module pool interface.
you have to write ur code in the PAI on the click of that button.
say if that button is display.
when 'display'.
call function GUI_upload.
map the fields and then display it..........
‎2007 May 08 10:37 AM
sachin ,
try this 1st upload the data into the internal table.using GUI_upload
Map the fields of the internal table to the fields of the module pool interface.
you have to write ur code in the PAI on the click of that button.
say if that button is display.
when 'display'.
call function GUI_upload.
map the fields and then display it..........
‎2007 May 08 10:57 AM
‎2007 May 08 11:05 AM
declare the itab with field type string.
and upload the data into itab.
using split statement separate the values into different fields.
move this field values to screen fields.
‎2007 May 08 11:05 AM
sachin ,
Try using this
HAS_FIELD_SEPARATOR = '<b>:</b>'
i guess you can do it
else the next option is take a string upload the data in the string and then split the data using SPLIT as told by sudha................
‎2007 May 08 11:17 AM
check this code.............
DATA: i_file like rlgrap-filename value '/usr/sap/tmp/file.txt'.
DATA: begin of it_datatab occurs 0,
row(500) type c,
end of it_datatab.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = i_file
filetype = 'ASC'
TABLES
data_tab = it_datatab "ITBL_IN_RECORD[]
EXCEPTIONS
file_open_error = 1
OTHERS = 2.
‎2007 May 08 11:27 AM
hi Sachin,
Here is the dummy code for you...............
say there are only 4 fields in the flat file as mentioned
0:2000:2029:34
data : begin of itab occurs 0 ,
f1,
f2(4),
f3(4),
f4(2),
end of itab.
DATA: i_file type string
value 'C:\Documents and Settings\amarwaha\Desktop\test.txt'.
DATA: begin of it_datatab occurs 0,
row(500) type c,
end of it_datatab.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = i_file
filetype = 'ASC'
TABLES
data_tab = it_datatab "ITBL_IN_RECORD[]
EXCEPTIONS
file_open_error = 1
OTHERS = 2.
loop at it_datatab.
split it_datatab-row at ':' into itab-f1 itab-f2 itab-f3 itab-f4.
append itab.
endloop.
now itab has all the data in the four fields...........
‎2007 May 08 11:29 AM
‎2007 May 08 11:36 AM
‎2007 May 08 11:37 AM
I just want to add one note: gui_upload reads the file from your local pc, and doesn't work in background.
If the file is not reachable from your PC or you want to read it from a batch job, you should use open dataset/read dataset instead.
‎2007 May 08 10:38 AM
Use the SPLIT statement.
SPLIT <fieldname> at ':' into <field1>....
Hope this helps.
Sudha
‎2007 May 08 10:53 AM
‎2007 May 08 11:52 AM
just create internal table with character dat type and in pbo module write
module upload, double click on upload and
in code
call function 'GUI_UPLOAD'
exporting
importing
tables
i_itab = tablename[]
...
reward points if helpful.
with regards,
suresh babu.