cancel
Showing results for 
Search instead for 
Did you mean: 

New Page COmmand in Smartforms

Former Member
0 Kudos

Hi,

My requirement is as follows,

Whenever the item number changes it has to generate a new page with the header

Whenever an item overflows it should come in a new page without the header details.

So for this I have two pages in my smartform.

Page1 - Header with item details

Page2 - Only item details without the header

I have given Page1's next page as Page2. And I have given a command whenever the item no changes it should go to Page1.

But whats happening now is whenever a new page is generated only Page 2 is coming and not the Page 1.

Any ideas??

Accepted Solutions (1)

Accepted Solutions (1)

MarcinPciak
Active Contributor
0 Kudos

For Page 2 try also setting next page as Page 1.

Regards

Marcin

Former Member
0 Kudos

Hey I tried tat like setting,

Page1 next page as Page2

Page2 next page as Page1

In the command Go to Page1

Now I am getting like,

Item 10 - With Header

Item 20 - Without header

Item 30 - With Header

So basically for alternate pages its coming..

Former Member
0 Kudos

well this requirement has to be solved in a slightly other way.

all you need is ONE page (FIRST), which has declared FIRST as NEXT_PAGE.

Next thing you need is a condition which recognizes a change in itemnumber and which triggers a page break.

So change of itemnumber will trigger a page break now as well as overflowing the main window.

Now around your header you need to call that condition once again.

if itemnumber has changed, do NOT show header, since this was the reason for page break. If itmenumber has NOT changed, then print the header since iteminformation has just exeeded page.

Former Member
0 Kudos

Florian - the same problem in your approach also.. the header gap is coming..

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

I have the similar requirement in smart forms . I need to print multiple pages whenever the line item chnages in my table control. I used Command to trigger new page based on the condition when the item changes.Bu this is now working . Could you please help in this issue.

Former Member
0 Kudos

Sharan,

at the end of loop at item table, create a command field, check go to new page button and give as page1 only,

and write a condition for that command as:

V_REC is greater than V_COUNT

where v_rec = no of records in table

v_count = count of the loop.

ex:

v_count = v_count + 1. ( write this code after loop node in program lines)

In this loop only add header details template.

example:

loop at it_vbak.

code lines for v_count

now create a template for header details.

loop at it_vbap.

now create a template for item details.

endloop.

create command with condition

endloop.

revert, if any concerns.

Former Member
0 Kudos

Hi ,

u want like this right ...

assume that table data

item item desc qty

10 10item descripotion 23

for material

20 20item descripotion 33

for material

O/P Like This u want

*page1

item item desc qty

10 10item descripotion 23

page2 (dont want want headers only remainning data of the line item)

for material

For this simply u can put your header in the main area of the table (leave header as blank)

Let me know if any concerns........

Regards,

Lokesh.

MarcinPciak
Active Contributor
0 Kudos

I just thought of different approach.

I will assume the item details part is in both pages the same window with elements inside.

So just leave one page with header (and the same page as next page). Now every time the item changes set a global flag saying the item has been completely displayed. Now for the window with header set a condition checking our flag. If set show the header and just right after it clear the flag (so it will be avaiable for next item). If flag not set, then the header will be suppressed.

The sequence would therefore be like


- page with header - item1 g_finished = 'X'  
- page with header - item2 g_finished = ' '
- page without header- item2 g_finished = 'X'
- page with header - item3 g_finished = 'X'
...

Should do the job

Regards

Marcin

Former Member
0 Kudos

Marcin - Thanks for your update..

But again there is a problem here

Whenever the header is not printed the line items should start where actually the header should have started..

No empty space should come..

So definitely there is a need for another page to be designed in such a way..

Former Member
0 Kudos

erm no thats wrong. if you do not print the header the items will be printed right there where the header would have been printed, otherwise you made some really uncommon things in your form.

make sure you dont print your header instead of printing it with emtpy values. SAP doesnt care if you print spaces or not. If you porint 2 pages of space, your printout will be 2 emtpy pages.

Edited by: Florian Kemmer on Aug 25, 2010 2:03 PM

Former Member
0 Kudos

But the main window will start from wherever we have assigned.

So example header window has top margin 15mm and main window 25 mm - tat comes fine..

now if no header window is ther main window has to start from top margin 15mm..

tats what i require..

Former Member
0 Kudos

oh lol now i got it. so you got a seperate window for your item header?

That is very unusual since normally item_header is beeing printed in main window. you would'nt have those problems you got now then.

Edited by: Florian Kemmer on Aug 25, 2010 2:30 PM

Former Member
0 Kudos

Hi..

This is one such specific reason for which we use two pages in smartform, displaying thew same data but with different Main Window Margins.

I guess you have a re-look into the events you are using for triggering new page. You can try using one in table's data tab, event on sort end. (AT END OF <ITEM>)

The second Page's Next page as First page is correct. Just need to check with event triggering and thus new page triggering.

Regards,

Karthik

Former Member
0 Kudos

I dont suppose what relevance the events has to do here..

We have the commands in smartforms to navigate to next page..

Former Member
0 Kudos

Hi..

As you are checking the change of an item number, AT END event is similar to that only, you will check when an item ends.

Commands are to direct what needs to be done, and events (which are used in smartform by using event on sort begin and sort end) take care of when it needs to be done. Generally its better to use events in smartforms especially to trigger new-page etc, which is one such requirement of yours.

Regards,

Karthik