Application Development 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: 

How to output text symbols dynamiclly

Former Member
0 Kudos

Hi everybody,

I have a question regarding text-symbols. I implemented a form routine which should add error messages to an internal table. This internal table will be output at the end of my program using the "write" command.

The form-routine looks like the following:

form add_error_2_log using p_error_code.

data: lv_text(8) type c.

concatenate 'text-' p_error_code into lv_text.
gs_log-msgtx = lv_text.
append gs_log to gt_log.

endform.

If I output my table now using the "write" command I only get my text-symbol number as a result e.g. text-t48.

Is there any way how I can get the text of the text symbol for the output?

Thanks in advance and regards!

Martin

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Martin

Use field symbols to solve this.


form add_error_2_log using p_error_code.
 
data: lv_text(8) type c.

 FIELD SYMBOLS : <FS> TYPE ANY.
concatenate 'text-' p_error_code into lv_text.
Assign (lv_text) TO <FS>. 
gs_log-msgtx = <FS>.
append gs_log to gt_log.
 
endform.

Thanks

Pushpraj

4 REPLIES 4

Former Member
0 Kudos

Hi Martin

Use field symbols to solve this.


form add_error_2_log using p_error_code.
 
data: lv_text(8) type c.

 FIELD SYMBOLS : <FS> TYPE ANY.
concatenate 'text-' p_error_code into lv_text.
Assign (lv_text) TO <FS>. 
gs_log-msgtx = <FS>.
append gs_log to gt_log.
 
endform.

Thanks

Pushpraj

0 Kudos

Thank you very much! It's just the perfect solution!

0 Kudos

I have implemented the solution you suggested and it worked fine so far. But now I get return code 4 during assigning the the variable to the field symbol. But I don't know why. The character variable which I want assign is not empty. Do you have any suggested what could cause this error?

Thanks and regards,

Martin

0 Kudos

Problem solved again. I didn't maintain the text symbol.