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

field symbols in objects

Former Member
0 Likes
1,281

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,255

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

9 REPLIES 9
Read only

Former Member
0 Likes
1,255

What happens if you use

LOOP AT rt ASSIGNING <l> where fieldname is not INITIAL.

Read only

Former Member
0 Likes
1,255

what does the short dump says?

Read only

Former Member
0 Likes
1,255

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

Read only

0 Likes
1,255

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

Read only

Former Member
0 Likes
1,256

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

Read only

0 Likes
1,255

I think it won't enter inside loop without assigning <FS>.

G@urav.

Read only

Former Member
0 Likes
1,255

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.

Read only

0 Likes
1,255

Hi Chandrashekhar, tried that, no effect

Read only

Former Member
0 Likes
1,255

I got it!

Protected values:-

- Parameters of the category IMPORTING REFERENCE for functions and

methods

Thanks for trying guys!!

Rgds

Sameer