cancel
Showing results for 
Search instead for 
Did you mean: 

Printing window in multiple pages.

Former Member
0 Kudos

Hi All,

I have developed a SAP script which is assigned to the standard driver problem. In standard program I have made source code enhancement to print the line Items in main window. so I have called WRITE_FORM for main window with the text element assigned for the line item display which is in loop.

So if the data is of one page everything is working properly but when the data exceeds and page 2 is displayed I am not getting the header of line item of main window. which is called using write_form before loop of line item code.

Can I get the page number in driver program to code according to pages.

Pls suggest me what to do.

Thanks.

Shweta

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member

Hi,

We normally call the WRITE_FORM for line items inside a loop.

So initially u can hardcode wf_page = 1.

Inside the loop you can count the no.of lines being occupied by each text element under MAIN window and if the no.of lines exceed the height of your MAIN window you can call

call function 'CONTROL_FORM'

EXPORTING

command = 'NEW-PAGE NEXT'.

and increment wf_page after the above FM is called.

For eg:

Height of MAIN window is 42 LN.

Define a constant in your driver program as co_mainform_lines TYPE i VALUE '42'.

Suppose the text element FACTORY_STD prints only 1 line in the script output, then wf_linecount will be incremented by 1.so whenever ur wf_linecount becomes 42 it goes inside the subroutine and calls next page.

call function 'WRITE_FORM'

EXPORTING

element = 'FACTORY_STD'

window = 'MAIN'

EXCEPTIONS

element = 1

function = 2

type = 3

unopened = 4

unstarted = 5

window = 6

bad_pageformat_for_print = 7

spool_error = 8

others = 9.

wf_linecount = wf_linecount + 1.

IF wf_linecount GE co_mainform_lines.

PERFORM new_page.

ENDIF.

FORM new_page.

  • Start a new page

call function 'CONTROL_FORM'

EXPORTING

command = 'NEW-PAGE NEXT'.

wf_page = wf_page + 1.

ENDFORM.

Regards,

Chandra.

Edited by: Chandra A on Mar 24, 2009 9:20 AM

Former Member
0 Kudos

Hi Schweta

To get an header in your output in your main which is on top every page use the following command

(OUTSIDE your loop)

CALL FUNCTION 'WRITE_FORM' "First header

EXPORTING ELEMENT = 'ITEM_HEADER'

EXCEPTIONS OTHERS = 1.

  • IF SY-SUBRC NE 0.

  • PERFORM PROTOCOL_UPDATE.

  • ENDIF.

CALL FUNCTION 'WRITE_FORM' "Activate header

EXPORTING ELEMENT = 'ITEM_HEADER'

TYPE = 'TOP'

EXCEPTIONS OTHERS = 1.

  • IF SY-SUBRC NE 0.

  • PERFORM PROTOCOL_UPDATE.

  • ENDIF.

After your lines and OUTSIDE your loop you have to use the following command

CALL FUNCTION 'WRITE_FORM' "Deactivate Header

EXPORTING ELEMENT = 'ITEM_HEADER'

FUNCTION = 'DELETE'

TYPE = 'TOP'

EXCEPTIONS OTHERS = 1.

  • IF SY-SUBRC NE 0.

  • PERFORM PROTOCOL_UPDATE.

  • ENDIF.

If it is one of the forms of 'NACE' then you can use the perform protocol_update for the error log.

this will do.

Gr., Frank

Former Member
0 Kudos

Hi

To get the headers in every page declare the headers in the top and endtop command.

/: TOP

/: Text

/: ENDTOP.

Hope this helps you

Regards,

Rajani

Former Member
0 Kudos

Hi Shweta,

Include the header of line within the loop ...end loop.

Regards,

Sravanthi