09-22-2006 1:49 PM
Hi All,
I require to display page number on the SAPScript.
The problem here is I have to display Page 1 when it is @ that is &PAGE& - 1 value.
Please let me know how to achieve this in the SAPscript.
Thanks in advance.
Amit
Hi, I dont want to display like 1 of 2..
but i want to display Page 1 whwn &PAGE& = 2 and so on.
Message was edited by: Amit Khare
09-22-2006 3:36 PM
hi,
Try with this system variable
<b>
&SAPSCRIPT-COUNTER_x& (x= 0..9)</b>
These fields represent ten counter variables that you can use in your text and forms for any counting purposes. You can use the + and - formatting options to increment or decrement a counter before its value is printed. You can use the DEFINE control command to assign any specific value to a counter.
Regards,
Sailaja.
09-22-2006 1:55 PM
09-22-2006 1:57 PM
&PAGE& OF &SAPSCRIPT-FORMPAGES&
&SAPSCRIPT-FORMPAGES& : this standard script variable stores total no of pages in that layout to print
&PAGE& stores current page no.
Regards
srikanth
Message was edited by: Srikanth Kidambi
09-22-2006 1:58 PM
hi,
&PAGE& is for current page no
&SAPSCRIPT-FORMPAGES& for total no of pages
Regards,
Sailaja.
09-22-2006 1:59 PM
09-22-2006 1:59 PM
Hi,
Write a External perform for this one ..
<b>In the script:</b>
PERFORM <Nmae> ZPROGRAM
USING &PAGE&
Changing &PAGE_NO&
ENDPERFORM
In the Program(ZPROGRAM) .
form <name> tables intab structure itcsy
DATA: var type i.
outab structure itcsy.
clear intab.
read table intab with key name = 'PAGE'.
if sy-subrc = 0.
var = intab-page + 1.
ENDIF.
CLEAR OUTTAB.
READ TABLE OUTAB WITH KEY NAME = 'PAGE_NO'.
IF SY-SUBRC = 0.
OUTAB-VALUE = VAR.
modify outab index sy-tabix.
ENDIF.
in your Script PAGE_NO will have the value of PAGE + 1.
Regards
Sudheer
09-22-2006 2:03 PM
hi,
You have to do it in a subroutine in the driver program.
form get_page tables intab structure itcsy
outab structure itcsy.
DATA: v_page type i.
clear intab.
read table intab with key name = 'PAGE'.
if sy-subrc = 0.
var = intab-page + 1.
ENDIF.
CLEAR OUTTAB.
READ TABLE OUTAB WITH KEY NAME = 'PAGNO'.
IF SY-SUBRC = 0.
OUTAB-VALUE = V_page.
endif.
modify outab index sy-tabix.
ENDIF.
Call the form in your script.
PERFORM get_page ZPROGRAM
USING &PAGE&
Changing &PAGNO&
ENDPERFORM
Regards,
Richa/
09-22-2006 2:01 PM
Hi Amit,
For displaying Page 1 when the variable &PAGE& holds the value 2 you will need to do the coding in the print program itself.
You can use the FM 'GET_TEXTSYMBOL' EXPORTING line = &PAGE& start_offset = 0. The importing parameter 'value' will contain the current page number.
You can then manipulate this as per your requirement and store the result in a global variable.
Now you can pass this global variable to your SAPScript and display it.
Hope this helps!
Regards,
Saurabh
09-22-2006 2:25 PM
Hi All,
thanks for the reply but the second problem here is I cant change the driver program.
Whatever I do I have to do it in SAPScripts only.
Amit
09-22-2006 3:40 PM
the &PAGE& and other fields are SCRIPT specific fields .you can use directly in the script editor. no need to touch the driver program.
09-22-2006 4:16 PM
Add the following to the window where you print page number:
/: IF &PAGE& = '2'
/: DEFINE &PAGE& = '1'
/: ENDIF
Regards
Sridhar
Message was edited by: Sridhar K
09-22-2006 3:36 PM
hi,
Try with this system variable
<b>
&SAPSCRIPT-COUNTER_x& (x= 0..9)</b>
These fields represent ten counter variables that you can use in your text and forms for any counting purposes. You can use the + and - formatting options to increment or decrement a counter before its value is printed. You can use the DEFINE control command to assign any specific value to a counter.
Regards,
Sailaja.