cancel
Showing results for 
Search instead for 
Did you mean: 

Need to print some text only in last page in SAP script

Former Member
0 Kudos

Moved to correct forum by Moderator. General wasn't right either.

Hi All.

I need to print "Remarks" only in last page of sap script.

Can anyone please help me on this.

Thanks

Senthil kumar V.

Edited by: Matt on Nov 21, 2008 7:38 AM

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi Senthil,

at last.
      call function 'WRITE_FORM'
       exporting
       element                          = 'REMARKS'
*   FUNCTION                            = 'SET'
*   TYPE                                = 'BODY'
         window                         = 'MAIN'

Regards,

Sravanthi

Former Member
0 Kudos

Hi,

You can use &nextpage& = 0 condition for displaying remarks in last page..

you can also do it through your print program

try this....

assign text element to the remarks...

loop at itab

call function write_form

at last.

call function write_form -- in the elements parameter pass the text element used for remarks

endat.

endloop.

this should work

regards

padma

Former Member
0 Kudos

Hi,

@Padma,

why have you a solution inside a loop for something that has to be done last?

below is easier:

loop at itab

call function write_form

endloop.

call function write_form -- in the elements parameter pass the text element used for remarks

Gr., Frank

Former Member
0 Kudos

Hi,

you have 4 possibilities.2 at non main window, 2 at main window.

at non main window.

1. /: IF &PAGE(C)& = &SAPSCRIPT-FORMPAGES(C)&

  • remarks

  • remarks

  • remarks

/: ENDIF

2, /: if &NEXTPAGE& ='0'.

  • remarks

  • remarks

  • remarks

/: ENDIF

at main window

3. Add the remarks at the last item of the main which is printed

4. add a new item to your main (/E)

put your remarks in it.

Change your program in such a way this item will print as last one.

like

/E REMARKS

  • remarks

  • remarks

  • remarks

and in sapscript program add logic at the end.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'REMARKS'

EXCEPTIONS

element = 1

window = 2.

I am sure this will do. Make a choice.

Gr., Frank

Former Member
0 Kudos

Hi,

/:IF &nextpage& eq '0'

  • Remarks

/:endif

Former Member
0 Kudos

The &nextpage& control command is only applied to windows that not is main windows...

Former Member
0 Kudos

Add the following to the sapscript main window.

/E LAST_PAGE_LOGIC

/: IF &V_LOGIC& NE &SPACE&

Z1 <A>Footer</>

/: ENDIF

your sapscript program should have the following logic at the end.

data: v_logic type c.

v_logic = 'X'.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'LAST_PAGE_LOGIC'

EXCEPTIONS

element = 1

window = 2.

Former Member
0 Kudos

In SAPscript, there are a few ways to print text only on the last page. The logical approach depends on whether you are using the MAIN window or a secondary window to print the text. If you are printing this text in the MAIN window, then simply put the words in a text element which prints last. If your footer is outside/below the MAIN window, then you'll want to use a secondary window-based approach.

If using a secondary window, one possibility is comparing the value in SAPscript symbol PAGE with SAPSCRIPT-FORMPAGES. When they are equal, have the text print; otherwise, have nothing print. However, these variables are not exactly the same. To make them 'apples-to-apples', insert a control command in your SAPscript form similar to a formatting command, for example:

/: IF &PAGE(3ZC)& = &SAPSCRIPT-FORMPAGES(3ZC)&

  • [your END OF PAGE text here]

/: ENDIF

Another option is to simply check if &NEXTPAGE& ='0'. This should achieve the same results.

Regards

Raj