Dynamic coloring of rows using FM (Reuse_alv_grid_display.)

I need to color the rows depending on the condition dynamically . I am using FM Reuse_alv_grid_display for ALV . I have the code using Oops Concept, But i need to know how can we do using the Function Module. Please Clarify

Hi,
In the final internal table you declare one fieldsline_col(4) type c.
Data: begin of itab occurs 0, "final internal table.
      line_col(4) type c,.
     end of itab.
IF .......your condition.
    loop at itab.
      if itab-WERKS = '1000'.
        itab-line_col = 'C600'.
      endif.
      modify itab.
      clear itab.
    endloop.
Next build your FIELDCATALOG ......
    gt_layout-zebra = 'X'.
    gt_LAYOUT-DETAIL_POPUP = ' '.
    gt_layout-info_fieldname = 'LINE_COL'.
Next pass this to your FM.
I hope this will help you.
Thanks.
If your issue is solved award points and close the thread if not revert back.
Message was edited by: Deepak333 k
Message was edited by: Deepak333 k

Similar Messages

  • How to color a row using REUSE_ALV_HIERSEQ_LIST_DISPLAY

    Hi,
    I'm able to color a row using REUSE_ALV_GRID_DISPLAY, I tried the same way to color a row at the item level using 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' but I'm not able to get the row color, please let me know how to acheive this.
    Thanks in Advnce
    Narayan

    you need to do 4 things.
    1. Add a field in your final internal table which ur going to display.
    2.Name the field as----
    > color_line(4)   TYPE  c,
                begin of itab,
                              matnr            type  mara-matnr,
                              ernam          type  mara-ernam,
                           color_line(4)   TYPE  c,
               end of itab.
    3.declare layout ....................> data :  it_layout   TYPE lvc_s_layo.
    4. After filled your fieldcat and before display your ALV
            loop at itab assigning to <itab>.
                          if <itab>-ernam eq 'XYZ'.
                          <itab>-color_line = 'C600'.
           end loop.
    it_layout-info_fname = 'COLOR_LINE'.
    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
    exporting
        IS_LAYOUT                      = it_layout
        IT_FIELDCAT                    = your_fieldcat
      and pass ur  ITAB.

  • Coloring table row using css in pfr

    Hi all,
    I am using classic table region for loading the records.After loading in PFR using table multiselection selecting one or more than one row then coloring should happen for those selected rows.
    In pfr we cann't change bean properties.
    Give ur idea.
    Thanks,

    Hi,
    Go through these threads...
    Can we colour the rows in the column of a table
    Changing Color of a value in a column
    Thanks,
    Gaurav

  • Coloring each row  Dynamically in WebDynpro using SALV_WD_TABLE component

    Hi All,
      We have a requirement in WebDynpro  ABAP ,to display the ALV  table rows with different colors on the bases of come condition at runtime.
        We have checked but got only for column wise but not row wise.
    Can we archive it for Row wise also?
    Thanks in advance.
    CB

    Hi Saji,
    Please go through this...
    coloring  the rows of alv dnamically
    Color ALV column and rows
    Cell color change in ALV
    Cheers,
    Kris.

  • Dynamic color color rows n't proper

    Hi all,
    above tablix red circle dynamic columns
    i am using :row background color :=IIf(rownumber("Tablix10") mod 2, "white","whiteSmoke")
    give any solutions
    thanks

    Hi Revathi,
    Please click the link below to see Alternating Group Colors and Alternating Row Colors:
    http://www.bidn.com/blogs/briankmcdonald/bidn-blog/717/alternating-group-colors-and-alternating-row-colors
    By the way, if you use matrix in your report, the RowNumber function in the Matrix is totally different with it in the table because you are always dealing with grouped data in a matrix. This expression only works fine whit table report. So if we want to have
    the alternative color in the matrix, we may use the Running Function.
    If the issue persists, please elaborate the structure of your report so that we can make further analysis and help you out.
    Regards,
    Charlie Liao

  • Finding minimum value in each row using dynamic query

    need to find the minimum and maximum value from each row using dynamic query
    [from curr] will be given as input
    Tuky

    DECLARE @t TABLE(a INT,b INT,c INT);
    INSERT @t VALUES(1,2,3),(9,8,7),(4,6,5);
    SELECT *
    ,      (   SELECT  MAX(val) 
               FROM    (VALUES (a)
                           ,   (b)
                           ,   (c)
                       ) AS value(val)
           ) AS MaxVal 
    ,      (   SELECT  MIN(val) 
               FROM    (VALUES (a)
                           ,   (b)
                           ,   (c)
                       ) AS value(val)
           ) AS MinVal 
    FROM @t;
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Adding Specific columns of dynamic internal table row into another column

    Hi Gurus,
    I need to add  few columns of a dynamic internal table row into another column:
    Article description hy01 hy02 total
    101      panza         10     12      22
    102      masht         12     12     24
    dynamic internal table is created and columns hy01 hy02.... can increase
    How to add the the values in hy01 hy 02... into total.
    Regards,
    Dep

    Hi,
    If you really want to have a dynamic table, then you will have to find a way to generate a whole new table, and then copy the data from the old table to the new one. There is no way to modify a type during runtime in ABAP.
    Here an example how to generate a dynamic table based on another internal table, hope this will help you.
    TYPE-POOLS: slis.
    PARAMETERS: p_nb_hy TYPE i DEFAULT 2. "Number of new HY columns to be added
    * Type ZST_T:
    *   matnr  TYPE matnr
    *   maktx  TYPE maktx
    *   hy01   TYPE i
    *   total  TYPE i
    TYPES: ty_t TYPE STANDARD TABLE OF zst_s.
    PERFORM main.
    *&      Form  main
    *       text
    FORM main.
      DATA: lt_fieldcat     TYPE slis_t_fieldcat_alv,
            lt_t            TYPE ty_t,
            lr_new_t        TYPE REF TO data.
      FIELD-SYMBOLS: <lt_new_t> TYPE STANDARD TABLE.
      "Add some lines to LT_T just to have something to display on screen
      DO 10 TIMES.
        APPEND INITIAL LINE TO lt_t.
      ENDDO.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'ZST_S'
        CHANGING
          ct_fieldcat      = lt_fieldcat.
      "Copy LT_T to LR_NEW_T
      PERFORM extend_and_copy_table USING lt_t p_nb_hy CHANGING lr_new_t lt_fieldcat.
      CLEAR lt_t. "Not needed anymore...
      ASSIGN lr_new_t->* TO <lt_new_t>.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          it_fieldcat = lt_fieldcat
        TABLES
          t_outtab    = <lt_new_t>.
    ENDFORM.                    "main
    *&      Form  extend_and_copy_table
    FORM extend_and_copy_table USING ut_t           TYPE STANDARD TABLE
                                     uv_nb_hy       TYPE i
                               CHANGING cr_t        TYPE REF TO data
                                        ct_fieldcat TYPE slis_t_fieldcat_alv
                               RAISING cx_sy_struct_creation cx_sy_table_creation.
      DATA: lo_tabledescr      TYPE REF TO cl_abap_tabledescr,
            lo_structdescr     TYPE REF TO cl_abap_structdescr,
            lo_new_structdescr TYPE REF TO cl_abap_structdescr,
            lo_new_tabledescr  TYPE REF TO cl_abap_tabledescr,
            lt_components      TYPE cl_abap_structdescr=>component_table,
            ls_component       TYPE cl_abap_structdescr=>component,
            lv_field_cnt       TYPE numc2,
            ls_fieldcat        TYPE slis_fieldcat_alv,
            lr_fieldcat        TYPE REF TO slis_fieldcat_alv.
      FIELD-SYMBOLS: <ls_old_s> TYPE ANY,
                     <lt_new_t> TYPE STANDARD TABLE,
                     <ls_new_s> TYPE ANY.
      "Get the list of all components from UT_T line structure
      lo_tabledescr  ?= cl_abap_tabledescr=>describe_by_data( ut_t ).
      lo_structdescr ?= lo_tabledescr->get_table_line_type( ).
      lt_components  = lo_structdescr->get_components( ).
      "The new columns will be from type of column HY01
      ls_component-type = lo_structdescr->get_component_type( 'HY01' ).
      "The new columns will have the same fieldcat info as column HY01
      READ TABLE ct_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'HY01'.
      "HY<lv_field_cnt> = new field name
      lv_field_cnt = uv_nb_hy + 1.
      "For each new column...
      DO uv_nb_hy TIMES.
        "Generate the new column field name
        CONCATENATE  'HY' lv_field_cnt INTO ls_component-name.
        ls_fieldcat-fieldname = ls_component-name.
        "Add the new field to the components of the new structure
        INSERT ls_component INTO lt_components INDEX 4.
        "Add the new field's fieldcat info to the fieldcat
        INSERT ls_fieldcat  INTO ct_fieldcat   INDEX 4.
        lv_field_cnt = lv_field_cnt - 1.
      ENDDO.
      "Adjust the COL_POS from fieldcat
      LOOP AT ct_fieldcat REFERENCE INTO lr_fieldcat.
        lr_fieldcat->col_pos = sy-tabix.
      ENDLOOP.
      "Create the new table
      lo_new_structdescr = cl_abap_structdescr=>create( p_components = lt_components ).
      lo_new_tabledescr  = cl_abap_tabledescr=>create( p_line_type = lo_new_structdescr ).
      CREATE DATA cr_t TYPE HANDLE lo_new_tabledescr.
      ASSIGN cr_t->* TO <lt_new_t>.
      "Copy all data from old to new table
      LOOP AT ut_t ASSIGNING <ls_old_s>.
        APPEND INITIAL LINE TO <lt_new_t> ASSIGNING <ls_new_s>.
        MOVE-CORRESPONDING <ls_old_s> TO <ls_new_s>.
      ENDLOOP.
    ENDFORM.                    "main

  • About inserting color to rows in alv

    hi ,
        could any one tell me how to insert colors to rows in alv.
    regards,
    pavan.

    hi,
    try like this
    TABLES:     ekko.
    TYPE-POOLS: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
      line_color(4) TYPE c,     "Used to store row color attributes
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          gd_tab_group TYPE slis_t_sp_group_alv,
          gd_layout    TYPE slis_layout_alv,
          gd_repid     LIKE sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-datatype     = 'CURR'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
          Build layout for ALV grid report
    FORM build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-info_fieldname =      'LINE_COLOR'.
    ENDFORM.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
          Display report using ALV grid
    FORM display_alv_report.
      gd_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = gd_repid
          is_layout          = gd_layout
          it_fieldcat        = fieldcatalog[]
          i_save             = 'X'
        TABLES
          t_outtab           = it_ekko
        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.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      DATA: ld_color(1) TYPE c.
      SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
       UP TO 10 ROWS
        FROM ekpo
        INTO TABLE it_ekko.
    *Populate field with color attributes
      LOOP AT it_ekko INTO wa_ekko.
    Populate color variable with colour properties
    Char 1 = C (This is a color property)
    Char 2 = 3 (Color codes: 1 - 7)
    Char 3 = Intensified on/off ( 1 or 0 )
    Char 4 = Inverse display on/off ( 1 or 0 )
              i.e. wa_ekko-line_color = 'C410'
        ld_color = ld_color + 1.
    Only 7 colours so need to reset color value
        IF ld_color = 8.
          ld_color = 1.
        ENDIF.
        CONCATENATE 'C' ld_color '10' INTO wa_ekko-line_color.
    wa_ekko-line_color = 'C410'.
        MODIFY it_ekko FROM wa_ekko.
      ENDLOOP.
    ENDFORM.                    " DATA_RETRIEVAL
    reward if usefull....

  • How can i change the color of row?

    hi
    I want change my background color of rows.
    for examole first row ,white and next gray and the other rows.
    thanks.

    Hello,
    May be you also select the rownum and use the following example. For more information, please search 'SRW.ATTR' in report help.
    function F_SALFormatTrigger return boolean is
    begin
    if :rownum = 1 then
    srw.attr.mask := SRW.BORDERWIDTH_ATTR +
    SRW.FBCOLOR_ATTR +
    SRW.BBCOLOR_ATTR +
    SRW.BORDPATT_ATTR +
    SRW.FFCOLOR_ATTR +
    SRW.BFCOLOR_ATTR +
    SRW.FILLPATT_ATTR;
    srw.attr.borderwidth := 1;
    srw.attr.fbcolor := 'red';
    srw.attr.bbcolor := 'blue';
    srw.attr.bordpatt := 'checker';
    srw.attr.ffcolor := 'yellow';
    srw.attr.bfcolor := 'green';
    srw.attr.fillpatt := 'crisscross';
    srw.set_attr (0, srw.attr);
    end if;
    RETURN(TRUE);
    end;
    Regards,
    George
    hi
    I want change my background color of rows.
    for examole first row ,white and next gray and the other rows.
    thanks.

  • How to set background color in row of JTable ?

    i am new in java please tell me about How to set background color in row of JTable ? please example code. Thnak you.

    Here is an example: http://www.javaworld.com/javaworld/javaqa/2001-09/03-qa-0928-jtable.html
    For more info on how to use tables read the swing tutorial: http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
    ICE

  • How to color specific row in a table....

    Hi all,
    I created a table out of an Array[]. The table is successfully filled up by array's elements. Each element is a row.
    I want to be able to color specific row; instead of every row. How do I do that?
    I was looking rendering to color a row or a string; but not successfull.
    Thank you for your time and assistence.

    My favorite way of doing this is to use CSS. You plan on giving the row you want colored an id attribute, then provide a style like this:
    <style type="text/css">
      tr#colorMe td {
        background-color:blue;
    </style>Then, when you want to color the row, you make the HTML output like this:
    <table ...>
      <tr> //normal row
        <td></td><td></td><td></td>
      </tr>
      <tr id="colorMe"> //colored row
        <td></td><td></td><td></td>
      </tr>
      <tr> //normal row
        <td></td><td></td><td></td>
      </tr>
    </table>

  • Dynamically color to each column in Cross-tab report

    Hello All,
    I am a newbie in Crystal report,from last few weeks, i am working on cross tab crystal report.i have a requirement to show color dynamically for each column.i am adding an attachment how i want it. i tried dynamic coloring using object field formula but it is showing red color to all data.i want red color data when in 2nd  cross tab report data is beyond upper or lower limit in first cross tab table. it will be very helpful if somebody will give me any clue on this.... i read so many articles now it seem like impossible for me..:(
    i am using visual studio 2010 and sap crystal report version 13.0.0.99 for visual studio 2010.

    Hello Manish,
    I have attached a sample report that does this. You will need to remove the .txt extension from the attached file to open it as an .rpt file.
    Please right click on one of the value fields of the first cross tab in the report > Format Field > Common > Suppress if Duplicated conditional formula.
    The nested formula is as follows;
    numbervar array l;
    numbervar array u;
    numbervar x:=CurrentColumnIndex;
    if GridRowColumnValue ('@limit') = 'lower limit' then
    (redim preserve l[x];
    l[x]:= tonumber(CurrentFieldValue))
    else if GridRowColumnValue ('@limit') = 'upper limit' then
    (redim preserve u[x];
    u[x]:= tonumber(CurrentFieldValue));
    false
    So it assigns each lower and upper limit value for each client (in the sample it is country) to an array using the cross tabs column index to index the array and it ends in False as we don't actually want it to suppress if duplicated. This nested formula is just used to generate the arrays of upper and lower values.
    In the second cross tab if you again right click on one of the value fields > Format Field > Font > Color you will see the following conditional formula;
    numbervar array l;
    numbervar array u;
    numbervar x;
    if not(tonumber(CurrentFieldValue) in l[CurrentColumnIndex] to u[CurrentColumnIndex]) then
    crred
    else
    crblack
    So this compaes the current field value to range generated by the 2 arrays and assigns a color based on whether or not it is in the range.
    Regards,
    Graham

  • Get selected rows using the fm REUSE_ALV_GRID_DISPLAY_LVC

    FYI ... for all those developers trying to select multiple rows in an ALV report, and get the selected rows - without using the OO approach to display to ALV, and without using checkboxes in the function module approach.  First off, you need to use the function module REUSE_ALV_GRID_DISPLAY_LVC instead of the standard REUSE_ALV_GRID_DISPLAY.  This allows you to select multiple rows using the toggle, line selection buttons, at the start of each row (with 'select all' button).  See the sample code below.  If you are converting from the one fm to the other, you will have to change the type of 2 of the structures to the 'LVC' structures and make minor code changes.  The example code below was initially using the REUSE_ALV_GRID_DISPLAY fm, and was converted to use REUSE_ALV_GRID_DISPLAY_LVC  to allow for multiple row selection.  The next step is to create a custom status, with a new custom button, that will start the processing of the selected rows.  Go to tcode SE41, press Copy Status, and copy program SAPLKKBL, status STANDARD, to your custom program (same name as the custom ALV rpt) and a new status name (ie STANDARD1).  In the new STANDARD1 status for the custom ALV program/rpt (tcode SE41), add a new button ('&EXE') at the end of the std buttons (items 29-35).  Assign the new button a Text, Icon and a Function Key. Thats it!
    Here's the code:
    FORM display_data.
    DATA:
      wa_callback_program LIKE sy-repid,
      wa_layout      TYPE lvc_s_layo,  "was  slis_layout_alv,       "D01K913690
      t_fieldcat        TYPE lvc_t_fcat,   "was  slis_t_fieldcat_alv,  "D01K913690
      wa_fieldcat    TYPE lvc_s_fcat,  "was  slis_fieldcat_alv,     "D01K913690
      t_excluding     TYPE slis_t_extab,
      wa_excluding TYPE slis_extab,
      wa_variant     LIKE disvariant.
    * Setup Field Catalog
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname  = 'ZBUKR'.
      wa_fieldcat-ref_field    = 'ZBUKR'.
      wa_fieldcat-ref_table   = 'REGUT'.
      APPEND wa_fieldcat TO t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'BANKS'.
      wa_fieldcat-ref_field   = 'BANKS'.
      wa_fieldcat-ref_table  = 'REGUT'.
      APPEND wa_fieldcat TO t_fieldcat.
    * Setup other ALV fm parameters
      CLEAR wa_excluding.
      wa_excluding-fcode = '&F12'.
      APPEND wa_excluding TO t_excluding.
      CLEAR wa_excluding.
      wa_excluding-fcode = '&F15'.
      APPEND wa_excluding TO t_excluding.
    * Callback program
      wa_callback_program = sy-repid.
    * List layout
      wa_layout-zebra = 'X'.
      wa_layout-sel_mode = 'A'.
    * variant
      wa_variant-variant  = p_var.
    * Display the ALV report
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'                "D01K913690
           EXPORTING
                i_callback_program             = wa_callback_program
                i_callback_pf_status_set    = 'SET_PF_STATUS'              "D01K913690
                i_callback_user_command  = 'USER_COMMAND'
                is_layout_lvc                       = wa_layout                          "D01K913690
                it_fieldcat_lvc                      = t_fieldcat                            "D01K913690
                it_excluding                         = t_excluding
                i_save                                 = 'A'
                is_variant                            = wa_variant
           TABLES
                t_outtab                              = t_regut
    *      EXCEPTIONS
    *           PROGRAM_ERROR            = 1
    *           OTHERS                             = 2
    ENDFORM.                               " DISPLAY_DATA
    FORM user_command
      USING
        r_ucomm     LIKE sy-ucomm
        rs_selfield TYPE slis_selfield.
      DATA: wa_text(80) TYPE c.
      CASE r_ucomm.
        WHEN '&EXE'.   "User pressed custom Execute button
          DATA ref1 TYPE REF TO cl_gui_alv_grid.
          CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
            IMPORTING
              e_grid = ref1.
          DATA: lt_index_rows TYPE lvc_t_row,
                     lt_row_no TYPE lvc_t_roid,
                     lw_row_no TYPE lvc_s_roid.
          CALL METHOD ref1->get_selected_rows
            IMPORTING
              et_index_rows = lt_index_rows
              et_row_no     = lt_row_no.
          LOOP AT lt_row_no
             INTO lw_row_no.
             *** CODE TO PROCESS EACH RECORD FROM MULTIPLE SELECTED***
          ENDLOOP.  "loop at lt_row_no
        WHEN '&IC1'.  "User double-clicked on row
          *** CODE TO PROCESS SINGLE RECORD SELECTED ***
        WHEN '&F03' .          " back
          SET SCREEN 0. LEAVE SCREEN.
        WHEN '&F15' .          " exit
          SET SCREEN 0. LEAVE SCREEN.
        WHEN '&F12' .          " cancel
          SET SCREEN 0. LEAVE SCREEN.
      ENDCASE.
    ENDFORM.                               " USER_COMMAND
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'STANDARD1'.
    ENDFORM. " set_pf_status
    Hope this helps ...
    Regards,
    Kevin
    Moderator message - Welcome to SCN.
    However, as you can see, the forum software was unable to format this because of the 2,500 character posting limit. since this looks interesting, would you please try to edit to conform to that limitation? You may try to split it into an initial post and a response.
    Edited by: Rob Burbank on Jul 8, 2009 1:39 PM

    Hi ,
         Make it use in your code and let me know if u have any concerns...
        Use "Subtotal_text" in events table.
    here GTOTAL is field in itab on which we sortindf data, and use your own field on which field u want to sort...
    refresh gt_event.
    clear gw_event.
    call function 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         i_list_type = 0
       IMPORTING
         et_events   = gt_event.
    Subtotal
    read table gt_event with key name = slis_ev_subtotal_text into gw_event.
    if sy-subrc = 0.
       move 'SUBTOTAL_TEXT' to gw_event-form.
       append gw_event to gt_event.
    endif.
         form subtotal_text using uw_subtot_line type ty_main
                    uv_subtottxt type slis_subtot_text.  "#EC CALLED
    if uv_subtottxt-criteria = 'GTOTAL'.
       uv_subtottxt-display_text_for_subtotal = 'TOTAL'.
    endif.
         *FORM build_sort .
    refresh gt_sort.
    gw_sort-spos      = 1.
    gw_sort-fieldname = 'GTOTAL'.
    gw_sort-tabname   = 'GT_MAIN'.
    gw_sort-up        = 'X'.
    gw_sort-subtot    = 'X'.
    APPEND gw_sort TO gt_sort.
    CLEAR gw_sort.
    Reward points once its useful..

  • Color report rows based on a value in that row

    I would like to Color report rows based on a value in that row.
    For examplle with the "EMP" table:
    I would like job=MANAGER to be red and job=CLERK to be green etc etc
    The other example I found only had the option of one color either the highlight or the default color.
    I am looking for a way to do multiple colors.

    Hi,
    In the row template, you can use #1#, #2#, etc to indicate where a field in the report needs to be output. This does not have to be plain text - ie, you can use it within style tags if you like.
    So, take a query like:
    SELECT EMPNO,
    ENAME,
    DEPTNO,
    DECODE(DEPTNO, 10, 'green', 20, 'red', 30, 'cyan', 'white') BG_COLOUR
    FROM EMPYou get columns 1=empno, 2=ename, 3=deptno and 4=bg_colour. In the row template, you can then do:
    Before Rows setting (sets up the table):
    &lt;table&gt;
    &lt;tr&gt;&lt;td&gt;ID&lt;/td&gt;&lt;td&gt;Name&lt;/td&gt;&lt;td&gt;Dept&lt;/td&gt;&lt;/tr&gt;After Rows setting (closes the table):
    &lt;/table&gt;Row Template 1 (used for ALL rows):
    &lt;tr style="background-color:#4#;"&gt;&lt;td&gt;#1#&lt;/td&gt;&lt;td&gt;#2#&lt;/td&gt;&lt;td&gt;#3#&lt;/td&gt;&lt;/tr&gt;Then, for every row, the colour that has been calculated using the DECODE function will be used in the style tag to colour the background for the entire row.
    How you determine the colours is up to you. I've used DECODE here, but you could use a field on the DEPT table to hold this and use this in your SQL statement.
    Andy

  • Dynamic no of rows in tabular form

    Dear oracle forms experts,
    hope you all will be doing fine.
    Is it possable to that a tabular form take dynamic no of rows at run time, i mean if we i query mode if data contains 20 rows then it should expand to 20 rows and if it is only 5 rown then it should expand to 5 rown. and if i do not want to use side bar as well.
    Regards
    Abbas

    OK and thanks you too.
    now if i take it in this way that i have defied a tabular form for let say 20 rows and now in query mode if there are only 5 records then my form shuold show only first 5 rows that have data and rest 15 should get hidden..
    so now can it be possable in forms Developer 10g.
    Kind Regards
    Abbas

Maybe you are looking for