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

dynamic field

Former Member
0 Likes
387

what is a dynamic field and what is its use?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
355

santosh,

Dynamic field means:

In certain conditions you don't know what is the data

type of input fileds.

To catch those values general data variable declaration will not work .For those you need to declare Fields symbles.

EX;

DATA: STR_DYNAMIC type string.

FIELD-SYMBOLS <FS_DYNAMIC> type any.

STR_DYNAMIC = 'st_vbak-vbeln'.

ASSIGN (STR_DYNAMIC) TO <FS_DYNAMIC>.

Don't forget to reward if useful.....

2 REPLIES 2
Read only

Former Member
0 Likes
355

Hi,

You can assign value to the field at runtime

For ex:

DATA: STR_DYNAMIC type string.

FIELD-SYMBOLS <FS_DYNAMIC> type any.

.

STR_DYNAMIC = 'st_vbak-vbeln'.

Here the value in STR_DYNAMIC is actually the fieldname whose value you want to read.

code

ASSIGN (STR_DYNAMIC) TO <FS_DYNAMIC>.

the above step takes the fieldname and then assigns the value stored in that fieldname to the field symbol

Generally Assign statements can give Short Dumps if the assignment is not possible. So recommended approach is check for sy-subrc.

Write the below code in If condition.

code

IF sy-subrc eq 0.

<FS_DYNAMIC> = field_value. "or your value

UNASSIGN <FS_DYNAMIC>. "This step is required to free up assignment

ENDIF.

[/code]

Hope this helps.

Regards

Read only

Former Member
0 Likes
356

santosh,

Dynamic field means:

In certain conditions you don't know what is the data

type of input fileds.

To catch those values general data variable declaration will not work .For those you need to declare Fields symbles.

EX;

DATA: STR_DYNAMIC type string.

FIELD-SYMBOLS <FS_DYNAMIC> type any.

STR_DYNAMIC = 'st_vbak-vbeln'.

ASSIGN (STR_DYNAMIC) TO <FS_DYNAMIC>.

Don't forget to reward if useful.....