Recently I have come across a requirement for a pre-printed form where two tables needs to be flowed at same time in same page. I have achieved this by below design, any other suggestion are mostly welcome.

Description:

Say you have a requirement where you have to generate a form where two or more table is flowing in one same page with a particular number of lines.

/wp-content/uploads/2013/09/12ntitled_273795.jpg

So in this particular form you have two tables, which is flowing at the same page with 1st table will always have 8 rows and second will have 5 rows on that page. If try to print tables one after another the 2nd table would not be triggered unless the 1st table finishes. 

Solution:

This functionality can be achieved by two methods.

  1. Say in the 1st table(itab1) there is total 10 records and in 2nd table(itab2) there is 12 records.

     1. Now you can determine that to display all the records you need 3 pages.  By below code

DESCRIBE TABLE itab1 LINES lv_lines1.

DESCRIBE TABLE itab2 LINES lv_lines2.

     2. AS max 8 record can be printed in one page for itab1

lv_rep1 = lv_lines1 / 8.

lv_rep2 = lv_lines2 / 5.

     3.So in your driver program you can call the form depending upon the pages. Like below

        IF (lv_rep1 GE lv_rep2 ).

             Lv_rep = lv_rep1.

        ELSE.

             Lv_rep = lv_rep2.

        ENDIF.

        DO lv_rep TIMES.

                        CALL FUNCTION lv_fm_name_c
EXPORTING                                       
output_waste   = itab1_temp
inbound_waste  = itab2_temp
general_info   = gs_gen_info
EXCEPTIONS
usage_error    = 1
system_error   = 2
internal_error = 3
OTHERS         = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.

        ENDDO.

In the do loop you have to take the 8 records from the first table(itab1) and put it to itab1_temp and from 2nd table (itab2) take 5 records and put it to itab2_temp.

     4. Lay out will like below:

/wp-content/uploads/2013/09/12ntitled_273795.jpg

You have to make the subform,in which the tables are present will be positioned.

Though this is bit simple but the problem with this kind of design is only you can not have the scrolling functionality as the form is getting called within the do loop many times.

So instead of scroll you have to press the below button to goto the next page.

/wp-content/uploads/2013/09/12ntitled_273795.jpg

  B.With the second method we can achieve the scrolling functionality i.e. all the pages will be on same page.For this we have to create a nested table, and          driver program itself we have to handle everything.

     1. The nested table will have the below structure. Say name of the table is Table1,and total 10 records are in itab1 and 12 records in itab2.

         Components are    1. pageno

                                     2. upper_tab (it will be a table type with a structure of itab1)

                         3. lower_tab(it will be a table type with a structure of itab2)

     2. In driver program we have to fill Table1

    1. 1st row with upper_tab with 8 records and 5 records in lower_tab and page will be 1.

          2. 2nd row with pageno 2 and upper_tab will have 2 records from itab1(9th and 10th as in 1st row we already have 8 records) and other 6lines will be filled                with blank data, lower_tab will have next 5 records from itab2.

          3. 3rd row with pageno 3 and upper_tab with 8 blank line and lower tab with last 2 records from itab2 and other blank record.

     3. Now the form layout will have the below structure.

          /wp-content/uploads/2013/09/12ntitled_273795.jpg

     4. One conditional page break should be there for pageno.

With this method we can achieve the scrolling functionality i.e. all pages will be present in same PDF document.

For my requirement I have designed the form like this. If anyone has completed it with some other method, kindly share the methods.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply