Active check for web UI transactions.
In our last projects when clients upgrade their CRM versions from lower to higher we faced some common issues.One common issue is to know how to check whether a transaction is creating using GUI or using WEB UI.
This is needed because in CRM lower versions clients used number of custom GUI enhancements in their business Add Ins and user exists and in other places to show GUI pop up, screens etc.
So at GUI level they want the same working environment and but when user logon from WEB UI these same BADI and exits having custom code for GUI popup,dialog box,screen calls which always create problem.
To avoid to run this unwanted code we used a standard Class which is CL_GUI_CONTROL.The class CL_GUI_CONTROL has number of methods and parameters to control GUI operations.
Parameter WWW_ACTIVE, GUI_IS_RUNNING of class CL_GUI_CONTROL played a very important role for all this.
This parameter is in Active state when transaction is calling from GUI .
Some used cases:-
We have Exit for GUI EXIT_SAPLSUSF_001 which calls when user logon to GUI . In this we have to call a screen for particular user id when that user logon to GUI and not for UI ,but when the same user logon from web UI and call some GUI transaction with Transaction launcher then the code for call screen was creating problem with UI.So for this we have used same parameter as :-
Similarly we have used this parameter in BADI Order_save to allow GUI popup only when creating transaction from GUI only .
Hope this will help someone.