Box in MAIN window of sapscript keeps misaligning...

Hello Experts,
I am currently modifying a sapscript and inside the MAIN window, there is a box command that 'boxes' a
static text. But the problem is, the box misaligns since the number of line items is dynamic.
So, how can I make the box command to just 'box' the static text correctly even though the line item is
dynamic?

HI,
Declare the Box and Static text in the main window with a new text element after the text element of the line items . so it will print it in the end when all of the Line items are printed..
(or)
Just create another script with the BOX and the text you want inside the BOX. i.e. this becomes another script which is separate from the line items you are printing there.
call this script in your driver program with start_form FM.
REPORT  YTEST_SCRIPT.
DATA:
  ITAB TYPE TABLE OF SFLIGHT,
  FS TYPE SFLIGHT.
SELECT * FROM SFLIGHT INTO TABLE ITAB.
CALL FUNCTION 'OPEN_FORM'
  EXPORTING
    FORM                              = 'ZSCRIPT_TEST'.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT ITAB INTO FS.
  CALL FUNCTION 'WRITE_FORM'
    EXPORTING
      ELEMENT                        = 'TEST'
      WINDOW                         = 'MAIN'.
  IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDLOOP.
CALL FUNCTION 'END_FORM'.      "---------->Ends the previous form
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'START_FORM'    "------------> Starts your new script with BOX and Static text
  EXPORTING
    FORM                   = 'ZSCRIPT_TEST1'.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
    ELEMENT                        = 'TEST'
    WINDOW                         = 'MAIN'.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'CLOSE_FORM'.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
This will print the BOX and the Static text in a new page after the line items got printed..
This will solve your issue...
Thanks&Regards
Sarves

Similar Messages

  • Drawing box in main window of sapscript form

    Hi all,
    I am developing a script for vendor balance confirmation report, in which I have to provide check boxes to allow the user to select an option.
    My problem is if I use the BOX statement to draw the box the alignment keeps changing when the size of vendor address changes.
    i.e the boxes moves up and down
    I have another reference script in which they used the following statement to draw the box <527>.
    Please suggest a way to use statement like this <527>
    Thanks,
    Rajan

    Try it as shown below for drawing dynamic boxes.
    Here the code works this way the YORIGIN is incremented by 0.6CM each time it is in the loop thus drawing tables dynamically.
    /E TAB
    /: POSITION XORIGIN '0.9' CM YORIGIN '+0.6' CM
    /: SIZE WIDTH '3.0' CM HEIGHT '0.6' CM
    /: BOX FRAME 10 TW.
    /: POSITION XORIGIN '3.9' CM
    /: SIZE WIDTH '7.3' CM HEIGHT '0.6' CM
    /: BOX FRAME 10 TW.
    /: POSITION XORIGIN '11.2' CM
    /: SIZE WIDTH '2.8' CM HEIGHT '0.6' CM
    /: BOX FRAME 10 TW.
    /: POSITION XORIGIN '14' CM
    /: SIZE WIDTH '2.6' CM HEIGHT '0.6' CM
    /: BOX FRAME 10 TW.
    /: POSITION XORIGIN '16.6' CM
    /: SIZE WIDTH '3.2' CM HEIGHT '0.6' CM
    /: BOX FRAME 10 TW
    P4 &X_VBAP-KWMENG(C)&,,&X_VBAP- ARKTX&,,&V_TOTALa&,,&V_TOTALb&,,&V_TOTALc&
    the driver program's piece of code.
    LOOP AT it_vbap INTO x_vbap.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
    element = 'TAB'
    window = 'MAIN'
    EXCEPTIONS
    element = 1
    function = 2
    type = 3
    unopened = 4
    unstarted = 5
    window = 6
    bad_pageformat_for_print = 7
    spool_error = 8
    codepage = 9
    OTHERS = 10.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDLOOP.
    Regards,
    SaiRam

  • Box in main window extend to next page in sapscript

    Hi all,
    I am trying to put box in main window in sapscript.
    contents of main window extends  to more than 1 page.
    Box  is appearing on first page but is not extending to other pages.
    Pl help,
    Regards
    Senthil

    Hi,
    Please refer this thread.
    Link: [sapscript box nto printed on all pages;
    Hope this will help you.
    Regards,
    Renuka S.

  • Box in main  window of script is not printing

    Helllo Friends
    Box in main window of script is not printing but the same is available in print preview. I have use the following commands.
    Please help me.
    /:           BOX WIDTH '23.40' CM FRAME 20 TW
    /:           BOX XPOS '0.00' CM YPOS '1.40' CM WIDTH '23.40' CM FRAME 25 TW
    /:           BOX XPOS '0.00' CM YPOS '8.10' CM WIDTH '23.40' CM FRAME 25 TW
    /:           BOX XPOS '0.00' CM YPOS '9.00' CM WIDTH '23.40' CM FRAME 25 TW
    /:           SIZE  WIDTH '0.00' CM HEIGHT '8.10' CM
    /:           BOX XPOS '0.00' CM  FRAME 25 TW
    /:           BOX XPOS '0.50' CM  FRAME 10 TW
    Thanks In Advance
    Regards
    SUNITHA

    Try changing X postion to not equal to zero something else for example.
    /:           POSITION WINDOW
    /:           POSITION XORIGIN '-0.1' CH YORIGIN '+0.4' LN
    /:           SIZE WIDTH +0.7 CH HEIGHT +5.0 LN
    /:           BOX FRAME 7 TW
    /:           BOX HEIGHT '1.1' LN INTENSITY 15
    Nabheet

  • Printing digital signature in main window of sapscript at some location

    Hi,
    I want to print graphics in main window in sapscript. I want to position the graphic ( signature) at some position (preferably right aligned ). How to do that? Can we do that in .bmp graphics. In case we use .tiff format , how to do it. Tell me the steps involved as I have never used RSTXLDMC to upload .tiff files.
    Regards,
    D.Mallick

    Hi
    Just open rstxldmc in se38 and execute.
    It will gve you a screen. You need to fill the first two blocks only. Remaining are optional.
    File Name :  Give pathe+name of your .tiff file
    Type         : Bcol for colour     and bmon for mono
    Resolution      : say 75 (as you wish)
    Second block
       Text name :   only replace astrick by your name ZHEX-MACRO- has to be there.
    Actually  this program will convert .tiff file into text file.
    you can include this text file in any window. Text name is the name of the text file generated
    no more changes
    Now execute.
    Now you can use this text file  ZHEX-MACRO-name   in any windoow
    If useful, give me points
    cheers
    vamshi

  • Printing dynamic box in main window in scripts

    hi ,
    I want to print the dynamic box in main window of my script.
    Ex. Suppose the content of the main window is 5 lines so it should print box for 5 those lines only.

    Hi,
    Create a Main window with only 2 lines, Give a BOX command it will give u Border for entire Main window.
    /:BOX FRAME 10 TW
    For giving vertical lines Syntax is
    /:BOX XPOS 16 CH YPOS 0 LN WIDTH '0' CM HEIGHT 2 LN FRAME 10 TW
    It gives u a vertical line at 16 character. so for ur requirment add another command at another XPOS.
    Try this below just below ur ITEM ELEMENT which has the display fields.
    Main Window
    /E ITEM_A
    A,,,,&ITAB-ABC&,,&ITAB-XXX&,,&ITAB-CDE&,,&ITAB-GEF&
    /:BOX FRAME 10 TW
    /:BOX XPOS 16 CH YPOS 0 LN WIDTH '0' CM HEIGHT 2 LN FRAME 10 TW
    /:BOX XPOS 26 CH YPOS 0 LN WIDTH '0' CM HEIGHT 2 LN FRAME 10 TW
    /:BOX XPOS 36 CH YPOS 0 LN WIDTH '0' CM HEIGHT 2 LN FRAME 10 TW
    /:BOX XPOS 46 CH YPOS 0 LN WIDTH '0' CM HEIGHT 2 LN FRAME 10 TW
    Change XPOS according to ur requirement.
    Now add another main window to the same page with changing UPPER margin, U can add upto 99 Main windows in one page.
    So add upto ur Page is full.
    For headings
    Create a Variable window same as Main window, in place of fields, give descriptions.
    Make sure that u give BOX command below the field declaration, if u give above, for last record it will not print box.
    Regards
    Bala Krishna

  • DRWAING BOXES IN MAIN WINDOW

    HOW TO DRAW BOXES IN MAIN WINDOW WITH OUT USING BOX XPOS

    u can draw dynamic boxes by using uline n vline options. But it takes a lot of time, and is suggestible only if it is very critical. Just try out.
    By using uline and vline, you can draw lines dynamically. Also u can specify the width too ... eg ... uline(120). Dont forget to specify the font style ans size of the font.

  • Box in main window (sapscript) problem.

    Hi, all.
    I meet a weird problem....
    I have 2 pages form which have 2 same MAIN window and of course their source code is same one. But when I run the output form, I found that one of the page which main window's box is disappear, while the other page no problem.
    How come like this? Should be the box appear in both MAIN window, right? Hope someone can guide me.
    Thanks in advance.

    Boxes in the main window only get printed in the first page, unless you include them in an element and explicitly call the, But of course that's not the way to go.
    Every other window in the same page which has content that's not inside one element gets printed every page. So to solve your problem, declare another window (perhaps called BOXES) with the appropiate dimmensions and define in it the boxes you need. Replicate this BOXES in the other pages (if you use different page formats inside the sapscript) or leave it in the First page (if it's the only one in the sapscript). The boxes will now print in every page.

  • Box inside Main window issue in Scripts

    I have issue in placing a box inside the main window. I would like to display text with a box frame at end of the line items.
    I tried creating seperate FOOTER window in the Last page, but it dint work as expected, since if the line items ended in the first page then the LAST page did not trigger and one more complication was if there were 4 pages, then there was blank window (FOOTER) in 2 pages and it looks ugly.
    I tried putting the box frame by using text element, calling after the end of the line items. The text displayed as needed, but the frame was misaligned.
    Kindly help me. Thanks in advance.
    Have a great weekend.

    Raj,
    Try to find out which text element is trigerring after the line items text element while debuging the script  and then place the box code in that text element.
    regards.

  • Positioning box in Main Window

    I have a main window (Sapscript) with multiple text elements as follows:
    <Start Text Element1>
    Include statement with varying text length
    <End Text Element1>
    <Start Text Element2>
    Include statement with varying text length
    <End Text Element2>
    <Start Text Element3>
    I need a box to appear here with item header. ****
    <End Text Element3>
    How can I position the box in the 3rd text element section ? The text appearing in Text Element1 & Text Element2 are not fixed in length. I will not know where text element 3 starts.

    Hi...
    You can do like this.
    BOX XPOS  YPOS   WIDTH 10 CM HEIGHT 10 CM
    INCLUDE TEXT
    INCLUDE TEXT
    INCLUDE TEXT.
    Here, you need to change your XPOS and YPOS accordingly
    So that your Third text will be fit in the Box.
    Regards
    Sandeep Reddy.
    Edited by: Sandeep Reddy on Dec 31, 2007 11:34 AM

  • How to do SUBTOTAL AND TOTAL in Main Window of SAPSCRIPT.

    Hello Friends,
    I am modifying standard SAPSCRIPT of packing slip. My client wants a subtotal and total in Main Window of Script for Eg. (They want Material Number wise Subtotal and finally Grandtotal at bottom in Main Window)
    Now i got stucked up here how to do it ?
    here is my sample code.
    LOOP AT XVBPLP WHERE VENUM = SHENR.
    IF XVBPLP-POSNR IS INITIAL.
        Versandelement
          PERFORM PACKING_TREE USING XVBPLP-UNVEL.
        ELSE.
        Lieferposition (Anteil)
          VBPLP = XVBPLP.
      CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            ELEMENT = 'DELPOS'.                     "Main Window call
    clear vbplp.
    ENDLOOP.
    Pls guide me for the same.

    HI,
    For the Line items, put a ELEMENT in the Smartform, and you will call this with in the LOOP and ENDLOOP, so here with in the LOOP count the TOTAL value.
    then create new element after the Line item Element, and call this Element after the Line items prints,
    /E  LINE_ITEM
      &1& &2 & &3&     " This will be in the loop and you need to caliculate the totla here
    /E SUB_TOTAL.
    &SUb_TOTAL&  " After all the line items pritns then call this Element
    Regards
    Sudheer

  • Printing of boxes in Main window of SAP Script at 2 different locations

    Hi Experts,
      I have an requriement in SAP script, I want to draw two boxes. The first box will be at the beginging of main window with 0.5 cm, which is comming perfectly. After the first box I have to display the entries related to a particular table, after the completion of that table I need to draw another box of lenght 0.5cm and the entries related to another table, needs to be displayed.
    I am able to get the first box with intensity, but for the second box I am not getting exact position where i need to draw a dynamic box by filling intensity.
    For that reason i have drawn two ulines and wrote the text, is there any way to fill internsity in between those lines.
    Thanks
    Ravi.

    Hi Sujeet,
    I already tried with that command, the problem is in between two boxes I dont know how many lines of data will come.
    There is a need of drawing a box dynamically.
    Thanks
    Ravi

  • How to get watermark in main window of SAPSCRIPT FORM

    can anyone help me to get watermark in a SAPSCRIPT FORMS
    in all pages

    Hi vinod,
    Thanks for reply I have tried but its not working.
    I have 2 main window one "main" and other "Main01". In the main 01 I have insert Bitmap command. I have other values to display  main.
    watermark is not coming second page.
    As u said I have given New-window the bitmap was not displaying.
    Please can u give details idea in this regards
    Thanks
    Regards
    Prashanth.

  • Main window of SAPScript versus Main window of smartform

    Hi,
    In case of Smartform we have one main window per page but in case of SAP Script we can have 0 to 99 Main window on one page.
    In case of smartform if the main window on one page gets filled then the remaining long text will jump on main window of second page.
    Following are my doubts:
    If I define three MAIN windows for three different kind of long texts on page one in SAP Script as follows:
    MAIN Window 1 -  Long text1
    Main Window 2 -  Long text2
    Main Window 3 -  Long text3
    1) If the long text 1 on MAIN window 1 of first page gets full does it automatically jump to Main Window 2 of first page ?
    2) If I don't want the long text on Main Window 1 to jump on Main window 2 on first page but on Main winodw 1 of next page , is it possible ? How do I do it ?
    Answers will be rewarded..
    Tushar.

    In SAPScripts if the long text is filled in the Main Window it will spill over into the same Main Window if it is defined in the next page. Text from one Main Window will nt spill over onto the text to different Main window.
    So as far as you questions are concerned:
    1. Not it does not automatically jump over into Main Window 2 from Main Window 1 on same page or next page.
    2. You just need to define the Same Main Window on the next page so that text gets jumped over to the next page. If it is possible just define the next page as the same page, so that you do not have to create a separate page and attach all the windows.
    Hope this helps you...
    Shashi Reddy

  • How to include a main window in sapscript

    hi all ,
        i just create a sapscript , and i found on sap online help that i could include main window up to 99 times ,  but i don't know how to include another main window.
    regards

    Hi Kevin,
    first Goto T-code SE71 create one test script in that design the layout in the normal method once your design is complete than there one option called EDIT
    in that EDIT-> window>creat-> vraible
                                                          main
    select the option main window placed this window according to u r requriment it will displayed as per logic.
    one imporatant point whn u place scond main window it take diffrent higt but it will not take differnt width so u can place scond main wiindow with differnt hight but not not in width.
    reward is usefull.
    thanks.

Maybe you are looking for