‎2010 Jun 12 5:58 AM
I have a req. in which i have to read file of format given below:
01 text
03 text
09 text
08 text
09 text
08 text
04 text
02 text
where 01, 03, 09, 08,04,02 are record types and 01,03, 04,02 are header and footer records and 09, 08 are the record types from which actual data has to be read .
For one employee some data has to be read from 09 record and some from 08 record. My problem is to how to read this data and get into an internal table (i.e . when to append the data in an internal table?).
Can anyone help me in this?
Thanks in advance!
Regards
Aleria Thomson
‎2010 Jun 12 6:30 AM
HI,
Please specifyin detail .
If r u uploading a file with the file format given then use FM GUI_UPLOAD
‎2010 Jun 12 7:17 AM
Hi,
See this example.
DATA : T_UPTAB LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE .
DATA : BEGIN OF T_DATA OCCURS 0,
01 text
03 text
09 text
08 text
09 text
08 text
04 text
02 text
end of t_data.
IF NOT P_FILE1 IS INITIAL."P_FILE1 is path in selection screen
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_FILE1
I_BEGIN_COL = 1
I_BEGIN_ROW = 2
I_END_COL = 37
I_END_ROW = 5000
TABLES
INTERN = T_UPTAB
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC EQ 0.
MESSAGE S208(00) WITH 'Successfully Uploaded the File'.
ELSE.
MESSAGE E208(00) WITH 'Error in the Uploaded file formate'.
ENDIF.
DELETE T_UPTAB WHERE VALUE IS INITIAL.
LOOP AT T_UPTAB .
AT NEW ROW .
CLEAR : T_DATA.
ENDAT .
IF T_UPTAB-COL = 1 .
T_DATA-01 = T_UPTAB-VALUE .
ELSEIF T_UPTAB-COL = 2 .
T_DATA-02 = T_UPTAB-VALUE .
ELSEIF T_UPTAB-COL = 3 .
T_DATA-03 = T_UPTAB-VALUE.
ELSEIF T_UPTAB-COL = 4 .
T_DATA-04 = T_UPTAB-VALUE .
AT END OF ROW.
APPEND T_DATA.
ENDAT.
endloop.
Regards,
Raj.