cancel
Showing results for 
Search instead for 
Did you mean: 

Printing Vertical Line In The 1st Page Of SAP Script O/p & Not In The Last

Former Member
0 Kudos

Moved to correct forum.

Hi All,

I have Standard Driver Program and Z SAP Script. The Sap Script has two Pages PAGE1 and NEXT. I have been asked to create a dotted vertical line, that should appear in the output SAP Script.

Hence I created a New Variable Window, where I wrote the logic for Vertical Dotted Line. Now the issue is when driver program is excuted and the output is displayed, for example if the output has 3 pages, the vertical Line should be visible only on the first two pages, and not on the last. Similarly if the output has only two pages, then the vertical dotted line should appear only in the first page.

Initially I tried to use the logic if the current page is equal to no. of . pages then dont execute the logic for the vertical line, but it did not work. I tried implementing the following syntax:

if &page& EQ &SAPSCRIPT-FORMPAGES&.

do not execute the logic.

else.

do not.

endif.

Is there any other way that this could be done.

Kindly Advise......

Edited by: Matt on Mar 23, 2009 7:29 AM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Roy,

Usually the next page of the last page in a script is zero. i.e if the NEXTPAGE is equal zero then it indicates that the current page is the last page in script. So put a condition on this basis.

if &NEXTPAGE& eq 0.

do not draw lines.

else.

draw lines.

endif.

Hope this would help you.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Try this logic

IF &NEXT-PAGE& NE 0.
PRINT.
ENDIF.

sometimes this logic might not work as the main window will not get you the next-page number as 0 and variable window cannot extend the page even if it finds the next-page as 0.

or

call the FM control_form to call the PAGE you want at the end of the printing.

ie if it is 2 pages call it at the end.

CALL FUNCTION 'CONTROL_FORM'
  EXPORTING
    command         = 'PAGE NAME'
* EXCEPTIONS
*   UNOPENED        = 1
*   UNSTARTED       = 2
*   OTHERS          = 3
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

This will solve the issue.

regards

sarves