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

assign

Former Member
0 Likes
754

Hi friends please explain this code . what exactly assign statement do .

CONCATENATE 'G_' p_tc_name '_LINES' INTO l_lines_name.

ASSIGN (l_lines_name) TO <lines>.

5 REPLIES 5
Read only

Former Member
0 Likes
720

Hi

The statement is assigning the <b>content of l_lines_names</b> to <b> field-symbol <lines>.</b>

l_lines_name is containing the name G_<value of p_tc_name>_LINES.

Regards

Raj

Read only

Former Member
0 Likes
720

hi,

after geetting concatenate the whole wil lbe sent to <lines>.

Read only

Former Member
0 Likes
720

Hi Prajwal,

ASSIGN statement is used to assign values to any field symbol youu are using in your code.

After the assign statement here value in the variable L_LINES_NAME will be available in the field-symbol <LINES>.

Thanks and Regards,

Kunjal Patel

Read only

varma_narayana
Active Contributor
0 Likes
720

Hi

CONCATENATE 'G_' p_tc_name '_LINES' INTO l_lines_name.

ASSIGN (l_lines_name) TO <lines>.

Basicall ASSIGN statement will make the field symbol to point a Data Object.

But We can Pass the Data Object name Directly (Static ASSIGN)

Eg:

data : VAR1 TYPE I VALUE 10.

FIELD-SYMBOLS <FS1> TYPE I.

ASSIGN VAR1 TO <FS1>.

WRITE <FS1>.

And..

We can Pass the Data Object name in a Variable (Dynamic ASSIGN)

Eg:

data : VAR1 TYPE I VALUE 10.

data : fieldname(10) type c .

FIELD-SYMBOLS <FS1> TYPE I.

fieldname = 'VAR1'.

ASSIGN (FIELDNAME) TO <FS1>.

WRITE <FS1>.

In this case the data object to which the field symbol should point will be determined at runtime.

Hope You will get it.

Regards.

Read only

Former Member
0 Likes
720

Hi,

normally,assign will move the contents of one variable to another.

where in case of field symbols.the value u r replacing also be assigned by another value.

other wise it will give error as field-symbol not assigned.

data:var1(10) value 'var2'.

data:var2(10) value 'var3'.

data:var3(10) value 'var4'.

data:var4(10) value 'output'.

field-symbols:<fs> type any.

field-symbols:<fs1> type any.

field-symbols:<fs2> type any.

assign (var1) to <fs>.

assign (<fs>) to <fs1>.

assign (<fs1>) to <fs2>.

write:/ <fs>, / <fs1>,/ <fs2>.

<b>reward if helpful</b>

rgds,

bharat.