cancel
Showing results for 
Search instead for 
Did you mean: 

regarding multiple pages

Former Member
0 Kudos

hi all,

i am facing this problem . i have developed a script for which i have to create five pages like one for duplicate, triplicate etc.. means the same page i have to print 5 times with different headings.any help in solving this please??????

regards,

Naren

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

If you are creating 5 pages for the script and printing the same data 5 times then there won't be any issue for you as all the pages are triggered you can maintain different variable windows on all the 5 pages and give the heading as you like there.

or

If you are looping the write form from your driver program 5 times then check for the sy-tabix and change the text element according to the sy-tabix value so you can print different headings for all the 5 times.

like

IF SY-TABIX = 1.
W_ELEMENT = 'FIRST'.
ELSEIF SY-TABIX = 2.
W_ELEMENT = 'SECOND'.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
ELEMENT = W_ELEMENT
........
........
ENDFUNCTION.

Maintain all the text elements in your script main window or variable window with different headings.

Regards

Sarves

Former Member
0 Kudos

thanks for the reply sarves,

i got the idea ; jus correct me if iam wrong ...i will create a window in the script with w_element as text element.and in the driver program i will loop the write form for all the windows.correct me

Former Member
0 Kudos

Hi,

Create the text elements FIRST, SECOND, THIRD, FOURTH AND FIFTH in the script and when you are looping in the driver program pass the elements value using a variable W_ELEMENT according to the sy-index value. In this you have 5 text elements in the script calling each text element according to the sy-index

In the first text element of the script give the text as Original.

second Duplicate

third Triplicate......

or

You can declare a variable in the driver program name

and pass it accordingly with the text element also. In this you will have only one text element in the script and change the value of the name according to the sy-index.

DO 5 TIMES.
IF SY-INDEX = 1.
NAME = 'ORIGINAL'.
ELSEIF.....
ENDIF.
CALL FUNCTION 'WRITE_FORM'.
ELEMENT = 'TEST'.
....
ENDFUNCTION.

Regards

Sarves

Edited by: Sarves Sombhatla on Jul 28, 2009 3:17 PM

Former Member
0 Kudos

thanks for the reply sarves.....i have almost solved it ..but when i tale printoutput i get 4 copies but the text is not changing.so dhould i include the whole open form ,write form print form in the do enddo.......or only write form..........please correct me.

Former Member
0 Kudos

Hi,

No it is not necessary to include all the function modules in the loop. only write_form will do it. I have replicated the scenario with 2 different page headings,Just check the code below

" Driver Program
CALL FUNCTION 'OPEN_FORM'
.......
DO 2 TIMES.
  IF sy-index = 1.
    name = 'Original'.
  ELSE.
    name = 'Duplicate'.
  ENDIF.
    CALL FUNCTION 'WRITE_FORM'
      EXPORTING
        element  = 'TEST'
        window   = 'MAIN'.
*        function = 'APPEND'.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    if sy-tabix > 1.
    clear name.
    endif.
ENDDO.
CALL FUNCTION 'CLOSE_FORM'
.......

" In SCRIPT MAIN WINDOW I have declared a text element 'TEST'

/E  TEST
*   &name&
/:  NEW-PAGE 'SECOND'

Note: I took the new-page just to trigger another page and check whether it is triggering in the second page Hope this will completely resolve the issue.

Regards

Sarves

Former Member
0 Kudos

thanks sarves............i have solved the problem. thank you very much

Answers (0)