cancel
Showing results for 
Search instead for 
Did you mean: 

Why can't I printout Current Page Number on the form correctly?

Former Member
0 Kudos

Hi guy,

I try to printout the header text on the packing list form,when I add following code in the SAP printout program,I can printout the text correctly,but I can't printout Current Page Number on the form with system symbols &PAGE&.(It can be printout correctly before adding following code).I don't know what happened,how can I get the right solution?

Can anybody help on this case?Your help is appreciated.

Thanks,

Don

DATA P_LINE1 LIKE TLINE.

DATA P_LINE2 LIKE TLINE.

DATA P_LINE3 LIKE TLINE.

DATA P_LINE4 LIKE TLINE.

DATA P_LINE5 LIKE TLINE.

DATA P_ALL LIKE TLINE.

DATA ITEXT LIKE TLINE OCCURS 0 WITH HEADER LINE.

DATA TEXTNAME LIKE STXH-TDNAME.

DATA TEMPCNTR TYPE I.

DATA POSNR Like VBDPL-POSNR.

DATA LT_TEXT TYPE TDTAB_C132.

DATA WA_TEXT LIKE LINE OF LT_TEXT.

IF POSNR EQ '000000'.

TEXTNAME = VBDKL-VBELN.

ELSE.

CONCATENATE VBELN POSNR INTO TEXTNAME.

ENDIF.

CALL FUNCTION 'READ_TEXT'

EXPORTING

ID = '0012'

LANGUAGE = 'E'

NAME = TEXTNAME

OBJECT = 'VBBK'

TABLES

LINES = ITEXT

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8.

IF SY-SUBRC <> 0.

CLEAR ITEXT.

CLEAR P_LINE1.

CLEAR P_LINE2.

CLEAR P_LINE3.

CLEAR P_LINE4.

CLEAR P_LINE5.

EXIT.

ENDIF.

CALL FUNCTION 'CONVERT_ITF_TO_ASCII'

EXPORTING

FORMATWIDTH = 128

IMPORTING

C_DATATAB = LT_TEXT

TABLES

ITF_LINES = ITEXT

EXCEPTIONS

INVALID_TABLETYPE = 1

OTHERS = 2.

LOOP AT LT_TEXT INTO WA_TEXT.

CONCATENATE P_ALL WA_TEXT INTO P_ALL SEPARATED BY SPACE.

SHIFT P_ALL LEFT DELETING LEADING SPACE.

IF TEMPCNTR = 0.

P_LINE1 = WA_TEXT.

ELSEIF TEMPCNTR = 1.

P_LINE2 = WA_TEXT.

ELSEIF TEMPCNTR = 2.

P_LINE3 = WA_TEXT.

ELSEIF TEMPCNTR = 3.

P_LINE4 = WA_TEXT.

ELSEIF TEMPCNTR = 4.

P_LINE5 = WA_TEXT.

ELSE.

EXIT.

ENDIF.

TEMPCNTR = TEMPCNTR + 1.

ENDLOOP.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Don,

It probably is a case of space crunch.

Let's try one thing. Instead of pring page number &PAGE& as it is, format it using: &PAGE(3ZC)&

What this would accomplish is, allot only 3 characters for printing the page number (we can assume your script wont print more than 999 pages in one run), Z would remove any 0s, i.e. if page number is 009, then only 9 would get printed, and C would compress it, instead of ' 9' straight 9 would get printed.

Check it out. Also it is not very clear how you have positioned the new standard text with relation to the page number while printing.

Cheers.

Former Member
0 Kudos

I tried,but failure with the same result '0'.

Regards,

Don

Former Member
0 Kudos

Hi Aditya,

Thanks for your information.

I put the new standard text and the currenty page number in different window with the same paragraph format.

Page window as:

<S>&PAGE(3ZC)& of &SAPSCRIPT-FORMPAGES&</>

&SAPSCRIPT-FORMPAGES& output correctly,but &PAGE(3ZC)& output is wrong,it is always '0'.If I removed the relevant script,it works fine.

Regards,

Don

Answers (2)

Answers (2)

Former Member
0 Kudos

Sorry,I missed an important information:

Zero was assigned to &PAGE& .So system show me the currenty page nubmer is '0' on every page.that's my problem.

Thanks,

Don

Former Member
0 Kudos

Hi, zhang qd

If u have a smartform, try &SFSY-PAGE(3ZC)&

Check OSS Note 779492.

Regards.