2009 Jul 06 5:33 PM
Hi ,
I am new on using field symbols,
so i need some help.
i gor the below error for this code.
LOOP at <dyn_table_o> INTO <dyn_wa_r>.
assign component 'ALT_KUNNR' of structure <dyn_wa_r> to <fs>.
if sy-subrc = 0 and <fs> is not initial.
APPEND <dyn_wa_r> to <dyn_table_r>.
endif.
ENDLOOP.
error:
You attempted to access an unassigned field symbol
(data segment 32771).
This error may occur if
- You address a typed field symbol before it has been set with
ASSIGN
- You address a field symbol that pointed to the line of an
internal table that was deleted
- You address a field symbol that was previously reset using
UNASSIGN or that pointed to a local field that no
longer exists
- You address a global function interface, although the
respective function module is not active - that is, is
not in the list of active calls. The list of active calls
can be taken from this short dump.
what should i do?
Regards,
Harshit Rungta
Edited by: Julius Bussche on Jul 7, 2009 9:02 AM
Please use meaningfull subject titles.
2009 Jul 06 5:37 PM
2009 Jul 06 5:38 PM
2009 Jul 06 5:54 PM
Thanks Rich,
But i am again getting error at the line
APPEND <dyn_wa_r> to <dyn_table_r>.
I also tried with
ASSIGN <dyn_wa_r> to <dyn_table_r>.
but still getting the error.
Thanks,
Harshit Rungta
2009 Jul 06 5:57 PM
2009 Jul 06 6:40 PM
FIELD-SYMBOLS :<dyn_table_r> TYPE STANDARD TABLE,
<dyn_wa_r> TYPE ANY.
ASSIGN <dyn_table_o> to <dyn_wa_r> .
ASSIGN <dyn_wa_r> to <dyn_table_r>.
*
field-symbols: <fs> type any.
LOOP at <dyn_table_o> ASSIGNING <dyn_wa_r>.
assign component 'ALT_KUNNR' of structure <dyn_wa_r> to <fs>.
if sy-subrc = 0 and <fs> is not initial.
APPEND <dyn_wa_r> to <dyn_table_r>.
endif.
ENDLOOP.
Hi Rich,
above is the code.
Its working now,
but the statement ASSIGN <dyn_table_o> to <dyn_wa_r> is transferring all the entries of the dyn table to the wa,
wheras i just want the structure of the same.
what should i do?
Regards,
Harshit Rungta
2009 Jul 06 6:49 PM
Yes, you appear to be a bit confused about what you are trying to do. <dyn_table_r> must be created dynamically at runtime and assign thereafter. Something like....
FIELD-SYMBOLS :<dyn_table_r> TYPE STANDARD TABLE,
<dyn_wa_r> TYPE ANY.
data: o_ref type data.
* assume that <dyn_table_o> has already been created, and assigned.
create data o_ref like <dyn_table_o>.
assign o_ref->* to <dyn_table_r>.
field-symbols: <fs> type any.
LOOP at <dyn_table_o> ASSIGNING <dyn_wa_r>.
assign component 'ALT_KUNNR' of structure <dyn_wa_r> to <fs>.
if sy-subrc = 0 and <fs> is not initial.
APPEND <dyn_wa_r> to <dyn_table_r>.
endif.
ENDLOOP.
As you can see above, you must create the dynamic internal table <dyn_table_r>. You can base this from the <dyn_tab_o> if it already exists at runtime. I'm assuming that it does.
Regards,
Rich Heilman
2009 Jul 06 7:11 PM
Thanks a lot Rich,
But for the statement
data : o_ref type data.
I am getting the error
"DATA" is a generic type. A type reference is possible only for field
symbols and formal parameters . . . . . . . . . .
Regards,
Harshit Rungta
2009 Jul 06 7:16 PM