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

Loop Timeout

Former Member
0 Likes
2,755

Hi everyone:

I have a abap program, where a loop returns this dump:

Nach einer bestimmten Zeit wird das Programm abgebrochen, um den

Arbeitsbereich für einen anderen wartenden Benutzer zu räumen.

Damit soll verhindert werden, daß ein Arbeitsbereich z.B. durch

- Endlosschleifen (DO, WHILE, ...),

- Datenbankzugriffe mit großer Ergebnismenge,

- Datenbankzugriffe ohne geeigneten Index (full table scan)

unnötig lang blockiert wird.

Die maximale Laufzeit eines Programms wird vom Systemprofilparameter

"rdisp/max_wprun_time" begrenzt. Die aktuelle Einstellung ist

600 Sekunden. Nach Überschreiten dieser Zeitgrenze wird versucht,

ein evtl. laufendes SQL-Statement abzubrechen bzw. dem ABAP-Prozessor

signalisiert, das laufende Programm abzubrechen. Danach wird nochmals

max. 60 Sekunden gewartet. Falls danach das Programm immer noch aktiv

ist, wird der Work-Prozeß durchgestartet.

erfolgreicher Bearbeitung nicht sofort abgebrochen wird, steht dem

Programm nochmal die Zeit von 600 Sekunden zur Verfügung.

Die maximale Laufzeit eines Programms beträgt dadurch mindestens den

doppelten Wert des Systemprofilparameters "rdisp/max_wprun_time".

Any idea about this?

Thanks.

Eduardo Campos.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
2,288

It seems that the time limit for the dialog process has expired. This is a system wide setting. You can either choose to run your program in background process, or we can see if there is anyway to speed it up. Can you please post the code of the program? Also, point out where you think it is spending most of the time.

Regards,

Rich Heilman

19 REPLIES 19
Read only

Former Member
0 Likes
2,288

hi,

as per settings the maximum time allowed for the program to run in foreground is 10 Minutes(600 seconds)..as the loop is taking longer time than that..schedule the job in the background and after it is completed check the result

regards

Sai easwar

Read only

0 Likes
2,288

Hi Sai:

can be increased these settings?

Regards.

Read only

0 Likes
2,288

Yes, you can, but it will be system wide. If your program is running that long and there is really nothing that can be done about it by tuning the ABAP code, then the action is usually to run in the background, not change that time limit setting.

Regards,

RIch Heilman

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
2,289

It seems that the time limit for the dialog process has expired. This is a system wide setting. You can either choose to run your program in background process, or we can see if there is anyway to speed it up. Can you please post the code of the program? Also, point out where you think it is spending most of the time.

Regards,

Rich Heilman

Read only

0 Likes
2,288

Hi

If you're loopin an internal table you can try to change the type, for example try to use a SORTED TABLE instead of STANDARD TABLE.

Max

Read only

0 Likes
2,288

Hi Rich:

This is the code, i think that in this perform PERFORM f_obtener_plan_vigente USING lv_progc_var

lv_objid_st

CHANGING

lv_objid_sc.

spending most time sorry by the Spanish words.

FORM f_llenar_tabla_faltas .

DATA: lv_faltas_just TYPE zcm_cab_ina-faltas,

lv_progc_var TYPE hrp1738-progc_var,

lv_objid_sc TYPE piqscobjid,

lv_objid_st TYPE piqstudent,

lv_materia TYPE hrp1001-sobid,

lv_mess(100),

lv_plan_short TYPE hrp1000-short,

v_tabix LIKE sy-tabix,

v_lin TYPE i,

v_cont TYPE i.

v_lin = 3000.

v_cont = 1.

  • Buscar, el plan de estudio, id del alumno y las faltas justificadas *

  • para hacer el update o insert en la tabla zcm_cab_ina

LOOP AT gt_total_faltas INTO ga_total_faltas.

v_tabix = sy-tabix.

  • loop vacio cada 5000 mi registros para evitar el timeout.

IF v_tabix > v_lin.

v_cont = v_cont + 1.

v_lin = v_lin * v_cont.

LOOP AT i_vacia.

ENDLOOP.

ENDIF.

  • Buscar si tiene faltas justificadas.

READ TABLE gt_faltas_just

WITH KEY matricula = ga_total_faltas-matricula

plan_estudio = ga_total_faltas-plan_estudio

anio = ga_total_faltas-anio

periodo = ga_total_faltas-periodo

materia_id = ga_total_faltas-materia_id

INTO ga_faltas_just.

IF sy-subrc = 0.

lv_faltas_just = ga_faltas_just-faltas.

ELSE.

lv_faltas_just = 0.

ENDIF.

  • Obtener la clase de programa de la materia.

SELECT SINGLE progc_var

INTO lv_progc_var

FROM hrp1738

WHERE plvar = gc_plvar AND

otype = gc_sm AND

objid = ga_total_faltas-materia_id AND

endda >= sy-datum.

IF sy-subrc = 0.

  • Obtener el id del estudiante

PERFORM f_obtener_id_estudiante USING ga_total_faltas-matricula

CHANGING lv_objid_st.

CHECK lv_objid_st NE 0.

  • Obtener el plan de estudios vigente para la clase de programa

  • de la materia.

PERFORM f_obtener_plan_vigente USING lv_progc_var

lv_objid_st

CHANGING lv_objid_sc.

IF lv_objid_sc NE 0.

  • Obtener el short del plan de estudios.

SELECT SINGLE short

INTO lv_plan_short

FROM hrp1000

WHERE plvar = gc_plvar AND

otype = gc_sc AND

objid = lv_objid_sc AND

endda >= sy-datum.

  • Validar si la materia si pertence al plan de estudios

  • regresado.

SELECT SINGLE sobid

INTO lv_materia

FROM hrp1001

WHERE otype = gc_sc AND

objid = lv_objid_sc AND

plvar = gc_plvar AND

rsign = gc_rsign AND " A

relat = gc_relat AND " 500

sclas = gc_sm.

IF sy-subrc = 0.

PERFORM f_actualizar USING ga_total_faltas

lv_plan_short

lv_objid_st

lv_objid_sc

lv_faltas_just.

ELSE.

lv_mess = 'La materia no pertences al plan vigente'.

PERFORM f_genera_log

USING ga_total_faltas-matricula

ga_total_faltas-materia_id

ga_total_faltas-anio

ga_total_faltas-periodo

lv_mess.

ENDIF.

ELSE.

lv_mess = 'El estudiante no tiene un plan vigente'.

PERFORM f_genera_log

USING ga_total_faltas-matricula

ga_total_faltas-materia_id

ga_total_faltas-anio

ga_total_faltas-periodo

lv_mess.

ENDIF.

ELSE.

lv_mess = 'No existe clase de plan para la materia'.

PERFORM f_genera_log

USING ga_total_faltas-matricula

ga_total_faltas-materia_id

ga_total_faltas-anio

ga_total_faltas-periodo

lv_mess.

ENDIF.

ENDLOOP.

Regards.

Read only

0 Likes
2,288

Where is the code for that PERFORM?

Regards,

Rich Heilman

Read only

0 Likes
2,288

This is the code:

FORM f_obtener_plan_vigente USING p_lv_progc_var

p_lv_objid_st

CHANGING p_lv_objid_sc.

DATA: lv_is_student TYPE hrobject,

lt_et_program_info TYPE STANDARD TABLE OF piqmrproginfo,

lt_et_segment TYPE STANDARD TABLE OF piqstudysegment,

la_et_program_info TYPE piqmrproginfo,

la_et_segment TYPE piqstudysegment,

lv_vigente(1),

lv_contador TYPE i,

lv_objid_sc TYPE piqscobjid.

CLEAR: lt_et_program_info, lt_et_segment.

REFRESH: lt_et_program_info, lt_et_segment.

  • Ejecutar la funcion HRIQ_STUDENT_MODREG_PROGS_GET para obtener los

  • planes de estudio del estudiante.

lv_is_student-plvar = gc_plvar.

lv_is_student-otype = gc_st.

lv_is_student-objid = p_lv_objid_st.

CALL FUNCTION 'HRIQ_STUDENT_MODREG_PROGS_GET'

EXPORTING

is_student = lv_is_student

  • IV_KEYDATE =

  • IV_PERYR =

  • IV_PERID =

  • IMPORTING

  • EV_LEADING_PROGRAM =

TABLES

et_program_info = lt_et_program_info

et_segment = lt_et_segment

  • ET_ADMISSION =

  • ET_REGISTRATION =

  • ET_STUDIES =

  • EXCEPTIONS

  • MISSING_OBJECT = 1

  • NO_DATA_FOUND = 2

  • PLVAR_NOT_FOUND = 3

  • OTHERS = 4

.

IF sy-subrc = 0.

lv_contador = 0.

LOOP AT lt_et_program_info INTO la_et_program_info

WHERE progc_var = p_lv_progc_var.

  • Validar vigencia del plan.

LOOP AT lt_et_segment INTO la_et_segment

WHERE plvar = gc_plvar AND

st_objid = p_lv_objid_st AND

cs_objid = la_et_program_info-cs_objid AND

sc_objid = la_et_program_info-sc_objid AND

endda >= sy-datum.

IF la_et_segment-endda >= sy-datum.

lv_vigente = 'X'.

lv_objid_sc = la_et_segment-sc_objid.

CONTINUE.

ENDIF.

ENDLOOP.

  • Si el plan es vigente incrementar en uno el contador.

IF lv_vigente = 'X'.

lv_contador = lv_contador + 1.

lv_vigente = ' '.

ENDIF.

ENDLOOP.

  • Validar que solo haya salido un plan vigente.

IF lv_contador = 1.

p_lv_objid_sc = lv_objid_sc.

ELSE.

lv_objid_sc = 0.

ENDIF.

ELSE.

"Mensaje de error.

ENDIF.

Read only

0 Likes
2,288

Yuou might try:


sort gt_faltas_just by matricula plan_estudio anio periodo materia_id.

LOOP AT gt_total_faltas INTO ga_total_faltas.
...
  READ TABLE gt_faltas_just
    WITH KEY matricula = ga_total_faltas-matricula
             plan_estudio = ga_total_faltas-plan_estudio
             anio = ga_total_faltas-anio
             periodo = ga_total_faltas-periodo
             materia_id = ga_total_faltas-materia_id
     BINARY SEARCH
    INTO ga_faltas_just.
...
ENDLOOP.

Read only

0 Likes
2,288

So do you think that it is spending most of its time in the function module call, or the nested loop below.

About how many records are present in each interal table after the function call.




LOOP AT lt_et_program_info INTO la_et_program_info
        WHERE progc_var = p_lv_progc_var.
* Validar vigencia del plan.
LOOP AT lt_et_segment INTO la_et_segment
    WHERE plvar = gc_plvar AND
      st_objid = p_lv_objid_st AND
      cs_objid = la_et_program_info-cs_objid AND
      sc_objid = la_et_program_info-sc_objid AND
      endda >= sy-datum.
  IF la_et_segment-endda >= sy-datum.
       lv_vigente = 'X'.
       lv_objid_sc = la_et_segment-sc_objid.
       CONTINUE.
  ENDIF.
ENDLOOP.

* Si el plan es vigente incrementar en uno el contador.
   IF lv_vigente = 'X'.
       lv_contador = lv_contador + 1.
       lv_vigente = ' '.
   ENDIF.
ENDLOOP.

Regards,

Rich Heilman

Read only

0 Likes
2,288

If there are a large number of records in both tables, performance of nested loops is slow. Change the inner loop to a binary read, followed by an indexed read.

Have a look at

Rob

Message was edited by: Rob Burbank

Read only

0 Likes
2,288

I think that function CALL FUNCTION 'HRIQ_STUDENT_MODREG_PROGS_GET'

is the cause.

Read only

0 Likes
2,288

So it spends a lot of time in this function module. If so, there is not really anything you can do about the performance, unless there are OSS notes to fix it. You should probably be running this in background. Is there a reason why background is not good for you?

Regards,

Rich Heilman

Read only

0 Likes
2,288

Hi Rob

But the inner loop only read 3 o 4 records.

Regards

Read only

0 Likes
2,288

Hi Rich:

The program have writes how can I see this message, when i run this like a job? is there a way or i need to change the program?

Read only

0 Likes
2,288

You can still view the spool via SM37. When you submit it to background, it will show up in SM37, from there you can view the spool that is created by your write statements.

Regards,

Rich Heilman

Read only

0 Likes
2,288

OK - that's probably not it then. Have you done a runtime analysis (SE30) to pinpoint the bottleneck?

Rob

Read only

0 Likes
2,288

Hi Rob:

I run the program in background, in this way it doesn't return a error, I make some change to the code with your suggestions, I put some points to you by this.

Thanks & regards.

Eduardo

Read only

0 Likes
2,288

It'd probably still be a good idea to do the runtime analysis. Even if it's run in the background, if it runs a long time and uses a lot of resources, it can slow down other processes.

Rob