Simple and good solution is DEFAULT.
1. Create a function which will return S001,S002 ect.
2. Set this function as Default in table design.
When you insert other values it will be fill automatically.
Almost same problem you can find from below link. Please take a look my comment below.
I need to insert a value based on year_num
Regards,
Vijay