Hi,
I developed a custom function module,
inside that i used two standard FMs to acheive the goal,
1. UI_CHECK(values for declaration mode and expression type)
2.CUPB_CHECK(Syntax Check, Scan, And Error Handling)
While using the FM CUPB_CHECK its necessary to pass the value for dark_mode as 'X', so that we may skip the sub screens and get error list in 'Return' Table
Loop the 'Return' parameter(its a table) and use BAPI_MESASAGE_GETDETAIL to get the exact error text according to the msg_id and msg_number.
Cheers!