Hi All,
The problem has been resolved. In the enhancement I had put a check that
If sy-tcode = 'PRAA'
{
......
......
}
This worked fine in foreground but in background it was not triggering so I have removed that check and now it is working fine.
Thanks.