Hi harishbabum,
The reason for the error is that part of your current configuration isn't compatible with Junos version 12.1X46-D40.2. Namely your disablement of the real ALG, you'll have to delete that command. Issue this command before upgrading ( in configuration mode ) :
# delete security alg real disable