cancel
Showing results for 
Search instead for 
Did you mean: 

WRITE (<f>) TO <g>.

Former Member
0 Kudos

In the WRITE TO statement,

WRITE (<f>) TO <g>.

code->

<b>DATA: name(10) TYPE c VALUE 'SOURCE_s',

source_s(10) TYPE c VALUE 'XYZ ',

target(10) TYPE c.

WRITE (name) TO target.

WRITE / target.

<i>Output->XYZ ( value of source_s)</i></b>

with this code , i get the output as XYZ - the value of the name field(first) is the

name of the second field, i.e. source_s.

now my question is ->

<b>DATA: name(10) TYPE c VALUE 'SOURCE_s',

source_s(10) TYPE c VALUE 'XYZ ',

xyz(10) type c value 'xyz1',

target(10) TYPE c.

WRITE (name) TO target.

WRITE / target.

<i>output-> XYZ

want output as -> xyz1 without using (source_s)</i></b>

Here we ,specify the name of the field containing the name of the source field in

parentheses.

<b>? --></b> Is there any method other than (source_s) so that i get the output as

xyz1.

This is my first post, so if i am not clear kindly excuse me.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

hey rich,,,

some more modifications....

watch this...

DATA: name(10) TYPE c VALUE 'SOURCE_s',

source_s(10) TYPE c VALUE 'XYZ ',

xyz(10) type c value 'xyz1',

target(10) TYPE c.

field-symbols: <fs1>,<fs2>.

assign (name) to <fs1>.

assign (<fs1>) to <fs2>.

WRITE <fs1> TO target.

WRITE / target.

WRITE <fs2> TO target.

WRITE / target.

WRITE (<fs1>) TO target.

WRITE / target.

o/p->

XYZ

xyz1

xyz1

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

I was thinking that you could do that. Nice work.

Regards,

Rich Heilman

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Not sure what your requirement is but you can assign the field to a field symbol.



report zrich_0002.


DATA: name(10) TYPE c     VALUE 'SOURCE_s',
      source_s(10) TYPE c VALUE 'XYZ ',
      xyz(10) type c      value 'xyz1',
      target(10) TYPE c.

field-symbols: <fs1>.

assign (SOURCE_S) to <fs1>.


WRITE <fs1> TO target.
WRITE / target.

if these answers are helpful, please reward points accordingly . Thanks.

Regards,

Rich Heilman

Former Member
0 Kudos

thanks rich,

i tried changing your code to some extent

REPORT ZSSABAP10_1 .

DATA: name(10) TYPE c VALUE 'SOURCE_s',

source_s(10) TYPE c VALUE 'XYZ ',

xyz(10) type c value 'xyz1',

target(10) TYPE c.

field-symbols: <fs1>,<fs2>.

assign (name) to <fs1>.

assign (<fs1>) to <fs2>.

WRITE <fs1> TO target.

WRITE / target.

WRITE <fs2> TO target.

WRITE / target.

so the o/p i get is -

XYZ

xyz1

so i was asking if i could do it through name itself..... now i am working on it... will post soon...