You use the its_ping function to check whether a transaction has been called by the ITS or in dialog mode from the SAP GUI.
its_ping
If its_ping determines that a transaction is called in dialog mode from the SAP GUI, it raises the exception its_not_available.
form check_its. call function 'its_ping' exceptions its_not_available = 1 others = 2. if sy-subrc = 0. * perform ITS-specific processing else. * perform SAP GUI-specific processing endif. endform.