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 Symbol assignment

Former Member
0 Likes
498

Hi fiends,

Please find below code. It is giving error that Fields is not assigned. Please advise me how to correct it.

The detailed error is.

The field symbol is no longer assigned because there was an attempt

make previously in a Unicode program to set the field symbol using

ASSIGN with offset and/or length specification. Here, the memory

addressed by the offset/length specification was not within the

allowed area.

code:

FIELD-SYMBOLS <TEXT> TYPE ANY.

DATA: ASSIGN_LENGTH LIKE SY-FDPOS,

ERROR_TEXT_LENGTH LIKE SY-FDPOS,

SHIFT_DISTANCE LIKE SY-FDPOS,

OVERWRITE_LENGTH LIKE SY-FDPOS.

SEARCH ERROR_TEXT FOR '&&'.

IF SY-SUBRC EQ 0.

OVERWRITE_LENGTH = 2.

ELSE.

SEARCH ERROR_TEXT FOR '&'.

IF SY-SUBRC EQ 0.

OVERWRITE_LENGTH = 1.

ELSE.

SEARCH ERROR_TEXT FOR '$'.

IF SY-SUBRC EQ 0.

OVERWRITE_LENGTH = 1.

ELSE.

EXIT.

ENDIF.

ENDIF.

ENDIF.

DESCRIBE FIELD T100-TEXT LENGTH ERROR_TEXT_LENGTH IN BYTE MODE.

SHIFT_DISTANCE = STRLEN( INSERT_TEXT ) - OVERWRITE_LENGTH.

ASSIGN_LENGTH = ERROR_TEXT_LENGTH - SY-FDPOS.

ASSIGN ERROR_TEXT+SY-FDPOS(ASSIGN_LENGTH) TO <TEXT>.

Here the error showing

-


SHIFT <TEXT> BY SHIFT_DISTANCE PLACES RIGHT.

ASSIGN_LENGTH = SHIFT_DISTANCE + OVERWRITE_LENGTH.

IF ASSIGN_LENGTH = 0.

ASSIGN_LENGTH = 1.

ENDIF.

ASSIGN ERROR_TEXT+SY-FDPOS(ASSIGN_LENGTH) TO <TEXT>.

MOVE INSERT_TEXT TO <TEXT>.

Hi fiends,

Please find below code. It is giving error that Fields is not assigned. Please advise me how to correct it.

The detailed error is.

The field symbol is no longer assigned because there was an attempt

make previously in a Unicode program to set the field symbol using

ASSIGN with offset and/or length specification. Here, the memory

addressed by the offset/length specification was not within the

allowed area.

code:

FIELD-SYMBOLS <TEXT> TYPE ANY.

DATA: ASSIGN_LENGTH LIKE SY-FDPOS,

ERROR_TEXT_LENGTH LIKE SY-FDPOS,

SHIFT_DISTANCE LIKE SY-FDPOS,

OVERWRITE_LENGTH LIKE SY-FDPOS.

SEARCH ERROR_TEXT FOR '&&'.

IF SY-SUBRC EQ 0.

OVERWRITE_LENGTH = 2.

ELSE.

SEARCH ERROR_TEXT FOR '&'.

IF SY-SUBRC EQ 0.

OVERWRITE_LENGTH = 1.

ELSE.

SEARCH ERROR_TEXT FOR '$'.

IF SY-SUBRC EQ 0.

OVERWRITE_LENGTH = 1.

ELSE.

EXIT.

ENDIF.

ENDIF.

ENDIF.

DESCRIBE FIELD T100-TEXT LENGTH ERROR_TEXT_LENGTH IN BYTE MODE.

SHIFT_DISTANCE = STRLEN( INSERT_TEXT ) - OVERWRITE_LENGTH.

ASSIGN_LENGTH = ERROR_TEXT_LENGTH - SY-FDPOS.

ASSIGN ERROR_TEXT+SY-FDPOS(ASSIGN_LENGTH) TO <TEXT>.

Here the error showing

-


SHIFT <TEXT> BY SHIFT_DISTANCE PLACES RIGHT.

ASSIGN_LENGTH = SHIFT_DISTANCE + OVERWRITE_LENGTH.

IF ASSIGN_LENGTH = 0.

ASSIGN_LENGTH = 1.

ENDIF.

ASSIGN ERROR_TEXT+SY-FDPOS(ASSIGN_LENGTH) TO <TEXT>.

MOVE INSERT_TEXT TO <TEXT>.

2 REPLIES 2
Read only

Former Member
0 Likes
460

Do you mean the error occurs at the shift statement.

If so then no data exists in the field symbol.

I suspect u nee to do the follwing: -

data field(50).

CONCATENATE 'ERROR_TEXT+'

SY-FDPOS *** You will need to make this a field of type char.

'('

ASSIGN_LENGTH

')' INTO FIELD.

ASSIGN (field) TO <TEXT>.

Read only

Former Member
0 Likes
460

Sapna,

just before using the field symbol check whether it is assigned or not.

only when it is assigned use that otherwise it will give you error. Bcoz field symbols are handled at runtime

<b>IF <FS> IS ASSIGNED</b>

Also debug at ASSIGN statement , see why it is not assigned

--

MB