<?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: Dynamic ITAB from Excel in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-itab-from-excel/m-p/6658603#M1445962</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check this &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REFRESH IT_TAB.
  CLEAR IT_TAB.

  CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
      filename                      = FILEPATH
      i_begin_col                   = 1
      i_begin_row                   = 3
      i_end_col                     = 5
      i_end_row                     = 9
    tables
      intern                        = IT_TAB
*   EXCEPTIONS
*     INCONSISTENT_PARAMETERS       = 1
*     UPLOAD_OLE                    = 2
*     OTHERS                        = 3
            .
  IF sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  SORT IT_TAB BY ROW COL.
  CLEAR wa_GLMAP.
  CLEAR wa_tab.
  IF IT_TAB[] IS NOT INITIAL.
    LOOP AT IT_TAB into wa_tab .
      CASE wa_tab-COL.
        WHEN '0001'.
          wa_GLMAP-L_GL_ACC = wa_tab-VALUE.
        WHEN '0002'.
          wa_GLMAP-DESC_LGL = wa_tab-VALUE.
        WHEN '0003'.
          wa_GLMAP-B_UNIT = wa_tab-VALUE.
        WHEN '0004'.
          wa_GLMAP-SAKNR = wa_tab-VALUE.
        WHEN '0005'.
          wa_GLMAP-DEL_IND = wa_tab-VALUE.
      ENDCASE.
      AT END OF ROW.
        APPEND wa_GLMAP TO t_GLMAP_DATA.
        CLEAR wa_GLMAP.
      ENDAT.
    ENDLOOP.
  ELSE.
    LEAVE LIST-PROCESSING.
  ENDIF.
.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;also check the following link&lt;/P&gt;&lt;P&gt;&lt;A href="http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=60655105" target="test_blank"&gt;http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=60655105&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: kk.adhvaryu on Mar 4, 2010 7:53 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 04 Mar 2010 06:53:14 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-03-04T06:53:14Z</dc:date>
    <item>
      <title>Dynamic ITAB from Excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-itab-from-excel/m-p/6658597#M1445956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) While uploading the Characteristics in the result recording the user provides the data in the Excel sheet.&lt;/P&gt;&lt;P&gt;2) While Uploading the Sales Orders from 4.0 to ECC6.0 the data from excel is being is used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For fixed format this is working fine but when they change the order of the columns or number of columns this approch fails.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have searched the WIKI, SDN and others, i found creation of dynamic internal table but could not handle when the number of columns change or their order changes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) How to capture the Columns Heading names&lt;/P&gt;&lt;P&gt;2) How to handle the Number of columns and when the order of columns change&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please guide me &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Warm Regards&lt;/P&gt;&lt;P&gt;Ram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Mar 2010 05:14:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-itab-from-excel/m-p/6658597#M1445956</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-03T05:14:14Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ITAB from Excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-itab-from-excel/m-p/6658598#M1445957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you really uploading an excel sheet? In most cases excel sheets are nothing else but csv files.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Mar 2010 06:18:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-itab-from-excel/m-p/6658598#M1445957</guid>
      <dc:creator>rainer_hbenthal</dc:creator>
      <dc:date>2010-03-03T06:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ITAB from Excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-itab-from-excel/m-p/6658599#M1445958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rainer,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The relavant data is provided in the excel format. &lt;/P&gt;&lt;P&gt;Now i am able to collect this into an Internal table using FM &lt;STRONG&gt;ALSM_EXCEL_TO_INTERNAL_TABLE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here i am using CASE key word and capturing the individual columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now&lt;/P&gt;&lt;P&gt;1) i want to know number of columns. " I got this.&lt;/P&gt;&lt;P&gt;2) i want to build a dynamic itab based on the columns provided &lt;/P&gt;&lt;P&gt;3) they can change the order of the columns and no of columns aswell.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please suggest further.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Warm Regards&lt;/P&gt;&lt;P&gt;Ram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Mar 2010 06:29:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-itab-from-excel/m-p/6658599#M1445958</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-03T06:29:27Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ITAB from Excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-itab-from-excel/m-p/6658600#M1445959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can opt for OLE automation for excel and check the number of columns and then do it....!&lt;/P&gt;&lt;P&gt;hope it helps..!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Mar 2010 06:35:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-itab-from-excel/m-p/6658600#M1445959</guid>
      <dc:creator>anup_deshmukh4</dc:creator>
      <dc:date>2010-03-03T06:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ITAB from Excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-itab-from-excel/m-p/6658601#M1445960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ram,&lt;/P&gt;&lt;P&gt;you've got your informations on number of columns and order (identified by col-header) in the first rows of your internal table  with row = '001'&lt;/P&gt;&lt;P&gt;Easiest approach to your request, would be a nested structure like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
TYPES: lty_tabline type table of CHAR50, 
       lty_t_tab type table of lty_tabline.
DATA: a_cell type char50.
DATA: gt_thetable type lty_t_tab, wa_int type lty_tabline.
DATA: xltab type table of ALSMEX_TABLINE,
      wa_xl type ALSMEX_TABLINE.
...
loop at xltab into wa_xl.
  at new row.
    check wa_int is not initial.
    append wa_int to gt_thetable.
    clear wa_int.
  endat.
  append wa_xl-value to wa_int.
endloop.
...
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Jörg&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Mar 2010 19:30:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-itab-from-excel/m-p/6658601#M1445960</guid>
      <dc:creator>jrg_wulf</dc:creator>
      <dc:date>2010-03-03T19:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ITAB from Excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-itab-from-excel/m-p/6658602#M1445961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I hope you can do a work around with this fm &lt;STRONG&gt;TEXT_CONVERT_XLS_TO_SAP&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Mar 2010 19:43:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-itab-from-excel/m-p/6658602#M1445961</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2010-03-03T19:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ITAB from Excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-itab-from-excel/m-p/6658603#M1445962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check this &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REFRESH IT_TAB.
  CLEAR IT_TAB.

  CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
      filename                      = FILEPATH
      i_begin_col                   = 1
      i_begin_row                   = 3
      i_end_col                     = 5
      i_end_row                     = 9
    tables
      intern                        = IT_TAB
*   EXCEPTIONS
*     INCONSISTENT_PARAMETERS       = 1
*     UPLOAD_OLE                    = 2
*     OTHERS                        = 3
            .
  IF sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  SORT IT_TAB BY ROW COL.
  CLEAR wa_GLMAP.
  CLEAR wa_tab.
  IF IT_TAB[] IS NOT INITIAL.
    LOOP AT IT_TAB into wa_tab .
      CASE wa_tab-COL.
        WHEN '0001'.
          wa_GLMAP-L_GL_ACC = wa_tab-VALUE.
        WHEN '0002'.
          wa_GLMAP-DESC_LGL = wa_tab-VALUE.
        WHEN '0003'.
          wa_GLMAP-B_UNIT = wa_tab-VALUE.
        WHEN '0004'.
          wa_GLMAP-SAKNR = wa_tab-VALUE.
        WHEN '0005'.
          wa_GLMAP-DEL_IND = wa_tab-VALUE.
      ENDCASE.
      AT END OF ROW.
        APPEND wa_GLMAP TO t_GLMAP_DATA.
        CLEAR wa_GLMAP.
      ENDAT.
    ENDLOOP.
  ELSE.
    LEAVE LIST-PROCESSING.
  ENDIF.
.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;also check the following link&lt;/P&gt;&lt;P&gt;&lt;A href="http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=60655105" target="test_blank"&gt;http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=60655105&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: kk.adhvaryu on Mar 4, 2010 7:53 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Mar 2010 06:53:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-itab-from-excel/m-p/6658603#M1445962</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-04T06:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ITAB from Excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-itab-from-excel/m-p/6658604#M1445963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you can fix that first row of excel is header that tells about order of columns and columns,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can declare an itab with all the fields needed in any case/scenario. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then use field symbols to move values corrospondingly to correctfields of itab.&lt;/P&gt;&lt;P&gt;So, in few cases, few of the columns will be blank, it will not affect anything and you can continue processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case no need to create dynamic itab.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Mar 2010 07:59:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-itab-from-excel/m-p/6658604#M1445963</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-04T07:59:44Z</dc:date>
    </item>
  </channel>
</rss>

