How to freeze row and column in JTable

Hi,
I need to freeze first two rows and columns in a large JTable. I found ways to freeze either a row or a column, but not both at the same time.
Can any of you help ?
Found this code which allows freezing a col. Similar method can be used to freeze column
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JViewport;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableModel;
public class FrozenTablePane extends JScrollPane{
public FrozenTablePane(JTable table, int colsToFreeze){
super(table);
TableModel model = table.getModel();
//create a frozen model
TableModel frozenModel = new DefaultTableModel(
model.getRowCount(),
colsToFreeze);
//populate the frozen model
for (int i = 0; i < model.getRowCount(); i++) {
for (int j = 0; j < colsToFreeze; j++) {
String value = (String) model.getValueAt(i, j);
frozenModel.setValueAt(value, i, j);
//create frozen table
JTable frozenTable = new JTable(frozenModel);
//remove the frozen columns from the original table
for (int j = 0; j < colsToFreeze; j++) {
table.removeColumn(table.getColumnModel().getColumn(0));
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
//format the frozen table
JTableHeader header = table.getTableHeader();
frozenTable.setBackground(header.getBackground());
frozenTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
frozenTable.setEnabled(false);
//set frozen table as row header view
JViewport viewport = new JViewport();
viewport.setView(frozenTable);
viewport.setPreferredSize(frozenTable.getPreferredSize());
setRowHeaderView(viewport);
setCorner(JScrollPane.UPPER_LEFT_CORNER, frozenTable.getTableHeader());
}

Hi,
I need to freeze first two rows and columns in a large JTable. I found ways to freeze either a row or a column, but not both at the same time.
Can any of you help ?
Found this code which allows freezing a col. Similar method can be used to freeze column
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JViewport;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableModel;
public class FrozenTablePane extends JScrollPane{
public FrozenTablePane(JTable table, int colsToFreeze){
super(table);
TableModel model = table.getModel();
//create a frozen model
TableModel frozenModel = new DefaultTableModel(
model.getRowCount(),
colsToFreeze);
//populate the frozen model
for (int i = 0; i < model.getRowCount(); i++) {
for (int j = 0; j < colsToFreeze; j++) {
String value = (String) model.getValueAt(i, j);
frozenModel.setValueAt(value, i, j);
//create frozen table
JTable frozenTable = new JTable(frozenModel);
//remove the frozen columns from the original table
for (int j = 0; j < colsToFreeze; j++) {
table.removeColumn(table.getColumnModel().getColumn(0));
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
//format the frozen table
JTableHeader header = table.getTableHeader();
frozenTable.setBackground(header.getBackground());
frozenTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
frozenTable.setEnabled(false);
//set frozen table as row header view
JViewport viewport = new JViewport();
viewport.setView(frozenTable);
viewport.setPreferredSize(frozenTable.getPreferredSize());
setRowHeaderView(viewport);
setCorner(JScrollPane.UPPER_LEFT_CORNER, frozenTable.getTableHeader());
}

Similar Messages

  • How to design rows and columns in sapscript layout

    Hi friends,
    Please let me know how to design rows and columns in sapscript layout with example?
    Thanks,
    Yogesh

    Hi friends,
    Please let me know how to design rows and columns in sapscript layout with example?
    Thanks,
    Yogesh

  • SSRS Report Freezing row and column while scrolling Issue

    Hello,
    I have created the report and i have freezed the row and column of the report while scrolling [To Freeze made the changes in tabulex property of the table "Keep Header visible while scrolling"] 
    meade the changes in the property [Advaned Mode]
    Fixed Data= true
    Keep Together=true
    Keep with group =After
    Report on new page=true
    When ever i will scroll down my report my all column headder will remains same. after that if i scroll to right my first freeded column headder will not display [group column or freezed row headder].
    COuld you please suggest me for the same issue.

    Hi Vinay,
    Based on my research, freezing row and column headers are different in table and matrix.
    In a table, if we want to freeze column header, we should make the changes in the first Static row group in Row Groups pane with Advanced Mode as you said. If we want to freeze row header, the table should have a group ahead, then we can enable “Repeat header
    rows on each page” and “Keep header visible while scrolling” options in Row Headers in Tablix Properties dialog box.
    In a matrix, if we want to freeze column header, we can enable “Repeat header columns on each page” and “Keep header visible while scrolling” options in Column Headers in Tablix Properties dialog box. If we want to freeze row header, we can enable “Repeat
    header rows on each page” and “Keep header visible while scrolling” options in Row Headers in Tablix Properties dialog box.
    Hope this helps.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to set the Selected row and Column in JTable

    Hi,
    i have a problem like the JTable having one Method getSelectedRow() and getSelectedColumn to know the Selected row and Column but if i want to explicitly set the Selected Row and Column,then there is no such type of Methods.If anybody has any solution then i will be thankful to him/her.
    Praveen K Saxena

    Is that what you're looking for? :myTable.getSelectionModel().setSelectionInterval(row, row);
    myTable.getColumnModel().getSelectionModel().setSelectionInterval(column, column);

  • Trouble Freezing Row and Column Headers

    I have created a report in HFR that is rather large. I need to freeze the row and column headers so that when I do a web preview, they are frozen and I can still see the headers when I scroll right or left or up and down. I have clicked on "Freeze Grid Headers" under the General tab on the Grid Properties sheet, but it only freezes my row headers and not my column headers. How do I get the column headers to freeze as well?
    Any help is greatly appreciated.

    there is nothing to do with servelts to solve thisCorrect. You may use IFRAME element on your page.

  • Freezing rows and columns.

    I need to know how to freeze the top row and the left column so when you scroll down or left to right that row and column of information stays visible. Can't seem to find in user guide. Thanks in advance.
    Dave

    As the feature is unavailable, it is normal that it is not described in the Help or in the User Guide.
    Some users wrote that we may mimic it activating the mode: "Show Print View".
    I'm not sure that it is really what you want.
    _Go to "Provide Numbers Feedback" in the "Numbers" menu_, describe what you wish.
    Then, cross your fingers, and wait _at least_ for iWork'09
    Yvan KOENIG (from FRANCE dimanche 28 décembre 2008 16:28:33)

  • How to color Rows and Columns of BI Query

    Hi to all,
    I have created BI query in query designer, with 2 structures for rows and Columns.
    Now I need that certain rows can be colored orange and certain columns as green color.
    I knew that it can be done in Query designer, but slice and dice reporting can not be done, which I required in my report.
    Is there any way I can do in WAD.
    or any other way to do that.
    i shall be thankfull to you for this.
    Regards
    Pavneet Rana

    Hi Rana,
    You can do the coloring of KF values using the report designer tool.
    Check the below links
    http://help.sap.com/SAPhelp_nw70/helpdata/en/dd/cea14119eb9f09e10000000a155106/frameset.htm
    [Creating Formatted reports using BEx Report Designer|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/00ae5173-6112-2d10-d78f-e7779d269f25?QuickLink=index&overridelayout=true]
    Regards
    KP

  • To freeze row and column in a view.

    Hi,
    Can anyone advise that is there any way where we can freeze a row and a column in a view.
    Many Thanks,
    Kate

    JTextArea has a replaceRange method.
    John

  • How to determine rows and columns of a two dimensional array at runtime?

    Dear All,
    I am using Java 5.
    I have defined an array as follows:
    int[][] arr= { {1,2,3}, {4,5,6}};
    Using the reference of arr, how can i get the rows (2) and columns (3) of this array at run-time?
    Thanks in advance.
    -Sameer

    rows and columns are simply the way you visualize the array.
    int[][] arr= { {1,2,3}, {4,5,6}};
    in above code
    if you access array element as arr[x][y]
    then x can have 0 or 1 where y can have 0,1 or 2
    */

  • Freezing Rows and Columns Question

    In a spreadsheet I have Row 1 Frozen as a Header row for descriptions and headings of different columns of expenses
    Is it possible to Freeze the very bottom row of all the totals? I am imagine that you could scroll up and down all the rows in between, but always see the decriptions at the Top Header Row and the Totals at the Bottom Row
    Is this possible?
    thanks
    MS

    Trackpad vs Mouse is just a matter of getting used to using the one you will use.
    Your profile indicates OS X v10.8 (Mountain Lion), so this answer applies to Numbers '09.
    With a trackpad, start by selecting the columns or rows you want to move. Click any cell to activate the table, then position the pointer over the tab of the first column to be selected. If the pointer changes to a vertical line crossed by a double headed arrow, shift it slightly until it changes bck to the selection pointer (black arrow pointing up and left). Then click and drag across the column Header tabs to select the columns.
    When the columns are selected, move the mouse pointer to a position just to the left of the letter labeling the first selected column. With the pointer positioned there, use your thumb to press and hold the mouse button/trackpad down, then use a finger to drag the columns down until they 'detach' from the table. Change the direction of drag to move the detached columns to the location where you want them. When the boundary showing where you want to places the columns changes to a thick blue line, release the mouse button/track pad (lift your thumb, but not your finger) to drop the columns into position.
    Rows:
    Change:
    "vertical line crossed by a double headed arrow" to "horizontal line..."
    "Drag across the column tabs..." to "Drag down the row tabs..."
    "Drag the columns down until..." to "Drag the rows right until..."
    Otherwise the same instructions.
    Regards,
    Barry

  • How to make Row and Column headings bold in 2004s Web template

    Hi!
    I have created a web template which has 3 queries.
    I would like to achieve the following
    1> Bold the column heading and row headings.
    2> Delete the space between the three reports(right now there is some space)
    3> Align the columns on top of each other so that it looks like a continuous report.
    (I know how to suppress the column headers on the 2 reports which are at the bottom)
    Is this possible in 2004s???
    With Table interface class gone in 2004s--is stylesheet modification the only way to go????
    Please provide me with steps to achieve the above.
    Helpers will be rewarded.

    Hi Zhu,
    Thanks for the link.This really helps.
    However I was only able to see the modules for Column Width, Negative number and Document Content.
    Is there any other module as well to change Column heading ?Its not mentioned in the documentation.
    Can you please let me know.
    Thanks,
    Vivek

  • How to hide rows and columns by AppleScript or Automator for printing

    Hello,
    I have to hide first empty rows (I do it by: organize - Column B is not empty)
    then: By context-menu in Header of Column K: Hide column
    and: By context-menu in Header of Column L: Hide column
    How can I make this 3 Steps automatic with AppleScript or Automator or maybe by formula?
    Thanks for any help

    Here is an edited version which allow you to choose the custom template on the fly.
    No need to edit a property in the script.
    --[SCRIPT printtable(s)_choosecustom]
    Enregistrer le script en tant que Script ou Application : printtable(s)_choosecustom.xxx
    déplacer le fichier ainsi créé dans le dossier
    <VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Numbers:
    Il vous faudra peut-être créer le dossier Numbers et peut-être même le dossier Applications.
    Sélectionner une partie de table, une table ou même plusieurs tables.
    Aller au menu Scripts , choisir Numbers puis choisir “printtable(s)_choosecustom”
    Le script crée un nouveau document depuis un modèle perso sélectionné,
    puis applique « Colle les valeurs » au contenu du presse-papiers.
    Il envoie enfin la commande d'impression.
    --=====
    L'aide du Finder explique:
    L'Utilitaire AppleScript permet d'activer le Menu des scripts :
    Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
    Cochez la case "Afficher le menu des scripts dans la barre de menus".
    Sous 10.6.x,
    aller dans le panneau "Général" du dialogue Préférences de l'Éditeur Applescript
    puis cocher la case "Afficher le menu des scripts dans la barre des menus".
    --=====
    Save the script as a Script or an Application : printtable(s)_choosecustom.xxx
    Move the newly created file into the folder:
    <startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
    Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
    Select a subset of a table, a table or even several tables.
    Go to the Scripts Menu, choose Numbers, then choose “printtable(s)_choosecustom”
    The script create a new document based on the selected custom template,
    then apply “Paste Values” to the clipboard's contents.
    At last, it issue the print command.
    --=====
    The Finder's Help explains:
    To make the Script menu appear:
    Open the AppleScript utility located in Applications/AppleScript.
    Select the "Show Script Menu in menu bar" checkbox.
    Under 10.6.x,
    go to the General panel of AppleScript Editor’s Preferences dialog box
    and check the “Show Script menu in menu bar” option.
    --=====
    Yvan KOENIG (VALLAURIS, France)
    2011/02/20
    2011/03/16 -- replaced the Blank template by a custom one defined thru the property custom_template
    2011/03/17 -- Let choose the custom template, no longer Paste but Paste Values.
    --=====
    property theApp : "Numbers"
    --=====
    on run
    --my doyourduty()
    run script doyourduty
    end run
    script doyourduty
    --on doyourduty()
    my activateGUIscripting()
    Copy the selected items *)
    my raccourci(theApp, "c", "c") (* cmd + c *)
    Create a new document based upon Blank.template *)
    set myNewDoc to my makeAnIworkDocFromCustom()
    As it's a custom template, there is no default table to delete.
    Delete the default table *)
    tell application "Numbers" to tell document 1 to tell sheet 1 to delete table 1
    my selectMenu("Numbers", 4, 8) (* Paste Values *)
    my raccourci(theApp, "p", "c") (* cmd + p = Print *)
    my raccourci(theApp, return, "") (* return = validate the Print command*)
    --end doyourduty
    end script
    --=====
    Creates a new iWork document from a custom template and returns its name.
    example:
    set myNewDoc to my makeAnIworkDocFromCustom()
    on makeAnIworkDocFromCustom()
    set nb_chiffres to 3 (*
    2 = allow 99 templates
    3 = allow 999 templates *)
    Grab the localized names of the templates folders *)
    tell application "Numbers"
    set templates_loc to localized string "Templates"
    -- set myTemplates_loc to localized string "My Templates"
    end tell -- to application a
    Define the path to the folder storing custom templates *)
    --set chemindesmodeles to "" & (path to library folder from user domain) & "Application Support:iWork:Numbers:" & templates_loc & ":" & myTemplates_loc & ":"
    set chemindesmodeles to "" & (path to library folder from user domain) & "Application Support:iWork:Numbers:" & templates_loc & ":"
    Grab the list of every items stored in the folder *)
    tell application "Finder"
    set entire_contents to entire contents of folder chemindesmodeles
    end tell
    Build two lists. One contain the path to every custom templates.
    The other contain the names of these templates and the names of subfolders *)
    set indx to 1
    set cheminde_mesmodeles to {}
    set nomsde_mesmodeles to {}
    set le_conteneur to ""
    tell application "System Events"
    repeat with i from 1 to count of entire_contents
    set un_element to item i of entire_contents as text
    try
    if type identifier of disk item un_element is in {"com.apple.iwork.numbers.template", "com.apple.iwork.numbers.sfftemplate"} then
    if name of container of disk item un_element is not le_conteneur then
    set le_conteneur to name of container of disk item un_element
    copy (text 1 thru nb_chiffres of "---") & space & le_conteneur to end of nomsde_mesmodeles
    end if
    copy un_element to end of cheminde_mesmodeles
    copy text -nb_chiffres thru -1 of ("00" & indx) & space & name of disk item un_element to end of nomsde_mesmodeles
    set indx to indx + 1
    end if
    end try
    end repeat
    end tell -- System Events
    if my parleAnglais() then
    set le_titre to "Numbers’s custom templates"
    else
    set le_titre to "Modèles personnalisés de Numbers"
    end if
    Choose the template to use.
    If you select a subfolder name, the script beep and ask one more time *)
    tell application (path to frontmost application as string)
    repeat
    set mon_choix to choose from list nomsde_mesmodeles with title le_titre
    if mon_choix is false then error number -128
    try
    set mon_choix to text 1 thru nb_chiffres of (item 1 of mon_choix) as integer
    exit repeat
    on error
    beep 1
    end try
    end repeat
    end tell
    tell application "Numbers"
    set nb_doc to count of documents
    open (item mon_choix of cheminde_mesmodeles)
    repeat until (count of documents) > nb_doc
    delay 0.1
    end repeat
    set doc_name to name of document 1
    end tell -- the_App
    return doc_name
    end makeAnIworkDocFromCustom
    --=====
    on parleAnglais()
    local z
    try
    tell application theApp to set z to localized string "Cancel"
    on error
    set z to "Cancel"
    end try
    return (z is not "Annuler")
    end parleAnglais
    --=====
    on activateGUIscripting()
    (* to be sure than GUI scripting will be active *)
    tell application "System Events"
    if not (UI elements enabled) then set (UI elements enabled) to true
    end tell
    end activateGUIscripting
    --=====
    ==== Uses GUIscripting ====
    This handler may be used to 'type' text, invisible characters if the third parameter is an empty string.
    It may be used to 'type' keyboard raccourcis if the third parameter describe the required modifier keys.
    I changed its name « shortcut » to « raccourci » to get rid of a name conflict in Smile.
    on raccourci(a, t, d)
    local k
    tell application a to activate
    tell application "System Events" to tell application process a
    set frontmost to true
    try
    t * 1
    if d is "" then
    key code t
    else if d is "c" then
    key code t using {command down}
    else if d is "a" then
    key code t using {option down}
    else if d is "k" then
    key code t using {control down}
    else if d is "s" then
    key code t using {shift down}
    else if d is in {"ac", "ca"} then
    key code t using {command down, option down}
    else if d is in {"as", "sa"} then
    key code t using {shift down, option down}
    else if d is in {"sc", "cs"} then
    key code t using {command down, shift down}
    else if d is in {"kc", "ck"} then
    key code t using {command down, control down}
    else if d is in {"ks", "sk"} then
    key code t using {shift down, control down}
    else if (d contains "c") and (d contains "s") and d contains "k" then
    key code t using {command down, shift down, control down}
    else if (d contains "c") and (d contains "s") and d contains "a" then
    key code t using {command down, shift down, option down}
    end if
    on error
    repeat with k in t
    if d is "" then
    keystroke (k as text)
    else if d is "c" then
    keystroke (k as text) using {command down}
    else if d is "a" then
    keystroke k using {option down}
    else if d is "k" then
    keystroke (k as text) using {control down}
    else if d is "s" then
    keystroke k using {shift down}
    else if d is in {"ac", "ca"} then
    keystroke (k as text) using {command down, option down}
    else if d is in {"as", "sa"} then
    keystroke (k as text) using {shift down, option down}
    else if d is in {"sc", "cs"} then
    keystroke (k as text) using {command down, shift down}
    else if d is in {"kc", "ck"} then
    keystroke (k as text) using {command down, control down}
    else if d is in {"ks", "sk"} then
    keystroke (k as text) using {shift down, control down}
    else if (d contains "c") and (d contains "s") and d contains "k" then
    keystroke (k as text) using {command down, shift down, control down}
    else if (d contains "c") and (d contains "s") and d contains "a" then
    keystroke (k as text) using {command down, shift down, option down}
    end if
    end repeat
    end try
    end tell
    end raccourci
    --=====
    my selectMenu("Numbers",4, 8)
    ==== Uses GUIscripting ====
    on selectMenu(theApp, mt, mi)
    tell application theApp
    activate
    tell application "System Events" to tell process theApp to tell menu bar 1 to ¬
    tell menu bar item mt to tell menu 1 to click menu item mi
    end tell -- application theApp
    end selectMenu
    --=====
    --[/SCRIPT]
    Yvan KOENIG (VALLAURIS, France) jeudi 17 mars 2011 21:29:15

  • How to customize row and column settings in BI report

    Hi SDN,
    We have integrated EP702 and BI 704systems and uploaded BI roles into portal. Now i want to personalize BI report settins.
    There are 10 columns in BI report, but initially 4 columns are only displayed. But we want to display all the columns initially. I didn't find any option to customize these settings. And variable screen button is displayed when click on Filter link. But we require this button in report itself. Information and Show chars buttons are not available in report.
    I am working on BI reports for the first time. Please help me to customize settings.
    regards,
    Sree.

    By default BEx web using a web template called 0ANALYSIS_PATTERN to render the queries. Most clients create a copy of SAP supplied standard web template and customize it to their needs. Most of the changes are what you have described. You can add a new button on the toolbar. Change the Analysis Item properties to control the number of columns.
    Once you have a new desired web template, you can set it as your default adhoc-analysis web template in IMG. Look for a node called Report relevant settings. All this setup needs to be done on the BW system. A restart of BI java is required after the customizing settings have been changed.
    Thanks
    Vineet

  • Report Writer Row and Column Format

    Hi
    Was wondering if there is a possible solution to this :-
    Understand that column format is controlled by format groups. This means that all figures in the same column will take the same format (such as scaling and decimal place).
    Scenario is ->
                        Colunn #1 -> column set as displaying no decimal point       
    Rev                  120
    OP                      5
    OP margin %     4.2 -> how to set this to 1 decimal point. Any formula syntax that I can use?
    Regards.

    Hi Vinay,
    Based on my research, freezing row and column headers are different in table and matrix.
    In a table, if we want to freeze column header, we should make the changes in the first Static row group in Row Groups pane with Advanced Mode as you said. If we want to freeze row header, the table should have a group ahead, then we can enable “Repeat header
    rows on each page” and “Keep header visible while scrolling” options in Row Headers in Tablix Properties dialog box.
    In a matrix, if we want to freeze column header, we can enable “Repeat header columns on each page” and “Keep header visible while scrolling” options in Column Headers in Tablix Properties dialog box. If we want to freeze row header, we can enable “Repeat
    header rows on each page” and “Keep header visible while scrolling” options in Row Headers in Tablix Properties dialog box.
    Hope this helps.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Rows and Columns

    Dear all,
    Could u plz tell me how to create rows and columns dynamically at runtime?
    I got 3 columns and multiple rows.How do i go about it?
    Is there ne FM to do this?

    Can you create an internal table dynamically? (at run time)
    Yes , you can create a Dynamic Internal table .Just chek out this program .
      type-pools : abap.
      field-symbols: <dyn_table> type standard table,
                   <dyn_wa>,
                   <dyn_field>.
      data: dy_table type ref to data,
          dy_line  type ref to data,
          xfc type lvc_s_fcat,
          ifc type lvc_t_fcat.
      selection-screen begin of block b1 with frame.
    parameters: p_table(30) type c default 'T001'.
    selection-screen end of block b1.
      start-of-selection.
        perform get_structure.
      perform create_dynamic_itab.      *********Creates a dyanamic internal table*********
      perform get_data.
      perform write_out.
      form get_structure.
      data : idetails type abap_compdescr_tab,
           xdetails type abap_compdescr.
      data : ref_table_des type ref to cl_abap_structdescr.
    Get the structure of the table.
      ref_table_des ?= 
          cl_abap_typedescr=>describe_by_name( p_table ).
      idetails[] = ref_table_des->components[].
        loop at idetails into xdetails.
        clear xfc.
        xfc-fieldname = xdetails-name .
        xfc-datatype = xdetails-type_kind.
        xfc-inttype = xdetails-type_kind.
        xfc-intlen = xdetails-length.
        xfc-decimals = xdetails-decimals.
        append xfc to ifc.
      endloop.
      endform.
      form create_dynamic_itab.
    Create dynamic internal table and assign to FS
      call method cl_alv_table_create=>create_dynamic_table
                   exporting
                      it_fieldcatalog = ifc
                   importing
                      ep_table        = dy_table.
        assign dy_table->* to <dyn_table>.
    Create dynamic work area and assign to FS
      create data dy_line like line of <dyn_table>.
      assign dy_line->* to <dyn_wa>.
      endform.
      form get_data.
    Select Data from table.
      select * into table <dyn_table>
                 from (p_table).
      endform.
       Write out data from table.
      loop at <dyn_table> into <dyn_wa>.
        do.
          assign component  sy-index  
             of structure <dyn_wa> to <dyn_field>.
          if sy-subrc <> 0.
            exit.
          endif.
          if sy-index = 1.
            write:/ <dyn_field>.
          else.
            write: <dyn_field>.
          endif.
        enddo.
      endloop.
    http://www.sap-img.com/ab030.htm

Maybe you are looking for