2008 Apr 03 5:47 PM
Hi Guys
I am using a field sym in the foll way and iam getting a dump.
ls_fcat = mod_fcat( ls_fcat ).
method mod_fcat.
field-SYMBOLS: <l> like line of rt.
LOOP AT rt ASSIGNING <l>.
CASE <l>-fieldname.
WHEN 'VALUE_CONTRACT_E'.
CLEAR: <l>-ref_field,<l>-ref_table.
<l>-coltext = text-h01. <l>-SCRTEXT_L = text-h01.
<l>-SCRTEXT_M = text-h02. <l>-SCRTEXT_S = text-h02.
WHEN OTHERS.
ENDCASE.
ENDLOOP.
ENDMETHOD.
endmethod.
When the control goes to clear it gives me a dump.I dont understand why coz iam already assignin <l> at every loop pass.
Please help!!
Thanks
2008 Apr 03 6:27 PM
It will throw a dump at runtime, if field symbol is not assigned.
so check whether field symbol assigned or not before u do the processing.
IF <FS> IS ASSIGNED.
..
..
..
ENDIF.
Edited by: Kashinath Pai on Apr 3, 2008 7:29 PM
Hi Guys
I am using a field sym in the foll way and iam getting a dump.
ls_fcat = mod_fcat( ls_fcat ).
method mod_fcat.
field-SYMBOLS: <l> like line of rt.
LOOP AT rt ASSIGNING <l>.
CASE <l>-fieldname.
WHEN 'VALUE_CONTRACT_E'.
CLEAR: <l>-ref_field,<l>-ref_table.
<l>-coltext = text-h01. <l>-SCRTEXT_L = text-h01.
<l>-SCRTEXT_M = text-h02. <l>-SCRTEXT_S = text-h02.
WHEN OTHERS.
ENDCASE.
ENDLOOP.
ENDMETHOD.
endmethod.
When the control goes to clear it gives me a dump.I dont understand why coz iam already assignin <l> at every loop pass.
Please help!!
Thanks
2008 Apr 03 5:54 PM
What happens if you use
LOOP AT rt ASSIGNING <l> where fieldname is not INITIAL.
2008 Apr 03 6:09 PM
2008 Apr 03 6:12 PM
Hi,
data : it_mara type table of mara .
field-symbols : <fs> like mara.
select * from mara into table it_mara up to 10 ROWS.
loop at it_mara ASSIGNING <fs>.
clear <fs>-matnr.
modify it_mara from <fs>.
endloop.And it works..
What's the error u r getting?
G@urav
2008 Apr 03 6:54 PM
Hi Guys
This is the error i get
A new value is to be assigned to the field "<L>", although this field is entirely or partly protected against changes.
***********************************************************************
The following are protected against changes:
- Character literals or numeric literals
- Constants (CONSTANTS)
- Parameters of the category IMPORTING REFERENCE for functions and
methods
- Untyped field symbols not yet assigned a field using ASSIGN
- TABLES parameters if the actual parameter is protected against changes
- USING reference parameters and CHANGING parameters for FORMs, if the
actual parameter is protected against changes and
- Accesses using field symbols if the field assigned using ASSIGN is
protected (or partially protected, e.g. key components of an internal
table with the type SORTED or HASHED TABLE) against changes
- Accesses using references, if the field bound to the reference is
protected (or partially protected) against changes
- External write accesses to READ-ONLY attributes,
- Content of a shared object area instance accessed using a shared lock
(ATTACH_FOR_READ).
Thanks
2008 Apr 03 6:27 PM
It will throw a dump at runtime, if field symbol is not assigned.
so check whether field symbol assigned or not before u do the processing.
IF <FS> IS ASSIGNED.
..
..
..
ENDIF.
Edited by: Kashinath Pai on Apr 3, 2008 7:29 PM
2008 Apr 03 6:49 PM
I think it won't enter inside loop without assigning <FS>.
G@urav.
2008 Apr 03 7:06 PM
Hi,
Do this
IF <l>-ref_field IS not initial.
CLEAR: <l>-ref_field,.
endif.
IF <l>-ref_table IS not initial.
CLEAR:<l>-ref_table.
endif.
2008 Apr 03 8:37 PM
2008 Apr 03 8:48 PM
I got it!
Protected values:-
- Parameters of the category IMPORTING REFERENCE for functions and
methods
Thanks for trying guys!!
Rgds
Sameer