cancel
Showing results for 
Search instead for 
Did you mean: 

Change Page in Sapscript form

odysseas_spyroglou
Participant
0 Kudos

Hi,

I have a custom report with a sapscript form that contains a list of records from KNA1 table. I would like to have a different page for every different KNA1-KUNNR (change page at new kunnr). Is this possible and how?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Kindly follow the below steps::

1.declare first field in ur internal table as 'KUNNR'.

2.once u get the required data into ur internal table to print, SORT the internal table with KUNNR.

3.LOOP the internal table to print and use CONTROL BREAK event (AT END OF KUNNR) to trigger new page for every new KUNNR.

4.In Control Break event (AT END OF KUNNR) call the Function Module 'CONTROL_FORM', which will trigger a new page in the output.

eg:

call function 'OPEN_FORM' --> to Open the Form

LOOP AT itab.

call function 'WRITE_FORM'

exporting

element = 'ITEM_DET'.

AT END OF KUNNR.

CALL FUNCTION 'CONTROL_FORM'

EXPORTING

COMMAND = 'NEW-PAGE'.

ENDAT.

endloop.

Hope it helps!!

Rgds,

Pavan

Answers (2)

Answers (2)

Former Member
0 Kudos

hi

You can do it break event statement based on consition and call the new page(at new , on change )

Thanks

odysseas_spyroglou
Participant
0 Kudos

thaks for the reply, but can you be more specific.

Where do I have to write the condition, in my program or in the sapscript form?

Former Member
0 Kudos

Hi,

Yes. it is possible.

Take one condition. in that whenever kunner is changed give the condition as go to new page.

Rgds,

Kiran