Dynamic columns in SAP script

Hi,
I have asked to provide a matrix type layout in SAP Script.Also in this matrix, number of columns is not fixed. At runtime it will be decided that how many columns will be there on the layout depending on the data fetch by the program. Can we provide this using requirement using SAP script or smartforms.
Thanks & Regards
vatsa

Hi Vatsa,
Just before getting into the SAP-script, determine how many columns needs to be displayed in the output and pass that variable to the SAP-script.
In SAP-script, whereever you define the BOX for displaying the columns, use the following commands. Use the necessary size for the width of the column.
An example is given below.
Data: W_No_of_Columns&>  type i.
/:           IF &<W_No_of_Columns&> EQ '4'
/:           BOX HEIGHT '22.20' LN WIDTH '59' CH FRAME 10 TW
/:           BOX HEIGHT '22.20' LN WIDTH '6.5' CH FRAME 10 TW
/:           BOX HEIGHT '22.20' LN WIDTH '15' CH FRAME 10 TW
/:           BOX HEIGHT '22.20' LN WIDTH '25' CH FRAME 10 TW
/:           BOX HEIGHT '22.20' LN WIDTH '36.5' CH FRAME 10 TW
                ENDIF.
/:           IF &<W_No_of_Columns& EQ '5'
/:           BOX HEIGHT '22.20' LN WIDTH '59' CH FRAME 10 TW
/:           BOX HEIGHT '22.20' LN WIDTH '6.5' CH FRAME 10 TW
/:           BOX HEIGHT '22.20' LN WIDTH '15' CH FRAME 10 TW
/:           BOX HEIGHT '22.20' LN WIDTH '25' CH FRAME 10 TW
/:           BOX HEIGHT '22.20' LN WIDTH '35' CH FRAME 10 TW
/:           BOX HEIGHT '22.20' LN WIDTH '45' CH FRAME 10 TW
                ENDIF.
Hope this helps.
<REMOVED BY MODERATOR>
Thanks,
-G
Edited by: Alvaro Tejada Galindo on Jul 8, 2008 10:57 AM

Similar Messages

  • Displaying text in two columns in SAP Script

    Moved to correct forum.  Please use a meaningful subject in future - I've edited it for you this time.
    Hello Everybody,
    I have a text to be displayed in Scripts. I want to split the text into 2 columns.
    Like in news paper.
    aaaaaaaaaaaaaaaa   aaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaa   aaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaa   aaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaa   aaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaa   aaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaa   aaaaaaaaaaaaaaaaaaa
    Like this.
    Can someone tell me how to do that?
    Thanks,
    Edited by: Matt on Mar 11, 2009 4:31 PM

    As far as I believe....
    Always text flows out of the main window if it is completely filled.
    So, create an instance of the main window.
    Go to Page windows->Select the main window->Edit->Create
    You will get one more main window and that will be of type with the name Main01
    Go to Screen painter and adjust the window in the way that you required.
    Just start printing the text by writing the code in main00.
    Automatically main01 will have the same code assgined(you can check if you want) and the data gets displayed once the main 00 window is filled.
    Hope it helps....

  • How to draw dynamic table in SAP Script !

    Hi,
        <i>I like to draw a table in the main window, the table height should depends on number of rows displayed on it.
    Could any one please help on this.
    Thank you,
    Senthil</i>

    HI senthil
    you have to use the BOX command in the SAPSCRIPT using which you can draw the table in script.
    in the starting of the MAIN WINDOW draw a horizontal line and then display your vairables
    in end again draw a horizontal line to close the table.
    the height of the vertical line will the number of records in the internal table.
    the vertical line can be drwan uisng
    BOX XPOS 10 YPOS 20 width 0 CH hieght <rowcount> CH.
    regards
    kishore
    regards
    kishore

  • Positioning dynamic text in SAP Script windows

    HI all,
    Is there any control command to position DYNAMIC text that comes from a variable into a window...
    Regards,
    Chandra Sekhar

    Hi chandra,
    You can move the text into one variable in the print
    program and in the layout form call this as
    &VAR&.
    Thanks&Regards,
    Siri.

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

  • Sap script main window related question

    hi
    i have a requirement to add a new column to sap script main window picking information from some table
    this new column is C2 and it takes reference from C1
    i ahve below queries
    1) is is better to add a new column to main window and increase and decrease alsl columns width of all columns
    or create a new window below the main window in which this new field will apear
    ie C1 and C2 to appear in this new window
    c1 is already coming in main window it needs to reaper with the new C2 in new window
    my concern is that since main window is only one and it it being called again and again to polultate the data
    how this new window will work will it be able to display the corect data
    whcih is better approach
    2) ASLO the requriement is that the new field should appear only when Reprint is done for the transfer order
    can anyone tell how to catch the reprint option or code from teh program what is defined for reprint option in program and how to catch it and put condtion?
    regards
    Arora

    If you would like to have vertical lines as well inside the frame....
    /:   BOX FRAME 10 TW                                                
    /:   BOX XPOS '1.2'  CM WIDTH 0 TW HEIGHT '12.7' CM FRAME 10 TW     
    /:   BOX XPOS '11.00' CM WIDTH 0 TW HEIGHT '12.7' CM FRAME 10 TW    
    /:   BOX XPOS '15.5' CM WIDTH 0 TW HEIGHT '12.7' CM FRAME 10 TW     
    /:   BOX XPOS '18.4' CM WIDTH 0 TW HEIGHT '12.7' CM FRAME 10 TW     
    Regards,
    Rich Heilman

  • Sap Script multi lines

    Dear All
          I want to print two tables data in two columns using sap script .
    how to print the data in multiline in a column.
    Thanks and Regards
    Suresh

    Hi,
         This how i used Main window for my requirement, you can modify Margins according to your use.
    Window     Meaning                      Left      Upper     Width     Hght
    MAIN    00 Main window                    7,00 CH  30,00 LN  70,87 CH   2,00 LN
    MAIN    01 Main window                    7,00 CH  32,00 LN  70,87 CH   2,00 LN
    MAIN    02 Main window                    7,00 CH  34,00 LN  70,87 CH   2,00 LN
    MAIN    03 Main window                    7,00 CH  36,00 LN  70,87 CH   2,00 LN
    MAIN    04 Main window                    7,00 CH  38,00 LN  70,87 CH   2,00 LN
    MAIN    05 Main window                    7,00 CH  40,00 LN  70,87 CH   2,00 LN
    MAIN    06 Main window                    7,00 CH  42,00 LN  70,87 CH   2,00 LN
    MAIN    07 Main window                    7,00 CH  44,00 LN  70,87 CH   2,00 LN
    ADDRESS    Addressee                     43,31 CH  10,00 LN  35,04 CH   7,80 LN
    CONSGNEE   Consignee/ship-to address      7,00 CH  64,00 LN  34,65 CH   4,96 LN
    FOOTER     Footer lines                   7,00 CH  58,00 LN  71,00 CH   4,00 LN
    HEADER     Header lines/logo            168,00 MM  10,00 MM   2,98 CM   2,00 CM
    INFO       General information - right    7,00 CH  11,81 LN  31,50 CH   5,91 LN
    Regards
    Bala Krishna

  • Problem in displaying the data of columns into rows in sap script

    hi,
    i am working on a sap script and i have to display the dat which is displayed in column into rows but it is not displaying it properly.
    eg, C
        12.1
        Si
        5.5
    it is displaying the data right now like this but i want to display the  data like this:-
    eg, C      Si
        12.1   5.5
    plzzprovide me guidelines how to solve this problem.

    hi,
    i am using this code to display the data:-
    plzz provide me guidelines where i am getting wrong?
    TOPparCOMPONENT DESP,,,,,, INS. LOT #, , , , , , MIC,,,,,,,,,, MIC VALUEparENDTOPparFINAL
    PROTECT
    IF &I_FINAL-PRUEFLOS& NE '000000000000'
    &I_FINAL-MAKTX(23)&&i_final-prueflos(12Z)&
    &I_FINAL-kurztext(25)&
    &I_FINAL-original_input(8)&
    ELSE
    &I_FINAL-MAKTX(23)&     
    &I_FINAL-kurztext(25)&
    &I_FINAL-original_input(8)&
    ENDIF
    ENDPROTECT
    ITEMHEAD
    POSITION WINDOW
    SIZE WIDTH +0 . 4 CH HEIGHT +1 LN
    BOX FRAME 10 TW
    BOX HEIGHT '1.35' LN INTENSITY 20
    IF &PAGE& = '1'
    BOX XPOS '0' CH YPOS '0' CM WIDTH '0' CM HEIGHT '43' LN FRAME '10' TW
    For horizontal line at top
    BOX XPOS '0' CH YPOS '0' CM WIDTH '75' CH HEIGHT '0' LN FRAME '10' TW
    COLUMN LINES...
    END OF COLUMN LINES...
    BOX XPOS '0' CH YPOS '43' LN WIDTH '75' CH HEIGHT '0' LN FRAME '10'TW
    BOX XPOS '75' CH YPOS '0' LN WIDTH '0' CH HEIGHT '43' LN FRAME '10'TW
    ELSE
    COLUMN LINES...
    END OF COLUMN LINES...
    BOX XPOS '0' CH YPOS '0' CM WIDTH '0' CM HEIGHT '47' LN FRAME '10' TW
    BOX XPOS '0' CH YPOS '0' CM WIDTH '75' CH HEIGHT '0' LN FRAME '10' TW
    BOX XPOS '0' CH YPOS '0' CM WIDTH '45' CM HEIGHT '0' LN FRAME '10' TW
    BOX XPOS '20' CH YPOS '0' CM WIDTH '0' CM HEIGHT '47' LN FRAME '10' TW
    BOX XPOS '0' CH YPOS '47' LN WIDTH '75' CH HEIGHT '0' LN FRAME '10'TW
    BOX XPOS '75' CH YPOS '0' LN WIDTH '0' CH HEIGHT '47' LN FRAME '10'TW
    ENDIF
    LINEFEED
    NEWPAGE
    NEW-PAGE
    provide me guidelines to solve this problem.
    Edited by: ricx .s on Mar 13, 2009 5:58 AM

  • SAP-Script; Is it possible to handle the BOX -Statement dynamic?

    Hi Scripters!
    My consultant wants a box around some information in a SAP-Script form.
    Normally this is quite easy, BUT in this case i have the information (which needs the box around) printed after the positions.
    So problem is: the box can not have a certain position in the Form since i dont know how much positions are to be printed.
    any ideas on this subject?

    Hi Florian,
    Yes it is possible to play arount with positions of Box.
    You can pass variable name in between & in place of fixed XPOS and YPOS.
    and pass value to that dynamic variable.
    You have to test a lot with different values in those variables for pefect settings.
    Hope it will solve your problem.
    Regards
    Krishnendu

  • Sap Script - putting dynamic height value in box command

    Hello All,
    In SAP scirpt I have to display a table which might have variable number of line items. So in box command I cannot mention the height statically.
    Is it possible to specify that dynamically like by using a variable and incrementing it every time the element is called from the loop?
    Thanks
    Indrajit

    no in SAP-SCRIPT this aint possible. But you could do this in an external perform, and have your incremented value back, tho since a external perform is beeing called from the form, the box statement might already have been interpreted.
    this again would mean that this way wouldnt work as well then.

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

  • How to change the font dynamically in SAP script

    Hello,
    There are three fields for a line item to be printed in SAP form (Through Script). The font of one field has to be bigger than rest of the two.
    Can anybody tell me how to change the font of a specific field in a line of an SAP-script?
    Regards
    Kiran

    Hi,
    Its like any other character format. you can have any field with a character format.
    --Ragu

  • How to create table in the sap script

    Hi,
    How to create a table in the  sap script layout, i Have to use table in the main window with  7 columns. can any one send sample code.
    How to calculate the number of line items which are displaying in the main window, if the number of line items are exceed in the main window then the amount has to be calculate and print as "BALANCE FORWARD" and the next page had to be displayed as "CARRY FORWARD" that amount. if this is the last page not subsequent page the amount had to be calculated the carry forward amount and total amount and print as "TOTAL AMOUNT". i am creating the new layout and the program is the standrad driver program i have to use and i have to use the standard Text elements only, can any one help me on this issue

    hi
    good
    there is no "pattern" option in SAPscript. All you have at your disposal are the following SAPscript commands: BOX, POSITION and SIZE. Not only are these commands both confusing and tedious to implement, they also are limited in what they can achieve. For instance, although you can suppress a box during printout (by making it conditional), there is no simple way to adjust it dynamically instead. Thus, to divide sequential line items, you may wish to use an underline (ULINE) or simply white space.
    thanks
    mrutyun

  • Alignmnet Issues with SAP Script

    Hi All i have an issue with SAP script i have few columns in the script where in the values in the column changes dynamically.For example the value of second column in the first row can be 5 characters and the value of the same in the 2nd row can be of 10 characters and it keeps varying for every row but the max length of it would be 20 characters.
    Now the issues is with the second column as the text in this column keep varying the text in the same row after the second column keep moving either towards right or towards left depending on the text in the second column,Can any one help me as how  can i fix this issue.
    Looking for your valuable inputs.
    Regards
    Hari Krishna.

    Hari,
    http://help.sap.com/saphelp_47x200/helpdata/en/d1/802d91454211d189710000e8322d00/frameset.htm
    Even though it is not the solution,I guess this link will be helpful.
    K.Kiran.

  • How to delete a line in SAP Script

    Hi,
         How to delete a line in SAP Script.
    Cheers
    S Kumar

    Okay.if still you are looking the option of deleting line there is one solution.
    Just delete the all contents of perticuler(which needs to deleted) line including the tag column(Where you are /*) and save.if you see again than line would not be seen as blank,you will found it has been deleted.

Maybe you are looking for

  • Cannot see instrument in EXS folder

    Hi, I cannot see the Vienna strings I have recently bought in Logic 8 EXS. The install has gone fine, I have rebooted and repaired disc permissions. The VSL samples are in the following location Library/Application Support/Logic/Sampler Instruments/V

  • STREAMS T_CONN_IND messages in Solaris 10

    We have a STREAMS module that we push on top of TCP to intercept both inbound and outbound connections. We have recently discovered that our module no longer seems to work on Solaris 10. It appears that for inbound connections (i.e. those coming in f

  • Updation of Primary Key in HR Table(PA2001)

    Can anyone please tell me how to update a primary key field in HR Tables (PA2001 and PA2002). I need to update <b>sprps</b> field in both the tables. I used HR_Infotype_Operation function module, but still it is not updating the field. Pls find the f

  • Why do we need WS Addressing??

    What is WS Addressing? Why do we need in SOA??? Give me Some Examples guys

  • Freespace in Tablespaces

    Dear all, We are getting red alert message on Database administration in EWA report , Kindly check below logs : We checked your system for tablespaces that may overflow in the near future. 10.2.1 Tablespaces - Autoextend Limit Tablespace Size (KB) Fr