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: 

End of page and start of page formatting.

Former Member
0 Kudos

Hi Guys/Dolls

I’ve a loop and inside that loop I’m writing data out to the screen

But the problem is when I get to the bottom of the page I want to leave a few lines so the output doesn’t look pants.

I also have a footer that has initials and comments.

As can be seen from the attachment page 1 seems ok but the main output on page 2 (not the header) starts off without having a line feed.

And if you look down further the main output on page 3 (not the header) starts off without having a line feed and finishes incorrectly.

Anybody see how I can rectify this.

Many thanks in advance.

Raj

The code is as follows:-

FORM process_external_data .

  DATA : old_opera_value LIKE itab_audit_details-olddt.
  DATA : new_opera_value LIKE itab_audit_details-olddt.
  DATA : old_btime_value LIKE itab_audit_details-btime.
  DATA : new_btime_value LIKE itab_audit_details-btime.
  DATA : old_begda_value LIKE itab_audit_details-begda.
  DATA : new_begda_value LIKE itab_audit_details-begda.
  DATA : old_endda_value LIKE itab_audit_details-endda.
  DATA : new_endda_value LIKE itab_audit_details-endda.
  DATA : old_splkz_value LIKE itab_audit_details-splkz.
  DATA : new_splkz_value LIKE itab_audit_details-splkz.


* Declare a variable to seperate the data.
  DATA : seperator(1) VALUE 'F'.
  DATA : full_operational_value(10).

  LOOP AT itab_audit_details INTO wa_audit_details.

    seperator = 'T'.
    old_opera_value = wa_audit_details-opera.
    old_btime_value = wa_audit_details-btime.
    old_begda_value = wa_audit_details-begda.
    old_endda_value = wa_audit_details-endda.
    old_splkz_value = wa_audit_details-splkz.

    IF old_opera_value <> new_opera_value OR
       old_btime_value <> new_btime_value OR
       old_endda_value <> new_endda_value OR
       old_begda_value <> new_begda_value OR
       old_splkz_value <> new_splkz_value.

      NEW-LINE.
      ULINE AT 10(110).
      NEW-LINE.
      WRITE AT 10 sy-vline.
      CASE wa_audit_details-opera.
        WHEN 'I' OR 'i'.
          full_operational_value = 'Insert'.
        WHEN 'U' OR 'u'.
          full_operational_value = 'Update'.
        WHEN 'D' OR 'd'.
          full_operational_value = 'Delete'.
        WHEN OTHERS.
          full_operational_value = 'Unknown'.
      ENDCASE.

      WRITE: AT 11 'Operation  = ', full_operational_value,
             AT 46 sy-vline,
             AT 47 'From ', wa_audit_details-begda,
             AT 65 'To ', wa_audit_details-endda,
             AT 119 sy-vline.
      NEW-LINE.
      ULINE AT 10(110).
      NEW-LINE.
      WRITE AT 10 sy-vline.
      WRITE AT 11 'Field'.
      WRITE AT 46 sy-vline.
      WRITE AT 47 'Old Value'.
      WRITE AT 81 sy-vline.
      WRITE AT 82 'New Value'.
      WRITE AT 119 sy-vline.
      NEW-LINE.
      ULINE AT 10(110).
      new_opera_value = old_opera_value.
      new_btime_value = old_btime_value.
      new_begda_value = old_begda_value.
      new_endda_value = old_endda_value.
      new_splkz_value = old_splkz_value.
    ENDIF.

    NEW-LINE.
    WRITE AT 10 sy-vline.
    WRITE AT 11 wa_audit_details-field.
    WRITE AT 46 sy-vline.
    PERFORM check_if_field_is_a_date
            USING wa_audit_details-ftype
            CHANGING wa_audit_details-olddt.
    PERFORM check_if_field_is_currency
            USING wa_audit_details-ftype
                  wa_audit_details-decim
            CHANGING wa_audit_details-olddt.
    WRITE AT 47 wa_audit_details-olddt.
    WRITE AT 81 sy-vline.
    PERFORM check_if_field_is_a_date
            USING wa_audit_details-ftype
            CHANGING wa_audit_details-newdt.
    PERFORM check_if_field_is_currency
            USING wa_audit_details-ftype
                  wa_audit_details-decim
            CHANGING wa_audit_details-newdt.
    WRITE AT 82 wa_audit_details-newdt.
    WRITE AT 119 sy-vline.
    NEW-LINE.
    ULINE AT 10(110).
  ENDLOOP.

* Insert a new ine if data was written in a tabular format from above.
  IF seperator = 'T'.
    WRITE: /.
  ENDIF.

ENDFORM.                    " process_external_data

1 REPLY 1

Former Member
0 Kudos

HI!

You might try to check the printed line number. For example if you set your riport to have 65 lines, you can call a new page, when the printout has reached the 60th line. For example:


REPORT zreport LINE-COUNT 65.   "define the riport with 65 lines pageformat
...
LOOP...
  IF sy-linno >= 60.   "actual printed line
    NEW-PAGE.
  ENDIF.
ENDLOOP.