Application Development and Automation 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: 
Read only

how to break the execution within a function

Former Member
0 Likes
634

Hi Fox,

I have a function which sometime needs more than 10 minutes to deliver a result. In order to limit the processing time, I need to abort the function and return a flag to to another system to indicate kind of "time out". How can I do this.

Cheers!

Kami

3 REPLIES 3
Read only

Former Member
0 Likes
537

While callin the function module, you can use


    CALL FUNCTION 'func name'
      STARTING NEW TASK w_taskname
      DESTINATION c_none
      PERFORMING f_formname ON END OF TASK
      EXPORTING

     IMPORTING

      EXCEPTIONS.

    IF SY-SUBRC EQ 0.

WAIT UNTIL w_confirm EQ 'X' UP TO 100 SECONDS.

    ENDIF.


**********************************
FORM f_formname USING us_taskname TYPE any.

  RECEIVE RESULTS FROM FUNCTION <func_name>
     IMPORTING
      EXCEPTIONS

IF SY-SUBRC EQ 0.
MOVE 'X' TO W_CONFIRM.
ENDIF.

ENDFORM.

Read only

0 Likes
537

Hi, first thanks you very much for your feedback.

Actually this function itself is a RFC function however the part that takes very long is a PERFORM so is there any possibility to receive a feedback whenever the PERFORM takes very long? Once again the structure is like this:

FUNCTION search.

...

...

...

PERFORM get_data TABLES i_table CHANGING i_table

...

...

ENDFUNCTION

*********************

SO the PERFORM get_data is the one part which sometime take very long time to process.

Any idea ?

Thanks for you help

Read only

Former Member
0 Likes
537

Hi,

Check system date and time at the start of FM , check the time and date at the part of the code where you want to set the flag. If it exceeds your time limit, say 10 mins, pass a flag to the calling program ot unit.

Thanks,

Kartavya