Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

FM RFC_PING_AND_WAIT

Former Member
0 Kudos

can anybody give me an example or code sample how use the Fm RFC_PING_AND_WAIT..

Points guranteed.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi again .....

anid the sample code is ......

REPORT ztst MESSAGE-ID zz.

*

TYPE-POOLS: slis. " ALV Global Types

DATA :

gt_user LIKE uinfo OCCURS 0 WITH HEADER LINE. " User info in SM04

----


START-OF-SELECTION.

PERFORM f_read_data.

PERFORM f_display_data.

----


  • Form F_LIRE_DATA

----


FORM f_read_data.

REFRESH gt_user.

  • Get User's info

CALL FUNCTION 'THUSRINFO'

TABLES

usr_tabl = gt_user.

  • Wait in a task

PERFORM f_call_rfc_wait.

ENDFORM. " F_READ_DATA

----


  • Form F_DISPLAY_DATA

----


FORM f_display_data.

DEFINE m_sort.

add 1 to ls_sort-spos.

ls_sort-fieldname = &1.

append ls_sort to lt_sort.

END-OF-DEFINITION.

DEFINE m_event_exit.

clear ls_event_exit.

ls_event_exit-ucomm = &1.

ls_event_exit-after = 'X'.

append ls_event_exit to lt_event_exit.

END-OF-DEFINITION.

DATA :

ls_layout TYPE slis_layout_alv,

lt_sort TYPE slis_t_sortinfo_alv,

ls_sort TYPE slis_sortinfo_alv,

lt_event_exit TYPE slis_t_event_exit,

ls_event_exit TYPE slis_event_exit.

  • Build Sort Table

m_sort 'ZEIT'.

  • Build Event Exit Table

m_event_exit '&NTE'. " Refresh

ls_layout-zebra = 'X'.

ls_layout-colwidth_optimize = 'X'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = sy-cprog

i_callback_user_command = 'USER_COMMAND'

is_layout = ls_layout

i_structure_name = 'UINFO'

it_sort = lt_sort

it_event_exit = lt_event_exit

TABLES

t_outtab = gt_user.

ENDFORM. " F_DISPLAY_DATA

----


  • FORM USER_COMMAND *

----


FORM user_command USING i_ucomm TYPE syucomm

is_selfield TYPE slis_selfield. "#EC CALLED

CASE i_ucomm.

WHEN '&NTE'.

PERFORM f_read_data.

is_selfield-refresh = 'X'.

SET USER-COMMAND '&OPT'. " Optimize columns width

ENDCASE.

ENDFORM. " USER_COMMAND

----


  • Form F_CALL_RFC_WAIT

----


FORM f_call_rfc_wait.

DATA lv_mssg(80). "#EC NEEDED

  • Wait in a task

CALL FUNCTION 'RFC_PING_AND_WAIT' STARTING NEW TASK '001'

PERFORMING f_task_end ON END OF TASK

EXPORTING

seconds = 5 " 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

----


FORM f_task_end USING u_taskname.

DATA lv_mssg(80). "#EC NEEDED

  • Receiving task results

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

ENDFORM. " F_TASK_END

                              • END OF PROGRAM

6 REPLIES 6

Former Member
0 Kudos

Hi anid,

check this may be it can help you....

http://www.sapgenie.com/abap/code/abap24.htm

regards,

venu.

Former Member
0 Kudos

hi anid,

this is the function code and show how we used it ......

CALL FUNCTION 'RFC_PING_AND_WAIT' STARTING NEW TASK '001'

PERFORMING f_task_end ON END OF TASK

EXPORTING

seconds = 5 " Refresh time

busy_waiting = space

EXCEPTIONS

RESOURCE_FAILURE = 1

communication_failure = 2 MESSAGE lv_mssg

system_failure = 3 MESSAGE lv_mssg

OTHERS = 4.

Former Member
0 Kudos

hi again .....

anid the sample code is ......

REPORT ztst MESSAGE-ID zz.

*

TYPE-POOLS: slis. " ALV Global Types

DATA :

gt_user LIKE uinfo OCCURS 0 WITH HEADER LINE. " User info in SM04

----


START-OF-SELECTION.

PERFORM f_read_data.

PERFORM f_display_data.

----


  • Form F_LIRE_DATA

----


FORM f_read_data.

REFRESH gt_user.

  • Get User's info

CALL FUNCTION 'THUSRINFO'

TABLES

usr_tabl = gt_user.

  • Wait in a task

PERFORM f_call_rfc_wait.

ENDFORM. " F_READ_DATA

----


  • Form F_DISPLAY_DATA

----


FORM f_display_data.

DEFINE m_sort.

add 1 to ls_sort-spos.

ls_sort-fieldname = &1.

append ls_sort to lt_sort.

END-OF-DEFINITION.

DEFINE m_event_exit.

clear ls_event_exit.

ls_event_exit-ucomm = &1.

ls_event_exit-after = 'X'.

append ls_event_exit to lt_event_exit.

END-OF-DEFINITION.

DATA :

ls_layout TYPE slis_layout_alv,

lt_sort TYPE slis_t_sortinfo_alv,

ls_sort TYPE slis_sortinfo_alv,

lt_event_exit TYPE slis_t_event_exit,

ls_event_exit TYPE slis_event_exit.

  • Build Sort Table

m_sort 'ZEIT'.

  • Build Event Exit Table

m_event_exit '&NTE'. " Refresh

ls_layout-zebra = 'X'.

ls_layout-colwidth_optimize = 'X'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = sy-cprog

i_callback_user_command = 'USER_COMMAND'

is_layout = ls_layout

i_structure_name = 'UINFO'

it_sort = lt_sort

it_event_exit = lt_event_exit

TABLES

t_outtab = gt_user.

ENDFORM. " F_DISPLAY_DATA

----


  • FORM USER_COMMAND *

----


FORM user_command USING i_ucomm TYPE syucomm

is_selfield TYPE slis_selfield. "#EC CALLED

CASE i_ucomm.

WHEN '&NTE'.

PERFORM f_read_data.

is_selfield-refresh = 'X'.

SET USER-COMMAND '&OPT'. " Optimize columns width

ENDCASE.

ENDFORM. " USER_COMMAND

----


  • Form F_CALL_RFC_WAIT

----


FORM f_call_rfc_wait.

DATA lv_mssg(80). "#EC NEEDED

  • Wait in a task

CALL FUNCTION 'RFC_PING_AND_WAIT' STARTING NEW TASK '001'

PERFORMING f_task_end ON END OF TASK

EXPORTING

seconds = 5 " 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

----


FORM f_task_end USING u_taskname.

DATA lv_mssg(80). "#EC NEEDED

  • Receiving task results

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

ENDFORM. " F_TASK_END

                              • END OF PROGRAM

Former Member

andreas_mann3
Active Contributor
0 Kudos

Hi,

have a look to this test program:

http://www.geocities.com/mpioud/Z_ALV_AUTO_REFRESH.html

Andreas

Former Member
0 Kudos

HI,

one more simple code is .....

report ZKISAN_PING_REFRESH .

data: l_data type i.

data: l_data1 type i.

data: l_data2 type i.

data: l_data3 type i.

l_data = 1.

get time.

write:/1 'Time', 10 'Ping No', 36 'Loop Time in Micro Sec' ,

60 'should be less than 3000 Micro Sec'.

write:/1 sy-uzeit, 10 l_data, 30 l_data3.

call function 'RFC_PING_AND_WAIT'

starting new task 'IF'

performing start_refresh on end of task

exporting

seconds = 1

BUSY_WAITING = space.

at user-command.

if sy-ucomm = 'REFR'.

l_data = l_data + 1.

sy-lsind = 0.

write:/1 'Time', 10 'Ping No', 36 'Loop Time in Micro Sec' ,

60 'should be less than 3000 Micro Sec'.

write:/1 sy-uzeit, 10 l_data, 30 l_data3.

get run time field l_data1.

call function 'RFC_PING_AND_WAIT'

starting new task 'IF'

performing start_refresh on end of task

exporting

seconds = 1

BUSY_WAITING = space.

endif.

*----


  • Program Subroutines

*----


form start_refresh using taskname.

get run time field l_data2.

l_data3 = l_data2 - l_data1.

  • The SET USER-COMMAND initiates the communication back to the program

set user-command 'REFR'.

endform.