Skip to Content

SAP script printing

PERFORM OPEN_FORM.

DATA:PAGE_FLAG TYPE I.

PAGE_FLAG = 0.

DATA:INDEX_CNT TYPE I.

DATA:EXPLICIT_FLAG TYPE C.

INDEX_CNT = 0.

LOOP AT T_FINAL[] INTO ST_FINAL.

ADD 1 TO INDEX_CNT.

IF INDEX_CNT = 7.

EXPLICIT_FLAG = 'X'.

ELSE.

CLEAR EXPLICIT_FLAG.

ENDIF.

IF PAGE_FLAG = 0.

PERFORM WRITE_FORM USING 'A' 'HEADER1'.

PERFORM WRITE_FORM USING 'B1' 'HEADER2'.

PAGE_FLAG = 1.

ENDIF.

PERFORM WRITE_FORM USING 'B' 'MAIN'.

AT LAST.

PERFORM WRITE_FORM USING 'C' 'FOOTER'.

PERFORM CLOSE_FORM.

EXIT.

ENDAT.

IF INDEX_CNT = 7.

PERFORM WRITE_FORM USING 'C' 'FOOTER1'.

PAGE_FLAG = 0.

INDEX_CNT = 0.

ENDIF.

ENDLOOP.

IN the main part of the script i have given

IF &EXPLICIT_FLAG& EQ 'X'.

NEW-PAGE.

ENDIF.

But the problem is after printing 7 records the 8 record is getting over written on the 1st record of the same page

I need the 8 and rest in the second page..

can any body help me in solving this problem

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Apr 11, 2008 at 12:24 PM

    Check in SE71 what you have set as NEXT PAGE

    Set it to itself.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 11, 2008 at 12:29 PM

    Hi,

    1.You are mentioned the index sarts from 0.So, 6 th equal to 7 th record.So,instead of mentioneing the 7 th mention the 6 th.

    2.With this it can work.

    Regards,

    If helpful reward with points(Don't forget).

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 11, 2008 at 12:30 PM

    Hi,

    Declare the variables globally

    Add comment
    10|10000 characters needed characters exceeded