cancel
Showing results for 
Search instead for 
Did you mean: 

Page Numbering in SAP Script

Former Member
0 Kudos

Hi,

IN the code below i am not able to separate OUT_PAR-VALUE as First page & Last page.

It is printing as First pageLast page.

Can any body please help me in separating it.

FORM GET_BARCODE TABLES IN_PAR STRUCTURE ITCSY

OUT_PAR STRUCTURE ITCSY.

DATA: PAGNUM LIKE SY-TABIX, "page number

NEXTPAGE LIKE SY-TABIX, "number of next page

NEXTPAGE1 LIKE SY-TABIX.

CLEAR : PAGNUM,NEXTPAGE.

READ TABLE IN_PAR WITH KEY 'PAGE'.

CHECK SY-SUBRC = 0.

PAGNUM = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY 'NEXTPAGE'.

CHECK SY-SUBRC = 0.

NEXTPAGE = IN_PAR-VALUE.

READ TABLE OUT_PAR WITH KEY 'BARCODE'.

CHECK SY-SUBRC = 0.

IF PAGNUM = 1. " AND TEST1 NE 'Y'.

OUT_PAR-VALUE = 'First page'. "First page

ENDIF.

IF NEXTPAGE = 2. " AND TEST NE 'X' .

OUT_PAR-VALUE+2 = 'Last Page'. "Flag: last page

ENDIF.

MODIFY OUT_PAR INDEX SY-TABIX.

ENDFORM. "GET_BARCODE

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

why u r doing all those things...u directly put &page& in text editor of script....

Former Member
0 Kudos

Hi ,

If i use this &page& it always prints 1. on all the pages.

Former Member
0 Kudos

HI,

All the three are entirely different pages. In one shot i will print 3 pages.

Former Member
0 Kudos

HI,

All the three are entirely different pages with the same data. In one shot i will print 3 pages.

Former Member
0 Kudos

Hi,

so are you printing it Recursively , I mean in a LOOP or something.

correct me if my understanding is wrong,you are printing the same data Three times and want

different page no. like Page 1,Page 2,page 3?

and seeing your code 1st suggestion is Use IF...ENDIF instead of CHECK!!! and whats the intention behind writing

IF NEXTPAGE = 2. " AND TEST NE 'X' .

OUT_PAR-VALUE+2 = 'Last Page'. "Flag: last page why +2????

ENDIF.

are you trying to do any string operation?

Former Member
0 Kudos

IF &NEXTPAGE& = 0

lastpage

endif.

former_member206396
Active Participant
0 Kudos

Try the follwoing.

IF PAGNUM = 1.

OUT_PAR-VALUE = 'First page'. "First page

ENDIF.

IF *_NEXTPAGE = 0.*_

OUT_PAR-VALUE+2 = 'Last Page'. "Flag: last page

ENDIF.

write to me if not works.

Ram

Former Member
0 Kudos

Hi Rama krishna ,

Thanx for the reply. Unfortunately it is not working.

Former Member
0 Kudos

Hi,

If &PAGE& EQ '1'

first page

endif.

If &NEXTPAGE& EQ '0'

last page.

Endif.

former_member206396
Active Participant
0 Kudos

May i konw what exactly you want to print? info is insufficient.

For your information

if &page& = 1.

  • stands for first page

endif.

if &NEXTPAGE& = 0

  • stands for last page

endif

Ram

Former Member
0 Kudos

Hi Rama krishna,

Sorry for the delay in replying. I have to print a Excise Document and that consists of 3 sets and that is in Duplex Format.

My requirement : When it prints the 3 sets the First Pag1 shld be Page 1, and 2nd page shld be Page No 2 and so on.

former_member206396
Active Participant
0 Kudos

Then you just use following:

Page no : &PAGE& ( -> page no: 1, Page no:2 .... etc., )

OR

Page &PAGE& of &FORMPAGES&

prints as : 1 of 3. ( if there are 3 pages )

Ram