ALV filter with own logic

Hello colleagues out there,
I have a request from my users concerning ALV filtering. They want to have filters of the kind :
- A = 5 or B = 6
- A + B > C
(A, B, C Columns of the table)
Surely I can implement such rules "hard" coded in the ABAP. But my question is: Is there are more generic way, that allows the users to define their filter rules themselves without having to modify my programs ?
Many thanky for your help
Rabanus Diehl

Hi rabanus,
1.  A = 5  can be done
    B = 6 can be done
but OR conditions, between two fields cannot be done,
in standard alv filter functionality.
2.  A + B > C
   cannot be done,
  bcos it allows filter only one one field, by one field,
  not
  using some expressions/equations.
regards,
amit m.

Similar Messages

  • ALV GRID with own EXCEL-Template

    Hallo,
    I have Problem with using ALV-Grid with a own created
    template.
    At First I copy the SAP_OM.XLS template to CUS_OM.XLS.
    Then I update it by deleting all sheets, but not RAWDATA.
    When I use this template in ALV-GRID, it would be the right one, but it his no Data.
    The security settings in Excel are correct.
    Can anyone help me to show the data like the normal
    ALV-GRID??
    thanks Dieter

    Hi
    Check this link...
    How to send data  to different tabs of an excel sheet?

  • Adding mandatory filter with own LoV to BW OLAP Universe

    Dear all,
    I want to add a own filter with custom LoV to a characteristics-filter in an OLAP Universe. This filter does not exist in the BEx Query, so I have to do it manually.
    So when the prompt shows up in WebI, the User should be able to select the Values from the custom LoV, for example:
    - Tokio
    - London
    - Paris
    The filter has to be mandatory and Tokio should be preselected. I was testing some things with the filter-XML, but always got errors. Can somebody tell me how this works?
    Thank you for help in advance!
    B. Wegner

    Hi,
    There are a few steps involved, I would suggest approaching them one at a time.
    First, try to set up a filter (condition in the universe) to only show data for Tokyo (no prompt). Ensure you can get this to work.
    Next, try and turn this condition into a prompt, but just define the LoV in the prompt syntax, not a separate object. Check that this works.
    Next, try and split out that LoV into it's own object that populates from the characteristic in the BEx query. This will be the tricky part (maybe), if possible, get a filter created in the BEx query (make sure it's set as 'ready for user input') so that you see how the LoV gets created.
    As a last resort, have a look in the manual: http://help.sap.com/businessobject/product_guides/boexir31SP3/en/xi31_sp3_sap_olap_univ_en.pdf
    Hope that helps.

  • How to creat CS-order with config service product with own logic

    Hi all,
    I saw already different threads related to this topic, however no clear solution was given yet.
    The scenario is:
    Create from a notification list the service orders and determine in the background a correct service product which is configurable. Via an own logic the service product is found in a z-table and and the configuration is done via a seperate logic.
    What would be the solution of the above scenario.
    I already found some information in using:
    CUCB_GET_CONFIGURATION
    CUCB_SET_CONFIGURATION
    CUCB_CONFIGURATION_TO_DB
    But does this work?
    How should the logical flow be in using these functionmdules.
    We are using BAPI_ALM_ORDER_MAINTAIN to create the service order, however it is not allowed in  this bapi to enter a service product which is configurable.
    Thanks for your input in this.
    Best regards,
    Pascal

    Also posted [here|http://www.sapfans.com/forums/viewtopic.php?f=7&t=353731]
    [Useful info|http://www.sapfans.com/forums/viewtopic.php?t=53651]
    PeteA

  • How to filter standard ALV report with custom UI element?

    Hello Expert,
    I got a requirement to filter standard ALV report based on the custom UI element (which is created in the screen before displaying the ALV report). Upon entering the values in the Custom field, the ALV report is displayed accordingly.
    Any ideas how to approach it?
    Thanks,
    Mohammed

    Hi,
    Okay, let me explain the steps in detail
    Let us say you have alv table with 10 records and alv table is shown first time with all 10 records
    Create an internal table in component controller's attribute GT_ORIGINAL_DATA and save all 10 records into this table first time
    Now, user enters value in FILTER_MATNR field 123 and press apply_filter button or press enter key
    Read the value of field filter_matnr and get the only matching records from global internal table GT_ORIGINAL_DATA into local internal table as below
              data lv_matnr type matnr.
              data lt_data   like wd_comp_controller->gt_original_data.
                   " read the value from context attribute of filter_matnr
                        lv_matnr = ???
                   " copy all data into local table
                        lt_data[] = wd_comp_controller->gt_original_data.
                   "delete the records which does not match
                     delete lt_data where matnr NP lv_matnr.
    Now, bind the data lt_data to context node of alv table
    Hope this helps you.
    Regards,
    Rama

  • Problem with ALV filter functionality when filtered for multiple values

    Hi,
    I am facing a problem with ALV filter functionality.
    I have displayed an ALV with some columns col_A, col_B and col_C
    col_A---- col_B -
    col_C
    1----
    a -
    abc
    2----
    b -
    pqr
    3----
    c -
    lmn
    4----
    d -
    xyz
    5----
    f -
    stu
    From the settings link I am applying filter on column col_C and selected multiple values say 'pqr', 'xyz' and 'lmn'.
    Now the ALV is showing rows only for last selection i.e . results are fetched only for value 'lmn'.
    i.e. after applying the filter the ALV table looks as below:
    col_A---- col_B -
    col_C
    3----
    c -
    lmn
    But ideally it should be:
    col_A---- col_B -
    col_C
    2----
    b -
    pqr
    3----
    c -
    lmn
    4----
    d -
    xyz
    I could not find any OSS note related to this issue.
    Please help me resolve this issue.
    Thanks,
    Feroz

    Hi,
    I am facing a problem with ALV filter functionality.
    I have displayed an ALV with some columns col_A, col_B and col_C
    col_A---- col_B -
    col_C
    1----
    a -
    abc
    2----
    b -
    pqr
    3----
    c -
    lmn
    4----
    d -
    xyz
    5----
    f -
    stu
    From the settings link I am applying filter on column col_C and selected multiple values say 'pqr', 'xyz' and 'lmn'.
    Now the ALV is showing rows only for last selection i.e . results are fetched only for value 'lmn'.
    i.e. after applying the filter the ALV table looks as below:
    col_A---- col_B -
    col_C
    3----
    c -
    lmn
    But ideally it should be:
    col_A---- col_B -
    col_C
    2----
    b -
    pqr
    3----
    c -
    lmn
    4----
    d -
    xyz
    I could not find any OSS note related to this issue.
    Please help me resolve this issue.
    Thanks,
    Feroz

  • Problem with alv filter

    Hi all,
    I have a problem when i filter ALV column, which has data type  BELNR (FI doc No). I input in filter FI doc: 40000007 (8 char long, w/o zero ahead), then i get the empty result. The really one i want to get is a ALV line with FI doc = '40000007'.
    Could u pls help me?
    Thanks and regards,
    Hung.

    Check the field catalog for field BELNR, it should have conversion exit ALPHA. (check your report or execute [The Consistency Check|http://help.sap.com/saphelp_sm32/helpdata/EN/d6/23253963143e6ae10000000a11402f/frameset.htm])
    Regards,
    Raymond

  • F4 Valuehelp with own dataelement in ALV

    Hi out there,
    i createt own dataelement with own domain. in domain there are fixed values.
    Now i designed an itab for alv grid. (abap oo methods).
    Unfortunately the F4 Help does not appear.
    How to config the corresponding fieldcat?
      CLEAR ls_fieldcat.
      ls_fieldcat-ref_table = '<Name ITAB>'.
      ls_fieldcat-fieldname = '<Name Column in ITAB>'.'.
      ls_fieldcat-DD_ROLL   = '<Name Dictionary Element>'.
      ls_fieldcat-F4AVAILABL   = 'X'.
      ls_fieldcat-edit = 'X'.
      APPEND ls_fieldcat TO pt_fieldcat.
    Unfortunately nothing happens. Just empty valuehelp.
    I testet the ddict-elem as selscreenparameter...and valuehelp appears..

    Thanks!
    I already got my f4 help. It's not a dynamic one. Jaust a custom Dataelement depending on Custom Domain WITH FIXED VALUES.
    I suggest its not neccesary to use eventing etc. Just ddictfunctionality in alv grid.
    I tried with
      ls_fcat-inttype = <name DDICT Element>.
    Like in   BCALV_EDIT_08.
    No Effect.

  • I don't actually own Logic Express, but...

    I don't actually own Logic Express, but I figured this would be a better place to ask my question.
    My question is regarding dither.
    I understand that dither, when it's all said and done, is simply low-level noise to keep truncated bits from sounding like butt when you reduce the word length of a recording.
    Can one, in theory, use any form of consistent noise as a form of a dither signal such as, for example, the gentle hiss of an audio cassette?
    I use this particular example because I happen to love the sound of tape hiss.
    Also, does one need to dither if the bit depth is never changed/reduced/increased if one if editing between two different audio editing programs? I record my tracks using GarageBand and I mix, finalize, etc. using Pro Tools and I add no type of effect or normalizing or anything other than light automation and tasteful mixing. Do I still need to dither even if my Pro Tools mix-down session is set to 44 kHz/16-bit?
    Thanks for any help anyone provides.

    If you're not changing the bit-depth or sampling rate, you do not need to dither.
    Dithering adds a very low level noise signal so as to avoid persistent and predicatble rounding problems but it's not the best way of adding hiss to a recording. If I'm doing a sound effect (perhaps a cassette playing back in a TV scene), I go to my stock library and find cassette tape hiss and add it to the mix (as a separate track). You could just add white noise with a band pass filter with quite high centre but it's not the same - it's just too random.
    Pete

  • ERROR B191 - IDoc has its own logical system as receiver

    I everybody, i'm tryng to execute a package to charge a ODS from another ODS (Datamart) but the process ends with the error "IDoc has its own logical system as receiver", can you help me with is?
    What should be the reason for this error? What can i make to solve it?
    Thanks to all

    Hi  Reddy,
    please let me know how did u solve this issue, even i have the same requirement and am gettign status 29.
    Thanks
    Rakesh

  • Hoe to creat own logical database inhr

    hi all,
    can anyone send the codefor creating the own logical databse like pnp in HR.

    <b>Creating a Logical Database</b>
    Open the Logical Database Builder (<b>SE36</b>)
    1. Enter a name on the initial screen of the Logical Database Builder and choose Create.
    2. A dialog box appears. Enter a short text. You can change this later by choosing Extras -> Short text or Administration info.
    3. Once you have entered the short text, you must define the root node of the logical database. Enter the node name and its attributes. There are three different types of nodes:
    The logical DB gets created.
    Then to edit the logical DB, use the following steps.
    The structure editor of the Logical Database Builder appears. On the left is the name of the root node, followed by a code for the node type: T for a database table, S for a ABAP Dictionary type, and C for a type from a type group. The new logical database now has a structure with a single node.
    You can now extend the structure as described in Editing the Structure.
    If you choose Next screen (right arrow in the application toolbar), a screen appears on which you can enter a search help for the logical database as described under Editing Search Helps.
    If you choose Next screen (right arrow in the application toolbar), a dialog box appears, asking you whether the system should generate the selections for the logical database. When you have confirmed the dialog box, a list appears, on which you can select all of the nodes that you want to use for field selections or dynamic selections. The fields that you select are included in the source code generated by the system for the selection include.
    The generated selection include is displayed in the ABAP Editor. You can change it as described in Editing Selections.
    If you choose Next screen (right arrow in the application toolbar), a dialog box appears, asking you whether the system should generate the database program for the logical database. The database program is generated from the structure and the selection include. It has a modular structure, consisting of several include programs and all of the necessary subroutines, with proposals for the statements that will read the data.
    The generated database program is displayed in the ABAP Editor. You can change it as described in Editing the Database Program.
    If you repeatedly choose Previous screen (left arrow in the application toolbar), you can display and change the general attributes of the logical database.
    Finally, you can maintain optional selection texts and documentation.
    <b>Reward if helpful</b>

  • Check Interactive report filter with APEX item :P101_USERNAME

    Hi,
    is there a way to create a filter with IR which is based on the :P101_USERNAME item?
    I use this variable with the windows user name and want to show only rows where the current user works with.
    Thanks ahead,
    Tobias

    Hi John,
    my plan was to reference the filter on the user level.
    Parts of selection for the IR:
    SELECT r.r_id,
    c.c_name,
    r.r_note,
    UPPER(r.win_account)
    FROM requests r, classes c
    WHERE r.r_c_id = c.c_id
    Info:
    WIN_ACCOUNT looks like: ARNHOLD_TOBIAS
    :P101_USERNAME looks like: ARNHOLD_TOBIAS
    The goal is that a user in the standard view sees only his rows/calls and if he want to see the rows/calls from the colleagues too. He/She would only need to take off the filter for the USERNAME.
    I could use my own items with an extra region too but I thought that there was an easier way then that.
    Tobias

  • ALV Reporting with drill down capabillities

    I'm creating a abap custom report using the ALV.  I want to drill down to CJ03 which is projects.  I know how to do it in regular custom reporting, but I don't seem to be able to get it to work using the ALV.  Can anyone help?
    Thanks.
    Linda

    Hi Linda,
    Take a look at this sample program. The logic to handle any interaction with the user is in my "PORCESS_USER_COMMANDS" routine.
    This is defined in the "I_CALLBACK_USER_COMMAND" parameter in the ALV FM.
    Hope this helps.
    Cheers,
    Pat.
    [code]
    Modification History
    Date      | Author    | Chg Req #     | Description
    15.08.2001| Pat Yee   | $TMP          | Program Creation
    This program is an example of how the ALV Display works.
    It will display Customer Data.
    This report will also show how to display an ALV report with different
    colored lines and icons
    REPORT zpat.
    Include Programs
    INCLUDE <icon>.
    Database Tables
    TABLES: kna1.                  "Customer Master
    Types
    TYPE-POOLS: kkblo.
    Structures
    Structure to hold the Color Information
    DATA: BEGIN OF st_color,
            color(3) TYPE c,
          END OF st_color.
    Structure to hold the Icon Information
    DATA: BEGIN OF st_icon,
            icon(4) TYPE c,
          END OF st_icon.
    ALV Field Catalog Structure
    DATA: st_fieldcat   TYPE slis_fieldcat_alv.
    ALV Layout Structure
    DATA: st_layout     TYPE slis_layout_alv.
    Internal Tables
    Output Table
    DATA: BEGIN OF tbl_kna1 OCCURS 0.
            INCLUDE STRUCTURE st_icon.   "Icon Structure
            INCLUDE STRUCTURE kna1.      "Customer Master Structure
            INCLUDE STRUCTURE st_color.  "Color Structure
    DATA: END OF tbl_kna1.
    ALV Field Catalog Table
    DATA: tbl_fieldcat  TYPE slis_t_fieldcat_alv.
    Variables
    DATA: fieldname(30) TYPE c,
          g_repid       LIKE sy-repid.
    Start of Selection
    START-OF-SELECTION.
      g_repid = sy-repid.
      PERFORM get_data.
    End of Selection
    END-OF-SELECTION.
      PERFORM do_fancy_stuff.
      PERFORM get_layout.
      PERFORM get_fieldcat.
      PERFORM create_report.
    *&      Form  CREATE_REPORT
          Learn to read the subroutine name!
    FORM create_report.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                i_interface_check       = ' '
                i_callback_program      = g_repid
                i_callback_user_command = 'PROCESS_USER_COMMANDS'
                it_fieldcat             = tbl_fieldcat
                i_default               = 'X'
                i_save                  = ' '
                is_layout               = st_layout
           TABLES
                t_outtab                = tbl_kna1
           EXCEPTIONS
                program_error           = 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.
    ENDFORM.                               " CREATE_REPORT
    *&      Form  GET_FIELDCAT
          Build the Field Catalog
    FORM get_fieldcat.
    Here the field catalog is created. To display more fields simply
    'uncomment' the additional lines and add the field name. Also note
    that the field catalog is much more powerful than this. You can
    intensify fields, change the colour, assign reference fields, etc.
    Look at type slis_fieldcat_alv for more options.
      PERFORM write_fieldcat USING 'ICON'  'TBL_KNA1' '    ' 'X' 1 '2' 'X'
      PERFORM write_fieldcat USING 'KUNNR' 'TBL_KNA1' 'KNA1' 'X' 2 ' ' ' '
      PERFORM write_fieldcat USING 'NAME1' 'TBL_KNA1' 'KNA1' ' ' 3 '10' ' '
                                   'X'.
      PERFORM write_fieldcat USING 'STRAS' 'TBL_KNA1' 'KNA1' ' ' 4 ' ' ' '
      PERFORM write_fieldcat USING 'TELF1' 'TBL_KNA1' 'KNA1' ' ' 5 ' ' ' '
      PERFORM write_fieldcat USING 'ORT01' 'TBL_KNA1' 'KNA1' ' ' 6 ' ' ' '
      PERFORM write_fieldcat USING 'PSTLZ' 'TBL_KNA1' 'KNA1' ' ' 7 ' ' ' '
      PERFORM write_fieldcat USING 'SORTL' 'TBL_KNA1' 'KNA1' ' ' 8 ' ' ' '
      PERFORM write_fieldcat USING 'ERNAM' 'TBL_KNA1' 'KNA1' ' ' 9 ' ' ' '
      PERFORM write_fieldcat USING 'SPRAS' 'TBL_KNA1' 'KNA1' ' ' 10 ' ' ' '
    perform write_fieldcat using '     ' 'TBL_KNA1' 'KNA1' ' ' 10 ' '.
    perform write_fieldcat using '     ' 'TBL_KNA1' 'KNA1' ' ' 11 ' '.
    perform write_fieldcat using '     ' 'TBL_KNA1' 'KNA1' ' ' 12 ' '.
    ENDFORM.                               " GET_FIELDCAT
    *&      Form  WRITE_FIELDCAT
          Write the Field Catalog data to the Field Catalog Table
         -->name   Field name
         -->tab    Table name
         -->st     Structure Name
         -->key    Is this field a Key?
         -->pos    Position Number
         -->length Field Length
         -->icon   Display as Icon
         -->hot    Hotspot
    FORM write_fieldcat USING name tab st key pos length icon hot.
      st_fieldcat-fieldname   = name.
      st_fieldcat-tabname     = tab.
      st_fieldcat-ref_tabname = st.
      st_fieldcat-key         = key.
      st_fieldcat-col_pos     = pos.
      st_fieldcat-outputlen   = length.
      st_fieldcat-icon        = icon.
      st_fieldcat-hotspot     = hot.
      APPEND st_fieldcat TO tbl_fieldcat.
      CLEAR st_fieldcat.
    ENDFORM.                               " WRITE_FIELDCAT
    *&      Form  PROCESS_USER_COMMANDS
          Interactive Reporting Commands
    FORM process_user_commands USING syst-ucomm LIKE syst-ucomm
                                     selfield TYPE slis_selfield.
    This subroutine is called when there is user interaction in the output
    In this case if the user double clicks the Customer Number then the
    program will call transaction XD03 and display the Customer Master
    Data
      CASE syst-ucomm.
        WHEN '&IC1'.
    get cursor field fieldname.
          READ TABLE tbl_kna1 INDEX selfield-tabindex.
          SET PARAMETER ID 'KUN' FIELD tbl_kna1-kunnr.
          CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
      ENDCASE.
    ENDFORM.                               " PROCESS_USER_COMMANDS
    *&      Form  GET_LAYOUT
      set the layout of the ALV.
      add color to the row?
    FORM get_layout.
      st_layout-info_fieldname    = 'COLOR'.
      st_layout-colwidth_optimize = 'X'.
      st_layout-get_selinfos      = 'X'.
    ENDFORM.                    " GET_LAYOUT
    *&      Form  get_data
          Get some data to play with
    FORM get_data.
      SELECT * FROM kna1 INTO CORRESPONDING FIELDS OF TABLE tbl_kna1
             UP TO 30 ROWS.
    ENDFORM.                    " get_data
    *&      Form  do_fancy_stuff
          Do some fancy pants stuff for example changing the color of
          lines and adding icons
    FORM do_fancy_stuff.
    Here we will demonstrate changing the color of ALV Record lines as
    well as displaying Icons
      LOOP AT tbl_kna1.
    All records where NAME1 begins with 'M', will be displayed in Bluish
    Green
        IF tbl_kna1-name1(1) EQ 'M'.
          tbl_kna1-color = 'C41'.  "Bluish Green
          MODIFY tbl_kna1 TRANSPORTING color.
        ENDIF.
    All records with no TELF1 will be displayed in White and have a
    Warning Icon
        IF tbl_kna1-telf1 IS INITIAL.
          tbl_kna1-color = 'C00'.  "White
          tbl_kna1-icon  = '@AH@'. "Warning Icon
          MODIFY tbl_kna1 TRANSPORTING icon color.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " do_fancy_stuff[/code]

  • LED in field of ALV(OOPs oriented)- Traffic lights in ALV filter popup

    Hi experts,
    Am showing LED in field of ALV(OOPs oriented)and when i click on  ALV filter for led field..it shows me Traffic lights in poup for filter.Please help me to get LED in filter popup also.
    Thanks,
    Sajay.

    Hi,
    Use the fuction module 'ICON_CREATE' as follows.
    CALL FUNCTION 'ICON_CREATE'
        "To create Red/Yellow/Green traffic icons
          EXPORTING
            name   = wrk_light
          IMPORTING
            RESULT = ip_status.
    wrk_light can be;
    'ICON_RED_LIGHT'
    'ICON_YELLOW_LIGHT'
    or 'ICON_GREEN_LIGHT' according to your scenario, that you can use the logic for your scondition.
    Use it in PBO.
    Regards,
    Renjith Michael.

  • 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

Maybe you are looking for

  • Losing Line-feed in XML parsing (XMLTRANSFORM) or File output (clob2file)?

    Hi all, need some help please! I'm using a xslt file to transferm a XML file into a txt format file. Within the XSLT file, there is a carriage-return (<xsl:text> </xsl:text>) (it disappeared already, here is what i'm using "#xD" or "#xA", have to tak

  • How do I import playlists from an old library file?

    How do I import playlists from an old library file? I have a new computer and it has the music files completely reorganized from my last computer so I can't just drop in my old library files and have it work. Basically, I'm hoping there is some way t

  • UCCX send entered digits to CAD display

    Hi, I'm trying to get a set of numbers (that will be entered by the caller) to show up in the enterprise data fields in CAD. Scenario would be that the caller would have to enter their customer number (7 digits) and when the call gets put through to

  • ORA-12514 :TNS: ------

    HI guys I have shutdown my database immidiate to do archiving and when i startup data base in in "mount" stage i get following message. Can any body help me why i am getting this message ORA-12514: TNS:Listner does not currently kknow of service requ

  • Why can't I see my "inbox" files from one of my 2 e-mail accounts?

    I can see my Gmail Inbox messages, but a second e-mail account has stopped displaying "inbox" messages, although I can see the messages on my iPhone and other "origin" computer for that account. All other folders are visible. Send messages are visibl