Dynamic column change in Alv

Hello friends,
                   Can any1 pls tell me if there is a function module available which can be used for dynamic column change in ALV.
                  Pls also elaborate how to use it.....

While filling the field catalog you can specify witht IFcondition.
Just see a example below...
FORM field_fill USING pt_fieldcat TYPE slis_t_fieldcat_alv.
  DATA : ls_fieldcat TYPE slis_fieldcat_alv,
         pos TYPE i VALUE 1.
  ls_fieldcat-col_pos       = pos.
  ls_fieldcat-fieldname     = 'C_ICON'.
  ls_fieldcat-seltext_m     = 'Change Status'.
  ls_fieldcat-tabname       = 'IT_OUTPUT'.
  APPEND ls_fieldcat TO pt_fieldcat.
  CLEAR ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       = pos.
  ls_fieldcat-fieldname     = 'BUKRS'.
  ls_fieldcat-ref_fieldname = 'BUKRS'.
  ls_fieldcat-ref_tabname   = 'ANLA'.
  APPEND ls_fieldcat TO pt_fieldcat.
  CLEAR ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       = pos.
  ls_fieldcat-fieldname     = 'ANLN1'.
  ls_fieldcat-ref_fieldname = 'ANLN1'.
  ls_fieldcat-ref_tabname   = 'ANLA'.
  APPEND ls_fieldcat TO pt_fieldcat.
  CLEAR ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       = pos.
  ls_fieldcat-fieldname     = 'ANLN2'.
  ls_fieldcat-ref_fieldname = 'ANLN2'.
  ls_fieldcat-ref_tabname   = 'ANLA'.
  APPEND ls_fieldcat TO pt_fieldcat.
  CLEAR ls_fieldcat.
  pos = pos + 1.
  IF p_farea = 'X'. " Conditional Based OUTPUT
    ls_fieldcat-col_pos       = pos.
    ls_fieldcat-fieldname     = 'GRUFL'.
    ls_fieldcat-ref_fieldname = 'GRUFL'.
    ls_fieldcat-ref_tabname   = 'ANLA'.
    APPEND ls_fieldcat TO pt_fieldcat.
    CLEAR ls_fieldcat.
    pos = pos + 1.
    ls_fieldcat-col_pos       = pos.
    ls_fieldcat-fieldname     = 'GRUFL_N'.
    ls_fieldcat-seltext_l     = 'New Floor Area'.
    ls_fieldcat-tabname       = 'IT_OUTPUT'.
    APPEND ls_fieldcat TO pt_fieldcat.
    CLEAR ls_fieldcat.
    pos = pos + 1.
  ENDIF.
  IF p_ldate = 'X'. " Conditional Based OUTPUT
    ls_fieldcat-col_pos       = pos.
    ls_fieldcat-fieldname     = 'LEABG'.
    ls_fieldcat-ref_fieldname = 'LEABG'.
    ls_fieldcat-ref_tabname   = 'ANLA'.
    APPEND ls_fieldcat TO pt_fieldcat.
    CLEAR ls_fieldcat.
    pos = pos + 1.
    ls_fieldcat-col_pos       = pos.
    ls_fieldcat-fieldname     = 'LEABG_N'.
    ls_fieldcat-seltext_l     = 'New Lease St.Date'.
    ls_fieldcat-tabname       = 'IT_OUTPUT'.
    APPEND ls_fieldcat TO pt_fieldcat.
    CLEAR ls_fieldcat.
    pos = pos + 1.
  ENDIF.
  ls_fieldcat-col_pos       = pos.
  ls_fieldcat-fieldname     = 'MESSAGE'.
  ls_fieldcat-seltext_l     = 'Status Message'.
  ls_fieldcat-tabname       = 'IT_OUTPUT'.
  APPEND ls_fieldcat TO pt_fieldcat.
  CLEAR ls_fieldcat.
  pos = pos + 1.
ENDFORM.                    " field_fill
Regards
Gopi

Similar Messages

  • Dynamic Columns in table /ALV

    Hi ,
    I need to decide number of columns at run time out of fixed number of coulmn in  table.
    one way of doing it through ALV column hiding  but problem is what ever coloumns I hide programeticaly user can always to go ALV settings and unhide them and that defeats the purpose.
    is there any otherway I can determine my number of columns dynamicaly.
    It can be a  table or ALV table.
    Thanks
    Gaurav

    Hi gaurav,
    In d Do_init method ,
    read the table following table
    data : ls_function            TYPE        salv_wd_s_a_function_ref,
    Disable Setting on ALV
      READ TABLE wd_this->alv_config_table->
    if_salv_wd_function_settings~t_functions
         INTO ls_function
         WITH KEY id = 'SALV_WD_SETTINGS'.
      IF sy-subrc = 0.
        ls_function-r_function->set_visible( cl_wd_uielement=>e_visible-none ).
      ENDIF.
    reward If Usefull

  • Variable Columns Dispaying in ALV Report

    Hi ,
    I am working on ALV report . I am displaying 40 static fields and variable fields . Those varaible fields dependent on internal table . In the internal table 3 fields are available
    if it contains 1 row then in report variable fields are   3  OR
    if it contains 2 rows then in report variable fields are 6  OR 
    if it contains 3 rows then in report variable fields are 9  OR
    if it contains n rows then in report variable fields are 3n.
    Example :  1)  Internal table have 3 fields sd_active , sd_close , sd_term .
                               Internal table is i_a936 , Work area w _a936 .
                                 w_a936-sd_active = 'A1'.
                                 w_a936-sd_close  = 'B1'.
                                 w_a936-sd_term    = 'C1'.
                                 append w_a936 to i_a936.
                                 w_a936-sd_active = 'A2'.
                                 w_a936-sd_close  = 'B2'.
                                 w_a936-sd_term    = 'C2'.
                                 append w_a936 to i_a936.
                      Then in final internal table it should display  6 columns like w_final-sd_Active1 ,w_final-sd_close1,w_final-sd_term1 , w_final-sd_Active2 ,w_final-sd_close2,w_final-sd_term2 . Columns in Internal table varies from i_a936 rows .
    I am trying to use Dynamic internal table .
    Regards
    Srihari Nerella

    Hi,
           I think this may help you . Use CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
    see the link
    Dynamic fields to be displayed in ALV
    Dynamic column change in Alv
    Dynamic Number of Columns in ALV

  • ALV with multiple header & dynamic columns

    Hello All,
    I have a requirement where in I need to print multiple header in alv.
    For eg.
    User Name : <Name_1>
    Channel     : <Channel_1>
    Sale Org    : <Sales Org_1>
    Col1 Col2 Col3 Col4 Col5 Col6 Col7 Col8
    User Name : <Name_2>
    Channel     : <Channel_2>
    Sale Org    : <Sales Org_2>
    Col1 Col2 Col3 Col4 Col5 Col6 Col7 Col8
    no of columns (Col1 , col2 )  are dynamic  . Which would be the best alv type do I need do use?  Is it possible using simple alv grid display. How to handle dynamic column.
    Thnx.

    it is not possible with normal grid or list.
    I guess it is possible by using ALV Block list
    Modified below program to get mutiple header
    REPORT z_alv_block_list.
    Type-pools
    TYPE-POOLS: slis.
    Data declarations.
    DATA: BEGIN OF t_vbak OCCURS 0,
            vbeln TYPE vbeln,
            bstnk TYPE vbak-bstnk,
            erdat TYPE vbak-erdat,
            kunnr TYPE vbak-kunnr,
          END OF t_vbak.
    DATA: BEGIN OF t_vbap OCCURS 0,
            vbeln  TYPE vbeln,
            matnr  TYPE vbap-matnr,
            netpr  TYPE vbap-netpr,
            waerk  TYPE vbap-waerk,
            kwmeng TYPE vbap-kwmeng,
            meins  TYPE vbap-meins,
          END OF t_vbap.
    DATA: t_fieldcatalog1 TYPE slis_t_fieldcat_alv.
    DATA: t_fieldcatalog2 TYPE slis_t_fieldcat_alv.
    DATA: v_repid         TYPE syrepid.
    DATA: s_layout        TYPE slis_layout_alv.
    DATA: v_tabname       TYPE slis_tabname.
    DATA: t_events        TYPE slis_t_event.
    start-of-selection event.
    START-OF-SELECTION.
      v_repid = sy-repid.
    Get the fieldcatalog for the first block
      PERFORM get_fieldcat1 CHANGING t_fieldcatalog1.
    Get the fieldcatalog for the second block
      PERFORM get_fieldcat2 CHANGING t_fieldcatalog2.
    Get the data for the first block
      SELECT vbeln bstnk erdat kunnr UP TO 10 ROWS
             INTO TABLE t_vbak
             FROM vbak WHERE vbeln > '0060000100'.
    Get the data for the second block
      SELECT vbeln matnr netpr waerk kwmeng meins UP TO 10
    ROWS
             INTO TABLE t_vbap
             FROM vbap WHERE vbeln > '0060000100'.
    init
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
           EXPORTING
                i_callback_program = v_repid.
    First block
      v_tabname = 'ITAB1'.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
           EXPORTING
                is_layout   = s_layout
                it_fieldcat = t_fieldcatalog1
                i_tabname   = v_tabname
                it_events   = t_events
           TABLES
                t_outtab    = t_vbak.
    Second block
      v_tabname = 'ITAB2'.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
           EXPORTING
                is_layout   = s_layout
                it_fieldcat = t_fieldcatalog2
                i_tabname   = v_tabname
                it_events   = t_events
           TABLES
                t_outtab    = t_vbap.
    *Display
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
          FORM GET_FIELDCAT1                           
          Get the field catalog for the first block    
    FORM get_fieldcat1 CHANGING lt_fieldcatalog TYPE
    slis_t_fieldcat_alv.
      DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
    Order number
      s_fieldcatalog-col_pos       = '1'.
      s_fieldcatalog-fieldname     = 'VBELN'.
      s_fieldcatalog-tabname       = 'T_VBAK'.
      s_fieldcatalog-ref_tabname   = 'VBAK'.
      s_fieldcatalog-ref_fieldname = 'VBELN'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Customer purchase order.
      s_fieldcatalog-col_pos       = '2'.
      s_fieldcatalog-fieldname     = 'BSTNK'.
      s_fieldcatalog-tabname       = 'T_VBAK'.
      s_fieldcatalog-ref_tabname   = 'VBAK'.
      s_fieldcatalog-ref_fieldname = 'BSTNK'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Creation date.
      s_fieldcatalog-col_pos       = '3'.
      s_fieldcatalog-fieldname     = 'ERDAT'.
      s_fieldcatalog-tabname       = 'T_VBAK'.
      s_fieldcatalog-ref_tabname   = 'VBAK'.
      s_fieldcatalog-ref_fieldname = 'ERDAT'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Customer
      s_fieldcatalog-col_pos       = '4'.
      s_fieldcatalog-fieldname     = 'KUNNR'.
      s_fieldcatalog-tabname       = 'T_VBAK'.
      s_fieldcatalog-ref_tabname   = 'VBAK'.
      s_fieldcatalog-ref_fieldname = 'KUNNR'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    ENDFORM.
          FORM GET_FIELDCAT2                           
          Get the field catalog for the second block   
    FORM get_fieldcat2 CHANGING lt_fieldcatalog TYPE
    slis_t_fieldcat_alv.
      DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
    Order number
      s_fieldcatalog-col_pos       = '1'.
      s_fieldcatalog-fieldname     = 'VBELN'.
      s_fieldcatalog-tabname       = 'T_VBAP'.
      s_fieldcatalog-ref_tabname   = 'VBAP'.
      s_fieldcatalog-ref_fieldname = 'VBELN'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Material number
      s_fieldcatalog-col_pos       = '2'.
      s_fieldcatalog-fieldname     = 'MATNR'.
      s_fieldcatalog-tabname       = 'T_VBAP'.
      s_fieldcatalog-ref_tabname   = 'VBAP'.
      s_fieldcatalog-ref_fieldname = 'MATNR'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Net price
      s_fieldcatalog-col_pos       = '3'.
      s_fieldcatalog-fieldname     = 'NETPR'.
      s_fieldcatalog-tabname       = 'T_VBAP'.
      s_fieldcatalog-ref_tabname   = 'VBAP'.
      s_fieldcatalog-ref_fieldname = 'NETPR'.
      s_fieldcatalog-cfieldname    = 'WAERK'.
      s_fieldcatalog-ctabname      = 'T_VBAP'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Currency.
      s_fieldcatalog-col_pos       = '4'.
      s_fieldcatalog-fieldname     = 'WAERK'.
      s_fieldcatalog-tabname       = 'T_VBAP'.
      s_fieldcatalog-ref_tabname   = 'VBAP'.
      s_fieldcatalog-ref_fieldname = 'WAERK'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Quantity
      s_fieldcatalog-col_pos       = '5'.
      s_fieldcatalog-fieldname     = 'KWMENG'.
      s_fieldcatalog-tabname       = 'T_VBAP'.
      s_fieldcatalog-ref_tabname   = 'VBAP'.
      s_fieldcatalog-ref_fieldname = 'KWMENG'.
      s_fieldcatalog-qfieldname    = 'MEINS'.
      s_fieldcatalog-qtabname      = 'T_VBAP'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    UOM
      s_fieldcatalog-col_pos       = '6'.
      s_fieldcatalog-fieldname     = 'MEINS'.
      s_fieldcatalog-tabname       = 'T_VBAP'.
      s_fieldcatalog-ref_tabname   = 'VBAP'.
      s_fieldcatalog-ref_fieldname = 'MEINS'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    ENDFORM.

  • Dynamic Columns in ALV GRID

    Hi Folks,
    can any body please give some input on the follwoing.
    i want to display material created by and material
    created on for each material based on material selection
    from selction screen dynamically.
    like s_mat = 1, 2,3.
    o/p must be
    mat1 |creted by | creted on| mat2 |creted by | creted on|mat3 |creted by | creted on|
    like if iam inputting 3 materials i need 3*3 = 9 columns in my alv grid o/p.
    I have alreaady searched SDN  I am not gettting any thing related to my requirement, please post some sample caode as I am new ot OOABAP.
    Thanks,
    Shwetha.
    Moderator message : Not enough re-search before posting, specification dumping not allowed.  Thread locked.
    Edited by: Vinod Kumar on Nov 24, 2011 1:31 PM

    method handle_data_changed.
         data: ls_good type lvc_s_modi,
               li_diff type i,
               value type p DECIMALS 3,
               old_value type p DECIMALS 3,
               lw_outtab1 type gt_tab.
    clear value.
           loop at er_data_changed->mt_good_cells into ls_good.
           value = ls_good-value.
           old_value = ls_good-value.
            if value lt 0 or value gt 1.
               MESSAGE 'Value is out of range' TYPE 'I'.
              Read table gt_outtab1 into lw_outtab1 index ls_good-row_id .
               perform show_alv.
               clear ls_good.
            ENDIF.
          ENDCASE.
           ENDLOOP.
    I again created the table.. actually data is not changed in the internal table but still it shows the changed value in the alv grid. even in build the table again and call the refersh alv grid method..

  • How to change recordset bahaviour to accept dynamic column names in the where clause

    Hi
    im using php-mysql and i make a recordset and i want to make the column names in the where clause to be dynamic like
    "select id,name from mytable where $tablename-$myvar";
    but when i do this my i break the recordset and it disappear
    and when i use variables from advanced recordset it only dynamic for the value of the column not for the column name
    and when i write the column name to dynamic as above by hand it truns a red exclamation mark on the server behaviour panel
    so i think the only way is to change the recordset behaviour is it? if so How to make it accept dynamic column names?
    thanks in advance.

    As bregent has already explained to you, customizing the recordset code will result in Dreamweaver no longer recognizing the server behavior. This isn't a problem, but it does mean that you need to lay out your dynamic text with the Bindings panel before making any changes. Once you have changed the recordset code, the Bindings panel will no longer recognize the recordset fields.
    Using a variable to choose a column name is quite simple, but you need to take some security measures to ensure that the value passed through the query string isn't attempting SQL injection. An effective way of doing this is to create an array of acceptable column names, and check that the value matches.
    // create array of acceptable values
    $valid = array('column_name1', 'column_name2', 'column_name3');
    // if the query string contains an acceptable column name, use it
    if (isset($_GET['colname']) && in_array($_GET['colname'], $valid)) {
      $col = $GET['colname'];
    } else {
      // set a default value if the submitted one was invalid
      $col = 'column_name1'
    You can then use $col directly in the SQL query.

  • Dynamic columns in ALV report

    halo fellow SAPiens,
    i need to show dynamic columns for a particular material........the scenario is as follows....
    1) there r 7 fixed columns describing the material...
    2)when the material returns back to the plant for some reason , i need to insert a column which shows the date and reason(char) of return.
    3)again after dispatching the material for some reason it comes back again a new column shld be displayed showin the date and reason(char).
    4)if the material doesnt come back...the report shows only 7 columns.
    any solution?

    try <a href="http://www.alvrobot.com.ar/home.php">here</a>  ......its a useful tool for dealing with ALV
    <b>reward points if useful</b>

  • Display dynamic columns in ALV

    Hi All,
    I have a requirement in which I have develop a report displaying material master basic data and classification data. The basic data I am getting from MARA and MAKT tables. And for classification data I am getting the class maintained from each material from tables INOB,KSSK and from KLAH, then I am getting the characteristics and its values by calling BAPI u2018BAPI_OBJCL_GETDETAILu2019 for each material .
    Now I have to prepare ALV  having column name for basic data (would be static) and characteristic name (would be dynamic, and I have to display characteristics values under it, for each material ).
    For example: if  material u2018CHWOJA4u2019 has 2 characteristics as u2018country (value u2018Franceu2019)u2019 and  u2018creation season(value u2018Decu2019)u2019  and second material u2018E50480u2019 has  3 characteristics as u2018Abacus (value u2018yesu2019)u2019 ,u2018country (value u2018Indiau2019)u2019 and  u2018 season(value Jank)u2019 , the  ALV output would be :
    Material Number;     Material description; Base Unit of Measure;Material Group; Abacus; Country;season          
    CHWOJA4; JACKET;PC;Z05; ; France;Dec          
    E50480;BRAZIL REAL;PC;Z06; yes; India;Jan               
    In short, my last column of the ALV would be the characteristic name and the content would be the char. value.
    Can you please suggest some ways to achieve this? A quick reply would be highly appreciated!
    Thanks,
    Vanitha

    Idea here is to have many fields for characterstic values in your output internal table.
    For eg.
    types : Begin of ty_mara,
               matnr type matnr_d,
               mtext type mktxt,
               char1 type string,
               char2 type string,
               char20 type string.
    Check for all the materials which has the maximum characterstic values. So, say for a material, there are 12 characterstics values and that is the maximum compared to anyother materials. Then in the field catalog hide the columns related to charactertics CHAR13 onwards till CHAR20.
    Note : I have assumed char20 as the max., which you can alter based on your scenario.
    Regards
    Ranganath

  • Handling ALV Layout & Dynamic Columns

    I have a custom report for Purchasing / Finance.
    1) I create 5 dynamic columns for the purchase rder invoices based on the report run date.
    Example:
    Previous Quarter   [Q4 2009]  [Q1 2010]   [Q2 2010]  [Q3 2010]
    My query is that this report has layouts defined. I want to add the dynamic columns to the report output.
    Example:  In the below scenario i have dynamic columns in the  fieldcat[] but the report shows only the columns defined in the layout selected. 
    disvariant-VARIANT has the layout selected from the seelction screen of the report.
    Also fieldcat-tabname = '<fs_table> '.
    CALL METHOD alv_grid->set_table_for_first_display
       EXPORTING
          is_variant                    = disvariant
          i_save                         = 'A'
          is_layout                     = layout
          is_print                        = print
       CHANGING
          it_outtab                     = <fs_table>
          it_fieldcatalog             = fieldcat[]
          it_sort                         = sort[]
       EXCEPTIONS
         invalid_parameter_combination = 1
         program_error                 = 2
         too_many_lines                = 3
         OTHERS                        = 4
    Appreciate if anyone knows the solution.

    I don't believe you can display the dynamic columns and still use the variant from the selection screen.
    Have you considered using multiple table rows for the multiple time periods?
    If you will always have 5 dynamic columns, maybe you can make them not dynamic and just make the column header text dynamic?

  • How to catch changed column values in alv oops using grid

    My requirement needs to catch changed column values in alv oops using grid .any method to do this.
    please help me out ,
    Tks in advance

    Have a look into the SAP standarad Programs those programs have the edit option on the ALV output.
    BCALV_EDIT_01
    BCALV_EDIT_02
    BCALV_EDIT_10.
    Regards,
    Gopi ,
    Reward points if helpfull.

  • Screen Field Value Should be changed based on changes in ALV values

    Hi All,
    We had created a ALV with container, in this Alv we have a checkbox, which is editable.
    Based on the selection on checkbox , we need to update a field "Total selected" on screen.
    we are using Event to handle data changed in ALV, but some how it doesn't work.
    we even tried to use 'DYNP_VALUES_UPDATE' Function module to Update the field.
    Please find the code below.
    LOOP AT gt_final INTO gw_final WHERE mark EQ 'X'.
              gv_sel  = gv_sel  + 1.
    ENDLOOP.
            lw_dynpfields-fieldname = 'GV_SEL'.
            lw_dynpfields-fieldvalue = gv_sel .
            APPEND lw_dynpfields TO lt_dynpfields.
            CALL FUNCTION 'DYNP_VALUES_UPDATE'
              EXPORTING
                dyname               = 'Z_MAINPROG'
                dynumb               = '0300'
              TABLES
                dynpfields           = lt_dynpfields
              EXCEPTIONS
                invalid_abapworkarea = 1
                invalid_dynprofield  = 2
                invalid_dynproname   = 3
                invalid_dynpronummer = 4
                invalid_request      = 5
                no_fielddescription  = 6
                undefind_error       = 7
                OTHERS               = 8.
            IF sy-subrc <> 0.
              MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
            ENDIF.
    We get Sy-subrc as 0. No error and no update.
    Thanks in advance.
    Regards,
    Ravi

    Do you flush to synchronize the itab from frontend?
    In Debugger, is the column updated via 'X' for the checkboxes?
    please insert cl_gui_cfw=>flush.  to sync in PAI before analyzing the table.
    Regards,
    Christian

  • How to switch off column coloring of alv grid printouts?

    Hello World!
    Is there any possibility (a customizing option or a parameter) to switch off cell/column coloring of alv grid printouts?
    It is very useful to see colored columns in screens, but they are darkened in printouts. How to avoid it?
    Thanks and regards,
    Vladimir

    Hi,
    You can have different layouts for a ALV report and each layout the look and feel can be different.
    So, the manual activity is the user will have to switch to the B/W layout before printing. I am not sure if you have enabled the LAYOUT option for the user to change it by himself.
    I hope I am able to get across my point.
    If you are using OO ALV control, you can dynamically change the layout using set_frontend_layout  method. The user can also change the layout --
    choose Change layout or Settings ® Layout ® Change.
    The Change Layout dialog box shows you which columns are currently displayed and which additional columns can be displayed.
    Regards,
    Ravi
    Note - Please mark the helpful answers
    Message was edited by: Ravikumar Allampallam

  • Problem with the order of the columns of a ALV

    I have a problem with a ALV, variants we keep this ALV does not record the order of the columns
    Thank you

    I suppose you want to change the sequence of columns of a ALV. If you can change it by clicking 'settings' of right-top corner of ALV. After done you can save the new settings into a new. If you find some abnormal behaviour, please check the settings by WDA component "wd_analyze_config_user".
    FYI.
    [http://help.sap.com/saphelp_nw70/helpdata/en/32/f26f73d81e11d1a26f0000e8a5a614/frameset.htm]

  • DataGrid with dynamic columns & renderers

    I'm developing using Flash Builder 4 & Flex SDK 4.1.
    I need to manage very dynamic DataGrid components and keep their definitions, which are all part of a complex item renderer of an Offers list.
    The objects structure is simplified as follows -
    Data: Model --> Offers ArrayCollection --> Offer VO --> DataGrid data ArrayCollection & DataGrid columns Array
    View: List --> Offer Item Renderer --> DataGrid
    1. Since the DataGrid's columns property accepts only an Array (not ArrayCollection), it seems like Data Binding for defining the columns is very problematic.
    I tried to bind it to the source property of an ArrayCollection that would keep my columns definitions, but it didn't really work (mainly header display bugs).
    What is the recommended way to keep the dynamic columns definition of a DataGrid?
    2. Each column can have a set of dynamic properties, so I created a "mutant" - Column VO that extends DataGridColumn and got a dynamic properties ArrayCollection on it.
    The columns got a custom header renderer that includes an icon when there are properties.
    The header renderers got 4 main states (NotSelectedWithProperties, SelectedWithProperties, NotSelectedWithoutProperties & SelectedWithoutProperties).
    However, the header renderer area seems a bit buggy when maintaning dynamic columns.
    Any thoughts on the subject?
    3. Anyway, I ended up recreating the DataGrid's columns Array very often (copying the columns definition on the offer's item renderer's dataChange event handler).
    Note that the dynamic properties can be edited when the column is selected and I copy their values from the view back to the model when entering the state NotSelectedWithProperties.
    This feels way too complicated and I really try to keep it simple, inspite of the required complexity.
    Does anyone have better ideas?
    4. In some cases the column's item renderer should also be modified into another DataGrid (grid-in-grid).
    I used the MXDataGridItemRenderer with a DataGrid and included an ArrayCollection for the "newValue" returned by the editor.
    (I use RendererIsEditor=true and on updateComplete populate that variable with the DataGrid's dataProvider contents)
    When needed, I loop though the data objects of the parent DataGrid and populate the related field with an ArrayCollection of key-value objects that are displayed on the internal DataGrid.
    After adding this feature I encounter very strange bugs -
    a. After editing the grid-in-grid values and changing the column's state (selecting & deselecting), I get the following exception:
    ArgumentError. Error #2025: The supplied DisplayObject must be a child of the caller.
    at flash.display::DisplayObjectContainer/setChildIndex()
    at mx.core::UIComponent/setChildIndex().......6993....
    All I could find about this is that it might be related to some context error or something, but I'm really stuck on this one.
    b. Sometimes another column might copy value from one row to another, running over the previous value.
    I'm not sure exactly what sequence of actions causes this behavior, but it's related to that itemRenderer for sure.
    c. Switching places with a column that uses the grid item renderer (headerShift) causes a stak overflow of StyleManager that tried to get style from the DataGridItemRenderer. This one I just found out, but couldn't reproduce a second time... strange!
    I'm pretty sure this caused another problem that I don't remember at the moment.
    The bottom line is that there got to be a better way to implement this feature within this already-complicated environment.
    Maybe I'm doing something very wrong here...
    Please advice and thanks for reading all this.

    Update on item 4a -
    This was a major issue (the main reason for opening this thread really) and I managed to resolve it!
    As part of my application, I override the default DataGrid behavior for column selection (headerRelease event).
    Instead of sorting, I change the column's header looks and define it as Selected (for showing its dynamic properties and enable its deletion).
    At first I did this by setting styles, but the look didn't refresh unless I created a new instance of the header renderer.
    Later I changed thi behavior to work with states, but I left the new header renderer instance creation commands and those lines created all the mess!
    Conclusion -
    If you define a custom header renderer for your datagrid column and then a custom item renderer, don't create a new instance of your header renderer!
    It would still be nice to get some response for the other issues I raised.
    Thanks and have a nice week.

  • REUSE_ALV_GRID_DISPLAY (column headings from ALV to EXCEL) Max please help

    Hi Max,
    If you remember in one of my last post I asked for changing the column headings in ALV display for example from 'Material' to 'Material used'.
    I am using
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
          I_CALLBACK_PROGRAM                = repid
          IT_FIELDCAT                       = field_body
          I_SAVE                            = g_save
          IS_VARIANT                        = g_variant
          IT_EVENTS                         = events
        TABLES
          T_OUTTAB                          = itab.
    And you suggested me the following way....
    loop at field_body into field_wa.
    case field_wa-fieldname.
      when 'Material'.
         field_wa-seltext_l = 'Material used'.
         field_wa-seltext_m = 'Material used'.
         field_wa-seltext_s = 'Material used'.
    endcase.
    modify field_body from field_wa.
    endloop.
    It is working well. In ALV display the column heading is changed to what I wanted. But the question is when I export the displayed ALV to Excel using ALV functionality, Export->Spreadsheet... I see that <b>I dont get the Column Heading into Excel as it was in the ALV display.</b>
    I get in the Excel as 'Material u' or 'Mat. Used'. But when I add this line in the code.....
    when 'Material'.
         field_wa-seltext_l = 'Material used'.
         field_wa-seltext_m = 'Material used'.
         field_wa-seltext_s = 'Material used'.
        <b> field_wa-outputlen = 20.</b>
    Then I see that I get the complete heading in the Excel. But this way the columns with outputlen 20 are taking much space in ALV display.
    Is there any fix for this. May be not mentioning the outputlen but still get the column headings into Excel as it was in ALV display.
    Anyone with ideas please respond. Waiting for replies. Thanks

    Hi
    The labels have a fixed size:
    seltext_l is long   text: 20 char
    seltext_m is medium text: 15 char
    seltext_s is short  text: 10 char
    The text 'Material used' is long 13 char so you should write:
    field_wa-seltext_l = 'Material used'.
    field_wa-seltext_m = 'Material used'.
    field_wa-seltext_s = 'Mat. used'.
    You can try to set the field colwidth_optimize of parameter IT_LAYOUT.
    This field should optimize the width of the colunm
    So
    data layout type SLIS_LAYOUT_ALV.
    layout-colwidth_optimize = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = repid
    IT_LAYOUT   = layout       
    IT_FIELDCAT = field_body
    I_SAVE = g_save
    IS_VARIANT = g_variant
    IT_EVENTS = events
    TABLES
    T_OUTTAB = itab.
    and you can decide which label has to be used:
    field_wa-seltext_l = 'Material used'.
    field_wa-seltext_m = 'Material used'.
    field_wa-seltext_s = 'Mat. used'.
    If you want to set the short text
    field_wa-ddictxt   = 'S'.
    ...medium
    field_wa-ddictxt   = 'M'.
    ...long
    field_wa-ddictxt   = 'L'.
    Max

Maybe you are looking for

  • Unable to search user in preproccess event handler through request based

    User oiminternal does not have access to SEARCH entity of t<Feb 20, 2013 5:53:51 PM EST> <Warning> <oracle.adfinternal.view.faces.renderkit .rich.NavigationPaneRenderer> <BEA-000000> <ILLEGAL_COMPONENT_HIERARCHY : A chil d component that is not a com

  • How do I delete a recurring event that was sent from an outside source?

    I have a number of recurring events that were added to the calendar from an outside calendar. A calendar that I do not have access to anymore. I wish to delete the entire series. Currently when I open the event I can not edit nor delete it. If I choo

  • Oracle Forms Patch 10 for 8i

    Does Oracle Forms Patch 10 apply to Oracle 8i or do you have to be on 9i? Also, does applying patch 10, catch you up on all previous patches (1-9)?.

  • Bug in the Oracle JSP parser..?

    Hi, I seem to have run into a problem with double quotes inside attributes of a custom tag. For example, on Tomcat the following line is valid in a JSP: <mylib:person label="<%="Mr " + surname%>" /> Tomcat treats the "Mr " in the expression as a Java

  • Unable to connect to CMS servername .  A wrong connection is made

    I am trying to enable my File Server on Crystal Enterprise XI R2. I run the following command from a linux prompt. ./ccm.sh -enable input.reportingdb -cms reportingdb.cmd:6400 -username administrator -password password I get the following error: Crea