cancel
Showing results for 
Search instead for 
Did you mean: 

Smartforms - Triggering new page ( Page-break)

Former Member
0 Kudos

Hello Friends,

I have to incorporate the logic for the below scenario in smartform. The requirement is like :-

I am displaying table contents in Main window. The display should be as below.

1. If the number of entries in table is 5, 4 items should be displayed in first page , 5 th item should be

displayed on second page.

2. If the number of entries in table is 6, 5 items should be displayed in first page, 6 th item should be

displayed on second page.

4.If the number of entries in table is 15, 5 items should be displayed in first page, next 9 items should be

displayed on second page, last item should be displayed on third page.

3. If the number of entries in table is 20, 5 items should be displayed in first page, next 10 items should

be displayed in second page, next 5 items should be displayed on third page.

This scenario is because of the signature in the footer which should be always displayed along with the

last record.

Currently we have 2 pages in which the same main window is used. so, whatever changes done in main window will reflect in both the pages.

We tried introducing a flag and a COMMAND ( Go to next page ). But it is not working .

Please give ur inputs.

Regards,

Hari.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

first U DESCRIBE the table entries in a variable, based on the value of the variable u trigger next page.

eg:

DESCRIBE table itab LINES gv_lines.

Write the below code in Program Lines 'LOOP'

LOOP AT itab.

gv_tabix = gv_tabix + 1.

IF gv_lines GT '4' AND gv_lines LE '6'.

IF gv_tabix EQ gv_lines.

gv_flag = 'X'.

ENDIF.

ENDIF.

ENDLOOP.

below the Program Lines 'LOOP' u insert a 'COMMAND' NEW PAGE and should call only when gv_flag = 'X'.

Hope it helps

Regards,

Pavan

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Try this,

declare a global variable for record count.

Before your loop use program lines node for describing internal table to get the number of records into the global variable declared.

Create alternate node... for checking the condition

( loop counter is a variable that you will be incrementing using program lines inside your loop node )

if loop counter < number of records.

if &sfsy-page& eq 1 and loop_counter > 5.

create command node to trigger new page

endif.

display the data

else.

create command node to trigger new page

read table itab index counter ( describe itab)

display the data of the record

endif.

regards

padma

Former Member
0 Kudos

HI Hari

Create the template --> create the program lines and print records based on conditionally per page.

After create the secondary window after the main window -->create text node and display the signature..

In the condition tab of the text node check the check only before end of main window..

Regards,

Sravanthi