I am having a smartform having two templates. First template is printed for all the billing document types. But the second template is printed for a particular set of billing document types. Only first template has a footer in addition to line items1 and second template just has line items2. Both the templates are having line items, hence data to be printed in both the templates is stored respectively in two internal tables(ITAB1 and ITAB2). I'm facing problem in printing them.
a. If I take one main window and assign those two internal tables in that main window and based on some condition prints the data such that data of 1st ITAB1 is printed on template 1 and data of 2nd ITAB2 is printed on second template, then I am unable to print the footer of 1st template because I have given the condition on footer as "Only After End of Main Window" and as MAIN window is triggered only once so when the MAIN window is triggered on Template1, it goes to Main Window of Template2 and hence Footer is never triggered on Template1.
b. If I instead Take ITAB1 in Main window and ITAB2 in secondary window, and I give a Command in Main Window that after printing ITAB1, go to Template2, then again I face a probelm that if line items of ITAB2 is more than the page sapce, then they wont go to next page as I'm here (in this case) taking ITAB2 in a Secondary Window and not the Main Window.
Is there any way that I can print both the templates so that first template(line items1+footer) is printed always and second template(line items2) is printed only for a particular billing document types.