Printing text in last page main window of a script

Hi All,
       I want to print some text at the bottom of last page main window.But how can we find that it is last page.I mean which condition we have to put for that.
I think the below condition like
If last-page NE ' 0'.
write : '----
'..........   will be used for printing at last page footer window.
what about main window........how to find that it is the main window of last page............
Thanks in advance ....
Regards,
Rakesh.

Hi,
you can use this
IF NEXT_PAGE EQ ' 0 '.
write the text here.
ENDIF.
in the main window itself. Once all the records got printed, it will check that there is no next page. at that time, that was the end of the internal table in the mainwindow and the text will be printed.
If you want a seperate window, then also the same logic will work.
If you want a seperate window, then the output look and feel will not be so good.
I mean where ever the last record got completed, it will print the text if you put it in Main window. other wise statically it will print at a particular position where your window was placed.
Regards,
Venkatesh

Similar Messages

  • Printing text on last page of adobe form

    Hi abapers,
    My requirment is that i have to print a particular text in the footer.
    But this has to be printed only on the last page.
    how do i go about doing this.
    thanks in advance.

    Hi Aditya,
    Give the condition as.
    If &SFSY-NEXT-PAGE & = 0.
    print what text u wanna to print.
    endif.
    Best Regards,
    Flavya

  • Condition text on last page of Main window of a SAPSCRIPT

    Hi,
         I want to print some condition text in last page of a Main window of my custom sapscript, we can't use &NEXTPAGE& in Main window. Is there any other method to identify the last page.

    Hi Venu gopal,
    In the print program use the control break statement.
    Refer this code
    *AT LAST*
    call function 'WRITE_FORM'
           exporting
           element                          = 'GRAND_TOTAL'
    *   FUNCTION                            = 'SET'
    *   TYPE                                = 'BODY'
             window                         = 'MAIN'
    Regards,
    Sravanthi

  • Print text on last but one page of SmartForms

    Hello everyone,
       Here I have a very specific requirement in SmartForms which I am not able to do even after trying a lot of options.
       I want to print Items of PO in Main Window and I am printing total on a different window which should be printed at end of all Items.  Again this does not mean total is printed on last page, as the last page has Conditions which is default with every PO.
      So the requirement is to find out the last but one page at runtime and print the total. 
    Thanks.

    Hi Priya,
    Even I faced the same problem while creating invoice.
    Soln:
    declare a variable "g_counter" at global definition tab with data type "I'.
    In the main window just after your table and before the command line which you have used, create a program line and give input and output parameters as "g_counter"
    In the body of program line just write "g_counter = g_counter + 1".
    Make sure your total window is placed after the main window in sequence.
    Than in the total window you can put condition as "g_counter = 1".
    I am sure this issue will be reolved.
    Regards,
    Vinit

  • How to print in the last page of the script..?

    Hi,
    I am working on a script. I have a header window and one main window. In the main window, I am printing the line items of the Invoice. Once the line items finish, I have to print the sub totals there. and also to print the company agreement details(around 10 lines of text) in the last page of the script.
    So, <b>how to print the agreement details in the last page of the script..?</b>
    Can anyone provide me a sample code to find the last page of the Script layout..?
    And regarding writing the agreement details, is it better to hard code the text or use the standard texts..? which one is better..?
    Regards,
    Paddu.

    HI,
      Just create a Standard text, if you are going to use this standard text in other layouts also... and use it otherwise you can hard code it as this its of only 10 lines.
    declare one more element in the  main window itselft and call it atlast it would print in the last page..
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
    ELEMENT = 'FOOTER'<b><- This element should contain the agreement details</b>
    FUNCTION = 'SET'
    TYPE = 'BODY'
    WINDOW = 'MAIN'
    EXCEPTIONS
    ELEMENT = 1.
    Thanks
    Mahesh

  • Print total in last page,

    Hello Everyone
    In PLD i have a requirement whereby if the layout goes into more than a page says 2 pages,then the total should display "Continued in next page" in the 1st page and in the last page(in our case 2nd page) total should print the document total in the same area. How can this be done? How to achieve this if...then...else statement in PLD
    if CurrentPage()!=TotalPages()
    then "Continued in Next page"
    else Doctotal
    Thanks and Regards
    Raghu
    Edited by: Raghu Ram on Apr 7, 2009 12:38 PM

    Dear Raghu,
    If you would like to print certain fields on the last page only,
    'TotalPages()' cannot be used in formula, therefore, please follow the
    Workaround below.
    As a Workaround create the following field:
       Field_Formula
       General Tab
       Untick visible
       Left = 0 / Width = 0 / Top = 0 / Height = 0
       Content Tab
       Source Type: Formula
       SystemString(ContinueNextPageNotice) ==''
    And enter the ID of this field as the "Link to" for the Fields you
    like to print on the last page only.
    For more information please refer to the NOTE 1058584.
    Hope this helps.
    Regards,
    Gagan Thareja
    SAP Business One Forums Team

  • Printing of Boxes dynamically in main window

    Is it possible to provide some conditions in SAPScript (form) to add boxes depending on the presence of different number of document numbers?i.e if there are 10 document numbers 10 boxes to be provided.Can this be handled in Main window of the script?

    Hi,
    You can hnadle this,
    You need to write a perform in the Script. and get the No of records which are printed in the main window according to that maintain 2 variables in that whcih we use the window size in the layout.
    in the Main windoe element, write as
    BOX WIDTH '1.2' CM HEIGHT <b>&HEIGHT&</b> CM FRAME 10 TW
    BOX WIDTH '9.5' CM HEIGHT &HEIGHT& CM FRAME 10 TW
    BOX WIDTH '11.5' CM HEIGHT &HEIGHT& CM FRAME 10 TW
    BOX WIDTH '13.5' CM HEIGHT &HEIGHT& CM FRAME 10 TW
    BOX WIDTH '15.9' CM HEIGHT &HEIGHT& CM FRAME 10 TW
    BOX WIDTH '19.1' CM HEIGHT &HEIGHT& CM FRAME 10 TW
    Height field should be in the TOP of the Driver program , i mean it should be a global field. and maintain this Height according to your requirment.

  • Smartform problem how to make second page main window dynamic?

    Hi SAP Community,
    I am facing a problem with designing a smartform. I have taken a table in the main window of the first page, and the main window length varies according to the number of entries in the table. If the records are more than that can be adjusted in the first page then the ramaining records move to the second page main window. After the second page main window i have defined a window which i have marked to get displayed after the main window, but the problem i am facing is that that the second page main window is geting overlapped with the window defined to come after it. Can any one help me with how to control the length of second page main window dynamically.
    Regards,
    Tushar

    Hi,
    Normally, to trigger next page the main window is mandatory.
    However, if the contents of main window are not sufficient enough to move over to next page then the next page would not get trigerred.
    Moreover, please check whether the table of contents in the first page are also existing in the next page otherwise you need to trigger a new page by using a command.
    Also please direct the next page of SECOND page to SECOND itself and check.
    Regards,
    Ram

  • How to print a window (ex:total)only after end of main window in SAP Script

    How to print a window(ex: total) only after end of main window in SAP Script
    Thank you.

    Create a total window and place it after your main window, get the number of lines in your main window and place counter
    Ex,&SAPSCRIPT-COUNTER_1(+)&,
    IF SAPSCRIPT-COUNTER_1& EQ <number of lines in main window>
    **print total
    ENDIF.
    Regards,
    Sairam

  • Main Window in SAP Script

    Hi Guys,
    I wanted to know as to why is it possible to create multiple main window in SAP Script.
          In most theory it is written a SAP Script can only use 1 main window, If thats the case why is it still possible to create more than 1 of them.
          Can you explain its use and functionality.
    Helpful answers will be duly rewarded.

    Hi,
    U can have multiple main windows in Sapscripts(Upto 99)
    Main Windows (MAIN)
    Each form must have one window of type MAIN. Such a window is called the main window of the form. For SAPscript forms, the main window has a central meaning:-
    ? It controls the page break.
    ? It contains the text body that may cover several pages.
    ? It allows to fix text elements at the upper and lower margins of the allocated page window (for example, for column headings).
    As soon as a window of type MAIN is full, SAPscript automatically triggers a page break and continues to output the remaining text in the main window of the subsequent page. Page windows of type MAIN have the same width throughout the form. The SAPscript composer thus avoids reformatting of the text after each page break.
    If a page does not have a main window, the system implicitly processes all other windows of the page and continues with the subsequent page. This page must not call itself as subsequent page (recursive call), since this would produce an endless loop. In such a case, SAPscript terminates the output after three subsequent pages.
    For printing header lines or totals, the different output areas of the main window are of special importance.
    The diffetent Output areas of main window are
                                                                      TOP
                                                                      BODY
                                                                      BOTTOM
    its use and functionality.*
    Suppose you have requirement that you r displaying data from two line item tables which can flow multiple pages.
    In this case u have to use multiple mail windows.
    Regards
    Sandipan

  • Regarding Number of MAIN Windows in SAP Script.

    Hi,
    SAP Script allows to place a maximum of 99 MAIN Windows. Is it possible to have different content in different MAIN Windows i.e., if i have 2 MAIN Windows in SAP Script with numbers 00 and 01 can i have different contents in these two windows. If possible please give us an example for the same.
    Thanks in advance for your esteemed help.
    Regards,
    Raghavendra Goutham.

    HI All,
    Thanks for your esteemed replies.
    But i want to frame my question exactly.
    In my script there are two main windows with number
    MAIN 00 and MAIN 01.
    MAIN 00
    Content:
    /E  data
      abc,,def
    In MAIN 01 i want to have only XYZ, some thing like this
    MAIN 01
    /E total
    XYZ
    My problem is: whenever i am changing the content in MAIN 01, the content in MAIN 00 is also getting changed.
    I do not want this to change, i want different content in both of them. Is this possibel if so how.
    Thanks and Regards,
    Raghavendra Goutham.
    MAIN 01

  • Print a text on last page of smartform rpt

    Hi All
    I want to print a text on first and last page of report created in smartforms
    plz suggest..........

    Hi,
    In a Smart Form, you can use a similar MAIN window approach. For a secondary window, you might wish to use a conditional event such as <b>'Only After End of Main Window'</b>.
    Map page FIRST to NEXT and page NEXT to NEXT as you have done; page LAST does not need to be mapped to any other page. Make sure the MAIN window is contained on both page FIRST and page NEXT. Then add a command node within your MAIN window at the very end of this window (outside of any tables or loops). In its general attributes click on the 'Go to new page' and select the LAST page here.
    During form output, regardless of whether the MAIN window is completed within page FIRST or NEXT, page LAST will be triggered as your final page.
    Note: Any secondary windows on pages FIRST or NEXT with the condition 'only after end of MAIN window' may no longer print, as form output now will advance to the LAST page before this condition is satisfied.
    Regards
    Sudheer

  • Secondary window to be printed on the last page the form

    Hello,
    Is there any way, by which we can show the defined secondary window on the last page of the form in smartform?
    Only 1 page is defined in the smartform for the layout.
    e.g. If no. of line items exceeds more than the size defined for it in the main window, then a new page is taken to print rest of the line items. then total (defined in the secondary window) of the line items must be displayed on the the last page of the form only in this case the last page is 2nd.
    Thanks and Regards,
    Paresh

    >
    paresh rane wrote:
    > e.g. If no. of line items exceeds more than the size defined for it in the main window, then a new page is taken to print rest of the line items. 
    > Paresh
    put a counter on which you are getting the line items.
    for the last page, the counter should be equal to the number of line items in the table .. right?
    so.. keep the number of records in another variable, lets say in the global initialization part.
    and for the secondary window condition tab
    keep
    counter = gv_number_of_lines
    only when this condition satisfies, the window will be triggered. and this condition will only be satisfied if all the items are covered => last page.

  • JTable printing code produces blank last page on Windows LAF, OK on Metal

    I've been banging my head on this one for hours. I'm printing JTables, handling the pagination myself (built in Printable is far too limited). I've one table which can have a variable number of columns, with some column counts it's fine, with others the last page simply comes up blank. Because the scale adjusts it may have something to do with the number of rows on the last page. 5 or 6 it screws up, 20 or so it's fine.
    This is the code that prints the section:
        public void print(Graphics2D graphics, Rectangle2D area, int pageIndex, String pageLabel) throws PrinterException {
            Shape oldClip = graphics.getClip();
            AffineTransform oldXForm = graphics.getTransform();
    //        graphics.clip(area);
            double y = area.getY();
            graphics.translate(area.getX(), area.getY());
            if(resize) {
                double stretch = area.getWidth() / (double)table.getColumnModel().getTotalColumnWidth();
                graphics.scale(stretch, stretch);
            if(table.getTableHeader() != null) {
                table.getTableHeader().print(graphics);
                graphics.translate(0, table.getTableHeader().getHeight());
            Rectangle tableBlock = new Rectangle(table.getX(), table.getY(), table.getColumnModel().getTotalColumnWidth(), 0);
            int rowNo;
            int frp = firstRowOnPage.get(pageIndex);
            int frnp = pageIndex + 1 >= firstRowOnPage.size() ? table.getRowCount() :
                firstRowOnPage.get(pageIndex + 1);
            for(rowNo = 0; rowNo < frp; rowNo++)
                tableBlock.y += table.getRowHeight(rowNo);
            for(;rowNo < frnp; rowNo++)
                tableBlock.height += table.getRowHeight(rowNo);
            graphics.translate(0, -tableBlock.y);
            graphics.setPaint(Color.BLACK);
            graphics.draw(tableBlock);
            graphics.clip(tableBlock);
            table.print(graphics);
            graphics.setTransform(oldXForm);
            graphics.setClip(oldClip);
        }Bascially it selects the block of rows to print by setting a clip box on the whole table size, and translates to bring the block to the top of the page.
    The rectangle drawn to the clip box is fine. table.print simply doesn't paint anything.
    I'm starting to think this might be a bug in the Windows LAF TableUI, because I've just tried switching to Metal and it works fine. Anyone had similar problems?

    Similar problems, just not with printing a JTable. Your problem might be totaly different but I have found that components change size (dimensions) and sub component sizes (like table columns) when you view them on different look and feels.

  • Include text to be printed in the middle of main window

    hi Gurus,
    In SAP script - i have used include text ( which is a picture ) which i need to bring it nearly to the center of the main window. ie.,
    /: INCLUDE IMAGE1 OBJECT TEXT ID ST PARAGRAPH P1
    paragraph p1, i have made the alignment as centered.
    and i have changed it to
    /: include zhex-macro-image1 object text id st ----> also didnt work 
    posnr         matnr         then this image should come.
    but still the image is coming in the begining of the new line.  i want it to be continued with the previous line.
    please guide me.
    thanks.
    Sakthi.

    >
    sakthi sri wrote:
    > hi Prakash,
    >
    > i already did what u said. but the problem is that image should come only for that material. if suppose that material is going to come as the last material then how that image will come in the last. it always comes in the same window only what we difined. thats why i am trying to push it in the main window itself.
    >
    > did u got my problem?
    As i understand the image is to be shown conditionally.
    Try:
    {code]
    /: IF posnr = 'the position you want' AND matnr = 'matrn you want'
    /: INCLUDE IMAGE1 OBJECT TEXT ID ST PARAGRAPH P1
    /: ENDIF
    {code}

Maybe you are looking for