<?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: Help: about Dynamic Table field name in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898637#M1144086</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Yunfan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe a simpler way would be :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters p_tab TYPE dd03l-TABNAME .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select count(*)&lt;/P&gt;&lt;P&gt;  from dd03l&lt;/P&gt;&lt;P&gt;  where TABNAME = p_tab&lt;/P&gt;&lt;P&gt;  and fieldname in ('MATNR', 'WERKS').&lt;/P&gt;&lt;P&gt;  IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    write: 'field exists in table', p_tab.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and regards,&lt;/P&gt;&lt;P&gt;Dev.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Dec 2008 13:54:49 GMT</pubDate>
    <dc:creator>dev_parbutteea</dc:creator>
    <dc:date>2008-12-12T13:54:49Z</dc:date>
    <item>
      <title>Help: about Dynamic Table field name</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898627#M1144076</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everyone first thanx for answering my first question in this forum.&lt;/P&gt;&lt;P&gt;i try to explain the situation clearly&lt;/P&gt;&lt;P&gt;i use a parameter to get an input table name, it can be CAWN, can be MARA, can be MVKE,&lt;/P&gt;&lt;P&gt;then i need to check whether in this table whether there is a colume/field called MatNr or Werks...&lt;/P&gt;&lt;P&gt;if so ... Process A&lt;/P&gt;&lt;P&gt;if not ... Process B&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how can i get the name of fields.(not the data content)&lt;/P&gt;&lt;P&gt;i think i should use fieldsymbol or something alike, anyone has a good example or idea?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanx!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Dec 2008 12:24:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898627#M1144076</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-12T12:24:19Z</dc:date>
    </item>
    <item>
      <title>Re: Help: about Dynamic Table field name</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898628#M1144077</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use FM NAMETAB_GET and you will get the list of table fields.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Dec 2008 12:31:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898628#M1144077</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-12T12:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: Help: about Dynamic Table field name</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898629#M1144078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Yunfan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can acheive this by using field symbols.&lt;/P&gt;&lt;P&gt;You need to declare two field symbols.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FIELD_SYMBOLS: &amp;lt;fs1&amp;gt; TYPE "Your internal table.
FIELD_SYMBOLS: &amp;lt;fs2&amp;gt; TYPE any&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, You need to use the statement&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;ASSIGN COMPONENT 'FIELD NAME' OF STRUCTURE &amp;lt;FS1&amp;gt; TO &amp;lt;FS2&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; - Check help for proper syntax &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this ASSIGNMENT is succcessful, this means the field that you are looking for is existing.&lt;/P&gt;&lt;P&gt;If the assignment is not successful, the field does not exist.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this solves your query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Ram.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Dec 2008 12:31:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898629#M1144078</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-12T12:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: Help: about Dynamic Table field name</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898630#M1144079</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;your report contain varying number of columns in the output ? &lt;/P&gt;&lt;P&gt;If yes then only you require dynamic table logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Else you can use Case statement or if statement according to the requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If table = CAWN&lt;/P&gt;&lt;P&gt;Check for the fields in the table &lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;Process A.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;Process B.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Dec 2008 12:34:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898630#M1144079</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-12T12:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help: about Dynamic Table field name</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898631#M1144080</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 the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:i_table_fieldlist like ddfield occurs 0 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Getting all fields of the specified table in internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  call function 'DD_NAMETAB_TO_DDFIELDS'&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      tabname  = &amp;lt;&amp;lt;---- table name&lt;/P&gt;&lt;P&gt;    tables&lt;/P&gt;&lt;P&gt;      ddfields = i_table_fieldlist.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then do 2 read table i_table_fieldlist with key FIELDNAME = matnr/werks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Dev&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Dec 2008 12:59:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898631#M1144080</guid>
      <dc:creator>dev_parbutteea</dc:creator>
      <dc:date>2008-12-12T12:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Help: about Dynamic Table field name</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898632#M1144081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;really interested in ur answer&lt;/P&gt;&lt;P&gt;FIELD_SYMBOLS: &amp;lt;fs1&amp;gt; TYPE "Your internal table.&lt;/P&gt;&lt;P&gt;but problem is i got my type from an input through parameter, it can be mvke, mara, cawn, or ...&lt;/P&gt;&lt;P&gt;how can i define &amp;lt;fs1&amp;gt; using a dynamic?.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Dec 2008 13:13:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898632#M1144081</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-12T13:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: Help: about Dynamic Table field name</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898633#M1144082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;here is my codes&lt;/P&gt;&lt;P&gt;PARAMETERS p_mat1 TYPE mara-matnr.&lt;/P&gt;&lt;P&gt;PARAMETERS p_mat2 type mara-matnr.&lt;/P&gt;&lt;P&gt;parameters p_tab(20) type c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;tab1&amp;gt; like p_tab,&lt;/P&gt;&lt;P&gt;               &amp;lt;tab2&amp;gt; type any,&lt;/P&gt;&lt;P&gt;               &amp;lt;wa&amp;gt; type any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ASSIGN COMPONENT 'MATNR' OF STRUCTURE &amp;lt;tab1&amp;gt; TO &amp;lt;tab2&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but the sy-subrc after this always 4 , even if i set p_tab = mvke&lt;/P&gt;&lt;P&gt;why???&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Dec 2008 13:17:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898633#M1144082</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-12T13:17:44Z</dc:date>
    </item>
    <item>
      <title>Re: Help: about Dynamic Table field name</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898634#M1144083</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;U can use fm DDIF_FIELDINFO_GET in order to find out the name of the fields of a dictionary table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you're working on realese =&amp;gt; 4.7:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;PARAMETERS: P_TABLE(30).

DATA: MY_TABLE TYPE  REF TO DATA,
           WA_TABLE TYPE REF TO DATA.

FIELD-SYMBOLS: &amp;lt;MY_TABLE&amp;gt; TYPE TABLE,
                             &amp;lt;WA_TABLE&amp;gt; TYPE TABLE.

* Create an internal table (this command works from rel 47)
CREATA DATA MY_TABLE TYPE TABLE OF (P_TABLE).
ASSIGN MY_TABLE-&amp;gt;* TO &amp;lt;MY_TABLE&amp;gt;.

* Create a work area
CREATA DATA WA_TABLE TYPE (P_TABLE).
ASSIGN WA_TABLE-&amp;gt;* TO &amp;lt;WA_TABLE&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Dec 2008 13:24:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898634#M1144083</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-12T13:24:17Z</dc:date>
    </item>
    <item>
      <title>Re: Help: about Dynamic Table field name</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898635#M1144084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi, thanx for replying &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATA DATA MY_TABLE TYPE TABLE OF (P_TABLE).&lt;/P&gt;&lt;P&gt;ASSIGN MY_TABLE-&amp;gt;* TO &amp;lt;MY_TABLE&amp;gt;.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create a work area&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CREATA DATA WA_TABLE TYPE (P_TABLE).&lt;/P&gt;&lt;P&gt;ASSIGN WA_TABLE-&amp;gt;* TO &amp;lt;WA_TABLE&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then how to prove if in this p_table has a field called matnr or not?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Dec 2008 13:33:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898635#M1144084</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-12T13:33:20Z</dc:date>
    </item>
    <item>
      <title>Re: Help: about Dynamic Table field name</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898636#M1144085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;          FIELD-SYMBOLS:&amp;lt;l_fs_dyn&amp;gt; TYPE ANY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         ASSIGN COMPONENT ls_fcat1-fieldname&lt;/P&gt;&lt;P&gt;          OF STRUCTURE &amp;lt;dyn_wa&amp;gt; TO &amp;lt;l_fs_dyn&amp;gt;.&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Krishna...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Dec 2008 13:37:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898636#M1144085</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-12T13:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: Help: about Dynamic Table field name</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898637#M1144086</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Yunfan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe a simpler way would be :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters p_tab TYPE dd03l-TABNAME .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select count(*)&lt;/P&gt;&lt;P&gt;  from dd03l&lt;/P&gt;&lt;P&gt;  where TABNAME = p_tab&lt;/P&gt;&lt;P&gt;  and fieldname in ('MATNR', 'WERKS').&lt;/P&gt;&lt;P&gt;  IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    write: 'field exists in table', p_tab.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and regards,&lt;/P&gt;&lt;P&gt;Dev.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Dec 2008 13:54:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898637#M1144086</guid>
      <dc:creator>dev_parbutteea</dc:creator>
      <dc:date>2008-12-12T13:54:49Z</dc:date>
    </item>
    <item>
      <title>Re: Help: about Dynamic Table field name</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898638#M1144087</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;If yuo need to know if a table has field called MATNR, you don't need to use field-symbols:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;PARAMETERS: P_TABLE TYPE  DDOBJNAME.

START-OF-SELECTION.

  CALL FUNCTION 'DDIF_FIELDINFO_GET'
       EXPORTING
            TABNAME        = P_TABLE
            FIELDNAME      = 'MATNR'
       EXCEPTIONS
            NOT_FOUND      = 1
            INTERNAL_ERROR = 2
            OTHERS         = 3.
  IF SY-SUBRC &amp;lt;&amp;gt; 0.
    WRITE: 'No field called MATNR'.
  ELSE.
    WRITE: 'Ok field called MATNR'.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if you wan to use field-symbols:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;PARAMETERS: P_TABLE TYPE  DDOBJNAME.

FIELD-SYMBOLS: &amp;lt;WA&amp;gt;    TYPE ANY,
               &amp;lt;MATNR&amp;gt; TYPE ANY.

DATA: WA TYPE REF TO DATA.

START-OF-SELECTION.

  CREATE DATA WA TYPE (P_TABLE).
  ASSIGN WA-&amp;gt;* TO &amp;lt;WA&amp;gt;.

  ASSIGN COMPONENT 'MATNR' OF STRUCTURE &amp;lt;WA&amp;gt; TO &amp;lt;MATNR&amp;gt;.
  IF SY-SUBRC = 0.
    WRITE: 'Ok field called MATNR'.
  ELSE.
    WRITE: 'No field called MATNR'.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Dec 2008 14:53:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-about-dynamic-table-field-name/m-p/4898638#M1144087</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-12T14:53:46Z</dc:date>
    </item>
  </channel>
</rss>

