Skip to Content
0
May 27, 2010 at 11:49 AM

Set initial value in a table field

2111 Views

HI all,

I have to test some programs and want to clear values in tables to check the behavior of a program when dealing with initial values.

I using this code:

parameters: p_pernr type pa0105-pernr,

p_val type pa0105-usrid.

data: ls_pa0105 type pa0105.

select single * from pa0105 into ls_pa0105

where subty = '0001'

and pernr = p_pernr.

if sy-subrc = 0.

if p_val is initial.

clear ls_pa0105-usrid.

else.

ls_pa0105-usrid = p_val.

endif.

modify pa0105 from ls_pa0105.

endif.

This works if I put a value in p_val but it does nothing if I leave p_val initial.

Even if I clear the field, when I execute the modify, nothing has change in the table.

Thanks for any help.