<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: EXCEL TO INTERNAL TABLE in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/excel-to-internal-table/m-p/2518233#M569858</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hI,&lt;/P&gt;&lt;P&gt;    tRY the below code:&lt;/P&gt;&lt;P&gt;TYPE-POOLS: truxs.&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF ty_dataupload,                                                              "Input file load structure&lt;/P&gt;&lt;P&gt;       col01(60) TYPE c,&lt;/P&gt;&lt;P&gt;       col02(60) TYPE c,&lt;/P&gt;&lt;P&gt;       col03(60) TYPE c,&lt;/P&gt;&lt;P&gt;END OF ty_dataupload.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: it_raw        TYPE truxs_t_text_data .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'F4_FILENAME'                                                        &lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      field_name = 'P_FILE'&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      file_name  = p_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      i_line_header        = ' '&lt;/P&gt;&lt;P&gt;      i_tab_raw_data       = it_raw                                                            "work table&lt;/P&gt;&lt;P&gt;      i_filename           = p_file&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      i_tab_converted_data = g_t_datatab[]                                                     "internal table to store the the data&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      conversion_failed    = 1&lt;/P&gt;&lt;P&gt;      OTHERS               = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 23 Jul 2007 05:43:23 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-23T05:43:23Z</dc:date>
    <item>
      <title>EXCEL TO INTERNAL TABLE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/excel-to-internal-table/m-p/2518229#M569854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;report  zagexcel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: g_t_excel_data like alsmex_tabline occurs 0 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; exporting&lt;/P&gt;&lt;P&gt;  filename                      = 'C:\Documents and Settings\ics001187\Desktop\book1.xls'&lt;/P&gt;&lt;P&gt;  i_begin_col                   = 1&lt;/P&gt;&lt;P&gt;  i_begin_row                   = 1&lt;/P&gt;&lt;P&gt;  i_end_col                     = 40&lt;/P&gt;&lt;P&gt;  i_end_row                     = 15000&lt;/P&gt;&lt;P&gt;tables&lt;/P&gt;&lt;P&gt;  intern                        = g_t_excel_data.&lt;/P&gt;&lt;P&gt;*EXCEPTIONS&lt;/P&gt;&lt;P&gt;*INCONSISTENT_PARAMETERS       = 1&lt;/P&gt;&lt;P&gt;*UPLOAD_OLE                    = 2&lt;/P&gt;&lt;P&gt;*OTHERS                        = 3&lt;/P&gt;&lt;P&gt;                                                  .&lt;/P&gt;&lt;P&gt;                                        if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;*MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;P&gt;*WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;P&gt;                                        endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort g_t_excel_data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2007 05:30:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/excel-to-internal-table/m-p/2518229#M569854</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-23T05:30:41Z</dc:date>
    </item>
    <item>
      <title>Re: EXCEL TO INTERNAL TABLE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/excel-to-internal-table/m-p/2518230#M569855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;wat do u want 2 kno?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2007 05:32:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/excel-to-internal-table/m-p/2518230#M569855</guid>
      <dc:creator>former_member188827</dc:creator>
      <dc:date>2007-07-23T05:32:04Z</dc:date>
    </item>
    <item>
      <title>Re: EXCEL TO INTERNAL TABLE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/excel-to-internal-table/m-p/2518231#M569856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;

HI,

define the internal table in which you are reading excel data as follows:
1. DATA declaration
data: g_t_excel_data like alsmex_tabline occurs 0 with header line,

2. call Function module 
Function to get the excel data from the file into internal table
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_pcfile
i_begin_col = 1
i_begin_row = 2
i_end_col = 14
i_end_row = 65536
TABLES
intern = g_t_excel_data
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc &amp;lt;&amp;gt; 0.
message 'Error opening specified file' type 'E'.
endif.

3. by using field-symbols transfer your data to internal table ITAB (same as your data structure) as follows:-

data: g_index like sy-tabix,
loop at g_t_excel_data.
move : g_t_excel_data-col to g_index.
assign component g_index of structure ITAB to &amp;lt;fs&amp;gt;.
move : g_t_excel_data-value to &amp;lt;fs&amp;gt;.

*at end of row append record
at end of row.
append ITAB.
clear ITAB
clear &amp;lt;fs&amp;gt;.
endat.
endloop. 

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;refer to this code. hope it might help u&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;ravish&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;plz dont forget to reward if useful&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2007 05:34:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/excel-to-internal-table/m-p/2518231#M569856</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-23T05:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: EXCEL TO INTERNAL TABLE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/excel-to-internal-table/m-p/2518232#M569857</link>
      <description>&lt;P&gt;HI &lt;/P&gt;&lt;P&gt;To upload&lt;/P&gt;&lt;P&gt;first use FM ALSM_EXCEL_TO_INTERNAL_TABLE and then move the date to internal table and&lt;/P&gt;&lt;P&gt;There are two function modules you can use: (1) 'ALSM_EXCEL_TO_INTERNAL_TABLE' or &lt;/P&gt;&lt;P&gt;(2) 'KCD_EXCEL_OLE_TO_INT'. Very similar but the first function module (ASLM) used in for foreground processing.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;1st report&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;2nd sample report&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.


***********************************************************************
* END-OF-SELECTION.
END-OF-SELECTION.
LOOP AT it_datatab INTO wa_datatab.
WRITE:/ wa_datatab-col1,
wa_datatab-col2,
wa_datatab-col3.
ENDLOOP.


 ]]&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;To download a file from internal table to excel &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
]]&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Check this link&lt;/P&gt;&lt;P&gt;[Removed by the moderator.]&lt;/P&gt;&lt;P&gt;Reward all helpfull answers&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Pavan&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jul 2007 05:39:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/excel-to-internal-table/m-p/2518232#M569857</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-23T05:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: EXCEL TO INTERNAL TABLE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/excel-to-internal-table/m-p/2518233#M569858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hI,&lt;/P&gt;&lt;P&gt;    tRY the below code:&lt;/P&gt;&lt;P&gt;TYPE-POOLS: truxs.&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF ty_dataupload,                                                              "Input file load structure&lt;/P&gt;&lt;P&gt;       col01(60) TYPE c,&lt;/P&gt;&lt;P&gt;       col02(60) TYPE c,&lt;/P&gt;&lt;P&gt;       col03(60) TYPE c,&lt;/P&gt;&lt;P&gt;END OF ty_dataupload.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: it_raw        TYPE truxs_t_text_data .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'F4_FILENAME'                                                        &lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      field_name = 'P_FILE'&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      file_name  = p_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      i_line_header        = ' '&lt;/P&gt;&lt;P&gt;      i_tab_raw_data       = it_raw                                                            "work table&lt;/P&gt;&lt;P&gt;      i_filename           = p_file&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      i_tab_converted_data = g_t_datatab[]                                                     "internal table to store the the data&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      conversion_failed    = 1&lt;/P&gt;&lt;P&gt;      OTHERS               = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2007 05:43:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/excel-to-internal-table/m-p/2518233#M569858</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-23T05:43:23Z</dc:date>
    </item>
  </channel>
</rss>

