Set column title with variable

Hi all,
Is it possible to set the column title with a value from a presentation variable (or any other variable) ?
I want to set the title based on a dynamic value.

In short - not out of the box
heres a workaround :
http://oraclebizint.wordpress.com/2008/01/25/oracle-bi-ee-101332-dynamic-column-headers-using-presentation-variables-sets-and-conditional-formatting/
but you wont be able to use 'enable column sorting in dashboards'
You could still use navigation, in theory, but you will need to construct a GOURL syntax as part of the column value and use the format as HTML option - this might not suit your data rows.

Similar Messages

  • How to set column title for CL_SALV_TREE

    Dear all,
    I am using CL_SALV_TREE to create a report. But, some unexpected problem comes up. I have used below code to set the title for each column:
      LR_COLUMNS = GR_TREE->GET_COLUMNS( ).
      LR_COLUMN = LR_COLUMNS->GET_COLUMN( 'FIELDNAME' ).
      LR_COLUMN->SET_LONG_TEXT( 'Long Text' ).
      LR_COLUMN->SET_MEDIUM_TEXT( 'Medium Text' ).
      LR_COLUMN->SET_SHORT_TEXT( 'Short Text' ).
    But, it seems that above code does not take effect when report is running. The title for column remains the info of ABAP Dictionary. Is anyone can help me to resolve this problem? It's very urgent for me!
    Looking forward to receiving your replies! Thank you very much!
    Justin,

    Hello Justin
    I copied the sample report <b>SALV_DEMO_TREE_FUNCTIONS</b> (available on IDES ECC 5.0) and added the following coding to routine <i>set_columns_technical</i>:
    [code]&----
    *&      Form  set_columns_technical
          text
    FORM set_columns_technical.
      DATA: lr_columns TYPE REF TO cl_salv_columns,
            lr_column  TYPE REF TO cl_salv_column.
      lr_columns = gr_tree->get_columns( ).
      lr_columns->set_optimize( abap_true ).
      lr_columns->set_column_position( columnname = 'PRICE'
                                       position   = 1 ).
    change a column's alignment
      TRY.
          lr_column ?= lr_columns->get_column( 'CURRENCY' ).
          lr_column->set_alignment( if_salv_c_alignment=>right ).
    "$Comment: added coding
          DATA:
            ld_short    TYPE scrtext_s,
            ld_medium   TYPE scrtext_m,
            ld_long     TYPE scrtext_l.
          ld_short = 'Short'.
          lr_column->set_short_text( ld_short ).
          ld_medium = 'Medium Col Text'.
          lr_column->set_medium_text( ld_medium ).
          ld_long = 'Long Column Text'.
          lr_column->set_long_text( ld_long ).
    "$Comment: added coding
        CATCH cx_salv_not_found.                            "#EC NO_HANDLER
      ENDTRY.
    ...[/code]
    At least the new short text is displayed on the ALV tree. I assume that you have to be very careful and scrupulous in choosing the correct data types for the method calls.
    Regards
      Uwe

  • How to Set Column Title using OLE2

    Hi All,
    I have a simple block which has 3 columns and I am trying to open that block data into excel using the code below. The code is in a button. It works prefectly fine. However, I want to also have the Prompts so that the first row is the column headers which I don't know how to get into this code. Does anyone have any suggestions? Thank you.
    DECLARE
    application Client_OLE2.Obj_Type;
    workbooks Client_OLE2.Obj_Type;
    workbook Client_OLE2.Obj_Type;
    worksheets Client_OLE2.Obj_Type;
    worksheet Client_OLE2.Obj_Type;
    args Client_OLE2.List_Type;
    cell ole2.Obj_Type;
    j INTEGER;
    k INTEGER;
    BEGIN
    application := Client_OLE2.create_obj('Excel.Application');
    Client_OLE2.Set_Property ( application , 'visible', 1);
    workbooks := Client_OLE2.Get_Obj_Property(application, 'Workbooks');
    workbook := Client_OLE2.Invoke_Obj(workbooks, 'Add');
    worksheets := Client_OLE2.Get_Obj_Property(workbook, 'Worksheets');
    worksheet := Client_OLE2.Invoke_Obj(worksheets, 'Add');
    go_block('DM_T_EXCEPTION_LOG');
    first_record;
    j:=1;
    k:=1;
    while :system.last_record = 'FALSE'
    loop
    for k in 1..3 /* Block has 3 columns */
    loop
    If not name_in(:system.cursor_item) is NULL Then
    args:=Client_OLE2.create_arglist;
    Client_OLE2.add_arg(args, j);
    Client_OLE2.add_arg(args, k);
    cell:=Client_OLE2.get_obj_property(worksheet, 'Cells', args);
    Client_OLE2.destroy_arglist(args);
    Client_OLE2.set_property(cell, 'Value', name_in(:system.cursor_item));
    Client_OLE2.release_obj(cell);
    End If;
    next_item;
    end loop;
    j:=j+1;
    next_record;
    end loop;
    /* For the last record */
    for k in 1..3
    loop
    If not name_in(:system.cursor_item) is NULL Then
    args:=Client_OLE2.create_arglist;
    Client_OLE2.add_arg(args, j);
    Client_OLE2.add_arg(args, k);
    cell:=Client_OLE2.get_obj_property(worksheet, 'Cells', args);
    Client_OLE2.destroy_arglist(args);
    Client_OLE2.set_property(cell, 'Value', name_in(:system.cursor_item));
    Client_OLE2.release_obj(cell);
    End If;
    next_item;
    end loop;
    Client_OLE2.Release_Obj(worksheet);
    Client_OLE2.Release_Obj(worksheets);
    END;

    Ok,
    I have managed to fix it but I have another problem. The code brings me my column headings but the 2nd row it doesn't bring me the right data into the first column and is messing it up. Can someone point out what I am doing wrong in the code?
    Thanks
    application Client_OLE2.Obj_Type;
    workbooks Client_OLE2.Obj_Type;
    workbook Client_OLE2.Obj_Type;
    worksheets Client_OLE2.Obj_Type;
    worksheet Client_OLE2.Obj_Type;
    args Client_OLE2.List_Type;
    cell ole2.Obj_Type;
    item_prompt VARCHAR2(32767);
    j INTEGER;
    k INTEGER;
    BEGIN
    application := Client_OLE2.create_obj('Excel.Application');
    Client_OLE2.Set_Property ( application , 'visible', 1);
    workbooks := Client_OLE2.Get_Obj_Property(application, 'Workbooks');
    workbook := Client_OLE2.Invoke_Obj(workbooks, 'Add');
    worksheets := Client_OLE2.Get_Obj_Property(workbook, 'Worksheets');
    worksheet := Client_OLE2.Invoke_Obj(worksheets, 'Add');
    go_block('DM_T_EXCEPTION_LOG');
    first_record;
    j:=1;
    k:=1;
    /* Add the column headings using item prompts */
    FOR k IN 1..10 /* Block has 10 visible columns */
    LOOP
    item_prompt := get_item_property(:SYSTEM.CURSOR_ITEM, prompt_text);
    args:=client_ole2.create_arglist;
    client_ole2.add_arg(args, j);
    client_ole2.add_arg(args, k);
    cell:=client_ole2.get_obj_property(worksheet, 'Cells', args);
    client_ole2.destroy_arglist(args);
    client_ole2.set_property(cell, 'Value', item_prompt);
    client_ole2.release_obj(cell);
    next_item;
    END LOOP;
    j := j+1;
    while :system.last_record = 'FALSE'
    loop
    for k in 1..10 /* DEPT has 3 columns */
    loop
    If not name_in(:system.cursor_item) is NULL Then
         item_prompt := get_item_property(:SYSTEM.CURRENT_BLOCK||'.'||:SYSTEM.CURRENT_ITEM, prompt_text);
    args:=Client_OLE2.create_arglist;
    Client_OLE2.add_arg(args, j);
    Client_OLE2.add_arg(args, k);
    cell:=Client_OLE2.get_obj_property(worksheet, 'Cells', args);
    Client_OLE2.destroy_arglist(args);
    Client_OLE2.set_property(cell, 'Value', name_in(:system.cursor_item));
    Client_OLE2.release_obj(cell);
    End If;
    next_item;
    end loop;
    j:=j+1;
    next_record;
    end loop;
    /* For the last record */
    for k in 1..10
    loop
    If not name_in(:system.cursor_item) is NULL Then
    args:=Client_OLE2.create_arglist;
    Client_OLE2.add_arg(args, j);
    Client_OLE2.add_arg(args, k);
    cell:=Client_OLE2.get_obj_property(worksheet, 'Cells', args);
    Client_OLE2.destroy_arglist(args);
    Client_OLE2.set_property(cell, 'Value', name_in(:system.cursor_item));
    Client_OLE2.release_obj(cell);
    End If;
    next_item;
    end loop;
    Client_OLE2.Release_Obj(worksheet);
    Client_OLE2.Release_Obj(worksheets);
    END;

  • Select column value with variable

    I want to select some data from tables . For that , i write this procedure :
        create or replace procedure find_and_insert
          colname varchar2(4000);
          var varchar2(4000);
          colval varchar2(4000);
        begin
          colname := 'COUNTRY_ID';
          var := 'select distinct(colname) into colval from HR.countries where colname = '||'AR'||';';
          execute immediate var; 
        end;
    But it can not work . It return 'COUNTRY_ID' into colval , not data of COUNTRY_ID ; Can anyone help me ?

    It is not clear what you are trying to do, but it looks like:
    declare
        v_colname1 varchar2(30);
        v_colname2 varchar2(30);
        v_var varchar2(4000);
        v_colval varchar2(4000);
    begin
        v_colname1 := 'COUNTRY_ID';
        v_colname2 := 'COUNTRY_NAME';
        v_var := 'select ' || v_colname2 || ' colval from HR.countries where ' || v_colname1 || ' = :1';
        execute immediate v_var
          into v_colval
          using 'AR';
        dbms_output.put_line(v_colval);
    end;
    Argentina
    PL/SQL procedure successfully completed.
    SQL>
    SY.

  • Xml search and replace for 'Session Variables' in column title view

    Hi Experts,
    I have around 10 reports where measure column titles are displayed based the session variable.
    Below is the syntax I have used in the column title
    @{biServer.variables['NQ_SESSION.VariableName']}
    Now I would like to replace the above syntax with some static text. To do this, I am trying to use the xml search and replace feature in the catalog manager.
    For some reason, catalog manager is unable to find the syntax in the xml file. I have tried using escape character also for the apostrophe by using &apos, but no luck.
    Any pointers on how to replace the text?
    Thanks

    Using Analysis get the xml conversion for @{biServer.variables['NQ_SESSION.VariableName']} from Advanced tab's xml code
    use this code to find in catalog manager, if you able to find then go for search and replace option.
    I think this should work for you.

  • Fetch the column title and evaluate with another value.

    Hi all,
    I am new to SAP SDK and am trying to populate the Forecast matrix with quantities for items defined in Sales Order and for the delivery date mentioned in SO.
    I want to fill in the quantities for the respective item code in the date column of Forecast.
    For ex: Sales Order has an item M which has a delivery date of say 15/12/2010 and quantity as 100 then when i want to fill this in Forecast how do i fill 100 Qty in the column with title date as 15/12/2010?
    As the column id are all variables in Forecast screen how best can i search for a particular date in the number of columns via code.
    Sample code if provided will be useful..
    Thanks in advance
    Regards
    Rohan S Kamble

    The following link might help you in achieving this
    Re: Make the column title with value month_year based on the fiscal year/period

  • View responses - Column titles

    Please can you help me find out why the questions I have created in the form (with either multiple/drop down answers) are not appearing in the column titles within "View Responses"???
    Currently I have lots of blank column titles with answers yes or no in them and I cant see what question releates to what answer??

    Hi,
    Do you have filters set?
    If possible, please provide a screenshot showing the problem.
    Let me point you to some documentation on View Responses features, please check these out and see if they help you resolve your issue:
    http://helpx.adobe.com/acrobat-com/formscentral/help/views.html
    http://helpx.adobe.com/acrobat-com/formscentral/help/sort-filter-data.html
    http://helpx.adobe.com/acrobat-com/formscentral/help/format-response-table.html
    Thanks,
    Lucia

  • [SOLVED] set columns in vim does not work

    I would like to set the window size of my vim to 95 when working with markdown files, so put
    set columns=95
    into an autosourced file when opening Markdown files. Unfortunately this has no effect and when I look at
    set columns?
    the window size is still 179 characters long.
    When I try to do
    set columns=95
    with vim already open, vim very shortly resizes the text/window, but after a second return to the original size which is 179 character (screen width)
    I tried ot figure out if it is a problem of my .vimrc by temporaliy working with a new empty .vimrc but the problem remains the same. I tried it out in another terminal emulator, but the problem remains the same. I tried it out logged in as root user before starting the XServer and here it worked as expected. So my gues is it has to do or with a X setting or with my window manager or with my shell.
    I am using i3, urxvt and zsh in the context where it didn't work and the Arch install default setting in the context where it works. Still I have no clue what causes the problem.
    Last edited by cutuchiqueno (2013-12-05 12:18:36)

    x33a wrote:I believe you'll need to float urxvt in i3 to do that.
    Thanks, I haven't thought of that possibility and it works. Although what I wanted to achieve is not possible with this solution though I found the Vimroom plugin which did the job, so thanks again.

  • ALV - COLUMN TITLE

    Hi,
    Does anyone have any ideas how I can include a COLUMN TITLE with 2 lines?
    The column should be listed as following:
    Customer
    Number
    123
    456
    789
    Thanks for your help!
    Janete

    Hi Janete ,
    This is not possible by ALV.
    You need to give column header as Short/Medium/long text in ALV and the same is used in ALV display.
    Hope this resolves your issue.

  • Is there any way to spool with variable column size?

    Hi, I'm spooling to a CSV file with the following script (the real SELECT is different but similar, Oracle 10.2.0.3.0):
    SET COLSEP ';'
    SET FEEDBACK OFF
    SET LINESIZE 2000
    SET PAGESIZE 0
    SET TERMOUT OFF
    SET TRIMSPOOL ON
    SET VERIFY OFF
    SPOOL test.csv REPLACE
    SELECT 'COLUMN1', 'COLUMN2', 'COLUMN3' FROM dual UNION ALL
    SELECT 'value1', NULL, NULL FROM dual UNION ALL
    SELECT 'value2', NULL, NULL FROM dual;
    SPOOL OFF
    EXIT SUCCESS COMMITThis produces the following output:
    COLUMN1;COLUMN2;COLUMN3
    value1 ;       ;
    value2 ;       ;Is there any way to get the following output with variable column size
    COLUMN1;COLUMN2;COLUMN3
    value1;;
    value2;;I've tried SET NULL '' but I see no difference. Thanks in advance!
    Markus

    In short, No, because SQL*Plus is laying out the data in columns.
    You could either combine the data into a single column by concatenating as strings or use some other method e.g.
    As sys user:
    CREATE OR REPLACE DIRECTORY TEST_DIR AS '\tmp\myfiles'
    GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser
    /As myuser:
    CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2
                                         ,p_dir IN VARCHAR2
                                         ,p_header_file IN VARCHAR2
                                         ,p_data_file IN VARCHAR2 := NULL) IS
      v_finaltxt  VARCHAR2(4000);
      v_v_val     VARCHAR2(4000);
      v_n_val     NUMBER;
      v_d_val     DATE;
      v_ret       NUMBER;
      c           NUMBER;
      d           NUMBER;
      col_cnt     INTEGER;
      f           BOOLEAN;
      rec_tab     DBMS_SQL.DESC_TAB;
      col_num     NUMBER;
      v_fh        UTL_FILE.FILE_TYPE;
      v_samefile  BOOLEAN := (NVL(p_data_file,p_header_file) = p_header_file);
    BEGIN
      c := DBMS_SQL.OPEN_CURSOR;
      DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
      d := DBMS_SQL.EXECUTE(c);
      DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
      FOR j in 1..col_cnt
      LOOP
        CASE rec_tab(j).col_type
          WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
          WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);
          WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);
        ELSE
          DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
        END CASE;
      END LOOP;
      -- This part outputs the HEADER
      v_fh := UTL_FILE.FOPEN(upper(p_dir),p_header_file,'w',32767);
      FOR j in 1..col_cnt
      LOOP
        v_finaltxt := ltrim(v_finaltxt||','||lower(rec_tab(j).col_name),',');
      END LOOP;
      --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
      UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
      IF NOT v_samefile THEN
        UTL_FILE.FCLOSE(v_fh);
      END IF;
      -- This part outputs the DATA
      IF NOT v_samefile THEN
        v_fh := UTL_FILE.FOPEN(upper(p_dir),p_data_file,'w',32767);
      END IF;
      LOOP
        v_ret := DBMS_SQL.FETCH_ROWS(c);
        EXIT WHEN v_ret = 0;
        v_finaltxt := NULL;
        FOR j in 1..col_cnt
        LOOP
          CASE rec_tab(j).col_type
            WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
                        v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
            WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
                        v_finaltxt := ltrim(v_finaltxt||','||v_n_val,',');
            WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
                        v_finaltxt := ltrim(v_finaltxt||','||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),',');
          ELSE
            v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
          END CASE;
        END LOOP;
      --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
        UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
      END LOOP;
      UTL_FILE.FCLOSE(v_fh);
      DBMS_SQL.CLOSE_CURSOR(c);
    END;This allows for the header row and the data to be written to seperate files if required.
    e.g.
    SQL> exec run_query('select * from emp','TEST_DIR','output.txt');
    PL/SQL procedure successfully completed.Output.txt file contains:
    empno,ename,job,mgr,hiredate,sal,comm,deptno
    7369,"SMITH","CLERK",7902,17/12/1980 00:00:00,800,,20
    7499,"ALLEN","SALESMAN",7698,20/02/1981 00:00:00,1600,300,30
    7521,"WARD","SALESMAN",7698,22/02/1981 00:00:00,1250,500,30
    7566,"JONES","MANAGER",7839,02/04/1981 00:00:00,2975,,20
    7654,"MARTIN","SALESMAN",7698,28/09/1981 00:00:00,1250,1400,30
    7698,"BLAKE","MANAGER",7839,01/05/1981 00:00:00,2850,,30
    7782,"CLARK","MANAGER",7839,09/06/1981 00:00:00,2450,,10
    7788,"SCOTT","ANALYST",7566,19/04/1987 00:00:00,3000,,20
    7839,"KING","PRESIDENT",,17/11/1981 00:00:00,5000,,10
    7844,"TURNER","SALESMAN",7698,08/09/1981 00:00:00,1500,0,30
    7876,"ADAMS","CLERK",7788,23/05/1987 00:00:00,1100,,20
    7900,"JAMES","CLERK",7698,03/12/1981 00:00:00,950,,30
    7902,"FORD","ANALYST",7566,03/12/1981 00:00:00,3000,,20
    7934,"MILLER","CLERK",7782,23/01/1982 00:00:00,1300,,10The procedure allows for the header and data to go to seperate files if required. Just specifying the "header" filename will put the header and data in the one file.
    Adapt to output different datatypes and styles are required.

  • Set Column Default Value with Workflow

    How to set Column Default Values using a workflow.
    <input alt="Mark as abusive!" id="ctl00_m_g_e11f6e6d_9b4b_42d7_97fb_486623821166_ctl12_ctl03_abuseButton_710" name="ctl00$m$g_e11f6e6d_9b4b_42d7_97fb_486623821166$ctl12$ctl03$abuseButton_710" src="http://www.sharepointforum.nl/_layouts/images/TOZIT/SharePointForums/abuse/abuse.png"
    style="border-width:0px;" title="Mark as abusive!" type="image" />
    15 seconds ago
    After I add an item including metadata in a List, a Workflow starts to create a Library Folder with rootfolder, subfolder and sub-subfolder names based on the List first three column values. 
    I like that the unique created library subfolder automatically receives several additional List column values in its Column Default Value with that workflow.
    After done, documents added to this subfolder are automatically populated with Metadata from the parent Subfolder.
    Workflow standard function can be used  to populate the folder Column Value to this but not the Column Default Value.
    Does someone has a solution how to set Column
    Default Value using a workflow?
    I like to use such workflow in Sharepoint 2010.
    Thank in advance.

    Hi,
    I think it cannot be achieved by workflow.

  • Error: Object variable or with variable not set while accessing BPC Excel

    Hi,
    I am working on BPC NW 7.5. When I am trying to access BPC for Excel I am getting the below error.
    'object variable or with variable not set'
    When I click on BPC for Excel it ask for the credentials, after entering it we encounter this error.
    Any idea why is this happening?
    Regards,
    Priyanka Singh

    Hi Renne,
    Could you share me the solution to resolve the issue?
    I am getting an error "object variable or with block variable not set" while trying to submit data through an Input schedule.
    I am working on SAP BPC 7.0 NW and using MS Excel 2003.
    I can log in to BPC Admin and excel with my user id and password.
    Only when i am trying to click esubmit --> send and refresh schedules i am getting this error.
    I checked my security profile and i have the submit data task in my task profile.
    Following couple existing SDN postings i tried to check the ADD-INs of the excel on my system. However it looks like the steps listed in the existing SDN posts are for MS EXCEL 2007.
    Please suggest me how do i resolve this issue. Please note I am working on SAP BPC 7.0 NW and using MS Excel 2003.
    Regards,
    Jagat

  • Error: Object variable or with variable not set while accessing

    Hi Friends,
    I am facing 'object variable or with variable not set' Error while opening BPC Excel.
    I have done, In Excel 2007, go to Excel Option -> Add-Ins -> Manage: COM Add-ins and Go...
    You look "BPC COM" disable and need enable again.
    But I am getting same Error message again and again. Please help me...
    I did BPC uninstall & install but still error massage poping
    Thank you in Advance

    Hi Kumar,
    I doubt if you are following the below steps. Please confirm. Thanks
    1. Open your normal Excel.
    2. Check for Planning and Consolidation tab on the top ribbon.
    3. I assume this wouldn't be available for you.
    4. If this is not present, open the Excel Options
    5. Click on Add-Ins and check the Active Application Add-ins
    6. Is Planning and consolidation present in it?
    7. If not, select "Disabled Add-ins" in the drop down below besides "Manage".
    8. Click "GO"
    9. Select the Planning and Consolidation add-in from disabled add-ins and "Enable" it.
    10. Check once again if this add-in is prersent in "Active" add-ins .
    11. Now close and re-open excel
    12. The Tab should be present now (Planning and Consolidation)
    Regards,
    Sanjeev

  • How do I get and set column attributes in a table or a treetable with Java?

    Using 11.1.1.4.0
    Hi,
    How do I get and set column attributes in a table or a treetable with Java? For a simple example, say I have a table and want certain roles to see all columns (including address), and other roles can see only certain columns (no address). In a Java method, I want to test if a table's column visible attribute is true and if so, set it to false before rendering it.
    Thanks in advance,
    Troy

    Hi,
    this use case would be a perfect example for using seeded MDS customization. Instead of checking what users are allowed to see or not upon rendering time, you have a customization class and thus the framework doing this for you.
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/31-mds-sample-169173.pdf
    In this paper and sample, specific users see different layouts. It also contains a customization class that shows how this can leverage ADF Security
    Frank

  • ALV with variable columns

    Hi All,
    I have to do a ALV with variable no. of columns. i.e Depending on the data , the columns should get populated.
    Thanks in advance.
    Dnyanesh

    Hi Dnyanesh,
        If you know the no. of columns to be used in the ALV before hand then you can change the field catalog.
    but if you dont know the no. of columns then you can create dynamic table.
    eg:
    1. Create your field catalog either manually or automatically using the function module, LVC_FIELDCATALOG_MERGE. Add more rows to the field catalog table (T_FIELDCAT) at run time.
    2. Use the field catalog to create a table dynamically using the method below.
    DATA: T_OUTPUT TYPE REF TO DATA
    FIELD-SYMBOLS: <T_OUTPUT> TYPE TABLE
    Call Method CL_ALV_TABLE_CREATE->CREATE_DYNAMIC_TABLE
    Exporting
    IT_FIELDCATALOG = T_FIELDCAT
    Importing
    EP_TABLE = T_OUTPUT
    ASSIGN T_OUTPUT->* TO <T_OUTPUT>.
    Now the field symbol <T_OUTPUT> is pointing to an output table of the structure that contains the fields which were determined at runtime. Now fill this table with the data and pass <T_OUTPUT> to the method SET_TABLE_FOR_FIRST_DISPLAY and the ALV grid should show the data properly.
    Example:
    *the content of itab will be fields of the new table
    loop at itab1 into wa1.
      Gs_FIELDCAT-TABNAME     = 'itab2'.
      GS_FIELDCAT-FIELDNAME = wa1-packid.
      GS_FIELDCAT-OUTPUTLEN = 2.
      GS_FIELDCAT-KEY         = space.
      GS_FIELDCAT-SELTEXT_L = wa1-packid.
      GS_FIELDCAT-COL_POS     =  1.
      GS_FIELDCAT-JUST        = 'L'.
      APPEND GS_FIELDCAT TO GT_FIELDCAT.
    endloop.
    LOOP AT GT_FIELDCAT INTO GS_FIELDCAT.
         MOVE-CORRESPONDING GS_FIELDCAT TO ls_fcat.
         APPEND ls_fcat TO lt_fieldcat.
    ENDLOOP.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
                 EXPORTING it_fieldcatalog = lt_fieldcat
                          IMPORTING ep_table = t_output.
    you can refer the following link also.
    ALV grid
    hope this helps.
    do get back if you need further clarification.
    Regards,
    Kinshuk

Maybe you are looking for

  • Can emac installer discs be used to install OS 9.2.2 on Pismo G3?

    I have a full set of original eMac installer discs, and want to use one set to install OS9.2.2 on an Apple Pismo G3. Can this be done? I've heard Apple OEM installer discs are "Mac machine specific", and can't be used to install OS software onto othe

  • Using A second Display For FR

    Hi all, wounder if anyone can help me. I have connected my iMac to a Sony Bravia 28" LCD TV, I mirror my mac screen to the TV, my mac screen apares on the TV in widescreen format ok. FR all works fine apart from one thing. Any video's, music video's

  • Hp cp1160 deskjet printer won't print from Mac OS 9

    Hello, I am running OS 9.2.2 on my Mac and I can't seem to print to my HP CP1160 inkjet printer. It is connected using USB. My other USB devices work fine. In fact in the Apple System profiler, I can see the CP1160 printer listed as being connected a

  • Cannot locate Burner Software

    Ok. So, I installed new Itunes...Now, it says "Registry Settings used by Itunes driver for importing, burning are missing. this can happen as a result of installing other CD Burn Software. Please re-install Itunes" Here is what I have done so far: (1

  • Safari 5 opens-no page will load-if I coose 1 from history it crashes ***?

    I can download Safari 5, but when I open it no page shows up, just the bar at the top, so I go to history and choose a page, like say Apple and then it quits unexpectedly. I'm unable to use firefox on a large number of my websites that I use for work