Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Field symbol, dynamically passing value to variable

$
0
0

Dear All,

I'm doing little experiments on field symbols , I got stuck at a point. It may be a small thing but I'm not clicking it.

scenario is  -

 

_________________________________________________________________________

* Please don't consider my code , it may wrong, Kindly try to understand what I want to achieve.  

_______________________________________ _________________________________

Data str1 type string,

         str2 type string,

          text1 type string,

          text2 type string.

field-symbols <fs1>,<fs2>.

do 2 times.

count = count + 1.

text1 = count.

 

CONCATENATE 'STR' text1 into text1.   " now value in TEXT1 is STR1.

condense text1.

ASSIGN TEXT1 to  <fs1>. " Now value of <fs1> is STR1 (Which is a variable defined in the beging)

 

 

text2 = 'HELLO'.

 

ASSIGN TEXT2to  <fs2>. " Assinging value of text2 to <FS2>


ASSIGN <fs2> to <fs1>. " here I'm trying to assign value of <fs2> which is 'HELLO' to the variable STR1, STR1 is already assigned to <FS1>

                                       


write :   /  SRT1,

              /   STR2.

 

Desired O/P.

 

HELLO

HELLO

 

So basically my requirement is -

I have to fill 2 variable str1 and str2, which I want to fill on cont  = 1 and count =  2 respectively. This I can achieve by using case statement.

but in real scenario I have more than 15 variable. So I want to use field symbol.

I want to fill value of text2 in to the variale which is assign to <FS1> .

(currently I'm having - > Text2 = HELLO , <FS1> = STR1

I want ----- STR1  = TEXT2

means ---> STR1  = 'HELLO').

Is it possible or not. Otherwise I'll go with case statement.


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>