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

Similar Messages

  • 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

  • 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

  • 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.

  • BOX in Scripts.

    I want to display box in script dynamically.
    please tell how this is possible.

    Hi,
         Create a main window with 2 Lines height,
         Create box for entire manin window,
         Position multiple main windows on one page, we can keep upto 99 main windows in one page.
    Sample code
    /E   ITEM_A
    IA &EKPO-EBELP&,,&T165M-ABSGR_TXT&
    IA
    /:BOX FRAME 10 TW
    /:BOX XPOS 16 CH YPOS 0 LN WIDTH '0' CM HEIGHT 2 LN FRAME   
       10 TW
    Regards
    Bala Krishna

  • 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

  • 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

  • How to acheive check box in SCRIPTS

    Hi All,
    I am working on SCRIPTS, I want a check box with checked in the layout after execting. I am not changing any driver program
    How to acheive this.
    Thanks in advance

    Hi,
    You can achive check boxes in scripts using this below link
    http://abapeasy.blogspot.com/2008/03/3-easy-way-to-add-checkbox-in-your.html
    with out modifying the print program u can check the check box using the PERFORM ---ENDPERFORM CONTROL COMMAND
    see this link how to use preform contorl command in script
    http://help.sap.com/saphelp_nw04/helpdata/en/d2/cb3d07455611d189710000e8322d00/frameset.htm
    Regards
    Jagadeesh

  • Is it possible to change the colour of box in script from black to blue

    Hi,
    Is it possible to change the colour of box in script from black to blue  or some other colour and background colour also...if so how....
    Thanks.

    No..
    It is not possible in scripts..
    In scripts u cannot use colors..
    In smartforms u can do that..
    reward if it helps u..
    sai ramesh

  • 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

  • Dynamic Text in script

    Hi,
    I want to display some text in a script window dynamically.
    Is it possible to have a dynamic window in script.
    Please help in this regard.
    Thanks & Regards,
    Rajesh

    Hi,
    All you can do is to put any condition while calling that window with that element.
    To ways to achive this.
    1.  In your print program put any condition while calling WRITE_FORM.. Like below:
    if condition 1 = 'True'.
    call function 'WRITE_FORM'
        exporting
          element   = 'TEXT'
         window    = 'DYNAMIC_TEXT'
        exceptions
          element   = 1
          function  = 2
          type      = 3
          unopened  = 4
          unstarted = 5
          window    = 6
          others    = 7.
    endif.
    2. Or Just in the script editor in that window , put any if condition to print that text. It means it will print your text only when any condition is setisfied.
    /: IF &CONDIITION& = 'TRUE'
    PF &ZZ_TEXT_TO_BE_DISPLAY&
    /: ENDIF
    Reg,
    Lokesh.

  • 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 poition box in script

    Dear All,
    I am trying to print Dynamic position box in sap script.If any body know the please tell me.
    Thanks,
    P G Venkatesh
    Edited by: venky.pg132 on Jun 27, 2011 2:10 PM

    add Boxes dynamically to SAPScript  But you can specify this in the print program.
    DATA COM(100).
    com = 'BOX WIDTH ''17.5'' CM HEIGHT 5 CM FRAME 10 TW INTENSITY 15'.
    CALL FUNCTION 'CONTROL_FORM'
    EXPORTING
    COMMAND = COM
    EXCEPTIONS
    UNOPENED = 1
    UNSTARTED = 2
    OTHERS = 3

  • Drawing boxes dynamically in the script

    Hi All,
             I have requirement in SAP script. iam getting the data from different elements and it has to displayed in the table format.after column header i need to draw the box and i have to print the data as in the format of boxes. iam placing box command in the first element but iam not getting the boxes for all data it is printing only on the top of the page. so please suggest the solution for drawing boxes dynamically .
    Thanks and Regards
    D.Ramesh

    I have handle a similar situation with box.That is drawing dynamically based on no of  items.
    If there are 2 items,the box height for 2 items will be displayed and if there are 10 itmes then box height for 10 items will be displayed.
    Only thing is u have to calculate the no of records and multiply with some sutable constant.Pass this content into varible declared in character format and use it in in box command as height.
    BOX XPOS '0' CM WIDTH '18.5' CM  HEIGHT &G_F_COUNT20& CM  FRAME 2 TW
    Here G_F_COUNT20 is varible.
    Try this way and let me know if u face any problem.
    Regards

  • 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

  • IPod classic - lower capacity than expected

    Connected my 160gb 7th gen classic for the first time and its only letting my put about 3000 songs on. Thought capacity was 40,000 - I am using iTunes Match if that makes any difference? Wondered if anyone knew why the capacity is so much lower than

  • Problems with messaging

    iv got two issues with my iphone messages 1. sometimes one particular number will not receive messages for around 2 days then all of a sudden will get a flood of texts off me from testing it.. i can still receive the messages from them though 2. some

  • Help on using Textutil shell script

    I remember a very helpful page on the Apple site describing the use of textutil and all its parameters. Now I want to use it again (to rename files), but the help pages seem to have disappeared. I've searched the Apple site and googled all sorts of c

  • Purchase Order Item Shipping Data Update

    Hi xperts, I need to update shipping data of purchase order item. I need to update the Unloading Point (ablad) field. Inside exit 'EXIT_SAPMM06E_013' I am changing value of field xekpv-ablad. but the value is not updated in the purchase order. Please

  • RegEx

    I tried to parse a text file, I use the white space as a delimiter to parse the file, but I don't want it to parse anything inside the single or double quotes, inside any forms of brackets. Give me some example, please help. Emily