Posted: Sun Nov 18, 2007 8:14 pm Post subject: Some silly ABAP: show and hide windows by request
Code:
REPORT ZIMRETTT.
**********************************************************
* This program is not very useful, but interesting.
* When started, it hides the screen, it is running in.
* After a preset time (60 second) it sends a popup window
* asking the user, if he wants it to be awaken. In case the
* user does not answer in 3 seconds, it removes the popup
* window and goes back to sleep.
* Create the following little program and associate it
* with transaction code ZITS:
*
*REPORT ZIMRETST.
*DATA: ANSWER, A(8).
*TABLES: INDX.
*CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
* EXPORTING
* DEFAULTOPTION = 'N'
* TEXTLINE1 = 'Do you want to awake the'
* TEXTLINE2 = ' sleeping window?'
* TITEL = 'You have 3 seconds to answer'
* CANCEL_DISPLAY = ' '
* IMPORTING
* ANSWER = ANSWER.
*IF ANSWER = 'J'.
* A = 'ZIZIZI'.
* EXPORT A TO SHARED BUFFER INDX(ST) ID 'ZAZAZA'.
*ENDIF.
**********************************************************
*
TABLES: INDX.
DATA: A(8) VALUE 'ZAZAZA'.
DATA: MODE LIKE SY-INDEX.
* Put my mark into the shared buffer
EXPORT A TO SHARED BUFFER INDX(ST) ID 'ZAZAZA'.
* Hide myself
CALL FUNCTION 'SAPGUI_SET_PROPERTY'
DESTINATION 'SAPGUI'
EXPORTING PROPERTY = 'VISIBLE'
VALUE = ' '.
* Wait for being called back
DO.
* Sleep for 60 seconds
CALL FUNCTION 'ENQUE_SLEEP'
EXPORTING
SECONDS = 60.
* Ask the user, if he wants me back
CALL FUNCTION 'TH_CREATE_MODE'
EXPORTING
TRANSAKTION = 'ZITS'
IMPORTING
MODE = MODE.
* Wait 3 seconds for the answer
CALL FUNCTION 'ENQUE_SLEEP'
EXPORTING
SECONDS = 3.
* Check if I am wanted back. If not: go back to sleep
IMPORT A FROM SHARED BUFFER INDX(ST) ID 'ZAZAZA'.
* Delete the popu window
CALL FUNCTION 'TH_DELETE_MODE'
EXPORTING
MODE = MODE.
* Exit if asked so
IF A = 'ZIZIZI'.EXIT.ENDIF.
ENDDO.
* No more sleep, redisplay myself
CALL FUNCTION 'SAPGUI_SET_PROPERTY'
DESTINATION 'SAPGUI'
EXPORTING PROPERTY = 'VISIBLE'
VALUE = 'X'.
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.