<?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 dynamic columns in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns/m-p/1693223#M304268</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose i have this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;loop at table into line.&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;if line-column1 eq 'something'.&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;endloop.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with that i search if the column line-column1 is equal to 'something', and if it is i do something. That works fine, but now i'm facing a problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The column that i need to search may be other of about 60 columns. It's the column i get in a string. For instance:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;data: text type string.&lt;/P&gt;&lt;P&gt;text = 'column1'.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is anyway to somehow get the value of a column by a string? In other words:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- if &amp;lt;b&amp;gt;text='column1'&amp;lt;/b&amp;gt; the validation should look as &amp;lt;b&amp;gt;if line-column1 eq 'something'.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;- if &amp;lt;b&amp;gt;text='column2'&amp;lt;/b&amp;gt; the validation should look as &amp;lt;b&amp;gt;if line-column2 eq 'something'.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the table had few columns a simple case/when, or even if/else would work, but this is a table with more than 60 columns, so it's an option i'm trying to avoid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Most likelly i need to store the value of the column i want to search in a string and then use it to compare in IF, but i don't know how.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some people told me that it might me done with field-symbols and appends, but since i'm kind of newbie in abap world i'm not managing to do that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me with this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advanced for any help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Oct 2006 01:01:33 GMT</pubDate>
    <dc:creator>luscruz</dc:creator>
    <dc:date>2006-10-24T01:01:33Z</dc:date>
    <item>
      <title>dynamic columns</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns/m-p/1693223#M304268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose i have this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;loop at table into line.&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;if line-column1 eq 'something'.&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;endloop.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with that i search if the column line-column1 is equal to 'something', and if it is i do something. That works fine, but now i'm facing a problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The column that i need to search may be other of about 60 columns. It's the column i get in a string. For instance:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;data: text type string.&lt;/P&gt;&lt;P&gt;text = 'column1'.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is anyway to somehow get the value of a column by a string? In other words:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- if &amp;lt;b&amp;gt;text='column1'&amp;lt;/b&amp;gt; the validation should look as &amp;lt;b&amp;gt;if line-column1 eq 'something'.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;- if &amp;lt;b&amp;gt;text='column2'&amp;lt;/b&amp;gt; the validation should look as &amp;lt;b&amp;gt;if line-column2 eq 'something'.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the table had few columns a simple case/when, or even if/else would work, but this is a table with more than 60 columns, so it's an option i'm trying to avoid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Most likelly i need to store the value of the column i want to search in a string and then use it to compare in IF, but i don't know how.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some people told me that it might me done with field-symbols and appends, but since i'm kind of newbie in abap world i'm not managing to do that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me with this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advanced for any help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Oct 2006 01:01:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns/m-p/1693223#M304268</guid>
      <dc:creator>luscruz</dc:creator>
      <dc:date>2006-10-24T01:01:33Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic columns</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns/m-p/1693224#M304269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Luis&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are already quite close to the solution to your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:
  ld_column_1   TYPE string,
  ld_column_2   TYPE string.

FIELD-SYMBOLS:
  &amp;lt;ls_line&amp;gt;     TYPE any,
  &amp;lt;ld_column&amp;gt;   TYPE any.

  ld_column_1 = 'COL_1'.  " upper case !!!
  ld_column_2 = 'COL_2'.  " upper case !!!

LOOP AT itab ASSIGNING &amp;lt;ls_line&amp;gt;.
* First column
  UNASSIGN: &amp;lt;ld_column&amp;gt;.
  ASSIGN COMPONENT (ld_column_1) OF STRUCTURE &amp;lt;ls_line&amp;gt;
    TO &amp;lt;ld_column&amp;gt;.
  IF ( &amp;lt;ld_column&amp;gt; IS ASSIGNED ).
*   Do something if condition is fulfilled
    IF ( &amp;lt;ld_column&amp;gt; eq 'something' ).
    ...
    ENDIF. 
  ENDIF.

* Second column
  UNASSIGN: &amp;lt;ld_column&amp;gt;.
  ASSIGN COMPONENT (ld_column_2) OF STRUCTURE &amp;lt;ls_line&amp;gt;
    TO &amp;lt;ld_column&amp;gt;.
  IF ( &amp;lt;ld_column&amp;gt; IS ASSIGNED ).
*   Do something if condition is fulfilled
    IF ( &amp;lt;ld_column&amp;gt; eq 'something' ).
    ...
    ENDIF. 
  ENDIF.  

ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Oct 2006 01:44:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns/m-p/1693224#M304269</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2006-10-24T01:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic columns</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns/m-p/1693225#M304270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;field-symbols &amp;lt;col&amp;gt; type any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at table into line.&lt;/P&gt;&lt;P&gt;assign component (text) of structure line to &amp;lt;col&amp;gt;.&lt;/P&gt;&lt;P&gt;if &amp;lt;col&amp;gt; eq 'something'.&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Oct 2006 02:34:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns/m-p/1693225#M304270</guid>
      <dc:creator>former_member186741</dc:creator>
      <dc:date>2006-10-24T02:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic columns</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns/m-p/1693226#M304271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you both, you were very helpfull !!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just having a problem, but already saw what was...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In line:&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the great help !!&lt;/P&gt;&lt;P&gt;Luís Cruz&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Luís Cruz&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Oct 2006 12:33:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns/m-p/1693226#M304271</guid>
      <dc:creator>luscruz</dc:creator>
      <dc:date>2006-10-24T12:33:14Z</dc:date>
    </item>
  </channel>
</rss>

