Application Development 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: 

Explicitly calling NEW PAGE for all windows conditionally in smartform

amber_garg
Active Participant
0 Kudos

Hi guys,

       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.

Regards

Amber

1 ACCEPTED SOLUTION

amber_garg
Active Participant
0 Kudos

Hi Guys,

      Any solutions / suggestions ??    .

Actually I was able to achieve the above through SAPSCRIPT easily hence i thought it would be possible in smartforms but need some help on how to achieve it.

Regards

Amber

4 REPLIES 4

amber_garg
Active Participant
0 Kudos

Hi Guys,

      Any solutions / suggestions ??    .

Actually I was able to achieve the above through SAPSCRIPT easily hence i thought it would be possible in smartforms but need some help on how to achieve it.

Regards

Amber

0 Kudos

Hi,

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

cheers,
Jānis

0 Kudos

Hi Janis,

      Thanks a lot for your reply . In the initialization TAB i just checked the condition in ABAP code for the particular invoice and according set the STARTPAGE for the CONTROL_PARAMETERS , it worked .

Thanks a lot.

0 Kudos

Dear Amber,

I found two ways to your issue.

1. Create second page same like first page but without logo and watermark now copy main window's conditions and paste all those conditions to all other remaining windows on first page, But here the problem may occur that for your Inv No. '0922xxxxx' the first page will print blank.

2. Create new Smartform without logo and watermark for Inv.No.'0922xxxxx' and in driver programs loop call this newly created smarform for this perticular Invoice No in IF INV_NO... ENDIF condition.

eg.

***********************************

IF INV_NO = '0922xxxxx' .

** <Call new smartform>

ELSE.

** <Old smartform>

ENDIF.

***********************************

Hope this helps.

Regards,

Siddhesh Satghare.

Message was edited by: Siddhesh Satghare