Dynamic BOX in sapscript

Hi,
I am using the BOX control command in SapScript.
Is it possible to assign the values of Xpos and Ypos
dynamicalliy.
In BOX XPOS 16 CH WIDTH 0 MM HEIGHT 18 MM FRAME 10 TW,
i want to assign the values at runtime, instead of
xpos 16 , something like Xpos Var, where var contain the value of xposition.
or any other method to print dynamic box in sap script

Hi
yes it is possible
see this
SAPScripts
POSITION WINDOW
SIZE WIDTH '160' MM HEIGHT '140' MM
BOX FRAME 10 TW
Box
BOX HEIGHT '11' MM WIDTH '160' MM FRAME 10 TW INTENSITY 35
linessssssss
BOX XPOS '20' MM WIDTH 0 TW HEIGHT '140' MM FRAME 10 TW
BOX XPOS '45' MM WIDTH 0 TW HEIGHT '140' MM FRAME 10 TW
BOX XPOS '80' MM WIDTH 0 TW HEIGHT '140' MM FRAME 10 TW
BOX XPOS '120' MM WIDTH 0 TW HEIGHT '140' MM FRAME 10 TW
Boxes, Lines, Shading: BOX, POSITION, SIZE
Use the BOX, POSITION, and SIZE commands for drawing boxes, lines, and shading to print particular windows within a form or passages of text within a window in a frame or with shading.
The SAP printer drivers that are based on page-oriented printers (the HP LaserJet driver HPL2, the Postscript driver POST, the Kyocera Prescribe driver PRES) employ these commands when printing. Line printers and page-oriented printers not supported in the standard ignore these commands. You can view the resulting printer output in the SAPscript print preview.
Syntax:
/: BOX [XPOS] [YPOS] [WIDTH] [HEIGHT] [FRAME] [INTENSITY]
/: POSITION [XORIGIN] [YORIGIN] [WINDOW] [PAGE]
/: SIZE [WIDTH] [HEIGHT] [WINDOW] [PAGE]
BOX Command
Syntax
/: BOX [XPOS] [YPOS] [WIDTH] [HEIGHT] [FRAME] [INTENSITY]
Effect: draws a box of the specified size at the specified position.
Parameters: For each of XPOS, YPOS, WIDTH, HEIGHT, and FRAME, you must specify both a measurement and a unit of measurement. Specify the INTENSITY parameter as a percentage between 0 and 100.
XPOS, YPOS
Upper left corner of the box, relative to the values of the POSITION command.
Default: Values specified in the POSITION command.
The following calculation is performed internally to determine the absolute output position of a box on the page:
X(abs) = XORIGIN + XPOS
Y(abs) = YORIGIN + YPOS
WIDTH
Width of the box. Default: WIDTH value of the SIZE command.
HEIGHT
Height of the box. Default: HEIGHT value of the SIZE command.
FRAME
Thickness of frame.
Default: 0 (no frame).
INTENSITY
Grayscale of box contents as %.
Default: 100 (full black)
Measurements: You must specify decimal numbers as literal values (like ABAP numeric constants) by enclosing them in inverted commas. Use the period as the decimal point character. See also the examples listed below.
Units of measurement: The following units of measurement may be used:
TW (twip)
PT (point)
IN (inch)
MM (millimeter)
CM (centimeter)
LN (line)
CH (character).
The following conversion factors apply:
1 TW = 1/20 PT
1 PT = 1/72 IN
1 IN = 2.54 CM
1 CM = 10 MM
1 CH = height of a character relative to the CPI specification in the form header
1 LN = height of a line relative to the LPI specification in the form header
/: BOX FRAME 10 TW
Draws a frame around the current window with a frame thickness of 10 TW (= 0.5 PT).
/: BOX INTENSITY 10
Fills the window background with shading having a gray scale of 10 %.
/: BOX HEIGHT 0 TW FRAME 10 TW
Draws a horizontal line across the complete top edge of the window.
/: BOX WIDTH 0 TW FRAME 10 TW
Draws a vertical line along the complete height of the left hand edge of the window.
/: BOX WIDTH '17.5' CM HEIGHT 1 CM FRAME 10 TW INTENSITY 15
/: BOX WIDTH '17.5' CM HEIGHT '13.5' CM FRAME 10 TW
/: BOX XPOS '10.0' CM WIDTH 0 TW HEIGHT '13.5' CM FRAME 10 TW
/: BOX XPOS '13.5' CM WIDTH 0 TW HEIGHT '13.5' CM FRAME 10 TW
Draws two rectangles and two lines to construct a table of three columns with a highlighted heading section.
POSITION Command
Syntax
/: POSITION [XORIGIN] [YORIGIN] [WINDOW] [PAGE]
Effect: Sets the origin for the coordinate system used by the XPOS and YPOS parameters of the BOX command. When a window is first started, the POSITION value is set to refer to the upper left corner of the window (default setting).
Parameters: If a parameter value does not have a leading sign, then its value is interpreted as an absolute value, in other words, as a value that specifies an offset from the upper left corner of the output page. If a parameter value is specified with a leading sign, then the new value of the parameter is calculated relative to the old value. If one of the parameter specifications is missing, then no change is made to this parameter.
XORIGIN, YORIGIN
Origin of the coordinate system.
WINDOW
Sets the values for the left and upper edges to match those of the current window (default setting).
PAGE
Sets the values for the left and upper edges to match those of the current output page (XORIGIN = 0 cm, YORIGIN = 0 cm).
/: POSITION WINDOW
Sets the origin for the coordinate system to the upper left corner of the window.
/: POSITION XORIGIN 2 CM YORIGIN '2.5 CM'
Sets the origin for the coordinate system to a point 2 cm from the left edge and 2.5 cm from the upper edge of the output page.
/: POSITION XORIGIN '-1.5' CM YORIGIN -1 CM
Shifts the origin for the coordinates 1.5 cm to the left and 1 cm up.
SIZE Command
Syntax
/: SIZE [WIDTH] [HEIGHT] [WINDOW] [PAGE]
Effect: Sets the values of the WIDTH and HEIGHT parameters used in the BOX command. When a window is first started, the SIZE value is set to the same values as the window itself (default setting).
Parameters: If one of the parameter specifications is missing, then no change is made to the current value of this parameter. If a parameter value does not have a leading sign, then its value is interpreted as an absolute value. If a parameter value is specified with a leading sign, then the new value of the parameter is calculated relative to the old value.
WIDTH, HEIGHT
Dimensions of the rectangle or line.
WINDOW
Sets the values for the width and height to the values of the current window (default setting).
PAGE
Sets the values for the width and height to the values of the current output page.
/: SIZE WINDOW
Sets WIDTH and HEIGHT to the current window dimensions.
/: SIZE WIDTH '3.5' CM HEIGHT '7.6' CM
Sets WIDTH to 3.5 cm and HEIGHT to 7.6 cm.
/: POSITION WINDOW
/: POSITION XORIGIN -20 TW YORIGIN -20 TW
/: SIZE WIDTH +40 TW HEIGHT +40 TW
/: BOX FRAME 10 TW
A frame is added to the current window. The edges of the frame extend beyond the edges of the window itself, so as to avoid obscuring the leading and trailing text characters.
http://esnips.com/doc/1ff9f8e8-0a4c-42a7-8819-6e3ff9e7ab44/sapscripts.pdf
http://esnips.com/doc/1e487f0c-8009-4ae1-9f9c-c07bd953dbfa/script-command.pdf
http://esnips.com/doc/64d4eccb-e09b-48e1-9be9-e2818d73f074/faqss.pdf
http://esnips.com/doc/cb7e39b4-3161-437f-bfc6-21e6a50e1b39/sscript.pdf
http://esnips.com/doc/fced4d36-ba52-4df9-ab35-b3d194830bbf/symbols-in-scripts.pdf
http://esnips.com/doc/b57e8989-ccf0-40d0-8992-8183be831030/sapscript-how-to-calculate-totals-and-subtotals.htm
Reward points for useful Answers
Regards
Anji

Similar Messages

  • How to draw a dynamic box in sapscript?

    Hello experts,
    I am currently facing a problem wherein in the main window I have multiple line items. What I want to do is that for every new line item, I would draw a box and so on...for example:
    BOX 1
    BOX 2
    BOX 3
    Here is the attributes of the main window where I would like the boxes to be drawn:
    MAIN    00 Main window                    2,00 CH  15,00 LN  78,00 CH  30,00 LN

    hi vijay please try out this code,
    u have to keep all the code as single text element,
    POSITION XORIGIN 2 CM YORIGIN +9 MM
    " the next  two ines will dra a box
    SIZE WIDTH 180 MM HEIGHT 40 MM
    BOX FRAME 30 TW
    OSITION XORIGIN 2 CM YORIGIN +9 MM
    SIZE WIDTH 180 MM HEIGHT 0 MM
    BOX FRAME 30 TW
    POSITION XORIGIN 2 CM YORIGIN +12 MM
    SIZE WIDTH 180 MM HEIGHT 0 MM
    BOX FRAME 30 TW
    POSITION XORIGIN 8 CM YORIGIN -21 MM
    SIZE WIDTH 0 MM HEIGHT 40 MM
    BOX FRAME 30 TW
    POSITION XORIGIN 2 CM YORIGIN +43 MM

  • Write dynamic box using sapscript

    I would like to write two box layout. but each box layout are variants, so i can wirte a fixed height. how can i when the first box is finished, then close the bottom line, and the start to write second box and the close. Thanks!

    I would like to write two box layout. but each box layout are variants, so i can wirte a fixed height. how can i when the first box is finished, then close the bottom line, and the start to write second box and the close. Thanks!

  • SAPscript - Dynamic box position and height.

    Greetings...
    How to print dynamic box according to the Element. I have an element with looping condition when i used box the line only printed on the first loop, but and no line printed on the next looping even though its is  different element.. Below is the sneak peak of my code.
    /E 101
    /:   BOX WIDTH 0 MM HEIGHT '2' MM FRAME 20 TW
    /:   POSITION YORIGIN '+2' MM
    W2   <B>&text&</><B>,,&zvalue&</>
    Thank you

    Hi
    it is very hard to print a dynamic box with sapscript.
    It is more easy to develop a new-smartform then to develop a dynamic box.
    i know only 1 sapscript which is using dynamic boxes. I do not know the sapscript only the fucntional name we use. That is shopfloor papers (for a production order). It has a good combination of printprogram and sapscript which both has to be working together to get it done. Try to find it and study it. Then you will find out how it works.
      There is no way to get it done with only changes in your sapscript.
    an alternative is to use tab's and '|' and ulines to make something that look a bit like boxes.
    Hope this will help you out.
    Gr., Frank

  • Dynamic Box Formatting in Scripts

    Hi,
    My requirement is ,
    This is regarding to SAPScripts.
    I should populate some data in a box.
    The box should adjust depending upon the data.( Whether the data is 2 lines or 10 lines).
    Help me out.
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Jul 8, 2008 11:21 AM

    Hi Manjunath,  
    Here is the code which can help you get the dynamic box's from the script.
    Here the element is TAB.
    There is a loop for this element in the driver program.
    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&
    Hope this Solves your Problem in dynamic Table drawings.
    <REMOVED BY MODERATOR>
    Thanks,
    Tej..
    Edited by: Alvaro Tejada Galindo on Jul 8, 2008 11:21 AM

  • Dynamic Box's

    Hi All,
        I have a one question , in SAP Scripts/Smartforms how can i draw a dynamic box's.  if there is one record one box (Like  Table with 3 Cells(rows & coloums))  has to appear, if it is 2 ,two box's has to appear depending up on the records.
    Please if any one having the code3 or path to slove this Problem, please give me the advice.
    Thanks very much in advance for your answer.
    Naren

    In print program, something like this
    data: ypos(5), ht(5).
    move '1.75' to ypos.
    move '3.00' to ht.
      call function 'WRITE_FORM'
           exporting
                element   = 'HEAD'
           exceptions
                element   = 01
                function  = 02
                type      = 03
                unopened  = 04
                unstarted = 05
                window    = 06.
      if sy-subrc ne 0.
        message e205 with 'WRITE_FORM failed.' sy-subrc element.
      endif.
    And in the SAPScript:
    /E   HEAD                                     
    /:   BOX YPOS &YPOS& LN HEIGHT &HT& LN INTENSITY 10
    Regards,
    SaiRam

  • 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

  • Output a shaded box in SAPScript with Dot Matrix Printer

    Hi guys,
    Is there a way to print a shaded box in Sapscript using Dot matrix printer?
    BOX XPOS '4'CM YPOS '2.8'CM WIDTH '2'CM HEIGHT '0.4'CM FRAME 10 TW INTENSITY 100
    I tried the code as above but it wouldn't work, and doing a search on this forum tells me box command wouldn't work on dot matrix printer. So is there any alternative to do this?

    Hi
    if it is possible try to print the same in another printer and confirm the problem
    no doubt certain printers may create such problems while printing the output
    so to confirm the problem try with other printer.
    Reward points for useful Answers
    Regards
    Anji

  • Dynamic box in smartforms

    hello gurus,
    i have to populate  dynamic boxes this is the scenario  any ideas...i mean how can i put this in smartform way...
    I
    f gift order <> 1
    Determine how many VALUES we have based on ship_charge, subtotal, promotion_amt and order_total.Think the max is 4
    Based on this count this determines the number of boxes
    This count will also determine which values are output
    Need to consider if promotion amount is negative then need to put negative sign before '£' sign
    Else.
    No boxes/prices are shown
    Endif.

    HI ,
    Use tables .
    right Click->create->tabels
    In data tab  , in loop to
    give the name of the internal table  and work area
    as  :  it_ekpo  into   is_ekpo
    In tables tab click details button
    Under line type 1 specify the size for each row of the table.
    The toal size of all the columns should not exceed the total window width .
    In the same line as details u can see the lines  and boxes .  using that u can fill the borders of the cell with lines .  Click on the cell and select the appropriate  line . When u display the line will be displayed as the border of the cell .
    Save chek activate
    Right click on main area and click tabline.
    Under line type specify the line type created in table .
    Then in each cell right click and create text  . and put variable as
    &is_abc-ebeln&.
    Regards

  • Sap script creating dynamic box problem

    Hi all,
    I am unable to create dynamic box in sap script.
    Because the printing lines in the main window changing from one customer to another customer.
    So could you please guide me how to create a dynamic box in sap script and also how to know the printing line nunber in main window.
    Advance thanks for your suggestion
    Regards,
    Sudhakar.

    In script form u can write following code
        /:       DEFINE &MY_XPOS& = ' '
        /:       DEFINE &MY_YPOS& = ' '
        /:       DEFINE &MY_HEIGHT& = ' '
        /:       DEFINE &MY_WIDTH& = ' '
        /:       PERFORM GET_BOX_SIZE IN PROGRAM Z_MY_PROG
        /:       CHANGING &MY_XPOS&
        /:       CHANGING &MY_YPOS&
        /:       CHANGING &MY_HEIGHT&
        /:       CHANGING &MY_WIDTH&
        /:       BOX XPOS '&MY_XPOS' MM  YPOS '&MY_YPOS' MM  HEIGHT '&MY_HEIGHT' MM WIDTH '&MY_WIDTH' MM INTENSITY 10 FRAME 0 TW
    In report u can write following code
    Form Get_Box_Size TABLES IN_PAR  STRUCTURE ITCSY
                             OUT_PAR STRUCTURE ITCSY.
         Loop at Out_Par.
              Case Out_Par-Name.
                   When 'MY_XPOS'.
                         Out_Par-Value = 100.
                   When 'MY_YPOS'.
                         Out_Par-Value = 57.
                   When 'MY_HEIGHT'.
                         Out_Par-Value = 300.
                   When 'MY_WIDTH'.
                         Out_Par-Value = 'Does it matter?'.
              EndCase.
              Modify Out_Par.
         EndLoop.
    EndForm.

  • Dynamic Box in script

    Hi,
    I have a script which currently prints a number of item details.
    Users want to change the layout so that the result is given in tabular format,i.e, the item details need to be displayed in rows and column format. As the number of items can vary, could you please help me with the logic of displaying this using script?
    Thanks in advance,
    Neethu

    Hi,
    Creating dynamic boxes in script is possible but formatting and getting proper allignment is very tedious job. I had similar requirement for creating dynamic boxes in SAP Script, but getting right allignment of those boxes was not possible and hence I switched to smartform. So I would advise you the same to use smartform for such type of requirement. In smartforms it becomes very easy.
    Still try the following syntax:
    /:POSITION XORIGIN '5' CM YORIGIN '5'CM
    /:SIZE HEIGHT '0' CM WIDTH '0' CM
    /:BOX FRAME 10 TW INTENSITY 10
    Hope this helps.
    Reragds,
    Abhijeet

  • Dynamic logo in sapscripts

    hi all,
    How do i create dynamic logo in sapscripts. i need to change the logo depending upon the company code. and there are 10 company codes. i have done my logic but how do i keep my variable.
    my varaible: complogo.
    thanxs in advance.

    Hi hari,
    make an if-statement for burks. You have to insert
    the logos as stadart-text.
    do this in script
    IF &BUKRS& = '0001'
    INCLUDE Z00001 OBJECT TEXT ID ST
    ENDIF
    IF &BUKRS& = '0002'
    INCLUDE Z00002 OBJECT TEXT ID ST
    ENDIF
    regards, Dieter

  • Dynamic BOX-es in SAPScript

    Hi!
    I would like to reduce the coding in my SAPScript so I would like to use variables to position the BOX-es.
    I would like to write a line with values, and print a box around the items.
    I imagined it somehow like this:
    /E ITEMS
    /: &wa_pa0002-nachn& &wa_pa0002-vorna& (&wa_pa0002-pernr&)
    /: BOX XPOS 0 CM YPOS &GV_Y_POS& CM HEIGHT 1 CM WIDTH 10 CM FRAME 10 TW
    The &GV_Y_POS& is manipulated in the printer program. Anyways it is not working.
    Any ideas?
    Thank you in advance
    Tamá

    This is the way I do it...And it works for me -;)
    SIZE WIDTH '0.7' CM HEIGHT '0.4' CM
    BOX FRAME 1 TW XPOS '0.0' CM YPOS &G_LINE1& CM
    Greetings,
    Blag.

  • Dynamic box position in SAPscript

    Hello,
    I need to put a box in the Main window after I print all line details and other things on the invoice. How can I find the current line position (Y position), so I can pass it to the POSITION command.
    Thanks
    Igor

    Hi Rich, Sam and Rob,
    Thanks for you reply. This is exactly what I need.
    I need to print totals box after the details on the same page of the invoice. The number of detail lines (and pages) is variable. That's why I have to put it in the Main window.
    Now it is printed on separate page (next page), but they want it on the same page as details if it fits.
    I was thinking about counting lines, but since there is a logo, address, headers, details, etc and all are printed in different fonts, this will be very difficult exercise.
    Any more ideas?
    Thanks
    Igor

  • PLZ HELP SAP SCRIPT ISSUE (DYNAMIC BOX)

    Hi all
    I want to include a dynamic text (means number of lines can vary) inside a box .
    please guide me how i can create this box whose size would be dynamic according to this text.
    plz help i am not able to find ne solution
    Thanx in advance
    Edited by: SARABPREET CHADHA on Mar 14, 2008 11:33 AM

    Following things to be done in Driver program.
      CALL FUNCTION 'READ_TEXT'
        EXPORTING
          ID              = TEXT_ID
          LANGUAGE        = PRINT_LANGUAGE
          NAME            = TEXT_NAME
          OBJECT          = TEXT_OBJECT
        IMPORTING
          HEADER          = TABLE_HEADER
        TABLES
          LINES           = TABLE_LINES
        EXCEPTIONS
          ID              = 01
          LANGUAGE        = 02
          NAME            = 03
          NOT_FOUND       = 04
          OBJECT          = 05
          REFERENCE_CHECK = 06.
    then
      CALL FUNCTION 'WRITE_FORM_LINES'
        EXPORTING
          HEADER    = TABLE_HEADER
          WINDOW    = WINDOW
        IMPORTING
          FROMPAGE  = FROMPAGE       " not interested ?
        TABLES
          LINES     = TABLE_LINES
        EXCEPTIONS
          FUNCTION  = 01
          TYPE      = 02
          UNOPENED  = 03
          UNSTARTED = 04
          WINDOW    = 05.
    and then in sap script.
    /:           INCLUDE &THEAD-TDNAME& OBJECT &THEAD-TDOBJECT& ID &THEAD-TDID&
    /:           PARAGRAPH T6 LANGUAGE
    Your text will apper in sapscript.
    Award points if useful...

Maybe you are looking for

  • Video playback from Final Cut Pro studders over HDMI

    I have a problem playing back video from FCP. The video output will studder during horizontal pans when I output via HDMI. The audio output is not affected. I have been playing video successfully using FireWire for output in FCP, however, my new vide

  • ALV Display Problem

    Dear Experts, I m working on ALV Report, User has 3 options : Open item, Clear Item and All item. ALV output is fine for open and clear item. but when user choose All item,  it displays every column twice. For reference code is like IF r_open = 'X'.

  • Parameter Passing between pages- process not picking up on changes

    Hello, new user, this is a different question than before. I have a drop-down list box on Page 1, upon which the user can choose a study number. The List Box is named "P1_STUDY_NBR". Then I have a list, one entry of which goes to my master-detail for

  • Need a copy of the installati​on software for a Deskjet F4210

    I am having a problem with the HP Solutions Center software launching. I believe I need to reinstall the software to get the problem fixed. I discovered that my  installation disk has been damaged. Is there a ftp download for this software available?

  • New project -- pspnr conversion

    Hello all, I have maked a development in module PS ( project builder T-code CJ20N ). I maked a table Zsap ( with PSPNR like key ) linked with module PS, so the user can entry some data in my table from cj20n transaction. The link between my table and