Application Development 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: 

Field symbol has not yet been assigned

Former Member
0 Kudos

Hi All,

I keep getting short dump error for below code.

ASSIGN COMPONENT 'QUANTITY' OF STRUCTURE <l_s_old> TO <l_qty>.

ASSIGN COMPONENT 'MATERIAL' OF STRUCTURE <l_s_old> TO <l_material>.

ASSIGN COMPONENT 'UNIT' OF STRUCTURE <l_s_old> TO <l_unit>.

IF <l_unit> = 'KG'.

<l_newfield> = <l_qty>.

The dump pointed to line IF <l_unit> = 'KG'.

10 REPLIES 10

Former Member
0 Kudos

Hi All,

Apologize I have accidentaly clicked on Post before I finished writing.

The short dump pointed to line IF <l_unit> = 'KG'. The short dump said :

Field symbol has not yet been assigned.

Error analysis

You attempted to access an unassigned field symbol

(data segment 32775).

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.

Please help. Thanks.

Former Member
0 Kudos

Hi!

Please post full code.

What is <l_s_old>? How you assign it?

Check sy-subrc after each assign statement.

Former Member
0 Kudos

Hi,

I assume that the field-symbol <l_unit> has the value 'KG' after the assign statement.

U can try this way :

1. Declare a local variable l_unit of type (internale table unit type) wih value 'KG'.

2. Check the field-symbol <l_unit> value with the above mentioned local variable l_unit instead of checking with a string 'KG' in the IF statement.

IF <l_unit> = l_unit.

go with ur coding.

I feel the error is because of type mismatch.

-Satya Priya

Former Member

Hi Satya,

Still not working.

Hi All,

Here is the complete code. Please help. Thanks.

METHOD if_rscnv_exit~exit.

FIELD-SYMBOLS: <l_s_old> TYPE ANY,

<l_material> TYPE ANY,

<l_qty> TYPE ANY,

<l_unit> TYPE ANY,

<l_newfield> TYPE ANY.

DATA:

v_dimid TYPE t006-dimid,

v_uomz1d TYPE /bic/azaamro0500-uomz1d,

v_uomn1d TYPE /bic/azaamro0500-uomn1d,

v_unit(2) value 'KG'.

*****************************************************

  • Assign the references to field symbols

*****************************************************

ASSIGN c_r_newfield->* TO <l_newfield>.

ASSIGN i_r_old->* TO <l_s_old>.

*****************************************************

  • To use the individual fields of the old table

  • structure (e.g. SID_0CALDAY), assign these fields

  • to field symbols using the field name.

*****************************************************

ASSIGN COMPONENT 'QUANTITY' OF STRUCTURE <l_s_old> TO <l_qty>.

ASSIGN COMPONENT 'MATERIAL' OF STRUCTURE <l_s_old> TO <l_material>.

ASSIGN COMPONENT 'UNIT' OF STRUCTURE <l_s_old> TO <l_unit>.

IF <l_unit> = v_unit.

<l_newfield> = <l_qty>.

ELSE.

SELECT SINGLE dimid FROM t006 INTO v_dimid

WHERE msehi = <l_unit>.

IF sy-subrc = 0 AND v_dimid = 'MASS'.

CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'

EXPORTING

input = <l_qty>

no_type_check = 'X'

unit_in = <l_unit>

unit_out = 'KG'

IMPORTING

output = <l_newfield>.

ELSE.

SELECT SINGLE uomz1d uomn1d FROM /bic/azaamro0500 INTO (v_uomz1d, v_uomn1d)

WHERE material = <l_material>

AND base_uom = <l_unit>

AND unit = 'KG'.

CHECK sy-subrc = 0.

<l_newfield> = <l_qty> / v_uomz1d * v_uomn1d.

ENDIF.

ENDIF.

ENDMETHOD.

0 Kudos

Hi Handoko,

Where comes from I_R_OLD? Have you initialize this reference?

You should have somewhere a line like :

CREATE DATA i_r_old TYPE sid_0calday.

Best regards,

Samuel

Former Member
0 Kudos

Hi,

1. Don't use the char type there again.

V_UNIT(2) value 'KG'.

2. Use

v_unit type SID_0CALDAY-unit (type).

          • the structure unit type

-Satya Priya

Former Member
0 Kudos

Can u check the sy-subrc value and the value <l_unit) after the statement.....in debugging mode

ASSIGN COMPONENT 'UNIT' OF STRUCTURE <l_s_old> TO <l_unit>.

I am assuming that the value is populated in <l_unit).

-Satya Priya

Former Member
0 Kudos

Hi Satya,

I have changed to

v_unit type /bi0/oiunit value 'KG'.

But still working.

I guess system said that field symbol has not been assigned, whereas, my code clearly have used the ASSIGN command.

Any idea ?

Former Member
0 Kudos

Hi,

R u looping at i_r_old into <l_s_old>. Then only your l_s_old will contain the values.

I coudn't see any loop statement in ur code. If there is no looping, how the work area l_s_old will contain the values.

Either u should loop at internal table i_r_old or read that internal table i_r_old into your work area

l_s_old to get the component value.

1) loop at <i_r_old> into <l_s_old>

or

2) Read table <i_r_old> into <l_s_old> index / key.

-Satya Priya

0 Kudos

This message was moderated.