<?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: Determine ITAB column dynamically in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/determine-itab-column-dynamically/m-p/6483022#M1419274</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, use field symbols.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assuming your work area is populated with the correct line, following code should help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
field-symbols: &amp;lt;fs_field&amp;gt; type any.

assign component (L_COL) of wa_mat to &amp;lt;fs_field&amp;gt;

&amp;lt;fs_field&amp;gt; = l_var.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now wa_mat-col_5 should have the value of 5000. I haven't tested the above code - so test it before relying on it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 21 Dec 2009 21:49:42 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-12-21T21:49:42Z</dc:date>
    <item>
      <title>Determine ITAB column dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/determine-itab-column-dynamically/m-p/6483020#M1419272</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an internal table like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;types: begin of ty_mat,
            matnr type manr,
            descr type maktx,
            col_1 type mhdlg,
            col_2 type mddlg,
            col_3 type mhdlg,
            col_4 type mhdlg,
            col_5 type mhdlg,
          end of ty_mat.

data: t_mat type standard table of ty_mat,
      wa_mat like line of t_mat.

data: l_col(6) type c,
      l_var type mhdlg.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;T_MAT has values like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;MATNR DESCR COL_1 COL_2 COL_3 COL_4 COL_5
1235  ABADFC 0     0     0      0      0&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; For eg, During runtime, &lt;STRONG&gt;L_VAR&lt;/STRONG&gt; value is determined as &lt;STRONG&gt;5000&lt;/STRONG&gt; and &lt;STRONG&gt;L_COL&lt;/STRONG&gt; value as &lt;STRONG&gt;COL_5&lt;/STRONG&gt; .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I have to update the internal table T_MAT like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;MATNR DESCR COL_1 COL_2 COL_3 COL_4 COL_5
1235  ABADFC 0     0     0      0    5000&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The value of L_VAR and L_COL changes dynamically all the times. Should I use the field-symbols?  Can you please suggest how to code for that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: ravi kumar on Dec 21, 2009 2:27 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Dec 2009 21:26:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/determine-itab-column-dynamically/m-p/6483020#M1419272</guid>
      <dc:creator>VenuAnumayam</dc:creator>
      <dc:date>2009-12-21T21:26:23Z</dc:date>
    </item>
    <item>
      <title>Re: Determine ITAB column dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/determine-itab-column-dynamically/m-p/6483021#M1419273</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, you would use field-symbols&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I supposse you are using wa_mat as the work area for t_mat and you know exactly which index you are going to modify&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In that case it would be something like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
assign component L_COL of structure wa_mat to &amp;lt;fs&amp;gt;.
&amp;lt;fs&amp;gt; = l_var.
modify t_mat from wa_mat index whatver.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But can you be more specific? I´m pretty sure what you are trying to achieve would be easier if you assign a field-symbols to the line in t_mat you want to modify instead of using a work area&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Dec 2009 21:48:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/determine-itab-column-dynamically/m-p/6483021#M1419273</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-21T21:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: Determine ITAB column dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/determine-itab-column-dynamically/m-p/6483022#M1419274</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, use field symbols.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assuming your work area is populated with the correct line, following code should help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
field-symbols: &amp;lt;fs_field&amp;gt; type any.

assign component (L_COL) of wa_mat to &amp;lt;fs_field&amp;gt;

&amp;lt;fs_field&amp;gt; = l_var.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now wa_mat-col_5 should have the value of 5000. I haven't tested the above code - so test it before relying on it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Dec 2009 21:49:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/determine-itab-column-dynamically/m-p/6483022#M1419274</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-21T21:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: Determine ITAB column dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/determine-itab-column-dynamically/m-p/6483023#M1419275</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot. I knew the code until &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;assign component L_COL of structure wa_mat to &amp;lt;fs&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Didn't know how to pass the value after that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Dec 2009 22:03:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/determine-itab-column-dynamically/m-p/6483023#M1419275</guid>
      <dc:creator>VenuAnumayam</dc:creator>
      <dc:date>2009-12-21T22:03:13Z</dc:date>
    </item>
  </channel>
</rss>

