Hide Dynamic columns and remove space

I have an application that allows users to generate a Crystal report containing selected columns.  A user is able to check which columns should appear on the report from a web page.  I'm able to display and suppress the dynamic columns but the space for the dynamic columns that are not selected remains.  How can I remove the space and have the columns move to the left?  
I'm using VS 2003 and Crystal 10.

As Ludek mentioned you would need to use the RAS .NET SDK to completely remove the column from the report. What you could do is start with a blank report, only have your database info added, then build UP your report rather than remove items. The ReportObjectController has a method called AddByName() that will insert a field into your report. It will add the field from left to right with a small buffer space.
In order to use the RAS .NET SDK with Visual Studio .NET you'll need to upgrade to Crystal Reports 2008 or Crystal Reports for Visual Studio 2010 (good free price here).
[RAS .NET Developer Guide|http://help.sap.com/businessobject/product_guides/boexir31/en/rassdk_net_dg_12_en.chm]
[RAS .NET API Ref|http://help.sap.com/businessobject/product_guides/boexir31/en/rassdk_net_apiRef_12_en.chm]

Similar Messages

  • Dynamically create and remove TEXT items in forms

    Hi Guys,
    Is there a way to dynamically create and remove TEXT items in form. For example I have the EMP and DEPT table and when
    I select the EMP table name from the LOV, rows of the EMP table with column name and data should get displayed on the screen and likewise a similar action for DEPT table and
    so on. I have about 90 tables from where data could be required to view and edit. They all have varying number of columns.
    Any suggestions ?
    Thanks
    KMD
    null

    Use OLE concept of developer and map Excel as an object
    Nadeem
    null

  • Is it possible to show/hide dynamically columns in RDLC form?

    We need to show/hide dynamically columns in our Report RDLC form based by the user desire needs.
    We need by the predefined checkboxes to set which columns should be seen and which should be hidden.
    Is it possible in RDLC form to make it "show/hide columns dynamically" with any way?

    Depends on what you mean dynamically, you still need to press the view report button.
    What you can do is right click on the column you want to be able to hide/display in design mode,
    click "Column visibilty", choose "show or hide based on an expression" then in your expression base your true or false on a boolean parameter for each column

  • How can we get Dynamic columns and data with RTF Templates in BI Publisher

    How can we get Dynamic columns and data with RTf Templates.
    My requirement is :
    create table xxinv_item_pei_taginfo(item_id number,
    Organization_id number,
    item varchar2(4000),
    record_type varchar2(4000),
    record_value CLOB,
    State varchar2(4000));
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'USES','fever','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'HOW TO USE','one tablet daily','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'SIDE EFFECTS','XYZ','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'DRUG INTERACTION','ABC','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'OVERDOSE','Go and see doctor','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'NOTES','Take after meal','TX');
    select * from xxinv_item_pei_taginfo;
    Item id Org Id Item Record_type Record_value State
    493991     224     1265-D30     USES     fever     TX
    493991     224     1265-D30     HOW TO USE     one tablet daily     TX
    493991     224     1265-D30     SIDE EFFECTS     XYZ     TX
    493991     224     1265-D30     DRUG INTERACTION     ABC     TX
    493991     224     1265-D30     OVERDOSE      Go and see doctor     TX
    493991     224     1265-D30     NOTES     Take after meal     TX
    Above is my data
    I have to fetch the record_type from a lookup where I can have any of the record type, sometime USES, HOW TO USE, SIDE EFFECTS and sometimes some other set of record types
    In my report I have to get these record typpes as field name dynamically whichever is available in that lookup and record values against them.
    its a BI Publisher report.
    please suggest

    if you have data in db then you can create xml with needed structure
    and so you can create bip report
    do you have errors or .... ?

  • How to hide the Columns and Views for Login user in SharePoint 2013

    Hi Friends,
    How to hide the Columns and Views for Login user in SharePoint 2013? Is it possible using OOB features? If not possible how can we hide the Columns and Views for Login user?
    Could you please help on this.
    Thanks,
    Tiru
    Tiru

    Hello Tirupal,
    There is no OOB way to do this.
    Please check this codeplex solution to achieve the same.
    https://sp2013columnpermission.codeplex.com/
    My Blog- http://www.sharepoint-journey.com|
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful

  • Hide the Column Or Remove the extra data

    Hi ALL ,
    I have developed using the development procedure from Simon_Hou and it works perfectly fine . Thank you Simon_Hou
    http://social.msdn.microsoft.com/Forums/office/en-US/842e2dcb-d949-4297-9d91-eac989692cb5/difference-between-the-grouped-column?forum=sqlreportingservices .
    Now then the requirement was to add Total to the developed report that's also solved.
    http://social.msdn.microsoft.com/Forums/office/en-US/3536c818-c7f0-4757-953c-003d19921311/grand-total-for-matrix-based-report?forum=sqlreportingservices
    Now an  issue is there extra column that get's generated dynamically ... For that i tried
    =IIF(ReportItems!Textbox2.value is nothing, true, false . 
    The expression does work but the
    Total  row cells values get repositioned to one cell to the right from it's original position .
    Now am fine with the extra empty column only issue  if the tablix contain only a single row or two rows of Data  then that empty column shows numeric data which is not required. Please refer to the below figure for
    clarity . I just want that the
    extra column is blank its doesn't show extra numeric data on a single or 2 rows or if it can be hidden without affecting the original position of the total cell .
     please kindly help because just due to this the reports are not going for production deployment .
    Thanks
    Priya

    Hi Priya,
    According to your description, you want to hide the blank column which is dynamically generated in matrix. Now when you put an expression to hide the column, only the cells inside of group are hidden but the cell in total row is not hidden. So it looks to
    be repositioned into one cell to the right. Is my understanding correct?
    In this scenario, we also already encountered this issue when we tested in our local environment. It seems to be an issue of internal implement for visibility control in Reporting Services. Now I am trying to involve someone more familiar with Reporting
    Services for a further look at this issue. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated.  
    Thank you for your understanding and support.
    Best Regards,
    Simon Hou

  • Pivot Table with Dynamic Columns and Headers

    Hello,
    I'm trying to pivot a table of data where the column headers will be dynamic.  While I know how to pivot the table to get what I want how will I be able to pick up the table column header from the Pivot to display in the report?
    For example:
    Unpivoted data is Employee Code, Branch Code, Problem Code, # of Problems.
    There is many records for a given Employee and Branch that I want to pivot so the Column headers are the Problem Codes and the data below is the SUM(num_problems) for that Problem.
    So the data may look like this for Tech Bob, Branch NY.
    Problem = LEAK, Num_problem = 5
    Problem = DAMAGE, Num_problem = 2
    Problem = OTHER, Num_problem = 3
    Which problem codes may appear is unknown but selecting the DISTINCT(problem) across all techs gives me the column headings to use.
    So if I pivot this data, I get this Row:
    Tech = Bob, Branch = NY, DAMAGE = 2, LEAK = 5, OTHER = 3
    So first can SSRS handle having dynamic columns?  Only Tech and Branch are known and the remaining columns are dynamic based on how many Problems they worked on.
    Second, how can I set the column heading in my Tablix to be the Problem Code?
    Sherry

    You just need to use a  matrix container
    Use EmployeeCode and BranchCode for row group
    ProblemCode as column group and SUM([No Of Problems]) as the data expression and it will generate the columns for you based on ProblemCode values automatically.
    See an example here
    Sample Matrix
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Export file - fixed columns and remove dimensions

    Hello Experts
    I wan't to use the standard export package ang get dimensions fixed in specific columns and also remove some dimensions.
    The problem is that i always get the dimensions randomly in columns and when i am able to remove dimensions, the dimensions are removed randomly, please see *MAPPING and result below, does anyone know how to do this? Or have an example? I have used the standard example files but they have not helped....
    *OPTIONS
    FORMAT = DELIMITED
    HEADER = YES
    DELIMITER=
    VALIDATERECORDS=NO
    ROUNDAMOUNT = 7
    OUTPUTHEADER=
    OUTPUTDELIMITER=
    SPECIFICMAPPING=YES
    *MAPPING
    ENTITY=*COL(1)
    TIME=*COL(2)
    ACCOUNT=*COL(3)
    RPTCURRENCY=*COL(4)
    AMOUNT=*COL(5)
    ACCOUNT,ENTITY,RPTCURRENCY,TIME,AMOUNT
    NON_FLOW,ADT5_E,ACTUAL,ANA_TONS,TOTALADJ
    NON_FLOW,568U_E,ACTUAL,ANA_TONS,TOTALADJ
    Best regards
    Jonas

    Given the nature of OLAP and FACT tables, I do not beleive that you are able to disassociate a dimension from the export process.  So, I don't think that you may choose the dimensions to export, plus there method of being written to a file may just be alphabetical. I would export the complete details and then manipulate the details during an import process. The only other alternative that I can think of is to write a custom SSIS SQL script, to allow for FACT member aggregation if you choose to remove a dimension.
    But I would need to test further. Hope this helps.

  • Dynamically adding and removing managed servers

    Hi,
              I'm experimenting with adding and removing managed servers while applications are running on the cluster. I've written some scripts using weblogic.Admin to do the tasks. It seems that it's working. However, I'd like to confirm that this is supported. I also have the following questions:
              1. Applications running on a cluster are automatically deployed to the newly configured managed server once it is started using startManagedWebLogic.sh. Are there any non-error situations that applications are not started automatically?
              2. To remove a managed server from the cluster, I first shutdown the server gracefully and then delete the server from the domain using weblogic.Admin. Is this the recommended way to do it?
              3. Anything else I need to pay attention to before adding and removing servers?
              Thanks for any information and pointers.
              Ming

    1. only if the staging mode is external.
              2. yes, if the server should be permanently removed. If the server is down for short maintenance, you do not need to remove it from the cluster.
              3. yes, try to avoid doing this during deployment tasks. That can be nasty.
              - Anders M.

  • Dynamically Add and Remove Train Stop with version 11.1.2.3

    I have found examples with prior versions, such as http://adfpractice-fedor.blogspot.com/2011/12/dynamic-adf-train-showing-train-stops.html.
    But, they do not work in 11.1.2.3.
    It appears that the APIs have changed considerably.
    Please advise as to a similiar example that is based on the API model for 11.1.2.3
    Thanks in advance for your help.

    Hi,
    I have a requirement to dynamically add different train stops at runtime, which are not part of the task flow at design time. I would like to build the train at runtime based on various conditions that occur. Is this possible?
    Train stops can only be removed from the train model before the first view renders, which means during task flow initialization. To a later point you cannot remove but hide stops. The train model is created upon task flow initialization too and any train stop that is not part of the model virtually doesn't exist. In your case I think creating a custom train model from ground up and using this with the train is the way to go. The default task flow metadata based implementation doesn't seem to do what you need it for. Alternatively, if you can predict the maximum number of train stops, you can design them at design time and then remove those you don't need at runtime using a HashMap reference in the train stop configuration and check the HashMap values upon initialization.
    Here's a write up on trains I did in the past: http://www.oracle.com/technetwork/issue-archive/2011/11-sep/o51adf-452576.html
    More documents you find on ADF Code Corner http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html (just search for train)
    Frank

  • How to call a SP with dynamic columns and output results into a .csv file via SSIS

    hi Folks, I have a challenging question here. I've created a SP called dbo.ResultsWithDynamicColumns and take one parameter of CONVERT(DATE,GETDATE()), the uniqueness of this SP is that the result does not have fixed columns as it's based on sales from previous
    days. For example, Previous day, customers have purchased 20 products but today , 30 products have been purchased.
    Right now, on SSMS, I am able to execute this SP when supplying  a parameter.  What I want to achieve here is to automate this process and send the result as a .csv file and SFTP to a server. 
    SFTP part is kinda easy as I can call WinSCP with proper script to handle it.  How to export the result of a dynamic SP to a .CSV file? 
    I've tried
    EXEC xp_cmdshell ' BCP " EXEC xxxx.[dbo].[ResultsWithDynamicColumns ]  @dateFrom = ''2014-01-21''"   queryout  "c:\path\xxxx.dat" -T -c'
    SSMS gives the following error as Error = [Microsoft][SQL Server Native Client 10.0]BCP host-files must contain at least one column
    any ideas?
    thanks
    Hui
    --Currently using Reporting Service 2000; Visual Studio .NET 2003; Visual Source Safe SSIS 2008 SSAS 2008, SVN --

    Hey Jakub, thanks and I did see the #temp table issue in our 2008R2.  I finally figured it out in a different way... I manage to modify this dynamic SP to output results into
    a physical table. This table will be dropped and recreated everytime when SP gets executed... After that, I used a SSIS pkg to output this table
    to a file destination which is .csv.  
     The downside is that if this table structure ever gets changed, this SSIS pkg will fail or not fully reflecting the whole table. However, this won't happen often
    and I can live with that at this moment. 
    Thanks
    --Currently using Reporting Service 2000; Visual Studio .NET 2003; Visual Source Safe SSIS 2008 SSAS 2008, SVN --

  • Hide one layer, and remove the visible layers using preflights!

    Hello,
    I have one pdf (with one layer called "ARTWORK")  in which I create a layer using Javascript. To do this I create a watermark and asigning it to a OCG contents with this code:
    this.addWatermarkFromText("watermark");
    this.getOCGs();
    function FindOCG(cName) {
        var aOCGs = this.getOCGs();
        for(var i=0; aOCGs && i<aOCGs.length;i++) {
            if(aOCGs[i].name == cName) return aOCGs[i];
        return null;
    var ocg = null;
    while( (ocg = FindOCG("Watermark")) != null) ocg.name = "NEW LAYER";
    this.setOCGOrder(this.getOCGs());
    Then I successfully run a preflight profile, which is able to select an object filled with a defined spot colour and put it on the layer named "NEW LAYER"
    The result of this is that I have two layers, (ARTWORK and NEW LAYER)
    But when I want to view ONLY the contents of the NEW LAYER, it is necessary to  show the ARTWORK layer as well, otherwise I see the only the text "watermark" added in the Javascript.
    My intention is hide the ARTWORK layer and show only the elements that I moved to the NEW LAYER, running the following Javascript code:
    var ocgs = this.getOCGs();
    for (var i in ocgs) {
        if (ocgs[i].name=="NEW LAYER")
            ocgs[i].state = true;
    else ocgs[i].state = false;
    and then run another preflight to remove invisible layers.
    But it seems  that even that I move the elements to the new layer, somehow they still remain in the artwork layer...
    Anyone could help me to solve this, please?
    Thanks and Regards.

    This is not really a JS question, more of a Preflight question...

  • ALV with dynamic columns and description labels in header titles

    Hi everybody,
    I have to implement an ALV whose columns are not defined until runtime. Is it possible to do that in some simple way? Is it necessary to use objects to define this kind of ALV's?
    And another one query, is it possible to add description labels to column headers so that when the user points with the cursor in them he/she gets a little explanation about the detail of the column (for example, description name of the product hierarchy when pointing to the column named with one of the existing hierarchies, i.e 010102102)
    Thanks in advance,

    for your first question check this
    Just check this sample from one of the SAP site
    ABAP Code Sample for Dynamic Table for ALV with Cell Coloring
    Applies To:
    ABAP / ALV Grid
    Article Summary
    ABAP Code Sample that uses dynamic programming techniques to build a dynamic internal table for display in an ALV Grid with Cell Coloring.
    Code Sample
    REPORT zcdf_dynamic_table.
    * Dynamic ALV Grid with Cell Coloring.
    * Build a field catalog dynamically and provide the ability to color
    * the cells.
    * To test, copy this code to any program name and create screen 100
    * as described in the comments. After the screen is displayed, hit
    * enter to exit the screen.
    * Tested in 4.6C and 6.20
    * Charles Folwell - [email protected] - Feb 2, 2005
    DATA:
    r_dyn_table TYPE REF TO data,
    r_wa_dyn_table TYPE REF TO data,
    r_dock_ctnr TYPE REF TO cl_gui_docking_container,
    r_alv_grid TYPE REF TO cl_gui_alv_grid,
    t_fieldcat1 TYPE lvc_t_fcat, "with cell color
    t_fieldcat2 TYPE lvc_t_fcat, "without cell color
    wa_fieldcat LIKE LINE OF t_fieldcat1,
    wa_cellcolors TYPE LINE OF lvc_t_scol,
    wa_is_layout TYPE lvc_s_layo.
    FIELD-SYMBOLS:
    <t_dyn_table> TYPE STANDARD TABLE,
    <wa_dyn_table> TYPE ANY,
    <t_cellcolors> TYPE lvc_t_scol,
    <w_field> TYPE ANY.
    START-OF-SELECTION.
    * Build field catalog based on your criteria.
    wa_fieldcat-fieldname = 'FIELD1'.
    wa_fieldcat-inttype = 'C'.
    wa_fieldcat-outputlen = '10'.
    wa_fieldcat-coltext = 'My Field 1'.
    wa_fieldcat-seltext = wa_fieldcat-coltext.
    APPEND wa_fieldcat TO t_fieldcat1.
    wa_fieldcat-fieldname = 'FIELD2'.
    wa_fieldcat-inttype = 'C'.
    wa_fieldcat-outputlen = '10'.
    wa_fieldcat-coltext = 'My Field 2'.
    wa_fieldcat-seltext = wa_fieldcat-coltext.
    APPEND wa_fieldcat TO t_fieldcat1.
    * Before adding cell color table, save fieldcatalog to pass
    * to ALV call. The ALV call needs a fieldcatalog without
    * the internal table for cell coloring.
    t_fieldcat2[] = t_fieldcat1[].
    * Add cell color table.
    * CALENDAR_TYPE is a structure in the dictionary with a
    * field called COLTAB of type LVC_T_SCOL. You can use
    * any structure and field that has the type LVC_T_SCOL.
    wa_fieldcat-fieldname = 'T_CELLCOLORS'.
    wa_fieldcat-ref_field = 'COLTAB'.
    wa_fieldcat-ref_table = 'CALENDAR_TYPE'.
    APPEND wa_fieldcat TO t_fieldcat1.
    * Create dynamic table including the internal table
    * for cell coloring.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = t_fieldcat1
    IMPORTING
    ep_table = r_dyn_table
    EXCEPTIONS
    generate_subpool_dir_full = 1
    OTHERS = 2.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    * Get access to new table using field symbol.
    ASSIGN r_dyn_table->* TO <t_dyn_table>.
    * Create work area for new table.
    CREATE DATA r_wa_dyn_table LIKE LINE OF <t_dyn_table>.
    * Get access to new work area using field symbol.
    ASSIGN r_wa_dyn_table->* TO <wa_dyn_table>.
    * Get data into table from somewhere. Field names are
    * known at this point because field catalog is already
    * built. Read field names from the field catalog or use
    * COMPONENT <number> in a DO loop to access the fields. A
    * simpler hard coded approach is used here.
    ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    <w_field> = 'ABC'.
    ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    <w_field> = 'XYZ'.
    APPEND <wa_dyn_table> TO <t_dyn_table>.
    ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    <w_field> = 'TUV'.
    ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    <w_field> = 'DEF'.
    APPEND <wa_dyn_table> TO <t_dyn_table>.
    * Color cells based on your criteria. In this example, a test on
    * FIELD2 is used to decide on color.
    LOOP AT <t_dyn_table> INTO <wa_dyn_table>.
    ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    * Get access to internal table used to color cells.
    ASSIGN COMPONENT 'T_CELLCOLORS'
    OF STRUCTURE <wa_dyn_table> TO <t_cellcolors>.
    CLEAR wa_cellcolors.
    wa_cellcolors-fname = 'FIELD2'.
    IF <w_field> = 'DEF'.
    wa_cellcolors-color-col = '7'.
    ELSE.
    wa_cellcolors-color-col = '5'.
    ENDIF.
    APPEND wa_cellcolors TO <t_cellcolors>.
    MODIFY <t_dyn_table> FROM <wa_dyn_table>.
    ENDLOOP.
    * Display screen. Define screen 100 as empty, with next screen
    * set to 0 and flow logic of:
    * PROCESS BEFORE OUTPUT.
    * MODULE initialization.
    * PROCESS AFTER INPUT.
    CALL SCREEN 100.
    * MODULE initialization OUTPUT
    MODULE initialization OUTPUT.
    * Set up for ALV display.
    IF r_dock_ctnr IS INITIAL.
    CREATE OBJECT r_dock_ctnr
    EXPORTING
    side = cl_gui_docking_container=>dock_at_left
    ratio = '90'.
    CREATE OBJECT r_alv_grid
    EXPORTING i_parent = r_dock_ctnr.
    * Set ALV controls for cell coloring table.
    wa_is_layout-ctab_fname = 'T_CELLCOLORS'.
    * Display.
    CALL METHOD r_alv_grid->set_table_for_first_display
    EXPORTING
    is_layout = wa_is_layout
    CHANGING
    it_outtab = <t_dyn_table>
    it_fieldcatalog = t_fieldcat2.
    ELSE. "grid already prepared
    * Refresh display.
    CALL METHOD r_alv_grid->refresh_table_display
    EXPORTING
    i_soft_refresh = ' '
    EXCEPTIONS
    finished = 1
    OTHERS = 2.
    ENDIF.
    ENDMODULE. " initialization OUTPUT

  • ALV report with dynamic columns, and repeated structure rows

    Hey Guys,
    I've done some ALV programming, but most of the reports were straight forward. This one is a little interesting. So here go the questions...
    Q1: Regarding Columns:
    What is the best way to code a report with columns being dynamic. This is one of the parameters the user is going to enter in his input.
    Q2: Regarding Rows:
    I want to repeat a structure(say it contains f1, f2, f3) multiple time in rows. What is the best way to do it? The labels for these fields have to appear in the first column.
    Below is the visual representation of the questions.
    Jan 06  , Feb 06, Mar 06....(dynamic)
       material 1
    Current Stock
    current required
    $Value of stock
       material 2
    Current Stock
    current required
    $Value of stock
       material 3
    Current Stock
    current required
    $Value of stock
    Thanks for your help.
    Sumit.

    Hi Sumit,
    Just check this sample from one of the SAP site
    ABAP Code Sample for Dynamic Table for ALV with Cell Coloring
    Applies To:
    ABAP / ALV Grid
    Article Summary
    ABAP Code Sample that uses dynamic programming techniques to build a dynamic internal table for display in an ALV Grid with Cell Coloring.
    Code Sample
    REPORT zcdf_dynamic_table.
    * Dynamic ALV Grid with Cell Coloring.
    * Build a field catalog dynamically and provide the ability to color
    * the cells.
    * To test, copy this code to any program name and create screen 100
    * as described in the comments. After the screen is displayed, hit
    * enter to exit the screen.
    * Tested in 4.6C and 6.20
    * Charles Folwell - [email protected] - Feb 2, 2005
    DATA:
    r_dyn_table TYPE REF TO data,
    r_wa_dyn_table TYPE REF TO data,
    r_dock_ctnr TYPE REF TO cl_gui_docking_container,
    r_alv_grid TYPE REF TO cl_gui_alv_grid,
    t_fieldcat1 TYPE lvc_t_fcat, "with cell color
    t_fieldcat2 TYPE lvc_t_fcat, "without cell color
    wa_fieldcat LIKE LINE OF t_fieldcat1,
    wa_cellcolors TYPE LINE OF lvc_t_scol,
    wa_is_layout TYPE lvc_s_layo.
    FIELD-SYMBOLS:
    <t_dyn_table> TYPE STANDARD TABLE,
    <wa_dyn_table> TYPE ANY,
    <t_cellcolors> TYPE lvc_t_scol,
    <w_field> TYPE ANY.
    START-OF-SELECTION.
    * Build field catalog based on your criteria.
    wa_fieldcat-fieldname = 'FIELD1'.
    wa_fieldcat-inttype = 'C'.
    wa_fieldcat-outputlen = '10'.
    wa_fieldcat-coltext = 'My Field 1'.
    wa_fieldcat-seltext = wa_fieldcat-coltext.
    APPEND wa_fieldcat TO t_fieldcat1.
    wa_fieldcat-fieldname = 'FIELD2'.
    wa_fieldcat-inttype = 'C'.
    wa_fieldcat-outputlen = '10'.
    wa_fieldcat-coltext = 'My Field 2'.
    wa_fieldcat-seltext = wa_fieldcat-coltext.
    APPEND wa_fieldcat TO t_fieldcat1.
    * Before adding cell color table, save fieldcatalog to pass
    * to ALV call. The ALV call needs a fieldcatalog without
    * the internal table for cell coloring.
    t_fieldcat2[] = t_fieldcat1[].
    * Add cell color table.
    * CALENDAR_TYPE is a structure in the dictionary with a
    * field called COLTAB of type LVC_T_SCOL. You can use
    * any structure and field that has the type LVC_T_SCOL.
    wa_fieldcat-fieldname = 'T_CELLCOLORS'.
    wa_fieldcat-ref_field = 'COLTAB'.
    wa_fieldcat-ref_table = 'CALENDAR_TYPE'.
    APPEND wa_fieldcat TO t_fieldcat1.
    * Create dynamic table including the internal table
    * for cell coloring.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = t_fieldcat1
    IMPORTING
    ep_table = r_dyn_table
    EXCEPTIONS
    generate_subpool_dir_full = 1
    OTHERS = 2.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    * Get access to new table using field symbol.
    ASSIGN r_dyn_table->* TO <t_dyn_table>.
    * Create work area for new table.
    CREATE DATA r_wa_dyn_table LIKE LINE OF <t_dyn_table>.
    * Get access to new work area using field symbol.
    ASSIGN r_wa_dyn_table->* TO <wa_dyn_table>.
    * Get data into table from somewhere. Field names are
    * known at this point because field catalog is already
    * built. Read field names from the field catalog or use
    * COMPONENT <number> in a DO loop to access the fields. A
    * simpler hard coded approach is used here.
    ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    <w_field> = 'ABC'.
    ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    <w_field> = 'XYZ'.
    APPEND <wa_dyn_table> TO <t_dyn_table>.
    ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    <w_field> = 'TUV'.
    ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    <w_field> = 'DEF'.
    APPEND <wa_dyn_table> TO <t_dyn_table>.
    * Color cells based on your criteria. In this example, a test on
    * FIELD2 is used to decide on color.
    LOOP AT <t_dyn_table> INTO <wa_dyn_table>.
    ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    * Get access to internal table used to color cells.
    ASSIGN COMPONENT 'T_CELLCOLORS'
    OF STRUCTURE <wa_dyn_table> TO <t_cellcolors>.
    CLEAR wa_cellcolors.
    wa_cellcolors-fname = 'FIELD2'.
    IF <w_field> = 'DEF'.
    wa_cellcolors-color-col = '7'.
    ELSE.
    wa_cellcolors-color-col = '5'.
    ENDIF.
    APPEND wa_cellcolors TO <t_cellcolors>.
    MODIFY <t_dyn_table> FROM <wa_dyn_table>.
    ENDLOOP.
    * Display screen. Define screen 100 as empty, with next screen
    * set to 0 and flow logic of:
    * PROCESS BEFORE OUTPUT.
    * MODULE initialization.
    * PROCESS AFTER INPUT.
    CALL SCREEN 100.
    * MODULE initialization OUTPUT
    MODULE initialization OUTPUT.
    * Set up for ALV display.
    IF r_dock_ctnr IS INITIAL.
    CREATE OBJECT r_dock_ctnr
    EXPORTING
    side = cl_gui_docking_container=>dock_at_left
    ratio = '90'.
    CREATE OBJECT r_alv_grid
    EXPORTING i_parent = r_dock_ctnr.
    * Set ALV controls for cell coloring table.
    wa_is_layout-ctab_fname = 'T_CELLCOLORS'.
    * Display.
    CALL METHOD r_alv_grid->set_table_for_first_display
    EXPORTING
    is_layout = wa_is_layout
    CHANGING
    it_outtab = <t_dyn_table>
    it_fieldcatalog = t_fieldcat2.
    ELSE. "grid already prepared
    * Refresh display.
    CALL METHOD r_alv_grid->refresh_table_display
    EXPORTING
    i_soft_refresh = ' '
    EXCEPTIONS
    finished = 1
    OTHERS = 2.
    ENDIF.
    ENDMODULE. " initialization OUTPUT
    Regards
    vijay

  • Button values in dynamic columns and rows

    Hi,
    I am working on webpage that allows the user to dynamically browse a database. I already did this as an applet and was asked to convert it to server-side intensive. Thus began my adventure into JSP and servlets.
    The problem i am having is that at some point a table is generated with a number of columns having submit buttons instead of just text. I want to get the column number and the value of the button that user clicks and use it in my servlet.
    Can anyone suggest a way to do this ?
    My current train of thoughts is to attach the column index to the name of the button and use javascript's onclick to call a function to set a hidden parameter. I am a novice to javascript - will it be possible to pass the name attribute of the button to the function ?
    Also, can I use jsp tags inside the javascript function ?
    TIA
    -Harry
    Below is the code for generating the page.
    <jsp:useBean id="tableData" scope="session" class="beans.TableBean" />
    <table border="1">
    <% int columnCount = tableData.getColumnCount(); %>
    <% int rowCount = tableData.getRowCount(); %>
    <tr align="center">
    <%for(int i=0; i < columnCount; i++)
    {%>
    <td>
    <%= tableData.getColumnTitle(i) %>
    </td>
    <%}%>
    </tr>
    <% for(int i=0; i<rowCount;i++)
    {%>
    <tr>
    <%for(int j=0; j<columnCount; j++)
    String val = tableData.getValueAt(i,j);
    %>
    <td>
    <%if(tableData.isDrill(j))
    %>
    <input type="submit" name="<%=val%>" value="<%=val%>" >
    <%}
    else
    {%>
    <%=val %>
    </td>
    <%}
    }%>
    </tr>
    <%}%>
    </table>

    Is there other data being passed to the servlet also... by the looks of the code you're using now, there isn't. If this is the case, why bother with submit buttons? You can just use an HTML button, and link it to the servlet passing the information you need, sending your column numbers as parameters inside the url,
    <input type="button" value="<%=val%>" onClick="window.location.href='myServlet?col=<%=j%>&val=<%=val%>';"

Maybe you are looking for