‎2009 Jun 09 3:31 PM
Hi All,
Help me on this , while while convert the data from excel to sap internal table, all the EXCEL data will come in one column in the inetrnal table .
i am using CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE' function for the converting.
This is the code.
DATA: it_main LIKE STANDARD TABLE OF alsmex_tabline WITH HEADER LINE.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = 'C:\Documents and Settings\Naresh.Mekala\Desktop\ttd.xls'
i_begin_col = 1
i_begin_row = 1
i_end_col = 3
i_end_row = 3
TABLES
intern = it_main
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
.
IF sy-subrc EQ 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT it_main.
*WRITE:/ IT_MAIN-ROW, ' ',
*IT_MAIN-COL, ' ',
WRITE: / it_main-value.
ENDLOOP.
‎2009 Jun 09 3:42 PM
‎2009 Jun 09 3:51 PM
Hi friend,
i created excel sheet like three rows and three columns.
Regards,
Naresh
‎2009 Jun 10 11:33 AM
Hi..
You can use the function Module SAP_CONVERT_TO_XLS_FORMAT to update data from excel to sap.
Best Regards,
Vanessa Noronha.
‎2009 Jun 10 11:45 AM
Hello Naresh,
As per my understanding, you have a excel with say 3 rows and 3 columns and you uploaded the same and collected the data in an internal table. Now you are getting the data in the same column and this is your concern.
Id this is the concern, then see in the internal table you are getting the row numbeer, cloumn number and the value of the cell (row, column). So based on the row number and column number you have to process the data accordingly.
Hope this helps you.
Regards,
Sachinkumar Mehta.
‎2009 Jun 09 3:44 PM
Hi friend,
i created excel sheet like three rows and three columns.
Regards,
Naresh
‎2009 Jun 09 3:45 PM
DATA : it_raw TYPE truxs_t_text_data.
DATA: filename1(128) TYPE c.
MOVE: filename TO filename1.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
i_line_header = 'X'
i_tab_raw_data = it_raw " WORK TABLE
i_filename = filename1
TABLES
i_tab_converted_data = IT_DUMMY "ACTUAL DATA
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
‎2009 Jun 09 3:48 PM
Have a look at program FILA_HELP_UPLOAD_EXCEL_01 for an example.
Rob
‎2009 Jun 10 1:31 PM
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = filename
i_begin_col = begcol
i_begin_row = begrow
i_end_col = endcol
i_end_row = endrow
TABLES
intern = intern
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
WRITE:/ 'Upload Error ', sy-subrc.
ENDIF.
break developer.
LOOP AT intern.
intern1 = intern.
CLEAR intern1-row.
APPEND intern1.
ENDLOOP.
SORT intern1 BY col.
LOOP AT intern1.
AT NEW col.
t_col-col = intern1-col.
APPEND t_col.
ENDAT.
zwlen = strlen( intern1-value ).
READ TABLE t_col WITH KEY col = intern1-col.
IF sy-subrc EQ 0.
IF zwlen > t_col-size.
t_col-size = zwlen.
Internal Table, Current Row Index
MODIFY t_col INDEX sy-tabix.
ENDIF.
ENDIF.
ENDLOOP.
DESCRIBE TABLE t_col LINES zwlines.
SORT intern BY row col.
DO zwlines TIMES.
WRITE sy-index TO fieldnames-title.
APPEND fieldnames.
ENDDO.
SORT intern BY row col.
LOOP AT intern.
tind = intern-col.
CONCATENATE 'DATA_TAB-VALUE_' tind INTO zwfeld.
ASSIGN (zwfeld) TO <fs1>.
<fs1> = intern-value.
AT END OF row.
APPEND data_tab.
CLEAR data_tab.
ENDAT.
ENDLOOP.
‎2009 Aug 17 11:02 AM