Application Development and Automation 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: 
Read only

SAPScript PageNmber

Former Member
0 Likes
799

Hi all,

I have created a ZMEDRUCK Script which has First page as FaxCover Page and then Actual PO starts printing. Now I want 'Page of Total_Page' to be Displayed

Ex) There are 3 pages in the PO

Fax Cover will display = 1 of 3

Purchase Order = 1 of 3

2 of 3

3 of 3.

I have used Variable &SAPSCRIPT-FORMPAGES& but in no vain.

Can anybody Assist me on this

Thanks in Adv

6 REPLIES 6
Read only

Former Member
0 Likes
765

Hi

You have to insert

&PAGE&/&SAPSCRIPT-FORMPAGES&

&PAGE& is the current page

&SAPSCRIPT-FORMPAGES& is the total number of pages

Max

Read only

Former Member
0 Likes
765

Hi,

&PAGE& -> will have the Current Page No

&SAPSCRIPT-FORMPAGES& --> Wil have the Totla No of Pages

So write:-

/: &PAGE&/&SAPSCRIPT-FORMPAGES&

Regards

Sudheer

Read only

0 Likes
765

Hello Sudhir,

The output which I am getting is

Fax Cover page = 1/4

PO = 1/4 then 2/4 then 3/4.

That means Initially Script considers Fax Cover Page When we use &SAPSCRIPT-FORMPAGES& but then When it starts printing Actual PO then Starts with 1 and Ends with 3 having 4 as Total Number of Pages.

This is the problem which I am facing

Read only

0 Likes
765

I think you need to use a perform where you reduce the page numbers.

Read only

0 Likes
765

then you have to write a PERFORM in the LAYOUT to get the total pages - 1.

send SCRIPT-FORMPAGES to this PERFORM and in that FORM(subroutine) reduce the value by 1 and get that value to the layout and print it as TOTAL PAGES.

here is the link,to know,how to call PERFORM in SCRIPT.

Regards,

Srikanth

Read only

Former Member
0 Likes
765

Hi Sanjay,

Define 2 Variables in the Script,

/: DEFINE &CURR_PAGE&
/: DEFINE &TOT_PAGE&

/:perform NAME in program ZTEST
/: using &PAGE&
/: using &SAPSCRIPT-FORMPAGES&
/: changing &CURR_PAGE&
/: Changing &TOT_PAGE&
/:endperform

<b>In the Program ZTEST:-</b>

data: L_page type i,
      L_Totpage type i.

FORM NAME TABLES INTAB  STRUCTURE ITCSY 
                 OUTTAB STRUCTURE ITCSY. 
 READ TABLE INTAB with key NAME = 'PAGE'
 IF sy-subrc = 0.
  L_PAGE = INTAB-VALUE.
  L_PAGE = L_PAGE - 1.  " Current Page - 1
 ENDIF.

 READ TABLE INTAB with key NAME = 'SAPSCRIPT-FORMPAGES'
 IF sy-subrc = 0.
  L_Totpage  = INTAB-VALUE.
  L_Totpage  = L_Totpage  - 1.  " Total Pages - 1
 ENDIF.

 READ TABLE OUTTAB with key NAME = 'CURR_PAGE'
 IF sy-subrc = 0.
  OUTTAB-VALUE = L_PAGE.
  ENDIF.
 Modify OUTTAB index SY-TABIX.

 READ TABLE OUTTAB with key NAME = 'TOT_PAGE'
 IF sy-subrc = 0.
  OUTTAB-VALUE = L_Totpage.
  ENDIF.
 Modify OUTTAB index SY-TABIX.

ENDFORM.

In the Script: After the First page, you can decalre now like

/: &CURR_PAGE& of &TOT_PAGE&.

Mark all the helpful answer

Regards

Sudheer