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

how to code this using FIELD SYMBOL ?

Former Member
0 Likes
503

Hello All,

I never used field symbols before and I think this is where I should use field symbols in my program.

I have a selection parameter period (p_period) and based on the p_period value(XX), I need to display the HSLXX, KSLXX from table GLT0 using field symbols. Can anyboby help me?

Thanks,

Chandni Reddy

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
445

Right, you can use field-symbols, here is a example.



report zrich_0002.

data: xGLT0  type  GLT0 .

data: field_name(20) type c.

field-symbols: <fs> .

parameters: p_per(2) type n.


* Read a line from table
select Single * from glt0 into xglt0.

* Build the field name that you want to access
concatenate 'XGLT0-HSL' p_per into field_name.

* Assign it
assign (field_name) to <fs>.

* Write it
write:/ <fs>.

Regards,

Rich Heilman

2 REPLIES 2
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
446

Right, you can use field-symbols, here is a example.



report zrich_0002.

data: xGLT0  type  GLT0 .

data: field_name(20) type c.

field-symbols: <fs> .

parameters: p_per(2) type n.


* Read a line from table
select Single * from glt0 into xglt0.

* Build the field name that you want to access
concatenate 'XGLT0-HSL' p_per into field_name.

* Assign it
assign (field_name) to <fs>.

* Write it
write:/ <fs>.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
445

Hi,

data: var type string.

field-symbols: <fs>.

CONCATENATE 'GLT0-HSL' p_period into var.

ASSIGN (VAR) to <FS>.

WRITE: / <FS>.

Thanks,

Naren