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

Using Assert id

Former Member
0 Likes
582

Hi ABAP guru's,

In this scenario,

data: w_c1(3) type c,

w_c2 type i,

zemp1 like table of zemp.

field-symbols <fs> type zemp.

select * from zemp into table zemp1.

read table zemp1 with key empno = '1' assigning <fs>.

assert id AAB_DEMO condition sy-subrc = 0.

w_c1 = <fs>-empno.

write w_c1.

Here AAB_DEMO is check group created in SAAB transaction inactive mode.

if sy-subrc ne 0. is it possible to run this program without getting any runtime error?

Thanks in advance.

Prasad G.V.K

1 ACCEPTED SOLUTION
Read only

naimesh_patel
Active Contributor
0 Likes
469

Check the weather the field-symbol is assigned or not before accessing it.


select * from zemp into table zemp1.
read table zemp1 with key empno = '1' assigning <fs>.
assert id AAB_DEMO condition sy-subrc = 0.
check <fs> is assigned.  " << check assigned status of the <FS>
w_c1 = <fs>-empno.
write w_c1.

Regards,

Naimesh Patel

1 REPLY 1
Read only

naimesh_patel
Active Contributor
0 Likes
470

Check the weather the field-symbol is assigned or not before accessing it.


select * from zemp into table zemp1.
read table zemp1 with key empno = '1' assigning <fs>.
assert id AAB_DEMO condition sy-subrc = 0.
check <fs> is assigned.  " << check assigned status of the <FS>
w_c1 = <fs>-empno.
write w_c1.

Regards,

Naimesh Patel