12-10-2012 5:42 PM
Hi Gurus,
I have been writing simple dialog programs for RF transactions in ECC 6.0 used on a terminal (handheld device) via SAP console. All messages from dialog program are posted as type 'I'. The users do not want to press ENTER on the information messages. Is there a way I can display a message in SAP console for a few seconds and then it disappears. Are there other ways of achieving it - Any alternate FM or piece of code?
This may be a stupid question. But in my ABAP experience I have never come across this situation. Nor did I find any usable results here on SCN(Still searching-Lot of noise).
I have tried FM 'SAPGUI_PROGRESS_INDICATOR' but it does not work when using transactions in SAP console.
I also tried creating a new screen to display message and using FM 'SAPGUI_SET_FUNCTIONCODE' in PBO to invoke the PAI without user input. In PAI I used a 5 second wait followed by a 'leave to screen'. This worked in the normal SAP Gui. But would not work when running it on the SAP console terminal. SAP console cannot use FM SAPGUI_SET_FUNCTIONCODE.
Regards,
Shravan
12-12-2012 7:32 AM
Hello Shravan,
because of using sap gui components, cl_gui_timer functions getting dump on terminals.
i wrote another example with asynchronous RFC. can you try it?
REPORT ztest_time.
PARAMETERS: s_param.
START-OF-SELECTION.
CALL FUNCTION 'ZRFC_TIMER_FOR_WAIT' STARTING NEW TASK sy-repid
PERFORMING finished ON END OF TASK
EXPORTING
i_intervals = 3.
* IMPORTING
* e_finished =
CALL SCREEN 100.
*&---------------------------------------------------------------------
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------
* text
*----------------------------------------------------------------------
MODULE status_0100 OUTPUT.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
LEAVE TO SCREEN 0.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Form return_zrfc
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->TASKNAME text
*----------------------------------------------------------------------*
FORM finished USING taskname.
DATA: _finished TYPE boolean.
RECEIVE RESULTS FROM FUNCTION 'ZRFC_TIMER_FOR_WAIT'
IMPORTING
e_finished = _finished.
CHECK _finished = 'X'.
LEAVE TO SCREEN 0.
ENDFORM. "return_
FUNCTION zrfc_timer_for_wait.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(I_INTERVALS) TYPE I DEFAULT 3
*" EXPORTING
*" VALUE(E_FINISHED) TYPE BOOLEAN
*"----------------------------------------------------------------------
CLEAR e_finished.
WAIT UP TO i_intervals SECONDS.
e_finished = 'X'.
ENDFUNCTION.
12-11-2012 6:59 AM
Hi Shravan,
For RF devices i prefer to write my own message screens, otherwise there are lots of unexpected cases in functions.
i have never meet a requirement as yours before, too. for this purpose you can use below code.
Code belongs to Sandipan Das
on http://wiki.sdn.sap.com/wiki/display/Snippets/Automatic+Data+Refresh+on+Module+pool+Screen
In originally, this code is for screen auto-refresh but i just added little modifications to test for your needs.You can use screen 100 for message output.
Best Regards
Basar Ozgur
*&---------------------------------------------------------------------
*& Report ZTEST_TIME
*&
*&---------------------------------------------------------------------
*&
*&
*&---------------------------------------------------------------------
REPORT ztest_time.
DATA: rf_gui_timer TYPE REF TO cl_gui_timer.
DATA:t1 TYPE sy-uzeit.
PARAMETERS: s.
*----------------------------------------------------------------------*
* CLASS lcl_event_handler DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS: on_finished FOR EVENT finished OF cl_gui_timer
IMPORTING sender.
ENDCLASS. "lcl_event_handler DEFINITION
*----------------------------------------------------------------------
* CLASS lcl_event_handler IMPLEMENTATION
*----------------------------------------------------------------------
*
*----------------------------------------------------------------------
CLASS lcl_event_handler IMPLEMENTATION.
METHOD: on_finished.
t1 = sy-uzeit .
LEAVE TO SCREEN 0.
"CALL SCREEN 100.
sender->run( ).
ENDMETHOD. "on_finished
ENDCLASS. "lcl_event_handler IMPLEMENTATION
START-OF-SELECTION.
CREATE OBJECT rf_gui_timer.
SET HANDLER lcl_event_handler=>on_finished FOR rf_gui_timer.
rf_gui_timer->interval = 3.
rf_gui_timer->run( ).
CALL SCREEN 100.
* write:sy-uzeit.
*&---------------------------------------------------------------------
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------
* text
*----------------------------------------------------------------------
MODULE status_0100 OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
*CREATE OBJECT rf_gui_timer.
* SET HANDLER lcl_event_handler=>on_finished FOR rf_gui_timer.
* rf_gui_timer->interval = 1.
t1 = sy-uzeit .
rf_gui_timer->run( ).
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------
* text
*----------------------------------------------------------------------
MODULE user_command_0100 INPUT.
IF sy-ucomm = 'B1'.
LEAVE PROGRAM.
ENDIF.
ENDMODULE. " USER_COMMAND_0100 INPUT
12-11-2012 6:03 PM
Hi Basar,
Thanks for the response. This is in line with what I tried with SAPGUI_SET_FUNCTIONCODE. But unfortunately this only works well on the SAP GUI. I am getting an ABAP dump for this on the terminal.
Regards,
Shravan
12-12-2012 7:32 AM
Hello Shravan,
because of using sap gui components, cl_gui_timer functions getting dump on terminals.
i wrote another example with asynchronous RFC. can you try it?
REPORT ztest_time.
PARAMETERS: s_param.
START-OF-SELECTION.
CALL FUNCTION 'ZRFC_TIMER_FOR_WAIT' STARTING NEW TASK sy-repid
PERFORMING finished ON END OF TASK
EXPORTING
i_intervals = 3.
* IMPORTING
* e_finished =
CALL SCREEN 100.
*&---------------------------------------------------------------------
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------
* text
*----------------------------------------------------------------------
MODULE status_0100 OUTPUT.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
LEAVE TO SCREEN 0.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Form return_zrfc
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->TASKNAME text
*----------------------------------------------------------------------*
FORM finished USING taskname.
DATA: _finished TYPE boolean.
RECEIVE RESULTS FROM FUNCTION 'ZRFC_TIMER_FOR_WAIT'
IMPORTING
e_finished = _finished.
CHECK _finished = 'X'.
LEAVE TO SCREEN 0.
ENDFORM. "return_
FUNCTION zrfc_timer_for_wait.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(I_INTERVALS) TYPE I DEFAULT 3
*" EXPORTING
*" VALUE(E_FINISHED) TYPE BOOLEAN
*"----------------------------------------------------------------------
CLEAR e_finished.
WAIT UP TO i_intervals SECONDS.
e_finished = 'X'.
ENDFUNCTION.
12-14-2012 6:02 PM
Thanks Basar. This sounds neat and I am positive it will work. I will try it out. I do not have access to the terminals temporarily.
Regards,
Shravan