<?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: Dynamic Variable names in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-variable-names/m-p/977672#M71244</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can use coding like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: ITAB OCCURS O,&lt;/P&gt;&lt;P&gt;      g_line_01(100),&lt;/P&gt;&lt;P&gt;      g_line_02(100),&lt;/P&gt;&lt;P&gt;      .&lt;/P&gt;&lt;P&gt;      .&lt;/P&gt;&lt;P&gt;      .&lt;/P&gt;&lt;P&gt;      g_line_99(100),&lt;/P&gt;&lt;P&gt;DATA: END OF ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE ITAB...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Sam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 25 Jul 2005 06:39:55 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-07-25T06:39:55Z</dc:date>
    <item>
      <title>Dynamic Variable names</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-variable-names/m-p/977670#M71242</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;Here is my fishy requirement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tens of variables globally declared as g_line_01,g_line_02 and so on to g_line_99. (I can not change this declaration  part &lt;SPAN __jive_emoticon_name="sad"&gt;&lt;/SPAN&gt; as it used by other part of the programs. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I need to fillin data into these g_line_xx lines which will then print into a dataset. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now my requirement is here:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lines g_line_13 to g_line_17 should contain the customer address information, ie. Name1, Name2, Name3, Name4, Street, City, PO Box and Postal Code, country etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now there exist a logic to group these fields and populate the lines from g_line_13 to g_line_17. The problem comes when one/some of the above said field/s is/are blank. That may result in one of the g_line_xx variable to be blank. I need to avoid this scenario. That means, if I see that g_line_15 is to be blank, then all the below line should come up by one line. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was thinking can we have this done by dynamic variable names ?? ie. I use some string manupulation to prepare the variable name g_line_xx and can I have this in the assignment statement ?? Or is it impossible?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jul 2005 06:28:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-variable-names/m-p/977670#M71242</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-25T06:28:06Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Variable names</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-variable-names/m-p/977671#M71243</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Karthick,&lt;/P&gt;&lt;P&gt;I'd suggest a simpler solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of declaring them as variables, try to use Internal table with 99 fields. Then it is easy to shfit them up or down accordingly rt?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Sam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jul 2005 06:33:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-variable-names/m-p/977671#M71243</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-25T06:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Variable names</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-variable-names/m-p/977672#M71244</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can use coding like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: ITAB OCCURS O,&lt;/P&gt;&lt;P&gt;      g_line_01(100),&lt;/P&gt;&lt;P&gt;      g_line_02(100),&lt;/P&gt;&lt;P&gt;      .&lt;/P&gt;&lt;P&gt;      .&lt;/P&gt;&lt;P&gt;      .&lt;/P&gt;&lt;P&gt;      g_line_99(100),&lt;/P&gt;&lt;P&gt;DATA: END OF ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE ITAB...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Sam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jul 2005 06:39:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-variable-names/m-p/977672#M71244</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-25T06:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Variable names</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-variable-names/m-p/977673#M71245</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Samuel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As I have clearly mentioned, we can not change the declaration part any more.. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway thanks for the reply&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jul 2005 06:40:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-variable-names/m-p/977673#M71245</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-25T06:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Variable names</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-variable-names/m-p/977674#M71246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Karthick,&lt;/P&gt;&lt;P&gt;I understand that. But still, you can use an internal table that would actually contain the manipulated (move up/down) values based on blank field values. Later, at the end of the modification process, just move the values from the internal table to the corresponding global variables defined already.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Sam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jul 2005 06:46:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-variable-names/m-p/977674#M71246</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-25T06:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Variable names</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-variable-names/m-p/977675#M71247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Karthik,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I have understood your requirement correctly, then I think what you want to do is possible. As an example I consider that you have the following data assignments currently  - &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;g_line_13 = VAR1. " 'ABC'
g_line_14 = VAR2. " 'DEF'
g_line_15 = VAR3  " '' (BLANK).
g_line_16 = VAR4  " 'JKL'.
g_line_17 = VAR5  " 'MNO'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the following code will move the data to the appropriate variable (taking into consideration the variable number) only when the source data field has got some content.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:  LV_FIELDNAME(9)   TYPE C,
       LV_PREFIX(7)      TYPE C VALUE 'G_LINE_'
       LV_LINE_NUMBER(2) TYPE N VALUE '12'.

FIELD-SYMBOLS : &amp;lt;FS_GLOBAL_VARIABLE&amp;gt;.



IF VAR1 IS NOT INITIAL.
  PERFORM MOVE_VARIABLE USING VAR1.
ENDIF.

IF VAR2 IS NOT INITIAL.
  PERFORM MOVE_VARIABLE USING VAR1.
ENDIF.

IF VAR3 IS NOT INITIAL.
  PERFORM MOVE_VARIABLE USING VAR1.
ENDIF.

IF VAR3 IS NOT INITIAL.
  PERFORM MOVE_VARIABLE USING VAR1.
ENDIF.

IF VAR3 IS NOT INITIAL.
  PERFORM MOVE_VARIABLE USING VAR1.
ENDIF.


FORM MOVE_VARIABLES USING VAR1.
  ADD 1 TO LV_LINE_NUMBER.
  CONCATENATE LV_PREFIX 
              LV_LINE_NUMBER
         INTO LV_FIELDNAME.
  ASSIGN (LV_FIELDNAME) TO &amp;lt;FS_GLOBAL_VARIABLE&amp;gt;.
  &amp;lt;FS_GLOBAL_VARIABLE&amp;gt; = VAR1.
ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if that helps. Or if you need some other information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anand Mandalika.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jul 2005 06:48:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-variable-names/m-p/977675#M71247</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-25T06:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Variable names</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-variable-names/m-p/977676#M71248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Great solution.. I had never thought about it.. Thanks a lot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anand,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ultimate answer.. It worked... Thanks a lot. I use this solution...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jul 2005 07:02:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-variable-names/m-p/977676#M71248</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-25T07:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Variable names</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-variable-names/m-p/977677#M71249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;could you give me the correct code&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jul 2005 10:34:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-variable-names/m-p/977677#M71249</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-25T10:34:48Z</dc:date>
    </item>
  </channel>
</rss>

