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

smartform multiple pages printing issue

former_member225134
Participant
0 Likes
4,948

Hi,

     In  my requirement am having two different pages first page is challan and second page is jj the values from first

page internal table same as second page.first page may be data overflow it contains matnr field (table) so some times data overflow

to next page.But the second page is always constant (single page) the values are just address fields so it is fetched from

first page itself.

Here issue is if internal table itab[] = 1 value means two page is printing correctly.

suppose internal table having 2 or more values means ,

itab[] = 2 means total 4 pages we want, itab[] = 3 means total 6 pages we want,

itab = 2 means it displaying 3 only second page( jj )form is not changing and printing  first page correctly based on looping.

i put loop on second page also..but second not printing multiple times based on loop.

May i know what reason??????i want to display page1 page2 for one value

next time page1 page2 for second value....Anyone suggest?????

Hi,

     In  my requirement am having two different pages first page is challan and second page is jj the values from first

page internal table same as second page.first page may be data overflow it contains matnr field (table) so some times data overflow

to next page.But the second page is always constant (single page) the values are just address fields so it is fetched from

first page itself.

Here issue is if internal table itab[] = 1 value means two page is printing correctly.

suppose internal table having 2 or more values means ,

itab[] = 2 means total 4 pages we want, itab[] = 3 means total 6 pages we want,

itab = 2 means it displaying 3 only second page( jj )form is not changing and printing  first page correctly based on looping.

i put loop on second page also..but second not printing multiple times based on loop.

May i know what reason??????i want to display page1 page2 for one value

next time page1 page2 for second value....Anyone suggest?????

27 REPLIES 27
Read only

Former Member
0 Likes
3,983

Hi Anitha,

You can overcome this problem by using COMMAND .

Using you can achieve page break.

Regards,

Dular Sharma.

Read only

VijayaKrishnaG
Active Contributor
0 Likes
3,983

Hi Anitha,

Please mention NEXT_PAGE property of PAGE2 as PAGE1.

Regrads,

Vijay

Read only

0 Likes
3,983

Hi thanks for your repli,

            Just now i changed NEXT_PAGE property of PAGE2 as PAGE1 but 4 page is displaying

and the 4 th page is blank .

Read only

0 Likes
3,983

Hi Anitha,

can you post screen shot of your smartform hierarchy.

Read only

0 Likes
3,983

Hi,

In page1 - general attributes page1.

1)main window

2)loop at itab

3)code:  N = n + 1.

4)command go to new page page1.  conditions N > 1.

"""""""""""""""under loop.

After the loop.

code:

describe table ITab lines lv_lines.

LOOP AT ITab

lv_count = lv_count + 1.

IF lv_count = lv_lines.

   lv_flag = 'X'.

ENDIF.

endloop.


4)command go to new page page2.  conditions lv_flag = X.



In page2 - general attributes EMPTY.


SECONDARY WINDOW CONDITION LV_FLAG = X.

LOOP ITAB.

ENDLOOP.




IF I GIVE PAGE 2 GENERAL ATTRIBUTES AS PAGE 1 MEANS EMPTY PAGE IS APPEARING.


Read only

0 Likes
3,983

Hi Anitha,

In PAGE2 which type of Window have you used? If it is MAIN window change it to Secondary.

But it would be better you post screen shot.

Regards,

Vijay

Read only

0 Likes
3,983

Otherwise,

Place the COMMAND element in loop and set NEXT_PAGE as PAGE1 for page2. Remove code and conditions on the windows and Command. Do not use any conditions.

PAGE1

     MAIN WINDOW

          TABLE LOOP

               MAIN_AREA

                    <DATA>

                    COMMAND (for page2).

PAGE2 (next page as 1)

     SECONDARY WINDOW

          <DATA>

Try as above.

Regards,

Vijay

Read only

0 Likes
3,983

using secondary window only..

Read only

0 Likes
3,983

Hi,

  Now i set page 1 next page as page2.

then                          loop

                            command-----go to new page page2

                         main window

                                      table

                               command

then page2 next page as page1.

                          secondary window       go to new page page1

                                    loop.

                                   templates.

Now also not working???

Read only

0 Likes
3,983

Anitha,

I am sorry, I am not able to understand your hierarchy.

-Vijay

Read only

Former Member
0 Likes
3,983

Hi,

you can use template on the place of internal table.

because size of template will be static and it will not affect second page.

otherwise command will be best option to use.

thanks

Read only

0 Likes
3,983

Hi,

Thanks for your repli.In second page am using templates only.It is the reaso it is not affecting second page.??Otherwise how can i give in command??

Read only

0 Likes
3,983

Have you tried with hierarchy I specified/mentioned above?

If so, what happened?

-Vijay

Read only

0 Likes
3,983

Yeah thanks,

                By your code now it is displaying correctly but last one empty is displaying???

Read only

0 Likes
3,983

Hi Anitha,

So now if table is having 3 records, whether are you getting 6 pages and a blank or 5 pages + blank?

I think you are getting 6 pages + a blank. If so, this is because of NEXT_PAGE property of %PAGE2.

After three 3 records processed in the table again PAGE1 will be triggered. That to be handled.

Regards,

Vijay

Read only

0 Likes
3,983

Thanks for your repli,

                     Yeah its only happening 6 pages + blank..next page as page1 i put.

but next page as page 2 means no values are displaying.

Read only

0 Likes
3,983

Hi Anitha M,

In your command you have to add a condition like this.

Sy-tabix <> 1.

With regards

Arun VS

Read only

0 Likes
3,983

Yeah thanks for your reply,

  In page1 am having command node but sy-tabix <> 1 is not working???

page2 general properties as page1 here.

Read only

0 Likes
3,983

Anitha,

Try as below. I hope works out.

In 'Global Definitions' - 'Initialization'  tab find number of records and count the pages required.

DESCRIBE <TABLE> LINES <VARIABLE>.

COUNT = VARIABLE * 2.  " Here COUNT defines number of pages to be printed.

Now place the condition for 'Main Window' in %PAGE1 as 'IF SFSY-PAGE <= COUNT.

Regards,

Vijay

Read only

0 Likes
3,983

HI,

    Not working... still blank page is displaying??

Read only

0 Likes
3,983

As a final,

Declare a variable (say as G_FLAG) in 'Global Definitions'.

Add 'PROGRAM LINES' before COMMAND in Main Window. In that increase the count (no.of times triggered).

G_FLAG = G_FLAG + 1.

Now change the condition on 'Main Window' as G_FLAG <= COUNT.

I wish this should close the issue.

Regards,

Vijay

Read only

0 Likes
3,983

Hi Anitha,

Where you are giving the command ? Is it on the beginning the n you can try the command sy-tabix <> 1 over there.

With Regards

Arun VS

Read only

0 Likes
3,983

Hi Anitha,

Have you tried as I mentioned in my last comment??

-Vijay

Read only

VijayaKrishnaG
Active Contributor
0 Likes
3,983

Hi Anitha, have you got solved this issue???

-Vijay

Read only

0 Likes
3,983

yeah solved..

Read only

0 Likes
3,983

Hi Anitha,

Nice to know that... please close the thread.

Regards,

Vijay

Read only

Former Member
0 Likes
3,983

Hi Anita,

I guess your requirement is Page1 & page2 should get displayed for each record.

If this is therequirement, you can have the below hierarchy,

Page : 1

Loop on the Records table( lets say It is ITAB[] )

                        -   main window

                        -   table

                        -  transfer the data in other fields which you want to display on 2nd PAGE.

                        -  command-----go to new page page2

endloop.

Page 2:

                       -  secondary window - In this window u can display the data you are getting from page1

                       -  command - go to page1 - (Note - as your no. of pages should be double the no of recordes, create a variable which will have the no of pages E.g. if 2 records , 4pages..save this value in this variable and use this as a condition in command on 2nd page - as only call 1st page where SFSY-PAGE < COUNT.

Hope this will work!!!

Award points if Helpful!!

Thanks!!