cancel
Showing results for 
Search instead for 
Did you mean: 

new page based on condition in sap script

Former Member
0 Kudos

Hi All,

I have some condition like header text is not blank , now in this case i want to print this header text on new page else page should not display . how to do that in sap script ... i tried searching SDN also but not found any aprrpriate answer.

Thanks ,

Ruchi

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi!

You can call the Function module CONTROL_FORM and give the new page command there validating the condition of the header text.

The new-page is displayed and even u can call a specific newpage if the header text is not initail.

even if u do not want to give a code as a FM then u can code it in the main window itself saying

the condition in if.....

and then

/: NEW-PAGE

The current page getting executed will be completed and the text in the following next lines will be written to the page specified in the form.

in the new page command if u specify a page not there in the form the corresponding statements are ignored.

then the below statement

/: NEW-PAGE page_new

except that the page page_new will be taken as the next page.

You can go any way u want.

Regards.

Former Member
0 Kudos

Hi,

Use CONTROL_FORM function module in driver progra.

eg:

IF header_text is not initial.

CALL FUNCTION 'CONTROL_FORM'

EXPORTING

COMMAND = 'NEW-PAGE'

EXCEPTIONS

UNOPENED = 1

UNSTARTED = 2

OTHERS = 3.

call function 'WRITE_FORM'

element = 'HEADER_TEXT'

window = 'HEADER'.

endif.

In script, call the ELEMENT 'HEADER_TEXT' and print the required header text...

Hope it helps!!

Rgds,

Pavan

former_member156446
Active Contributor
0 Kudos

[In SAP SCRIPT, how to add a page break or print the records in a new page |http://stackoverflow.com/questions/208648/in-sap-script-how-to-add-a-page-break-or-print-the-records-in-a-new-page]