Posted: Fri Feb 13, 2009 1:25 pm Post subject: Refresh dynpro at selection screen
Code:
REPORT z_refresh_test.
*---------------------------------------------------------------------*
* CLASS lcl_gui_timer DEFINITION
*---------------------------------------------------------------------*
CLASS lcl_gui_timer DEFINITION INHERITING FROM cl_gui_control.
PUBLIC SECTION.
CONSTANTS: eventid_finished TYPE i VALUE 1 .
CLASS-DATA: interval TYPE i VALUE '0'.
EVENTS: finished .
METHODS: cancel EXCEPTIONS error,
constructor IMPORTING
lifetime TYPE i OPTIONAL
value(shellstyle) TYPE i OPTIONAL
value(parent) TYPE REF TO cl_gui_container OPTIONAL
EXCEPTIONS
error,
run
EXCEPTIONS
error,
dispatch REDEFINITION.
ENDCLASS.
*---------------------------------------------------------------------*
* CLASS lcl_event_handler DEFINITION
*---------------------------------------------------------------------*
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS: on_finished FOR EVENT finished OF lcl_gui_timer.
ENDCLASS.
DATA: gui_timer TYPE REF TO lcl_gui_timer.
DATA: event_handler TYPE REF TO lcl_event_handler.
DATA: timeout_interval TYPE i VALUE '3'.
PARAMETERS: p_datum TYPE sy-datum,
p_uzeit TYPE sy-uzeit.
AT SELECTION-SCREEN OUTPUT.
p_datum = sy-datum.
p_uzeit = sy-uzeit.
CREATE OBJECT gui_timer.
SET HANDLER event_handler->on_finished FOR gui_timer.
gui_timer->interval = timeout_interval.
CALL METHOD gui_timer->run.
*---------------------------------------------------------------------*
* CLASS lcl_event_handler IMPLEMENTATION
*---------------------------------------------------------------------*
CLASS lcl_event_handler IMPLEMENTATION.
METHOD on_finished.
* Start Timer again
gui_timer->interval = timeout_interval.
CALL METHOD gui_timer->run.
* cause PAI
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'REFR'.
ENDMETHOD.
ENDCLASS.
*---------------------------------------------------------------------*
* CLASS lcl_gui_timer IMPLEMENTATION
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
CLASS lcl_gui_timer IMPLEMENTATION.
METHOD constructor.
TYPE-POOLS: sfes.
DATA clsid(80).
DATA event_tab TYPE cntl_simple_events.
DATA event_tab_line TYPE cntl_simple_event.
IF clsid IS INITIAL.
DATA: return,
guitype TYPE i.
guitype = 0.
CALL FUNCTION 'GUI_HAS_OBJECTS'
EXPORTING
object_model = sfes_obj_activex
IMPORTING
return = return
EXCEPTIONS
OTHERS = 1.
IF sy-subrc NE 0.
RAISE error.
ENDIF.
IF return = 'X'.
guitype = 1.
ENDIF.
IF guitype = 0.
CALL FUNCTION 'GUI_HAS_OBJECTS'
EXPORTING
object_model = sfes_obj_javabeans
IMPORTING
return = return
EXCEPTIONS
OTHERS = 1.
IF sy-subrc NE 0.
RAISE error.
ENDIF.
IF return = 'X'.
guitype = 2.
ENDIF.
ENDIF.
CASE guitype.
WHEN 1.
clsid = 'Sapgui.InfoCtrl.1'.
WHEN 2.
clsid = 'com.sap.components.controls.sapImage.SapImage'.
ENDCASE.
ENDIF.
CALL METHOD super->constructor
EXPORTING
clsid = clsid
shellstyle = 0
parent = cl_gui_container=>default_screen
autoalign = space
EXCEPTIONS OTHERS = 1.
IF sy-subrc NE 0.
RAISE error.
ENDIF.
CALL METHOD cl_gui_cfw=>subscribe
EXPORTING
shellid = h_control-shellid
ref = me
EXCEPTIONS OTHERS = 1.
IF sy-subrc NE 0.
RAISE error.
ENDIF.
* Register the events
event_tab_line-eventid = lcl_gui_timer=>eventid_finished.
APPEND event_tab_line TO event_tab.
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.