cancel
Showing results for 
Search instead for 
Did you mean: 

New page every 7 item, dynamic form

Former Member
0 Kudos

I got a form with a header page with one item in it and another page with only items (lets call it the item page).

The header page should always display and be populated.

The item page should only display if we have more than one item.

Iif we have more than 8 items in total (1 on header page, 7 on item page), we need to create another item page.

I made the page layout but I have no idea how to make it possible that it will be dynamic and generating pages depending on number of items I have.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

OttoGold
Active Contributor
0 Kudos

Can you provide the description of the current form behaviour? What you can see when the form is generated and next what you need to change? Maybe you can provide a form template name if it is SAP-standard. I have very little to build on, I don´t know anything about your expertize and nothing about your form. Maybe you can try to write me a private mail to speed this up. Otto

Former Member
0 Kudos

sent email, thanks.

Answers (1)

Answers (1)

OttoGold
Active Contributor
0 Kudos

Hello,

you can achieve this in multiple ways. Pick one:))

1) In ABAP coding use DESCRIBE TABLE and save to a new variable how many rows (your items) do you have.

If you know you need one for a header and X (7?) for a item page, you know how many pages you will populate using this table rows/ items. In your form you can test this variable and using script change the number of anything you want.

This option is better when the way you count the items is not super-simple.

2) You can count the rows in the script and make a decision based on this count in the script too.

You if you just count your items/ table rows.

Hope this helps, Otto

Former Member
0 Kudos

yeah I got a counter on the items and with that derived how many pages I need.

But how do I make the form create these pages depending on the number of pages I need?

I am trying the setup in subform/pagination but not really understanding how to make it work.

OttoGold
Active Contributor
0 Kudos

When you need to have a subform repeated:

- the parent subform needs to have a content flowed (so the new forms can be added easily)

- the repeated subform must have object - binding - repeat subform for each data item check ed true (and min count 1 or more)

- to break the page use object - pagination - place - top of next page (for example)

You can use a conditional break. You write a condition and if this is true, the page is broken.

Otto

Former Member
0 Kudos

if possible, could you give me a more detailed description how to set this up.

Its kind of confusing atm.

In my hierarchy view I have one Master Pages which is "empty" and page1 right under it.

At the same data leavel I have 2 items.

HEADER and ITEM.

Page 1 is HEADER

Page 2 is ITEM.

WHat I neet is to setup ITEM to display as many times as a global valiable I call GV_NO_PAGES.

Once on record level I need it to loop through my internal table which will populate 1 item on page 1, 7 on page 2, 7 on page 3 etc.

Is this possible?

OttoGold
Active Contributor
0 Kudos

What you need can be done, definitely. But you should think about the problems you face not to pick the most terryfying way to achieve this.

I hope I can understand your problem. But I cannot recommend you to do this through scripting.

First: SAP advise for Adobe is not to script anything what you do not have to scipt. That means avoid scripting every time possible. That means: try to change your solution so most of the changes are done in ABAP before the form is generated. I will clarify further.

Second: If you have header occurence independent "wierdly dependent") on the items page occurence, work on them separatelly.

Conclusion:

Create a table for the header lines.

Create a table for the item/ body lines.

From the original table create these two in ABAP. I have understood that your only criteria to distribute the rows is the index. You do know the index for every row in the ABAP as well.

This will make the body lines and header lines independent and you can bind first table to header subform and the second to body subform and work nicely with the "repeat for each data item" on binding tab.

If you don´t like it: Create a table where the row has a header line and the body lines.

This way you separate the lines as well but the number of headers is the same as number of bodies.

Hope some of this makes sense:)) Otto

p.s.: if you can catch only a step or two, we can work on this in the next posts:))

Former Member
0 Kudos

It kind of started out this way since the layout was reused from existig form.

The item body lines are in seperate tables.

Since my layout is dependent on the rules set I got, with 1 item on the first page, 7 on the next page, 7 on the third page etc I think its better deciding how many pages it should create depending ono my global variabel.

How should I do the pagination? on my ITEM on hierarchy?