cancel
Showing results for 
Search instead for 
Did you mean: 

Two Elements in Main Window

hitesh2
Participant
0 Kudos

Hello,

I am working on sapscript. MAIN window has two elements ( Order Info, Carrier Info. ) First page display only 1 - 10 records for each element in Main Window.

( In my scenario, it's possbile the either one of the element may have more then 10 record but 11th record should print in that section of Next Page )

Next page should display starting with record 11 on subsequent elements. How can i accomplish this scenario.

I apperciate your help.

Thanks

Hitesh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

in driver program, count the sy-tabix if it reaches '11', then call the FM 'CONTROL_FORM' and in the command give 'NEW-PAGE' and then call the WRITE_FORM of 2nd element.

write code like below in ur driver program.

eg:

data : gv_tabix.

LOOP AT itab.

gv_tabix = sy-tabix.

IF sy-tabix LE 10.

call function 'WRITE_FORM'

EXPORTING

element = element1

EXCEPTIONS

.

ENDIF.

IF gv_tabix GT 10.

call function 'CONTROL_FORM'

exporting

command = 'NEW-PAGE'.

clear gv_tabix.

ENDIF.

IF sy-tabix GT 10.

call function 'WRITE_FORM'

EXPORTING

element = element2

EXCEPTIONS

.

ENDIF.

ENDLOOP.

dont forget to give NEXT PAGE for first page as 'FIRST PAGE' name.

Hope it resolves

Rgrds,

Pavan

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Hitesh,

U better separate it, Print one element in main window and comment out other element. For the other element u define a normal window and in the driver program append what all data for second element in to an internal table. Then use the WRITE_FORM_LINES function module to write it into other window and make sure to clear the internal table, when it reaches the next page, as if u need to print from 11 record.

For the main window element it will print automatically, as it overflows.

In the WRITE_FORM_LINES function module, the table parameters you can specify the paragraph format for the TLINE-TDFORMAT and concatenate the text with tab position as what u do in any of the windows and pass it to the TLINE-TDLINE.