<?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 Using a string for a column name for an internal table. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-a-string-for-a-column-name-for-an-internal-table/m-p/8051325#M1611819</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;I need a little help if possible, I have searched for the solution but no luck, what I have found out though is I probably need to use field symbols...&lt;/P&gt;&lt;P&gt;Basically I need to use a string as a column name to access an internal table.&lt;/P&gt;&lt;P&gt;I think maybe an example would be good.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
    DATA: lw_field(30)   TYPE c,
        lw_cname(30)   TYPE c,
        lw_tab_ref(60) TYPE c,
        lwa_cust_x     LIKE LINE OF i_cust_x.
    
  FIELD-SYMBOLS: &amp;lt;fs&amp;gt; LIKE LINE OF i_cust_x.

  IF w_exit_exec IS INITIAL.
  " No missing madatory so far
    LOOP AT i_cust_x INTO lwa_cust_x.
        IF lwa_cust_x-ekorg = space.
        " Check for blank Purch Ord
            IF lwa_cust_x-zesokz = fuwa_data-zesokz.
                IF lwa_cust_x-xman = 'X'.
                " Mandatory import item


                   lw_cname = lwa_cust_x-field.
                    TRANSLATE lw_cname TO LOWER CASE.
                    CONCATENATE 'fuwa_data-' lw_cname INTO lw_tab_ref.
                    ASSIGN lw_tab_ref TO &amp;lt;fs&amp;gt;.
                    IF &amp;lt;fs&amp;gt; = space.
                            lw_field = lwa_cust_x-field.
                            w_exit_exec = 'X'.   "DON'T PERFORM UPDATE
                            MESSAGE i045 WITH lw_field INTO fcw_message.
                            EXIT. 
                    ENDIF.


                ENDIF. " Mandatory import item
            ENDIF.
        ENDIF. " Check for blank Purch Ord
    ENDLOOP.

  ENDIF. " No missing madatory so far
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was hoping that after the assignment &amp;lt;fs&amp;gt; would be a reference to the fuwa_data with the column of what has been from lwa_cist_x_field....&lt;/P&gt;&lt;P&gt;but it seems that &amp;lt;fs&amp;gt; is a reference to a string in fact lw_tab_ref&lt;/P&gt;&lt;P&gt;so lets say that &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lwa_cust_x-field = 'EKORG'&lt;/P&gt;&lt;P&gt;lw_cname='ekorg' after the translate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fuwa_data has a column called ekorg&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;fs&amp;gt; = fuwa_data-ekorg (but is a sting)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to say something like...&lt;/P&gt;&lt;P&gt;IF &amp;lt;fs&amp;gt; = 1000 THEN " as in accessing the column in fuwa_data and not a string...&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope I have explained this ok, but I am having trouble finding the best example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Jul 2011 11:29:16 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-07-07T11:29:16Z</dc:date>
    <item>
      <title>Using a string for a column name for an internal table.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-a-string-for-a-column-name-for-an-internal-table/m-p/8051325#M1611819</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;I need a little help if possible, I have searched for the solution but no luck, what I have found out though is I probably need to use field symbols...&lt;/P&gt;&lt;P&gt;Basically I need to use a string as a column name to access an internal table.&lt;/P&gt;&lt;P&gt;I think maybe an example would be good.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
    DATA: lw_field(30)   TYPE c,
        lw_cname(30)   TYPE c,
        lw_tab_ref(60) TYPE c,
        lwa_cust_x     LIKE LINE OF i_cust_x.
    
  FIELD-SYMBOLS: &amp;lt;fs&amp;gt; LIKE LINE OF i_cust_x.

  IF w_exit_exec IS INITIAL.
  " No missing madatory so far
    LOOP AT i_cust_x INTO lwa_cust_x.
        IF lwa_cust_x-ekorg = space.
        " Check for blank Purch Ord
            IF lwa_cust_x-zesokz = fuwa_data-zesokz.
                IF lwa_cust_x-xman = 'X'.
                " Mandatory import item


                   lw_cname = lwa_cust_x-field.
                    TRANSLATE lw_cname TO LOWER CASE.
                    CONCATENATE 'fuwa_data-' lw_cname INTO lw_tab_ref.
                    ASSIGN lw_tab_ref TO &amp;lt;fs&amp;gt;.
                    IF &amp;lt;fs&amp;gt; = space.
                            lw_field = lwa_cust_x-field.
                            w_exit_exec = 'X'.   "DON'T PERFORM UPDATE
                            MESSAGE i045 WITH lw_field INTO fcw_message.
                            EXIT. 
                    ENDIF.


                ENDIF. " Mandatory import item
            ENDIF.
        ENDIF. " Check for blank Purch Ord
    ENDLOOP.

  ENDIF. " No missing madatory so far
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was hoping that after the assignment &amp;lt;fs&amp;gt; would be a reference to the fuwa_data with the column of what has been from lwa_cist_x_field....&lt;/P&gt;&lt;P&gt;but it seems that &amp;lt;fs&amp;gt; is a reference to a string in fact lw_tab_ref&lt;/P&gt;&lt;P&gt;so lets say that &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lwa_cust_x-field = 'EKORG'&lt;/P&gt;&lt;P&gt;lw_cname='ekorg' after the translate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fuwa_data has a column called ekorg&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;fs&amp;gt; = fuwa_data-ekorg (but is a sting)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to say something like...&lt;/P&gt;&lt;P&gt;IF &amp;lt;fs&amp;gt; = 1000 THEN " as in accessing the column in fuwa_data and not a string...&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope I have explained this ok, but I am having trouble finding the best example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jul 2011 11:29:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-a-string-for-a-column-name-for-an-internal-table/m-p/8051325#M1611819</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-07-07T11:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: Using a string for a column name for an internal table.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-a-string-for-a-column-name-for-an-internal-table/m-p/8051326#M1611820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please use brackets for the assign command.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
ASSIGN (lw_tab_ref) TO &amp;lt;fs&amp;gt;.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dirk&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jul 2011 11:34:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-a-string-for-a-column-name-for-an-internal-table/m-p/8051326#M1611820</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-07-07T11:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using a string for a column name for an internal table.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-a-string-for-a-column-name-for-an-internal-table/m-p/8051327#M1611821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think what you need is&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;ASSIGN COMPONENT lw_cname OF STRUCTURE fuwa_data TO &amp;lt;fs&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Oliver&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jul 2011 12:19:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-a-string-for-a-column-name-for-an-internal-table/m-p/8051327#M1611821</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-07-07T12:19:39Z</dc:date>
    </item>
  </channel>
</rss>

