Changing fields color in CL_GUI_ALV_GRID using class

Hi,
I've written a lot of posts but still I have problem with changing color for CL_GUI_ALV_GRID.
I have class ZKSL_CL_4_17_ALV_GRID_OO with 3 methods : SELECT, HANDLE_DBL_CLICK AND DISPLAY_ALV
I want to change fields color every time I double click on IT.
METHOD SELECT.
   DATA:
         lt_sflight                TYPE TABLE OF           zkslt_sflight,
         ls_layout                 TYPE                    lvc_s_layo,
         lr_custom_container       TYPE REF TO             cl_gui_custom_container,
         lr_my_class               TYPE REF TO             zksl_cl_4_17_alv_grid_oo.
   SELECT *  FROM zkslt_sflight  INTO TABLE mt_sflight
      WHERE carrid    = iv_carrid AND
          ( fldate    IN it_date  OR
            price     IN it_price OR
            planetype IN it_type )
CALL FUNCTION 'Z_KSL_SCREEN'.
ENDMETHOD.
from FM z_ksl_screen i call screen 400 and from status_400 output  I call method DISPLAY_ALV
METHOD display_alv.
   DATA:
          lr_custom_container       TYPE REF TO             cl_gui_custom_container,
          lt_sflight                TYPE TABLE OF           zkslt_sflight,
          lt_catalog                TYPE STANDARD TABLE OF  lvc_s_fcat,
          ls_catalog                LIKE LINE OF            lt_catalog,
          ls_layout                 type                    slis_layout_alv,
          lr_my_class               TYPE REF TO             zksl_cl_4_17_alv_grid_oo.
   CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
     EXPORTING
       i_structure_name = 'ZKSLT_SFLIGHT'
     CHANGING
       ct_fieldcat      = lt_catalog[].
************BULID LAYOUT
   ls_layout-no_input = 'X'.
   ls_layout-colwidth_optimize = 'X'.
   ls_layout-totals_text       = 'Totals(201)'.
   ls_layout-info_fieldname    = 'LINE_COLOR'.
   IF mr_gui_alv_grid IS INITIAL.  "-----------------------------------if----------------------&
     CREATE OBJECT: lr_custom_container
       EXPORTING
         container_name = 'DISPLAY',
         lr_my_class.
     CREATE OBJECT mr_gui_alv_grid
       EXPORTING
         i_parent = lr_custom_container.
     SET HANDLER lr_my_class->handle_dbl_click FOR mr_gui_alv_grid.
     CALL METHOD mr_gui_alv_grid->set_table_for_first_display
       EXPORTING
         i_structure_name = 'ZKSLT_SFLIGHT'
        is_layout        =   ls_layout
         i_save           = 'A'
       CHANGING
         it_outtab        = Mt_sflight
         it_fieldcatalog  = lt_catalog.
   ELSE.     "-------------------------------------------------ELSE---------------------&
     mr_gui_alv_grid->refresh_table_display( ) .
   ENDIF.
ENDMETHOD.
In handler i am trying to change fields color and call method display sending new out_table
CALL METHOD me->display_alv
     CHANGING
       ct_fieldcat = lt_fieldcat.
Please give me some easy advice how to do that.
thank you in advice.

Thank you Klaus for your reply,
The problem is that I need to make this using classes.
I tried to make my structure data with LVC_T_SCOL as you wrote,
a field of table type LVC_T_SCOL in the structure of your output table
DATA BEGIN OF lt_data. 
       INCLUDE STRUCTURE sflight.
       DATA cellcolors  TYPE lvc_t_scol .
   DATA END OF lt_data.
TYPES: BEGIN OF mtt_tab.
*         INCLUDE STRUCTURE ZKLST_sflight.  " I get error that I cannot use ref to abap dic
           INCLUDE TYPE ZKSLT_SFLIGHT.
           TYPES: cellcolors  TYPE lvc_t_scol ,
             END OF mtt_tab.
After making type mtt_tab
i declare data   lt_tab                    TYPE STANDARD TABLE OF  mtt_tab.
and when I try to copy table mt_sflight (it is atribut of calss) like below
LOOP AT mt_sflight INTO ls_mt .
*   READ TABLE lt_tab INDEX sy-tabix ASSIGNING <ls_tab>.
*   MOVE-CORRESPONDING <ls_mt> TO <ls_tab>.
*    UPDATE lt_tab FROM TABLE mt_sflight.
     MOVE-CORRESPONDING ls_mt to lt_tab.
   ENDLOOP.
I am getting error "lt_tab is not internal str or table with header"
Can you help me with this? 

Similar Messages

  • Change Field Color

    Hi All,
    I have a multi-record block with 8 fields. The last field stores the total of fields 5,6and 7.
    Depending on the number in the “Total” field I want it’s color to change. For example if it is b/w 10 and 25, it should be red, b/w 26 and 35 it should be Yellow and b/w 36 and 50 it should be green. I tried using Set_Item_Property and also Set_Item_Instance_Property by creating a Visual Attribute for each color. But what happens is the entire row gets the color instead of only the “Total” field. Can you please help me get over this?
    Thanks in advance.

    Hi SIS,
    Followng is the code:
    set_item_property('ENZ_CLIENT_EVALUATION.STOT_EVA',visual_attribute,'VA_EVAL_LGND_ORGI');
    If :STOT_EVA between v_blk_1 and v_blk_2 then
         set_item_property('ENZ_CLIENT_EVALUATION.STOT_EVA',visual_attribute,'VA_EVAL_LGND_BLK');
    Elsif :STOT_EVA between v_red_1 and v_red_2 then
         set_item_property('ENZ_CLIENT_EVALUATION.STOT_EVA',visual_attribute,'VA_EVAL_LGND_RED');
    Elsif :STOT_EVA between v_mag_1 and v_mag_2 then
         set_item_property('ENZ_CLIENT_EVALUATION.STOT_EVA',visual_attribute,'VA_EVAL_LGND_MAG');
    Elsif :STOT_EVA between v_grn_1 and v_grn_2 then
         set_item_property('ENZ_CLIENT_EVALUATION.STOT_EVA',visual_attribute,'VA_EVAL_LGND_GRN');
    end if;

  • Dynamically changing Grid title  in alv using class

    Hi all,
    I need to get grid title dynamically for single screen for user actions through buttons.What is the option available in cl_gui_alv_grid.
    in reuse_alv_grid_display one field grid_title is  available .but here i could not able to find anything like this .how to solve this issue.
    thanks in advance,
    raja

    When user presses a button on the application toolbar....with function code ( say TITL ) then the grid_title field can be changed manually and can be reflected in the display by refreshing the table using the method below..
    please try this....
    flag = 1.
    FORM user_command USING u_ucomm   LIKE sy-ucomm
                         us_selfield TYPE slis_selfield.
        CASE u_ucomm.
         WHEN 'TITL'.
            IF flag EQ 1.
               flag = 2.
               grid_title = 'ALV_DISPLAY_1'.
               CALL METHOD grid->refresh_table_display
                 EXPORTING
                   IS_STABLE      =
                 I_SOFT_REFRESH =
                 EXCEPTIONS
                   FINISHED       = 1
                   others         = 2.                 
             elseif flag eq 2.
               flag = 1.
               grid_title = 'ALV_DISPLAY_2'.
               CALL METHOD grid->refresh_table_display
                 EXPORTING
                   IS_STABLE      =
                 I_SOFT_REFRESH =
                 EXCEPTIONS
                   FINISHED       = 1
                   others         = 2.
              endif.
         ENDCASE.
    ENDFORM.

  • Change field color to Unspecified

    Hi,
    I have a forms in 10g which I converted from 6i. I have few poplist items in my canvas. Some of them have the correct color but few of them have white in the background. I want to change all the colors to use <Unspecified>. How do I get that?? If I type in <Unspecified> in the property pallette, it doesnt accept and I hv to mandatory choose a color.
    All of you experts, pls advise.
    Thanks.

    Hi Diana,
    In the property palette of the item, go to the color and on the toolbars (at the top) you will see a icon for inherit. Just click on it.
    That will do the work.

  • Change Field desription in report using Infotype

    Hi,
    I create a HR Report, using infotype's. When we execute the report, it fields description comes in unknown format...means user can't understand that.
    Please let me know From where we can change the field description of any column.
    Plz. help...

    U are Welcome!!
    If u are using alv then manually fill the field catalog and give the field names as u desire as i have done in below code...
    * Column 1 in ALV
      ls_fcat-no_out = '' .
      ls_fcat-col_pos = 1.
      ls_fcat-tabname = 'oitab'.
      ls_fcat-fieldname = 'Field 1'.
      Is_fcat-outputlen = '10'.
      ls_fcat-edit(1) = ''.
      ls_fcat-no_sum = 'X'.              "Only Output, if input then 'X'
      ls_fcat-key = 'X'.
      append ls_fcat to fieldcat.
    * Column 2 in ALV
      clear : ls_fcat.
      ls_fcat-col_pos = 2.
      ls_fcat-tabname = 'oitab'.
      ls_fcat-fieldname = 'Field 2'.
      ls_fcat-edit(1) = ''.
      ls_fcat-do_sum = 'X'.
      ls_fcat-key = ''.
      append ls_fcat to fieldcat.
    * Column 3 in ALV
    clear : ls_fcat.
    ls_fcat-col_pos = 3.
      ls_fcat-tabname = 'oitab'.
      ls_fcat-fieldname = 'Field 3'.
      ls_fcat-edit(1) = ''.
      ls_fcat-do_sum = 'X'.
      append ls_fcat to fieldcat.

  • Changing Values on ALV Grid (using Classes)

    Hi all,
        I have ALV Grid output, on which ZMENG (Target Qty) column is editable. So user will enter in value in ZMENG column and press ENTER. Then TOTAL column should be populated with ZMENG * NETWR columns. I have tried with changing/ entering values with char data type columns like MAKTX etc.. Its working fine with them. But when I entered in value in ZMENG, the actual value which I have entered is not flowing into LS_GOOD-VALUE. For char data types its been populated with user entered values.
          Can anyone please tell why its not happening with Quantity or Currency fields.
      method handle_data_changed.
        DATA: ls_good TYPE lvc_s_modi,
              l_netwr TYPE vbap-netwr,
              l_total TYPE vbap-netwr,
              l_zmeng TYPE vbap-zmeng.
        LOOP AT er_data_changed->mt_good_cells INTO ls_good.
          CASE ls_good-fieldname.
            WHEN 'ZMENG'.
              <<<<l_zmeng = ls_good-value.>>>>
              call method er_data_changed->get_cell_value
                             exporting i_row_id = ls_good-row_id
                                       i_fieldname = 'NETWR'
                             importing e_value = l_netwr.
              l_total = l_zmeng * l_netwr.
              call method er_data_changed->modify_cell
                        exporting i_row_id = ls_good-row_id
                                  i_fieldname = 'TOTAL'
                                  i_value     = l_total.
          ENDCASE.
      ENDLOOP.
    ENDMETHOD.
    Fieldcatlog for Quantity field:
      l_fcat-tabname = 'IT_VBAP'.
      l_fcat-fieldname = 'ZMENG'.
      l_fcat-coltext = 'Qty'.
      l_fcat-outputlen = 17.
      l_fcat-edit = 'X'.
      APPEND l_fcat TO ct_fcat.
      CLEAR l_fcat.

    Hi Jaker 
    Try calling cl_gui_alv_Grid->refresh_table_display.
    refresh table display when ever the qty is changed.
    It should work.
    Venkat.

  • Change BG color of Panel using script (AS3)

    Dear, all
    I am a newbies in Flex. Now I have some trouble with thw
    sample thing.
    That is how can I change BackgroungColor of panel using
    script(AS3)
    I can do it by mxml BUT!! I really need to change it using
    AS3. Does you know what should I do NEXT.

    When you lookup a component in FB3 help sys, if you see it
    under styles, then you need to use setStyle() in AS, if you see it
    as a property, just use dot notation.

  • Missing class for indicator field value [changed-fields-locking-policy]

    -------<br>
    Edit:<br>
    Please, ignore the post below. I found the problem here. The real problem is reported in my other post.<br>
    -------<br>
    <br>
    Hello,<br>
    <br>
    In order to test the optimistic locking by fields, I created a very simple TopLink project via the TopLink Workbench. It only consists of one table that was mapped via TopLink's own "Add or Update Existing Tables from Database". I made no modifications to the automatically generated mappings.<br>
    <br>
    After I set up the rest of the project, I ran it and it ran okay.<br>
    <br>
    Then I went to the table descriptor, then to the "Locking" tab, and then I selected "Optimistic Locking" -> "By Fields" -> "Changed Fields".<br>
    <br>
    That was ALL I changed.<br>
    <br>
    And when I tried to run the project this time, I got the following exception:
    <blockquote>
    Exception [TOPLINK-43] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DescriptorException
    Exception Description: Missing class for indicator field value [toplink:changed-fields-locking-policy] of type [class java.lang.String].<br>
    Descriptor: XMLDescriptor(oracle.toplink.descriptors.VersionLockingPolicy --> [DatabaseTable(locking-policy)])<br>
         at oracle.toplink.exceptions.DescriptorException.missingClassForIndicatorFieldValue(DescriptorException.java:878)<br>
         at oracle.toplink.internal.ox.QNameInheritancePolicy.classFromRow(QNameInheritancePolicy.java:109)<br>
         at oracle.toplink.mappings.foundation.AbstractCompositeObjectMapping.valueFromRow(AbstractCompositeObjectMapping.java:150)<br>
         at oracle.toplink.mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:1012)<br>
         at oracle.toplink.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:241)<br>
         at oracle.toplink.internal.ox.XMLObjectBuilder.buildObject(XMLObjectBuilder.java:128)<br>
         at oracle.toplink.ox.mappings.XMLCompositeCollectionMapping.buildCompositeObject(XMLCompositeCollectionMapping.java:157)<br>
         at oracle.toplink.mappings.foundation.AbstractCompositeCollectionMapping.valueFromRow(AbstractCompositeCollectionMapping.java:735)<br>
         at oracle.toplink.mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:1012)<br>
         at oracle.toplink.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:241)<br>
         at oracle.toplink.internal.ox.XMLObjectBuilder.buildObject(XMLObjectBuilder.java:128)<br>
         at oracle.toplink.internal.ox.record.DOMUnmarshaller.xmlToObject(DOMUnmarshaller.java:284)<br>
         at oracle.toplink.internal.ox.record.DOMUnmarshaller.xmlToObject(DOMUnmarshaller.java:265)<br>
         at oracle.toplink.internal.ox.record.DOMUnmarshaller.unmarshal(DOMUnmarshaller.java:152)<br>
         at oracle.toplink.ox.XMLUnmarshaller.unmarshal(XMLUnmarshaller.java:339)<br>
         at oracle.toplink.tools.workbench.XMLProjectReader.read(XMLProjectReader.java:162)<br>
         at oracle.toplink.tools.workbench.XMLProjectReader.read(XMLProjectReader.java:209)<br>
         at oracle.toplink.tools.sessionconfiguration.TopLinkSessionsFactory.loadProjectConfig(TopLinkSessionsFactory.java:307)<br>
         at oracle.toplink.tools.sessionconfiguration.TopLinkSessionsFactory.createSession(TopLinkSessionsFactory.java:241)<br>
         at oracle.toplink.tools.sessionconfiguration.TopLinkSessionsFactory.buildServerSessionConfig(TopLinkSessionsFactory.java:215)<br>
         at oracle.toplink.tools.sessionconfiguration.TopLinkSessionsFactory.buildSession(TopLinkSessionsFactory.java:168)<br>
         at oracle.toplink.tools.sessionconfiguration.TopLinkSessionsFactory.buildTopLinkSessions(TopLinkSessionsFactory.java:124)<br>
         at oracle.toplink.tools.sessionconfiguration.XMLSessionConfigLoader.load(XMLSessionConfigLoader.java:103)
    </blockquote>
    Can anybody tell me what that means? And why do I see "VersionLockingPolicy" in the stack trace? I explicitly specified locking "By Fields".<br>
    <br>
    Here's a fragment from the project XML file:
    <blockquote>
    <toplink:locking xsi:type="toplink:changed-fields-locking-policy"/>
    </blockquote>
    Is this a TopLink bug or am I doing something wrong? (By the way, if I choose optimistic locking by "All fields", it works. But locking by "Changed fields" doesn't.)<br>
    <br>
    Best regards,<br>
    Bisser
    Message was edited by:
    bisser

    Ooooops, sorry, guys!
    I was using TopLink 10.1.3.0 JARs to run a project created via TopLink 10.1.3.1 Workbench. That was the reason for the exception.
    I ran across the REAL problem, however. The one that was occurring when I created the TopLink project via JDeveloper 10.1.3.1 and ran it via JDeveloper 10.1.3.1. That's why I decided to try with TopLink 10.1.3.1 Workbench instead of JDeveloper 10.1.3.1.
    I will report the problem in a clean separate post.

  • Can you change the color of selected text in word?

    I use Word 2010, and when I select text it is always blue, is there a way to change the color?

    I use Word 2010, and when I select text it is always blue, is there a way to change the color?
    My earlier posting was an error.
    I apologize.
    You seem to be saying that the default colour for text is blue.
    You need to change:-
    Normal.dotm
     - to change the default colour of text.
    In order to change the default colour of text take the following steps (that were tested on Windows 7 and Office 2007 - the process should be
    similar, if not identical, for yourself):-
    1. Open a new blank document (this should
    have the default text as blue).
    Save that document with a new name for example:-
    c:\word\testing_aug_25_2014_2
    2. In the above document:-
    Insert tab
    Text group
    Click on the drop down arrow to the lower right of:-
    Quick Parts
     - then click on:-
    Field . . .
    The:-
    Field
     - window should open.
    3. In the:-
    Field
     - window in the field called:-
    Field names:
     - scroll down to:-
    Template
     - and click on that option so that it's highlighted in blue.
    Now, towards the top right hand corner of the same window, click in the box called:-
    Add path to file name
     - so that it has a tick (check mark) in that box.
    Click:-
    OK
    The file name of the template should now be inserted into your document.
    On my machine this was:-
    C:\Users\user_name\AppData\Roaming\Microsoft\Templates\Normal.dotm
    The above path might be different for you.
    4. I saved my document at this point.
    5. Now open the file called:-
    C:\Users\user_name\AppData\Roaming\Microsoft\Templates\Normal.dotm
    A document should open on your screen (still with blue text) and with:-
    Normal.dotm
    - in the middle of the Title Bar at the top of the screen.
    Highlight all of the text in the document so that it's (for example) black.
    Save the file.
    6. Close all open documents in WORD and
    close WORD itself.
    7. Now open a new document and its default
    text should be set to the colour that you applied at step 5. above (I used black at that point).
    Does that resolve your problem?

  • Change to Color or Change Color - Can't figure out gradual change

    Hi, this may seem stupid, but I can't figure out how to gradually change a color to another color gradually.  The closest I get is an instant change of color in Change to Color.  I am trying to turn something pure white, I changed lighting to get a pure white, but the transition isn't a smooth one using this technique, please help a noob!  BTW I do know about clicking the clock for time-dependent changes, I simply can't get gradual.

    Using Change to Color, try to use key frames for Hue and Saturation with both near zero from the beginning and then close to 100% where the end color is to take over.

  • How to change color of cl_gui_alv_grid - cell ?

    Hi,
    i´m using cl_gui_alv_grid to display a table. In the table are colored cells.
      gs_layout-ctab_fname = 'COLINFO'.
          clear lcl_color.
          lcl_color-fname = 'DELIV_DATE_AB'.
          lcl_color-color-col = cl_gui_resources=>list_col_negative.
          lcl_color-color-int = 0.
          lcl_color-color-inv = 0.
          append lcl_color.
        wa_output-colinfo[] = lcl_color[].
        append wa_output to it_output.
    call method grid1->set_table_for_first_display
         exporting
    *    I_BYPASSING_BUFFER            =
    *    I_BUFFER_ACTIVE               =
    *    I_CONSISTENCY_CHECK           =
    *    I_STRUCTURE_NAME              =
         is_variant                    = gs_variant
         i_save                        = 'U'
    *    I_DEFAULT                     = 'X'
           is_layout                     = gs_layout
    *    IS_PRINT                      =
    *    IT_SPECIAL_GROUPS             =
         it_toolbar_excluding          = it_excluding
    *    IT_HYPERLINK                  =
    *    IT_ALV_GRAPHICS               =
    *    IT_EXCEPT_QINFO               =
        changing
          it_outtab                     = it_output
         it_fieldcatalog               = gt_fieldcat[]
    *    IT_SORT                       =
    *    IT_FILTER                     =
         exceptions
           invalid_parameter_combination = 1
           program_error                 = 2
           too_many_lines                = 3
           others                        = 4.
    That all works fine!
    Now i want to change the color of the colored cell. I changed the table wa_output-colinfo in this way:
    read table wa_output-colinfo into lcl_color
                with key fname = 'DELIV_DATE_AB'.
              if sy-subrc = 0.
                clear lcl_color-color-col.
                lcl_color-color-int = 0.
                lcl_color-color-inv = 0.
                modify wa_output-colinfo from lcl_color index sy-tabix.
              endif.
    After that i call:
    ls_stable-row = 'X'.
    ls_stable-col = 'X'.
            call method grid1->refresh_table_display
               exporting
                 is_stable      = ls_stable
               exceptions
                 finished       = 1
                 others         = 2.
    But nothing happens with the colored cell!
    Any ideas?
    thanks&regards
    Dirk

    Hello Dirk
    As I said the problem is the time point when you call the REFRESH_TABLE_DISPLAY method.
    Please note that after handling an event usually PAI of the dynpro is NOT pass and therefore the list is not refreshed.
    The following sample report shows how to solve this problem:
    *& Report  ZUS_SDN_ALV_EDITABLE_1D
    * Flow logic of screen '100' (no elements, ok-code => gd_okcode ):
    **PROCESS BEFORE OUTPUT.
    **  MODULE STATUS_0100.
    **PROCESS AFTER INPUT.
    **  MODULE USER_COMMAND_0100.
    REPORT  zus_sdn_alv_editable_1d.
    TYPE-POOLS: abap.
    CONSTANTS:
      gc_tabname       TYPE tabname  VALUE 'KNB1'.
    TYPES: BEGIN OF ty_s_outtab.
    INCLUDE TYPE knb1.
    TYPES: cellcolor  TYPE lvc_t_scol.
    TYPES: END OF ty_s_outtab.
    TYPES: ty_t_outtab    TYPE STANDARD TABLE OF ty_s_outtab
                          WITH DEFAULT KEY.
    DATA:
      gd_okcode        TYPE ui_func,
      gt_fcat          TYPE lvc_t_fcat,
      gs_layout        TYPE lvc_s_layo,
      gs_variant       TYPE disvariant,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_grid          TYPE REF TO cl_gui_alv_grid.
    DATA:
      gs_outtab        TYPE ty_s_outtab,
      gt_outtab        TYPE ty_t_outtab.
    " Set new ok code in event handler: 'X' = yes, ELSE = no
    PARAMETER:
      p_newokc         AS CHECKBOX  DEFAULT ' '.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid
            IMPORTING
              er_data_changed
              e_onf4
              e_onf4_before
              e_onf4_after
              e_ucomm
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_data_changed.
    *   define local data
        DATA: ld_answer(1)  TYPE c.
        check ( p_newokc = abap_true ).
        " Triggers PAI -> required for list refresh
        CALL METHOD cl_gui_cfw=>set_new_ok_code
          EXPORTING
            new_code = 'REFRESH'
    *        IMPORTING
    *          rc       =
      ENDMETHOD.                    "handle_data_changed
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT * FROM  (gc_tabname)
        INTO CORRESPONDING FIELDS OF TABLE gt_outtab UP TO 99 ROWS.
      PERFORM colour_cells.
    * Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent = cl_gui_container=>screen0
          ratio  = 90
        EXCEPTIONS
          OTHERS = 6.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Create ALV grid
      CREATE OBJECT go_grid
        EXPORTING
          i_parent = go_docking
        EXCEPTIONS
          OTHERS   = 5.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      SET HANDLER:
        lcl_eventhandler=>handle_data_changed FOR go_grid.
      " Triggers event DATA_CHANGED by pushing ENTER
      CALL METHOD go_grid->register_edit_event
        EXPORTING
          i_event_id = cl_gui_alv_grid=>mc_evt_enter
        EXCEPTIONS
          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.
    * Build fieldcatalog and set hotspot for field KUNNR
      PERFORM build_fieldcatalog.
      PERFORM set_layout_and_variant.
    * Display data
      CALL METHOD go_grid->set_table_for_first_display
        EXPORTING
          is_layout       = gs_layout
          is_variant      = gs_variant
          i_save          = 'A'
        CHANGING
          it_outtab       = gt_outtab
          it_fieldcatalog = gt_fcat
        EXCEPTIONS
          OTHERS          = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * NOTE:
    * Documenation of I_SAVE ("An Easy Reference for ALV Grid Control")
    *I_SAVE
    *Determines the options available to the user for saving a layout:
    *? 'X': global saving only
    *? 'U': user-specific saving only
    *? 'A': corresponds to 'X' and 'U'
    *? SPACE: no saving
    * Link the docking container to the target dynpro
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = syst-repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * ok-code field = GD_OKCODE
      CALL SCREEN '0100'.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      go_grid->check_changed_data( ).
      CASE gd_okcode.
        WHEN 'BACK'  OR
             'EXIT'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
        WHEN 'REFRESH'.
          PERFORM colour_cells.
          CALL METHOD go_grid->refresh_table_display
    *        EXPORTING
    *          is_stable      =
    *          i_soft_refresh =
    *        EXCEPTIONS
    *          finished       = 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.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  BUILD_FIELDCATALOG
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_fieldcatalog .
    * define local data
      DATA:
        ls_fcat        TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
          i_structure_name             = gc_tabname
    *     I_CLIENT_NEVER_DISPLAY       = 'X'
    *     I_BYPASSING_BUFFER           =
    *     I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        EXCEPTIONS
          inconsistent_interface       = 1
          program_error                = 2
          OTHERS                       = 3.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      ls_fcat-edit = abap_true.
      MODIFY gt_fcat FROM ls_fcat
          TRANSPORTING edit
        WHERE ( key NE abap_true ).
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  SET_LAYOUT_AND_VARIANT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM set_layout_and_variant .
      CLEAR: gs_layout,
             gs_variant.
      gs_layout-cwidth_opt = abap_true.
      gs_layout-zebra      = abap_true.
      gs_layout-ctab_fname = 'CELLCOLOR'.
      gs_variant-report = syst-repid.
      gs_variant-handle = 'GRID'.
    ENDFORM.                    " SET_LAYOUT_AND_VARIANT
    *&      Form  COLOUR_CELLS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM colour_cells .
    * define local data
      DATA: ls_outtab   TYPE ty_s_outtab,
            ls_color    TYPE lvc_s_scol,
            ld_idx      TYPE i.
      LOOP AT gt_outtab INTO ls_outtab.
        ld_idx = syst-tabix.
        REFRESH: ls_outtab-cellcolor.
        IF ( ls_outtab-erdat+0(4) <= '2000' ).
          CLEAR: ls_color.
          ls_color-fname = 'ERDAT'.
          ls_color-color-col = cl_gui_resources=>list_col_negative.
          ls_color-color-int = 0.
          ls_color-color-inv = 0.
          APPEND ls_color TO ls_outtab-cellcolor.
        ENDIF.
        MODIFY gt_outtab FROM ls_outtab INDEX ld_idx.
      ENDLOOP.
    ENDFORM.                    " COLOUR_CELLS
    Regards
      Uwe

  • Enter event  field color change issue

    I'm trying to make a script that will change the color of a field's content area when the user enters it (either through clicking or tabbing to the field). It seems simple enough to do, but I haven't been able to get it working.
    I downloaded the sample .pdf file that describes how to do this at: http://partners.adobe.com/public/developer/en/livecycle/designer/pdfs/FieldFillColor.pdf
    Push the button, the colors change. Seems to work fine, right? Except for the horrible, horrible period in the color definition, of course. Publishing a 2 line script with a bug as an EXAMPLE? For shame.
    But, when you move the code to the Enter event, the caption changes color, but the content area does not... until you LEAVE the text box, at which point it DOES change color. This doesn't make any sense to me. Is there something undocumented going on here that I don't know about, or is this just another bug?

    This won't speed it up, but I suggest making your code a lot cleaner by making use of this class (I haven't tested it):
    public class ColorRange {
       private Color min, max;
       public ColorRange(Color min, Color max) {
          this.min = min; this.max = max;
       public boolean contains(Color c) {
          return c.getGreen() >= min.getGreen() && c.getGreen() <= max.getGreen() &&
             c.getRed() >= min.getRed() && c.getRed() <= max.getRed() &&
             c.getBlue() >= min.getBlue() && c.getBlue() <= max.getBlue();
    //...SNIP...
    ColorRange blue, red, green, yellow; //initialize these
    //...SNIP...
       if ( blue.contains(robot.getPixelColor(640,480) ) {Furthermore, I would introduce constants for your sample locations:
    Point blueLoc = new Point(640, 480); //etcEdited by: endasil on 14-Sep-2009 10:21 AM

  • How can i change the color of a field in a table depence of a value

    Hi forum
          Is this possible to change the color of a row in a specific field of a table depends of the value of this field,,, for example if the value is equal or greather than 1.
    Thnks
    Josué Cruz

    Josue,
    Yes this is possible if you use the fillColor method. It requires R,G,B value of color.
    //Sample code which highlights cell2 in my table which has two rows.
    frm1.Table1.Row2.Cell2.fillColor = "120,120,120";
    // If you want highlight complete row.
    frm1.Table1.Row2.fillColor = "120,120,120";
    So now just apply an if loop which reads the input value as greater than 1 and use the code shown above.
    Chintan

  • Error in field catalog in ALV grid display using classes at do_sum = "X'.

    Hi,
    I'm using classes in ALV Grid display.
    the code for the field catalog is going to dump because of the statement in the field catalog for field 'netwr',do_sum = 'X'.
    that do_sum = 'X' is not working and going to dump when executed.with out that do_sum it is working fine. the error in dump analysys is showing sap standard incude LSLVCF01.
        assign component
               <ls_fieldcat>-fieldname of structure rt_data to <g_field>.
        if sy-subrc ne 0.
          message x000(0k).
        endif.
    sy-subrc is 4 when the program is being executed.
    CODE:
    FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat.
      DATA ls_fcat TYPE lvc_s_fcat.
      ls_fcat-fieldname = 'VBELN1'.
      ls_fcat-ref_field = 'VBELN'.
      ls_fcat-ref_table = 'VBRK'.
      ls_fcat-coltext = 'Invoice No'.
      ls_fcat-seltext = 'Invoice No'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
      ls_fcat-fieldname = 'BUDAT'.
      ls_fcat-ref_table = 'BKPF'.
      ls_fcat-coltext = 'Invoice Date'.
      ls_fcat-seltext = 'Invoice Date'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
    ls_fcat-fieldname = 'NETWR'.
      ls_fcat-ref_field = 'NETWR'.
      ls_fcat-ref_table = 'VBRK'.
      ls_fcat-coltext = 'Value of Invoice'.
      ls_fcat-seltext = 'Value of Invoice'.
      ls_fcat-datatype = 'CURR'.
      ls_fcat-do_sum = 'X'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
    ENDFORM.
    can u please look in the code and rectify the error,
    would appeciate ur response.
    regards,
    veera.

    Hi,
    try this..
    ls_fcat-fieldname = 'NETWR'.
    ls_fcat-ref_field = 'NETWR'.
    ls_fcat-ref_table = 'VBRK'.
    ls_fcat-coltext = 'Value of Invoice'.
    ls_fcat-seltext = 'Value of Invoice'.
    ls_fcat-datatype = 'CURR'.
    ls_fcat-do_sum = 'X'.
    <b>ls_fcat-cfieldname = 'WAERS'.</b>
    APPEND ls_fcat TO pt_fieldcat.
    CLEAR ls_fcat.
    Regards
    vijay

  • Tabular Forms - how to change the color of text when the field is disabled

    Hi,
    I have a tabular form and some of it's columns are disabled showing text in grey color...
    is there a way to change the color to black and bold the text...?
    thanks

    Okay, i've taken a look at your example.
    The column formatting does not work on the input fields. The help on the item says that it generates a span with a style attribute. This would work for a display field, not for an input field.
    Css like i've written should be in the style tags, put up in the header section of the page (page -> edit -> header region).
    You've already put script tags there, the style tags go there aswell. You shouldn't even need to put your script tags in the header region. Just put your code up in the javascript functions region (without the script tags).
    However, i tested in firefox and here color works on an input field, changing the font color. In IE it does not do this. Cross browser implementations and such, not much to do about it here. See http://stackoverflow.com/questions/602070/changing-font-colour-in-textboxes-in-ie-which-are-disabled.
    I did notice that you build your form with a bunch of input fields, which you disable through javascript in the footer of the region. Then on submit, you set the disabled to false again for all those fields! If you want those fields to always be submitted to the server, why wouldn't you use the readonly attribute? Readonly fields are always submitted, and can't be edited by the user. Plus, readonly fields CAN be styled however you want! You can get rid of the javascript code in your header then.
    Even the javascript in the footer is not necessary. If you just add 'readonly="true"' (without single quotes) to the element attributes of your items (edit column -> column attributes region) = no javascript at all (less maintenance).

Maybe you are looking for

  • Imac having kernel panics

    hey i have an imac 27' i7 and keep getting kernel panic crashes. there is no set time it will crash, just that a dark screen comes over the monitor and says I need to restart by turning the power off. below is the latest crash report. any ideas would

  • How to create a filter using mathscript transfer function in labview

    Dear all, I am currently designing a filter in labview using a Mathscript looping. The filter can be represented in transfer function. I have attachted the transfer function equation together with its value and the desire frequency vs. amplitude grap

  • Passing dynamic value into HTML from webforms

    We're setting up an imaging application on the web, and I need the ability to read an image path from the database with forms (or a stored PL/SQL procedure I can call from forms), and have that open an HTML file in a web browser and pass it the name

  • Which include i can use instead of PNP LDB

    Hi Friends - Which standard include i can use for PNP  LDB  ? am working in abap webdynpro and need to use some macro like rp_provide_from_last  but for them we have to use pnp ldb and in abap webdynpro we can't define  LDBs    so  i need the standar

  • My E75 can not read arabic message or arabic appli...

    I have new E75. I can not read arabic message (message with arabic characters) also some applicaiton that required arabic characters like ramadan applicaiton Hadeeth. How can download the arabic fonts to resove this problem? looking for your help.