Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Code to invoke new-page in sapscript based on a condition

aris_hidalgo
Contributor
0 Likes
695

Hello experts,

I am having a problem here. What I want to do is for every change of value in a certain field, for example field A, those records will be on a new page and it goes as well for field B and its records. Thanks guys and take care!

Hello experts,

I am having a problem here. What I want to do is for every change of value in a certain field, for example field A, those records will be on a new page and it goes as well for field B and its records. Thanks guys and take care!

3 REPLIES 3
Read only

Former Member
0 Likes
622

hi Vijay,

check this link

http://help.sap.com/saphelp_erp2005/helpdata/en/46/bb181dab4811d4968100a0c94260a5/frameset.htm

Syntax:

/: INCLUDE MYTEXT

NEW–PAGE: SAP Script automatically carries out a page break if window MAIN of one page is filled with NEW-PAGE command. You can face page break at any point. The current page is completed and the text in the following line is written on new page. If no name is defined, then, the next page attributes from page setup is taken.

Syntax:

/: NEW – PAGE [PAGE-NAME]

NEW–WINDOW: You can have 99 MAIN windows on one page. If MAIN window is filled, then the next MAIN window is accessed automatically. With NEW-WINDOW command, you can call next main window even if the current MAIN window is not yet completely filled.

PROTECT: You can determine that a paragraph must not be separated by a page break. The lines in this command are printed together on one page. If the space is enough on current page, then all the lines are printed on current page. If, however the space is not sufficient the PROTECT command works as a ‘NEW-PAGE’.

Read only

Former Member
0 Likes
622

Hi Viray,

You can make use of IF or else for the same.

Example taken from the thread :

you can find more eg. on the same thread.

/: IF &mseg-bwart& NE 631 .

/: IF &MKPF-TCODE2& NE 'MB01' AND &MKPF-TCODE2& NE 'MIGO_GR'

I1 ,,&MSEG-WEMPF&

<b>For New Page.</b>

/: NEW-PAGE

/: ELSE

I1 ,,&MSEG-EBELN&

/: ENDIF

/:ENDIF

Hope this will help you.

Cheers

Sunny

Rewrd points, if found helpful

Message was edited by: Sunny

Read only

Former Member
0 Likes
622

Hi vijaylab,

1. For such kind of requirement, we have to

take care of 2 things.

<b> a) logic in driver program.

b) New element in layout for new-page</b>

2. b) New element in layout for new-page

First of all make a new element

by any name (eg. mynew)

in the layout and write this line in it.

/: new-page

(this element will be called, when we want to print

new page, based upon the logic)

3. a) logic in driver program.

U must be printing in loop.

The ITAB must be SORTED on that field (Very important)

Take new variable eg. OldValue

Write your own logic

to put new value in this oldvalue,

If the NEW value is NOT EQUAL to old value,

then

using WRITE_FORM

write the element for new page.

regards,

amit m.