on 11-26-2009 11:26 PM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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.
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.