<?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 naming of instance reference variable in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-naming-of-instance-reference-variable/m-p/9112902#M1707057</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;How to dynamically name instances of a particular class.&amp;nbsp; &lt;/P&gt;&lt;P&gt;For example: I have 4 screens 9000,9001,9002,9003.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: lv_name type string.&lt;/P&gt;&lt;P&gt;field_symbols: &amp;lt;fs_objref&amp;gt; TYPE REF TO cl_gui_custom_container.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE OBJECT GR_CUST_CONT_9000,&lt;/P&gt;&lt;P&gt;CREATE OBJECT GR_CUST_CONT_9001,&lt;/P&gt;&lt;P&gt;CREATE OBJECT GR_CUST_CONT_9002,&lt;/P&gt;&lt;P&gt;CREATE OBJECT GR_CUST_CONT_9003,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of this, I need to assign a variable lv_name.&lt;/P&gt;&lt;P&gt;CONCATENATE 'GR_CUST_CONT_'&amp;nbsp; lv_dynnr INTO lv_name.&lt;/P&gt;&lt;P&gt;assign lv_name TO &amp;lt;fs_objref&amp;gt;.&lt;/P&gt;&lt;P&gt;CREATE OBJECT &amp;lt;fs_objref&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;DPM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Nov 2012 12:05:01 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2012-11-14T12:05:01Z</dc:date>
    <item>
      <title>dynamic naming of instance reference variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-naming-of-instance-reference-variable/m-p/9112902#M1707057</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;How to dynamically name instances of a particular class.&amp;nbsp; &lt;/P&gt;&lt;P&gt;For example: I have 4 screens 9000,9001,9002,9003.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: lv_name type string.&lt;/P&gt;&lt;P&gt;field_symbols: &amp;lt;fs_objref&amp;gt; TYPE REF TO cl_gui_custom_container.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE OBJECT GR_CUST_CONT_9000,&lt;/P&gt;&lt;P&gt;CREATE OBJECT GR_CUST_CONT_9001,&lt;/P&gt;&lt;P&gt;CREATE OBJECT GR_CUST_CONT_9002,&lt;/P&gt;&lt;P&gt;CREATE OBJECT GR_CUST_CONT_9003,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of this, I need to assign a variable lv_name.&lt;/P&gt;&lt;P&gt;CONCATENATE 'GR_CUST_CONT_'&amp;nbsp; lv_dynnr INTO lv_name.&lt;/P&gt;&lt;P&gt;assign lv_name TO &amp;lt;fs_objref&amp;gt;.&lt;/P&gt;&lt;P&gt;CREATE OBJECT &amp;lt;fs_objref&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;DPM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Nov 2012 12:05:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-naming-of-instance-reference-variable/m-p/9112902#M1707057</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-11-14T12:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic naming of instance reference variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-naming-of-instance-reference-variable/m-p/9112903#M1707058</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi DPM,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think, instead of that it would be better to have internal table containing object references (object collection).. this internal table can have field 'Sceen ID' and "Reference to custom container (REF TO)'.&lt;/P&gt;&lt;P&gt;Then you can instaintiate the object per screen id and add it to the object collection.. while retriving, simply get the required object by referring screen id field from the internal table..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Abhijit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Nov 2012 10:00:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-naming-of-instance-reference-variable/m-p/9112903#M1707058</guid>
      <dc:creator>Abhijit</dc:creator>
      <dc:date>2012-11-15T10:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic naming of instance reference variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-naming-of-instance-reference-variable/m-p/9112904#M1707059</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Field names in an ABAP program are only there to make the programmer's life easier. &lt;SPAN style="text-decoration: underline;"&gt;If you find yourself building logic around the names of fields which you declare in your program, you're doing something wrong&lt;/SPAN&gt;. Whatever relationship you're trying to define in the names of your fields, you should instead be defining in the values of a field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your specific situation, you shouldn't define the relationship between a screen number and it's custom container object by naming the custom container object from that screen number. Instead, as Abhijit said, you should create a table that relates a screen number (in one column) to the custom container object) in another column. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Nov 2012 15:50:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-naming-of-instance-reference-variable/m-p/9112904#M1707059</guid>
      <dc:creator>alex_campbell</dc:creator>
      <dc:date>2012-11-15T15:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic naming of instance reference variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-naming-of-instance-reference-variable/m-p/9112905#M1707060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Howdy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For what its worth, I don't think there's any problem using naming convention to achieve what seems to be a repetitive task.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So your code should work like this (change highlighted in bold)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONCATENATE 'GR_CUST_CONT_'&amp;nbsp; lv_dynnr INTO lv_name.&lt;/P&gt;&lt;P&gt;assign &lt;STRONG&gt;(lv_name)&lt;/STRONG&gt; TO &amp;lt;fs_objref&amp;gt;.&lt;/P&gt;&lt;P&gt;CREATE OBJECT &amp;lt;fs_objref&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may also want to consider encapsulating the Create object call in a method or subroutine and passing the object reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2012 02:47:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-naming-of-instance-reference-variable/m-p/9112905#M1707060</guid>
      <dc:creator>alex_cook</dc:creator>
      <dc:date>2012-11-19T02:47:39Z</dc:date>
    </item>
  </channel>
</rss>

