Lógica para quebra de pagina no SapScript

Lógica aplicada para quebra de pagina em formulário SAPScript, neste caso este dai conta 28 linhas para mudar de página.

PERFORM verif_count CHANGING count
                                     pag.
_________________________________________________________________

FORM verif_count CHANGING p_count
                          p_pag.

  count = count + 1.

  IF p_form = 'ZHR_BR_TERMO_NEW'.
    IF count = 28.
*     Nova pag ao atingir total de 28 ítens
      PERFORM end_form CHANGING subrc.
      PERFORM start_form USING g_arc_index
                  CHANGING subrc.
      PERFORM write_hrt.
      PERFORM write_drt.
      p_count = 1.
      p_pag  = p_pag + 1.
    ELSE.
*     Nova pag para novo motivo de Off-cicle
      IF vc_ocrsn_ant NE drt-ocrsn AND vc_ocrsn_ant NE space.
*       Imprime total do off-cicle anterior
        LOOP AT frt WHERE pernr EQ hrt-pernr
                      AND ocrsn EQ vc_ocrsn_ant.
          PERFORM write_frt.
        ENDLOOP.
*       Nova página
        PERFORM end_form CHANGING subrc.
        PERFORM start_form USING g_arc_index
                    CHANGING subrc.
        PERFORM write_hrt.
        p_count = 1.
        p_pag  = p_pag + 1.
      ENDIF.

      PERFORM write_drt.

____________________________________________________________________________

    ENDIF.
  ENDIF.
ENDFORM.     





FORM write_drt.


  DATA: textelement TYPE pbrsp_text_element_wa,
        rc LIKE sy-subrc.

  CLEAR textelement.

  textelement-window  = 'MAIN'.
  textelement-element = 'DETAIL'.

  PERFORM write_form_text_element USING textelement
                                  CHANGING rc.

ENDFORM.                    "write_drt

Queremos saber sua opinião