‎2008 Dec 12 9:34 AM
Hi all,
I have a flat file in text format with records separated by comma. How can i move to internal table?
Given has field separator as 'X' but still record not moved.
‎2008 Dec 12 9:51 AM
‎2008 Dec 12 9:35 AM
This is really solved in this forum over and over and over again. Isnt it possible to search first before asking?
‎2008 Dec 12 9:51 AM
‎2008 Dec 12 9:53 AM
the first step is to find the path of the file using the FM 'F4_FILENAME'
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = 'F_PATH'
IMPORTING
file_name = f_path.
the P_PATH should be declare as f_path TYPE rlgrap-filename .
and assign the path to a variable type STRING (text file TYPE STRING).
before that declare a internal table in the structure of the notepad
Then for uploading the file name use FM - GUI_UPLOAD
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = textfile
filetype = 'ASC'
has_field_separator = '#'
TABLES
data_tab = int_dats[]. " value returned in the internal table
regards
chinnaiya
‎2008 Dec 12 10:42 AM
hi,
try using this function module with fname = name of flat file
DATA FNAME TYPE RLGRAP-FILENAME.
DATA PNAME TYPE STRING
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
STATIC = ' '
MASK = ' '
CHANGING
FILE_NAME = fname
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2
PNAME = FNAME.
and gui_upload:
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = PNAME
FILETYPE = 'ASC'
thanks
Arjun