Posted: Sun Nov 18, 2007 8:28 pm Post subject: Rings the bell on any PC, that has a sapgui connected to SAP
This ABAP rings the bell on any chosen pc, that has a sapgui connected to SAP
Code:
REPORT SAPLGRAP.
************************************************************************
* This program seds an audio alert to a specific user's frontend
* server. The program needs a pre-registered rfc program listening on
* every pc. The rfcexec can be started from the windows automatic
* startup like this:
* rfcexec -a100.100.100.100.rfcexec -ggatewayhostname -xsapgwXX
* ^ ^
* IP of the pc IP of the gateway host
************************************************************************
* Get the terminal, that belongs to the user
start-of-selection.
data: user value 'IMRE'.
DATA: OPCODE TYPE X VALUE 2.
DATA: BEGIN OF USR_TABL OCCURS 10.
INCLUDE STRUCTURE UINFO.
DATA: END OF USR_TABL.
CALL 'ThUsrInfo' ID 'OPCODE' FIELD OPCODE
ID 'TAB' FIELD USR_TABL-*SYS*.
* Get the corresponding IP address
data: arp_command(30) value '/usr/sbin/arp',
BEGIN OF TABL OCCURS 0,
LINE(200),
END OF TABL,
ip_address(100).
read table usr_tabl with key bname = 'IMRE'.
if sy-subrc <> 0. write: 'There is no such a user logged in'.
exit.endif.
arp_command+14 = usr_tabl-term.
CALL 'SYSTEM' ID 'COMMAND' FIELD arp_command
ID 'TAB' FIELD TABL-*SYS*.
read table tabl index 1.
shift tabl right up to ')'.
shift tabl right deleting trailing ')'.
shift tabl left up to '('.
shift tabl left deleting leading '('.
* Get the systems that has been registered on the gateway.
data: begin of connected_systems occurs 10.
include structure GWY_SYSTEm.
data: end of connected_systems.
* Call the alert with the new destination
DATA : BEGIN OF RET OCCURS 10,
TEXT(80),
END OF RET .
data: command(256) value
'sndrec32.exe /play /close c:/winnt/ringin.wav'.
CALL FUNCTION 'RFC_REMOTE_EXEC' DESTINATION 'ZTTTT'
EXPORTING
COMMAND = COMMAND
TABLES
PIPEDATA = RET.
* Delete the rfc destination
clear rfcdes.
select single * from rfcdes where rfcdest = 'ZTTTT'.
delete rfcdes.
if sy-subrc <> 0. write: 'Unsuccessfull delete'.
exit. endif.
commit work.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.