2008 Nov 19 10:17 AM
Hi ,
I am using the FM 'ALSM_EXCEL_TO_INTERNAL_TABLE' to upload a excel sheet.
The Excel sheet has a header line also.
The excel sheet may contain no data for few of the fields.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_FILE
I_BEGIN_COL = 1
I_BEGIN_ROW = 1
I_END_COL = 60
I_END_ROW = 100
TABLES
INTERN = I_DATA
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
if there is no data in that particular column , the internal table doesnt have the info for that particular field.
For ex. if ROW 1 ,COL 3 doesnt contain data :
I_DATA-ROW = '001'.
I_DATA-COL = '001'.
I_DATA-ROW = '001'.
I_DATA-COL = '002'.
I_DATA-ROW = '001'.
I_DATA-COL = '004'.
But i need that column also included in the internal table.
How to do this.
Vikki,
2008 Nov 19 10:24 AM
Hi,
Use this FM,
This FM will internally call the FM: 'ALSM_EXCEL_TO_INTERNAL_TABLE'
CALL FUNCTION 'FAA_FILE_UPLOAD_EXCEL'
EXPORTING
i_filename = p_input
i_delimiter = gc_tab (Horizontal tab cl_..)
TABLES
et_filecontent = gt_rec
EXCEPTIONS
error_accessing_file = 1
OTHERS = 2.
IF sy-subrc NE 0.
Input file could not be read
MESSAGE s001 WITH text-s02.
flg_error = gc_x. " X
EXIT.
Later the data can be split at the delimiter...
Regards
Shiva
2008 Nov 19 10:51 AM