cancel
Showing results for 
Search instead for 
Did you mean: 

Field-symbol gets unassigned unexpectedly.

walkerist
Participant
0 Kudos
185

Hi, has anyone experienced that the field-symbol gets unassigned unexpectedly?

Here's my code

ASSIGN IT_TABLE [ ... ] TO FIELD SYMBOL <FS_TEST>.

IF <FS_TEST> IS ASSIGNED.

ENDIF.

DATA(V_VAR1) = <FS_TEST>-EBELN.   <-------------- I'm encountering an error here. Because the <FS_TEST gets unassigned even though there was no UNASSIGN logic inside the IF ENDIF condition.

How do I resolve that?

 

Accepted Solutions (0)

Answers (1)

Answers (1)

DominikTylczyn
Active Contributor

Hello @walkerist 

Field symbols don't get unassigned automagically but themselves. Your code is as follows (make sure to format the code properly in your question):

ASSIGN IT_TABLE [ ... ] TO FIELD SYMBOL <FS_TEST>.
IF <FS_TEST> IS ASSIGNED.
ENDIF.
DATA(V_VAR1) = <FS_TEST>-EBELN.

If the assignment in the 1st line fails, then IF...ENDIF is not executed, but line 4 is. Thus, the line 4 is executed even if the field symbol is not assigned. 

Best regards

Dominik Tylczynski

walkerist
Participant
0 Kudos
Actually, the the assignment was successful. The program were able to go inside the IF ENDIF logic. I'm curious why after that IF ENDIF, the <FS_TEST> went unassigned. But thanks.
DominikTylczyn
Active Contributor
0 Kudos
You must have done something in the IF...ENDIF block to unassign the field symbol. If you had shared IF...ENDIF block source code, we would be able to help more.