2013 Oct 25 6:31 PM
Hy Guys.
I am using the function ALSM_EXCEL_TO_INTERNAL_TABLE a file. 'Csv' the Structure is :
| 7034-0040-1 | 3.000,00 | CD | 9999.99.99 |
Four columns.
Why the return of function returns:?
Row Column Value
| 0001 | 0001 | 7034-0040-1;3.000 |
| 0001 | 0002 | 00;CD;9999.99.99 |
should be correct is:
7034-0040-1
3.000
....
...
.....Etc.
My code is
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = 1
i_begin_row = 2
i_end_col = 4
i_end_row = 65000
TABLES
intern = t_itab
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
See attacheds:
Thanks
2013 Oct 25 6:35 PM
That function module only returns all the values in the cell. The we have to loop at it.
LOOP AT T_Itab.
AT END OF ROW.
COLLECT LW_structure INTO T_structure.
ENDAT.
endloop.
If you have a CSV file, then I believe, you could use something as simple as GUI_UPLOAD, which would format the file according to your needs.
2013 Oct 25 6:35 PM
That function module only returns all the values in the cell. The we have to loop at it.
LOOP AT T_Itab.
AT END OF ROW.
COLLECT LW_structure INTO T_structure.
ENDAT.
endloop.
If you have a CSV file, then I believe, you could use something as simple as GUI_UPLOAD, which would format the file according to your needs.
2013 Oct 25 7:29 PM
Please update your t_itab structure.
it should have four columns.
Example,
Create internal table
DATA: BEGIN OF IT_TABLE OCCURS 0,
COLUMN1 TYPE C LENGTH 10,
COLUMN2 TYPE C LENGTH 10,
COLUMN3 TYPE C LENGTH 10,
COLUMN4 TYPE C LENGTH 10,
END OF IT_TABLE.
transfer the vaue to internal table
LOOP AT T_ITAB.
CASE T_ITAB-COL.
WHEN '0001.
MOVE T_ITAB-VALUE TO IT_TABLE-COLUMN1.
WHEN '0002'.
MOVE T_ITAB-VALUE TO IT_TABLE-COLUMN2.
WHEN '0003'.
MOVE T_ITAB-VALUE TO IT_TABLE-COLUMN3.
WHEN '0004'.
MOVE T_ITAB-VALUE TO IT_TABLE-COLUMN4.
AT END OF ROW.
APPEND IT_TABLE.
ENDLOOP.
Regards,Venkat
2013 Oct 26 1:11 AM
Hi,
If you dont't want to use that then use this FM - TEXT_CONVERT_XLS_TO_SAP. It will put the the data as per the required structure - no extra processing is required.
TYPE-POOLS:truxs.
DATA: l_it_raw TYPE truxs_t_text_data. " for Excel file
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_line_header = 'X'
i_tab_raw_data = l_it_raw "This is blank internal table
i_filename = p_file "File Name with path
TABLES
i_tab_converted_data = pc_it_map_data "In this internal table data will be uploaded
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
2013 Oct 26 5:57 AM
HI,
Try this one
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = '1'
i_begin_row = '2'
i_end_col = '256'
i_end_row = '65000'
TABLES
intern = t_itab
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
ENDIF.
Or check the below image and remove the check box in excel format and run ur program.
2013 Oct 26 6:17 AM
Hi
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = 1
i_begin_row = 2
i_end_col = 4
i_end_row = 65000
TABLES
intern = t_itab
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
Your code is ok
See this wiki page to know about ALSM_EXCEL_TO_INTERNAL_TABLE for better understanding.
http://wiki.scn.sap.com/wiki/display/Snippets/How+to+use++FM+ALSM_EXCEL_TO_INTERNAL_TABLE