Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Getting value from variables.

Former Member
0 Likes
1,705

Hi ABAP'ers.

I have a question about how to move value.

What i have:

lv_counter

<gs_dyn>

I give sample code:

DO 3 TIMES.


       ADD 1 TO lv_counter.

       ASSIGN COMPONENT sy-index OF STRUCTURE <gs_dyn> TO <fs_value>.

       CONCATENATE 'GV_LICZBA' lv_counter INTO lv_liczba.

       ASSIGN ('lv_liczba') TO <fs_value>.

     ENDDO.

My question is:

When I concatenate 'GV_LICZBA' and lv_counter I will get the name of variable which I want take value. But I only get in first 'DO' 'GV_LICZBA1' instead a value of this.

Could someone to help me?


8 REPLIES 8
Read only

Tomas_Buryanek
Product and Topic Expert
Product and Topic Expert
0 Likes
1,673

It is not clear what is your problem. Can you describe it better?

-- Tomas --
Read only

sandroramos
Active Participant
0 Likes
1,673

Hi, try without quotes, should work:

ASSIGN (lv_liczba) TO <fs_value>.

Regards,

Sandro Ramos

Read only

0 Likes
1,673

Hi Sandro.

Thanks, your way is correct.

Read only

0 Likes
1,673

Great!!

Please, mark the correct answer to close this thread.

Best Regards,

Sandro Ramos

Read only

0 Likes
1,673

I don't see "set as correct" option.

Read only

0 Likes
1,673

Because you unmarked this as a question!

Rob

Read only

Former Member
0 Likes
1,673

Hi Wojtek,

Instead of CONCATENATE 'GV_LICZBA' lv_counter INTO lv_liczba.

write the below code.(Just remove the colon (' '))

CONCATENATE GV_LICZBA lv_counter INTO lv_liczba.


It will work...


Thanks,

Satya

Read only

bhuvneshkumar_gupta
Participant
0 Likes
1,673

Hi WojteK

View the code.

DATA: lv_text1 TYPE  string,

       lv_text2 TYPE  string,

       lv_dis   TYPE  string,

       lv_cnt   TYPE  string.

FIELD-SYMBOLS: <fs> TYPE ANY.

DO 2 TIMES.

lv_cnt = sy-index.

CONCATENATE 'LV_TEXT' lv_cnt INTO lv_dis.

CONDENSE   lv_dis NO-GAPS.

ASSIGN (lv_dis) to <fs>.

CHECK <fs> IS ASSIGNED.

<fs> = lv_dis.

ENDDO.

WRITE: lv_text1, lv_text2.


Hope it  helpful,


Regards,

Bhuvnesh