cancel
Showing results for 
Search instead for 
Did you mean: 

Catch Exception on not ASSIGNing the Field Symbol?

Former Member
0 Kudos

Hi,

Am assigning some content to field symbol with the below statement,

<fs> TYPE ANY.

ASSIGN (v_field_name) TO <fs>.

I am aware of that, if its not ASSIGNs system will throw dump!! But, I want to avoide this dump, so, pls. let me know, How to handle it? actually, i know it(IF ASSIGNS-TRY-CATCH EXCEPPTION), but, at this point I forgot it

Thank you

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Check for sy-subrc after the ASSIGN statement. if sy-subrc is initial, then use the field symbol others dont.

<fs> TYPE ANY.

ASSIGN (v_field_name) TO <fs>.

if sy-subrc is initial.

use the field symbol <fs> here

endif.

Former Member
0 Kudos

Thank you. But, I guess, system will throw dump, when the pointer encounters the ASSIGN statement itself!! right? i mean, system wuld not give any chance to move to next statement (in our case, its SY-SUBRC check)!!

1)ASSIGN (v_field_name) TO <fs>.

2)if sy-subrc is initial.

3)use the field symbol <fs> here

4)endif.

So, supose, its not get ASSIGNed, then, system will throw dump in the 1st line itself, right? meaning, system will not see/read the 2nd statement, right? sorry if am wrg, bcz, currently i do not hv SAP.

thank you

Former Member
0 Kudos

NO system will not dump at the ASSIGN statement. The system will dump when u r trying to access a field symbol that is not assigned. so if u write a statement like

w_test = <fs>.

then the system will dump. because <fs> is not assigned.

so in this case if you write

ASSIGN (v_field_name) TO <fs>.

if sy-subrc is initial.

w_test = <fs>.

endif.

then the code will not dump.

Former Member
0 Kudos

ok, thank you, wuld like to wait for some more time for any other experts replies, thank you

Answers (0)