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

error at assignment

Former Member
0 Likes
1,408

HI All ,

while executing below program for field-symbol it gives dump i.e. ERROR AT ASSIGNMENT : OVERWRITTEN PROTECTED FIELD.

PARAMETERS P_FIELD(10) DEFAULT 'ABCD'.

FIELD-SYMBOLS: <F1>.

ASSIGN: (P_FIELD) TO <F1>.

WRITE:/ 'P_FIELD', P_FIELD,

/ 'F1' , <F1>.

BUT, working fine when DEFAULT value is assign 'SY-DATUM' IN PARAMETER as below program-

PARAMETERS P_FIELD(10) DEFAULT 'SY-DATUM'.

FIELD-SYMBOLS: <F1>.

ASSIGN: (P_FIELD) TO <F1>.

WRITE:/ 'P_FIELD', P_FIELD,

/ 'F1' , <F1>.

PLEASE HELP ME REGARDING THIS..

THANKS ,

SNEHA

8 REPLIES 8
Read only

Former Member
0 Likes
1,314

Hi,

not sure what you are trying to do here, but when you assign like this:

ASSIGN (p_field) TO <field-symbol>.

p_field should contain an actual field declared in your programme. As sy-datum is always declared that will work, but 'ABCD' is not a field in your programme, just a string, so that will not work.

Roy

Read only

0 Likes
1,314

Hi Roy,

actually i'm trying to check how value in P_field is changing dynamically.

i also check this by declaring the field as char but than no value for field-symbol is coming.

thanks,

sneha

Read only

0 Likes
1,314

This code definitely gives me the output, not sure how it is different for you.

PARAMETERS p_field(10) DEFAULT 'ABCD'.

DATA: abcd(4) VALUE '1234'.
FIELD-SYMBOLS: <f1>.
ASSIGN: (p_field) TO <f1>.
WRITE:/ 'P_FIELD', p_field,
/ 'F1' , <f1>.

Read only

0 Likes
1,314

Hi ,

thanks for your reply.

i already try this but its not working as we want.

while changing value of P_field the value of filed-symbol value is not showing its value is showing blank.

thanks,

sneha

Read only

0 Likes
1,314

Hi,

What exactly is the value that you are looking for?? is it ABCD or is it like ABCD is the field and you want to see the value in that field???

if you want to see ABCD as the output, then code will be :

PARAMETERS P_FIELD(10) DEFAULT 'ABCD'.

FIELD-SYMBOLS: <F1>.

ASSIGN: P_FIELD TO <F1>. --- > check the p_field .. there is no bracket for this field.

WRITE:/ 'P_FIELD', P_FIELD,

/ 'F1' , <F1>.

if you want to see the value in ABCD, then ABCD should be a field which is declared and it has some value in it. code is as follows:

data : abcd type vbeln.

PARAMETERS P_FIELD(10) DEFAULT 'ABCD'.

FIELD-SYMBOLS: <F1>.

ASSIGN: (P_FIELD) TO <F1>. ---> check the p_field .. its in brackets and it assignes the value of ABCD(ie 3020) to <F1>

abcd = '03020'.

WRITE:/ 'P_FIELD', P_FIELD,

/ 'F1' , <F1>.

Thanks

Sam.

Edited by: Sam_sap1212 on Aug 18, 2011 11:18 AM

Read only

0 Likes
1,314

A field symbol contains no value in the way you're thinking! It is merely a reference pointer to where the data resides.

in other words, if I loop at table assigning <fs>.

<fs>-field = some_value. points to the row and field that actually contains the data value and updates the row and field with some_value.

Look again at code supplied that is working...I believe you have a coding error.

Read only

0 Likes
1,314

Hi Sam,

thanks for your reply , its works exactly as we want.

Thanks,

sneha

Read only

Former Member
0 Likes
1,314

RESOLVED