2007 Aug 02 5:05 PM
Hi ABAPr's,
My Excel file containe 255 charcter and FM is taking only 50 chars.
Please help me how to read 255 charcter fields Excel files.
So, Urgent....
Thakes in advance.
Param.
Hi ABAPr's,
My Excel file containe 255 charcter and FM is taking only 50 chars.
Please help me how to read 255 charcter fields Excel files.
So, Urgent....
Thakes in advance.
Param.
2007 Aug 02 5:10 PM
u need to copy the function module and relevant data variables and modify the FM and variables according to ur requirement and use it.
2007 Aug 02 5:13 PM
2007 Aug 02 5:13 PM
Hi parameswara,
1. U want to upload data from EXCEL
into internal table.
2. and u are using ALSM_EXCEL_TO_INTERNAL_TABLE.
3. But We cannot do this direclty !
*----
For uploading purpose :
6. There are TWO options.
a) either save the excel to TAB Delimited file,
and use GUI_UPLOAD to upload the data in internal table.
b) use FM for excel purpose.
7. a) is easy and recommended
8. b) there is a FM for it,
but we have to apply some more logic
bcos the FM uploads data of excel
in the intenal table,
CELL BY CELL
9. afTER THAT , we have to convert this cell by cell data,
into our format of internal table.
10. use this code (just copy paste in new program)
(it is tried wit T001 structure data)
(it will AUTOMATICALLY based upon the
fields of internal table,
convert data from cell by cell,
to that of internal table fields)
REPORT abc.
*----
DATA : ex LIKE TABLE OF alsmex_tabline WITH HEADER LINE.
DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
DATA : cmp LIKE TABLE OF rstrucinfo WITH HEADER LINE.
DATA : col TYPE i.
DATA : col1 TYPE i.
FIELD-SYMBOLS : <fs> .
DATA : fldname(50) TYPE c.
*----
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = 'd:\def.xls'
i_begin_col = 1
i_begin_row = 1
i_end_col = 100
i_end_row = 100
TABLES
intern = ex
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
BREAK-POINT.
*----
CALL FUNCTION 'GET_COMPONENT_LIST'
EXPORTING
program = sy-repid
fieldname = 'T001'
TABLES
components = cmp.
*----
LOOP AT ex.
AT NEW row.
IF sy-tabix <> 1.
APPEND t001.
CLEAR t001.
ENDIF.
ENDAT.
col = ex-col.
col1 = col + 1.
READ TABLE cmp INDEX col.
CONCATENATE 'T001-' cmp-compname INTO fldname.
ASSIGN (fldname) TO <fs>.
<fs> = ex-value.
ENDLOOP.
BREAK-POINT.
<b>12. Or u can use other FM like this :
TEXT_CONVERT_XLS_TO_SAP
code
TYPE-POOLS : truxs.
DATA : ws_rawdata TYPE truxs_t_text_data.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR = 'X'
i_tab_raw_data = ws_rawdata
i_filename = filename
TABLES
i_tab_converted_data = (your internal table)</b>
regards,
amit m.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |