I had debug the Galaxy S4 i9500 device with that problem.. The problem occurs because of:-
1. Check your charging port flex cable, it may have been defective.. Replace New One..
2. Dont use GT-i9505 Charging Flex Cable on GT-i9500 device..
Hope it will help you solved your problem faced.