cancel
Showing results for 
Search instead for 
Did you mean: 

printing 10 line items in first page

naresh_bammidi
Contributor
0 Kudos

Dear Experts ,

I am working on scripts,what my requirement is ,first 10 records should be printed in first page remainig all should be printed in next page.I adjusted the window size to fit only 10 records ,so remainig records are printing in next page.up to now okay.but how to do programatically.i tried like this

CALL FUNCTION 'OPEN_FORM'
 EXPORTING
   FORM                              = 'ZST1'.

loop at it_mara FROM 1 TO 10.
CALL FUNCTION 'WRITE_FORM'
 EXPORTING
   ELEMENT                        = '100'
   FUNCTION                       = 'SET'
   TYPE                           = 'BODY'
   WINDOW                         = 'MAIN'
endloop.


  LOOP AT IT_MARA FROM 11.
CALL FUNCTION 'WRITE_FORM'
 EXPORTING
   ELEMENT                        = '200'
   FUNCTION                       = 'SET'
   TYPE                           = 'BODY'
   WINDOW                         = 'WIN'
endloop.
CALL FUNCTION 'CLOSE_FORM'.

Here i have created two pages in my form.first page contains 'MAIN' window with element '100'.

second page contains 'WIN' window with element '200'.after executing my driver program, internal table contains 300 records.but its displaying only 10 records in first page .is this right way?please help me out.

Accepted Solutions (0)

Answers (3)

Answers (3)

naresh_bammidi
Contributor
0 Kudos

it's solved by calling control_form and passed new-page command

if count EQ 11.

CALL FUNCTION 'CONTROL_FORM'

EXPORTING

command = 'NEW-PAGE'

EXCEPTIONS

UNOPENED = 1

UNSTARTED = 2

.

ENDIF.

Former Member
0 Kudos

Hi ,

Use MAIN window for both text elements after writing the /e 100 in for form put PAGE-BREAK next to this statement write /e200.

Former Member
0 Kudos

Hi,

Why dont you use protect - end protect with a condition.

IF record no <= 10.

protect.

endprotect.

endif.

That would restrict records on 1st page.