Thank you for reaching out to us and our sincere apologies for the inconvenience caused.
The S Pen can be affected by an electromagnetic field, such as a case.
Do you have a case or cover on your device? if yes, please remove it and try again.
Try soft resetting your device. Press and hold the power and volume down buttons for about 10 to 15 seconds (this will not erase your data, it is just to reboot the device)
Reset your S Pen.
1. From the home screen, swipe either up or down to access apps.
2. Select Settings.
3. Select Advanced features.
4. Select S Pen.
5. Select S Pen remote.
6. Select Menu.
7. Select Reset S Pen.
Also ensure that your device software is updated.
Should the issue persist kindly take the device to an accredited service center for an assessment. You can use the link below to find a service center near you