Explicitly calling NEW PAGE for all windows conditionally in smartform
First I will explain the how the program / smartfrom looks like as follows.
I have a selection screen where the user is supposed to enter the multiple values for INVOICE NO (VBELN) in a select option. I am printing each invoice as a seperate smartform . I am using a LOOP in driver program for this which will create a smartform for each iteration of the loop. In the smartform , I am using the TABLE for displaying the item details. I have a single page PAGE1 with background watermark , logos etc.
Till here , its working perfectly fine as expected.
Now my new requirement is out of all the invoice which are been entered by the user in select option , if the invoice is "0922xxxxx" only that particular invoice should be printed in a different page (without logos and watermarks).
To achieve this , I created a PAGE2 (without watermark) and copied the MAIN WINDOW to PAGE2.After that created a COMMAND under the MAIN WINDOW where in gave the setting for GO TO NEW PAGE as PAGE2. In the CONDITIONS tab of COMMAND , gave the CONDITION for INVOICE No = '0922xxxxx'.
Upon execution , what is happening all other invoices are coming correctly as earlier , but for this particluar invoice "0922xxxx" , initially the PAGE1 is displayed with other windows for DATE , LOGO , PAGE HEADER etc (along with watermark). The MAIN WINDOW contents are empty (as expected) and then on next page PAGE2 is shown with the contents of MAIN Window with the details of the particular invoice.
Now what I wanted is for this invoice , PAGE1 should not be displayed at all and just PAGE2 should be displayed.
Technially speaking I can understand why the above output is coming , since the COMMAND is given under the MAIN WINDOW and hence the other WINDOWS (DATE , LOGO etc) are outside the conditions of this COMMAND.
Kindly let me know if someone has a solution for this.
Jānis B replied
In the INITIALIZATION under Global Definitions, pass in and out CONTROL_PARAMETERS and set the STARTPAGE accordingly... I'm not sure, but you may also be able to set the STARTPAGE in driver program before passing CONTROL_PARAMETERS to SF. But it definitely works form INITIALIZATION inside SF.
I still remember, how I was struggling to figure this one out