‎2011 Aug 18 12:50 PM
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
‎2011 Aug 18 1:27 PM
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
‎2011 Aug 18 1:45 PM
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
‎2011 Aug 18 2:12 PM
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>.
‎2011 Aug 18 2:26 PM
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
‎2011 Aug 18 5:18 PM
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
‎2011 Aug 18 5:39 PM
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.
‎2011 Aug 19 7:08 AM
Hi Sam,
thanks for your reply , its works exactly as we want.
Thanks,
sneha
‎2011 Aug 19 7:39 AM