<?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: assign field name dynamically in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/assign-field-name-dynamically/m-p/1627145#M280154</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately, I did not get your complete requirement..just lost on the way. But feel that field symbols should be able to help you. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example :&lt;/P&gt;&lt;P&gt;lval &amp;lt;= 'BFKKZK'.&lt;/P&gt;&lt;P&gt;select * from zmapping into table imap&lt;/P&gt;&lt;P&gt;where tablein = lval.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at imap.&lt;/P&gt;&lt;P&gt;  concatenate imap-tablein imap-infield into lfield&lt;/P&gt;&lt;P&gt;  separated by '-'.&lt;/P&gt;&lt;P&gt;  assingn (lfield) to &amp;lt;FI&amp;gt;.&lt;/P&gt;&lt;P&gt;  assign (imap-outfield) to &amp;lt;FO&amp;gt;.&lt;/P&gt;&lt;P&gt;  &amp;lt;FO&amp;gt; = &amp;lt;FI&amp;gt;.&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note : There is one thing that needs to be added in the loop is to read the particular table..but here I am not sure of the key etc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anurag&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 Sep 2006 09:30:55 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-09-15T09:30:55Z</dc:date>
    <item>
      <title>assign field name dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/assign-field-name-dynamically/m-p/1627144#M280153</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 got a problem that I can not solve for the moment and would be happy for some input.&lt;/P&gt;&lt;P&gt;We would like to mapp a value of an inputfield to an output field. But the problem is that we do not know the actual value of the infield name until running the program. We have a mapping table looking like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ZMAPPING&lt;/P&gt;&lt;P&gt;tablein    TYPE CHAR20&lt;/P&gt;&lt;P&gt;INFIELD    TYPE CHAR20&lt;/P&gt;&lt;P&gt;OUTFIELD   TYPE CHAR20&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The values of the table could look like this:&lt;/P&gt;&lt;P&gt;ZMAPPING-TABLEIN  could contain the value BFKKZK &lt;/P&gt;&lt;P&gt;ZMAPPING-INFIELD could contain a fieldname e.g DATE&lt;/P&gt;&lt;P&gt;ZMAPPING-OUTFIELD could contain a fieldname e.g L_DATE_PARAM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The program gets a string into the program.&lt;/P&gt;&lt;P&gt;Depending of the first two positions of the string there is a table defining what kind of structure that should be used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tabstruc:&lt;/P&gt;&lt;P&gt;rec typ having for example the value 01 &lt;/P&gt;&lt;P&gt;tablename having for example the value  BFKKZK&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so when the string is coming into the program I read this table in order to get the value of which structure I should store the stringfield. &lt;/P&gt;&lt;P&gt;Then I would like to move the string to this dynamic structure, meaning that sometimes the string is moved to structure BFKKZK and somethings to BFKKZP. &lt;/P&gt;&lt;P&gt;Then I would like to get all the entries in the table zmapping having the value of tabstruc-tabname e.g BFKKZK&lt;/P&gt;&lt;P&gt;For this entries I would like to read the value of the field in the string e.g BFKKZK-DATE and store it to the output field e.g L_DATE_PARAM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hopefully anyone understands what I am trying to do and what the problem is, first it is to assign a string to a structure dynamically and then I would like to read the value of the field BFKKZK-DATE in the dynamically stored table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks to you coming with ideas &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Lena&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Sep 2006 09:21:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/assign-field-name-dynamically/m-p/1627144#M280153</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-15T09:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: assign field name dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/assign-field-name-dynamically/m-p/1627145#M280154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately, I did not get your complete requirement..just lost on the way. But feel that field symbols should be able to help you. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example :&lt;/P&gt;&lt;P&gt;lval &amp;lt;= 'BFKKZK'.&lt;/P&gt;&lt;P&gt;select * from zmapping into table imap&lt;/P&gt;&lt;P&gt;where tablein = lval.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at imap.&lt;/P&gt;&lt;P&gt;  concatenate imap-tablein imap-infield into lfield&lt;/P&gt;&lt;P&gt;  separated by '-'.&lt;/P&gt;&lt;P&gt;  assingn (lfield) to &amp;lt;FI&amp;gt;.&lt;/P&gt;&lt;P&gt;  assign (imap-outfield) to &amp;lt;FO&amp;gt;.&lt;/P&gt;&lt;P&gt;  &amp;lt;FO&amp;gt; = &amp;lt;FI&amp;gt;.&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note : There is one thing that needs to be added in the loop is to read the particular table..but here I am not sure of the key etc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anurag&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Sep 2006 09:30:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/assign-field-name-dynamically/m-p/1627145#M280154</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-15T09:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: assign field name dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/assign-field-name-dynamically/m-p/1627146#M280155</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 I understand:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: MY_STRUCTUTURE TYPE REF TO DATA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;MY_STRUCT&amp;gt; TYPE ANY,&lt;/P&gt;&lt;P&gt;               &amp;lt;INPUT&amp;gt;     TYPE ANY,&lt;/P&gt;&lt;P&gt;               &amp;lt;OUTPUT&amp;gt;    TYPE ANY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: TABLE(30), FIELDNAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE DATA MY_STRUCTUTURE TYPE (ZMAPPING-TABLEIN).&lt;/P&gt;&lt;P&gt;ASSIGN MY_STRUCTUTURE-&amp;gt;* TO &amp;lt;MY_STRUCT&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ASSIGN COMPONENT ZMAPPING-INFIELD OF STRUCTURE &amp;lt;MY_STRUCT&amp;gt; TO &amp;lt;INPUT&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ASSIGN (ZMAPPING-INFIELD) TO &amp;lt;OUTPUT&amp;gt;.&lt;/P&gt;&lt;P&gt;&amp;lt;OUTPUT&amp;gt; = &amp;lt;INPUT&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Sep 2006 09:37:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/assign-field-name-dynamically/m-p/1627146#M280155</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-15T09:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: assign field name dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/assign-field-name-dynamically/m-p/1627147#M280156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you know the source structure you can use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: l_LineType TYPE string, &lt;/P&gt;&lt;P&gt;      l_Ref  TYPE REF TO DATA. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;row&amp;gt;  &lt;/P&gt;&lt;P&gt;             . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;l_LineType = 'SURCESTRUC'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE DATA l_ItabRef TYPE  (l_LineType). &lt;/P&gt;&lt;P&gt;ASSIGN l_Ref-&amp;gt;* TO &amp;lt;row&amp;gt;. &lt;/P&gt;&lt;P&gt;&amp;lt;row&amp;gt; = l_inputstring.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And than you can do the mapping to access dynamically a field in a structure you can use:&lt;/P&gt;&lt;P&gt;ASSIGN COMPONENT lv_fieldname OF STRUCTURE row TO &amp;lt;fs&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I didn't test this, but it should work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OK OK I was too slow &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Tobias Ohm&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Sep 2006 09:43:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/assign-field-name-dynamically/m-p/1627147#M280156</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-15T09:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: assign field name dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/assign-field-name-dynamically/m-p/1627148#M280157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;    check table nametab_get to get all fields of&lt;/P&gt;&lt;P&gt;    table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Amole&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Sep 2006 09:45:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/assign-field-name-dynamically/m-p/1627148#M280157</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-15T09:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: assign field name dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/assign-field-name-dynamically/m-p/1627149#M280158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi miroslav,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. There are two things&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   a) dynamic name which we get for the structure-field to read&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  b) actual structure &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Do like this :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;DATA : VARNAME(50) TYPE C.&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS : &amp;lt;FS&amp;gt;&lt;/P&gt;&lt;P&gt;VARNAME = 'MYDYNAMICFIELDNAME'  &lt;/P&gt;&lt;P&gt;ASSIGN (VARNAME) TO &amp;lt;FS&amp;gt;.&lt;/P&gt;&lt;P&gt;WRITE &amp;lt;FS&amp;gt;.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Sep 2006 10:14:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/assign-field-name-dynamically/m-p/1627149#M280158</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-15T10:14:08Z</dc:date>
    </item>
  </channel>
</rss>

