‎2011 Dec 24 11:12 AM
This piece of code was used to refresh alv data automatically for every 3 minutes and it worked perfectly in sap 4.7
But in SAP 6 I am getting runtime error :RPERF_ILLEGAL_STATEMENT
Statement LEAVE TO TRANSACTION is not allowed in this form
---------------------------------------------------------
FORM f_call_rfc_wait .
DATA lv_mssg(80). "#EC NEEDED
CALL FUNCTION 'RFC_PING_AND_WAIT' STARTING NEW TASK '0O1'
PERFORMING f_task_end ON END OF TASK
EXPORTING
seconds = 180 " Refresh time
busy_waiting = space
EXCEPTIONS
RESOURCE_FAILURE = 1
communication_failure = 2 MESSAGE lv_mssg
system_failure = 3 MESSAGE lv_mssg
OTHERS = 4.
ENDFORM. " f_call_rfc_wait
FORM f_task_end USING taskname.
DATA lv_mssg(80). "#EC NEEDED
RECEIVE RESULTS FROM FUNCTION 'RFC_PING_AND_WAIT'
EXCEPTIONS
RESOURCE_FAILURE = 1
communication_failure = 2 MESSAGE lv_mssg
system_failure = 3 MESSAGE lv_mssg
OTHERS = 4.
CHECK sy-subrc EQ 0.
SET USER-COMMAND '&NTE'. "Refresh
LEAVE TO CURRENT TRANSACTION AND SKIP FIRST SCREEN.
ENDFORM. " f_task_end
*&--------------------------------------------------------------------*
*& Form user_command1
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
* -->UCOMM text
* -->SELFIELD text
* for detailed list and automatic refreshing
*---------------------------------------------------------------------*
FORM area_prod_alv.
TYPE-POOLS: slis.
DATA t_fieldalv TYPE slis_t_fieldcat_alv.
DATA: ls_slis_fieldcat TYPE slis_fieldcat_alv.
PERFORM f_call_rfc_wait.
PERFORM initial_alv_fieldcat CHANGING t_fieldalv[].
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_bypassing_buffer = 'X'
i_buffer_active = ' '
i_callback_program = 'ZMPQ203_SHOP_HONEW'
i_callback_pf_status_set = 'PF_STATUS'
i_callback_user_command = 'USER_COMMAND1'
it_fieldcat = t_fieldalv[]
i_save = 'X'
it_events = gt_event[]
is_layout = lo_layout
TABLES
t_outtab = itab3
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " area_prod_alv
--------------------------instead of LEAVE TO CURRENT TRANSACTION AND SKIP FIRST SCREEN.
i have also tried LEAVE to TRANSACTION TRASACTION_NAME AND SKIP FIRST SCREEN.
& also CALL TRANSACTION TRASACTION_NAME AND SKIP FIRST SCREEN.
but i got same error
‎2011 Dec 24 2:42 PM
I suggest you to use another approach for the autorefresh: use class CL_GUI_TIMER instead of the RFC_PING_AND_WAIT function module. There is an example report (I don't remember its name but it is in the the same package of the class) and there are a few posts in the SDN.
http://wiki.sdn.sap.com/wiki/display/Snippets/AutomaticDataRefreshonModulepoolScreen
‎2011 Dec 24 12:13 PM
‎2011 Dec 24 12:14 PM
‎2011 Dec 26 3:30 AM
‎2011 Dec 24 2:42 PM
I suggest you to use another approach for the autorefresh: use class CL_GUI_TIMER instead of the RFC_PING_AND_WAIT function module. There is an example report (I don't remember its name but it is in the the same package of the class) and there are a few posts in the SDN.
http://wiki.sdn.sap.com/wiki/display/Snippets/AutomaticDataRefreshonModulepoolScreen
‎2011 Dec 25 9:11 PM
‎2011 Dec 29 11:45 AM
Hi
try with below methods and FM in your object
*call screen 0.
LEAVE TO CURRENT TRANSACTION AND SKIP FIRST SCREEN.
Usually this command is enough to call PAI/PBO by force
CALL METHOD CL_GUI_CFW=>SET_NEW_OK_CODE
EXPORTING
NEW_CODE = 'DUMMY'.
CALL FUNCTION 'SAPGUI_SET_FUNCTIONCODE'
EXPORTING
FUNCTIONCODE = '/00'
EXCEPTIONS
FUNCTION_NOT_SUPPORTED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
Implement suitable error handling here
ENDIF.
CALL METHOD CL_GUI_CFW=>FLUSH
might be your issue will solve the above solution.
Thanks and Regards,
Syfulla