<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic oops alv in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/oops-alv/m-p/2810701#M657013</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi abapers&lt;/P&gt;&lt;P&gt;i m having a query i want to give colors to my rows in alvs&lt;/P&gt;&lt;P&gt;how can i do this i m using alv oops.&lt;/P&gt;&lt;P&gt;thx in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 02 Oct 2007 16:41:24 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-10-02T16:41:24Z</dc:date>
    <item>
      <title>oops alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oops-alv/m-p/2810701#M657013</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi abapers&lt;/P&gt;&lt;P&gt;i m having a query i want to give colors to my rows in alvs&lt;/P&gt;&lt;P&gt;how can i do this i m using alv oops.&lt;/P&gt;&lt;P&gt;thx in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Oct 2007 16:41:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oops-alv/m-p/2810701#M657013</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-02T16:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: oops alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oops-alv/m-p/2810702#M657014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;welcome to SDN&lt;/P&gt;&lt;P&gt;see the sample code and do accordingly&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;REPORT sapmz_hf_alv_grid .&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Type pool for icons - used in the toolbar&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;TYPE-POOLS: icon.&lt;/P&gt;&lt;P&gt;TABLES: zsflight.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;To allow the declaration of o_event_receiver before the&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;lcl_event_receiver class is defined, decale it as deferred in the&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;start of the program&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CLASS lcl_event_receiver DEFINITION DEFERRED.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;G L O B A L I N T E R N A L T A B L E S&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*DATA: gi_sflight TYPE STANDARD TABLE OF sflight.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;To include a traffic light and/or color a line the structure of the&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;table must include fields for the traffic light and/or the color&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;TYPES: BEGIN OF st_sflight.&lt;/P&gt;&lt;P&gt;INCLUDE STRUCTURE zsflight.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Field for traffic light&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;TYPES: traffic_light TYPE c.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Field for line color&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;types: line_color(4) type c.&lt;/P&gt;&lt;P&gt;TYPES: END OF st_sflight.&lt;/P&gt;&lt;P&gt;TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.&lt;/P&gt;&lt;P&gt;DATA: gi_sflight TYPE tt_sflight.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;G L O B A L D A T A&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;DATA: ok_code LIKE sy-ucomm,&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Work area for internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;g_wa_sflight TYPE st_sflight,&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;ALV control: Layout structure&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;gs_layout TYPE lvc_s_layo.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Declare reference variables to the ALV grid and the container&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;go_grid TYPE REF TO cl_gui_alv_grid,&lt;/P&gt;&lt;P&gt;go_custom_container TYPE REF TO cl_gui_custom_container,&lt;/P&gt;&lt;P&gt;o_event_receiver TYPE REF TO lcl_event_receiver.&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Work area for screen 200&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;g_screen200 LIKE zsflight.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Data for storing information about selected rows in the grid&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;gi_index_rows TYPE lvc_t_row,&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Information about 1 row&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;g_selected_row LIKE lvc_s_row.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;C L A S S E S&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;CLASS lcl_event_receiver DEFINITION.&lt;/P&gt;&lt;P&gt;PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;METHODS:&lt;/P&gt;&lt;P&gt;handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid&lt;/P&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;e_object e_interactive,&lt;/P&gt;&lt;P&gt;handle_user_command FOR EVENT user_command OF cl_gui_alv_grid&lt;/P&gt;&lt;P&gt;IMPORTING e_ucomm.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;CLASS lcl_event_receiver IMPLEMENTATION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_event_receiver IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;METHOD handle_toolbar.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Event handler method for event toolbar.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CONSTANTS:&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Constants for button type&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;c_button_normal TYPE i VALUE 0,&lt;/P&gt;&lt;P&gt;c_menu_and_default_button TYPE i VALUE 1,&lt;/P&gt;&lt;P&gt;c_menu TYPE i VALUE 2,&lt;/P&gt;&lt;P&gt;c_separator TYPE i VALUE 3,&lt;/P&gt;&lt;P&gt;c_radio_button TYPE i VALUE 4,&lt;/P&gt;&lt;P&gt;c_checkbox TYPE i VALUE 5,&lt;/P&gt;&lt;P&gt;c_menu_entry TYPE i VALUE 6.&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;ls_toolbar TYPE stb_button.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Append seperator to the normal toolbar&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CLEAR ls_toolbar.&lt;/P&gt;&lt;P&gt;MOVE c_separator TO ls_toolbar-butn_type..&lt;/P&gt;&lt;P&gt;APPEND ls_toolbar TO e_object-&amp;gt;mt_toolbar.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Append a new button that to the toolbar. Use E_OBJECT of&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;event toolbar. E_OBJECT is of type CL_ALV_EVENT_TOOLBAR_SET.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;This class has one attribute MT_TOOLBAR which is of table type&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;TTB_BUTTON. The structure is STB_BUTTON&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CLEAR ls_toolbar.&lt;/P&gt;&lt;P&gt;MOVE 'CHANGE' TO ls_toolbar-function.&lt;/P&gt;&lt;P&gt;MOVE icon_change TO ls_toolbar-icon.&lt;/P&gt;&lt;P&gt;MOVE 'Change flight' TO ls_toolbar-quickinfo.&lt;/P&gt;&lt;P&gt;MOVE 'Change' TO ls_toolbar-text.&lt;/P&gt;&lt;P&gt;MOVE ' ' TO ls_toolbar-disabled.&lt;/P&gt;&lt;P&gt;APPEND ls_toolbar TO e_object-&amp;gt;mt_toolbar.&lt;/P&gt;&lt;P&gt;ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;METHOD handle_user_command.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Handle own functions defined in the toolbar&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CASE e_ucomm.&lt;/P&gt;&lt;P&gt;WHEN 'CHANGE'.&lt;/P&gt;&lt;P&gt;PERFORM change_flight.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;LEAVE TO SCREEN 0.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDCASE.&lt;/P&gt;&lt;P&gt;ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;S T A R T - O F - S E L E C T I O N.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;SET SCREEN '100'.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Module USER_COMMAND_0100 INPUT&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODULE user_command_0100 INPUT.&lt;/P&gt;&lt;P&gt;CASE ok_code.&lt;/P&gt;&lt;P&gt;WHEN 'EXIT'.&lt;/P&gt;&lt;P&gt;LEAVE TO SCREEN 0.&lt;/P&gt;&lt;P&gt;ENDCASE.&lt;/P&gt;&lt;P&gt;ENDMODULE. " USER_COMMAND_0100 INPUT&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Module STATUS_0100 OUTPUT&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODULE status_0100 OUTPUT.&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;For parameter IS_VARIANT that is sued to set up options for storing&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;the grid layout as a variant in method set_table_for_first_display&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;l_layout TYPE disvariant,&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Utillity field&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;l_lines TYPE i.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;After returning from screen 200 the line that was selected before&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;going to screen 200, should be selected again. The table gi_index_rows&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;was the output table from the GET_SELECTED_ROWS method in form&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;CHANGE_FLIGHT&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;DESCRIBE TABLE gi_index_rows LINES l_lines.&lt;/P&gt;&lt;P&gt;IF l_lines &amp;gt; 0.&lt;/P&gt;&lt;P&gt;CALL METHOD go_grid-&amp;gt;set_selected_rows&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;it_index_rows = gi_index_rows.&lt;/P&gt;&lt;P&gt;CALL METHOD cl_gui_cfw=&amp;gt;flush.&lt;/P&gt;&lt;P&gt;REFRESH gi_index_rows.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Read data and create objects&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;IF go_custom_container IS INITIAL.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Read data from datbase table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;PERFORM get_data.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create objects for container and ALV grid&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CREATE OBJECT go_custom_container&lt;/P&gt;&lt;P&gt;EXPORTING container_name = 'ALV_CONTAINER'.&lt;/P&gt;&lt;P&gt;CREATE OBJECT go_grid&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;i_parent = go_custom_container.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create object for event_receiver class&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;and set handlers&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CREATE OBJECT o_event_receiver.&lt;/P&gt;&lt;P&gt;SET HANDLER o_event_receiver-&amp;gt;handle_user_command FOR go_grid.&lt;/P&gt;&lt;P&gt;SET HANDLER o_event_receiver-&amp;gt;handle_toolbar FOR go_grid.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Layout (Variant) for ALV grid&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;l_layout-report = sy-repid. "Layout fo report&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Setup the grid layout using a variable of structure lvc_s_layo&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Set grid title&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;gs_layout-grid_title = 'Flights'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Selection mode - Single row without buttons&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;(This is the default mode&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;gs_layout-sel_mode = 'B'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Name of the exception field (Traffic light field) and the color&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;field + set the exception and color field of the table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;gs_layout-excp_fname = 'TRAFFIC_LIGHT'.&lt;/P&gt;&lt;P&gt;gs_layout-info_fname = 'LINE_COLOR'.&lt;/P&gt;&lt;P&gt;LOOP AT gi_sflight INTO g_wa_sflight.&lt;/P&gt;&lt;P&gt;IF g_wa_sflight-paymentsum &amp;lt; 100000.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Value of traffic light field&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;g_wa_sflight-traffic_light = '1'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Value of color field:&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;C = Color, 6=Color 1=Intesified on, 0: Inverse display off&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;g_wa_sflight-line_color = 'C610'.&lt;/P&gt;&lt;P&gt;ELSEIF g_wa_sflight-paymentsum =&amp;gt; 100000 AND&lt;/P&gt;&lt;P&gt;g_wa_sflight-paymentsum &amp;lt; 1000000.&lt;/P&gt;&lt;P&gt;g_wa_sflight-traffic_light = '2'.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;g_wa_sflight-traffic_light = '3'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;MODIFY gi_sflight FROM g_wa_sflight.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Grid setup for first display&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CALL METHOD go_grid-&amp;gt;set_table_for_first_display&lt;/P&gt;&lt;P&gt;EXPORTING i_structure_name = 'SFLIGHT'&lt;/P&gt;&lt;P&gt;is_variant = l_layout&lt;/P&gt;&lt;P&gt;i_save = 'A'&lt;/P&gt;&lt;P&gt;is_layout = gs_layout&lt;/P&gt;&lt;P&gt;CHANGING it_outtab = gi_sflight.&lt;/P&gt;&lt;P&gt;*-- End of grid setup -&lt;/P&gt;&lt;HR originaltext="------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Raise event toolbar to show the modified toolbar&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CALL METHOD go_grid-&amp;gt;set_toolbar_interactive.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Set focus to the grid. This is not necessary in this&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;example as there is only one control on the screen&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CALL METHOD cl_gui_control=&amp;gt;set_focus EXPORTING control = go_grid.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDMODULE. " STATUS_0100 OUTPUT&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Module USER_COMMAND_0200 INPUT&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODULE user_command_0200 INPUT.&lt;/P&gt;&lt;P&gt;CASE ok_code.&lt;/P&gt;&lt;P&gt;WHEN 'EXIT200'.&lt;/P&gt;&lt;P&gt;LEAVE TO SCREEN 100.&lt;/P&gt;&lt;P&gt;WHEN'SAVE'.&lt;/P&gt;&lt;P&gt;PERFORM save_changes.&lt;/P&gt;&lt;P&gt;ENDCASE.&lt;/P&gt;&lt;P&gt;ENDMODULE. " USER_COMMAND_0200 INPUT&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form get_data&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM get_data.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Read data from table SFLIGHT&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;FROM zsflight&lt;/P&gt;&lt;P&gt;INTO TABLE gi_sflight.&lt;/P&gt;&lt;P&gt;ENDFORM. " load_data_into_grid&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form change_flight&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Reads the contents of the selected row in the grid, ans transfers&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;the data to screen 200, where it can be changed and saved.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM change_flight.&lt;/P&gt;&lt;P&gt;DATA:l_lines TYPE i.&lt;/P&gt;&lt;P&gt;REFRESH gi_index_rows.&lt;/P&gt;&lt;P&gt;CLEAR g_selected_row.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Read index of selected rows&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CALL METHOD go_grid-&amp;gt;get_selected_rows&lt;/P&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;et_index_rows = gi_index_rows.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Check if any row are selected at all. If not&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;table gi_index_rows will be empty&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;DESCRIBE TABLE gi_index_rows LINES l_lines.&lt;/P&gt;&lt;P&gt;IF l_lines = 0.&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;textline1 = 'You must choose a line'.&lt;/P&gt;&lt;P&gt;EXIT.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Read indexes of selected rows. In this example only one&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;row can be selected as we are using gs_layout-sel_mode = 'B',&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;so it is only ncessary to read the first entry in&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;table gi_index_rows&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;LOOP AT gi_index_rows INTO g_selected_row.&lt;/P&gt;&lt;P&gt;IF sy-tabix = 1.&lt;/P&gt;&lt;P&gt;READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Transfer data from the selected row to screenm 200 and show&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;screen 200&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CLEAR g_screen200.&lt;/P&gt;&lt;P&gt;MOVE-CORRESPONDING g_wa_sflight TO g_screen200.&lt;/P&gt;&lt;P&gt;LEAVE TO SCREEN '200'.&lt;/P&gt;&lt;P&gt;ENDFORM. " change_flight&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form save_changes&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Changes made in screen 200 are written to the datbase table&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;zsflight, and to the grid table gi_sflight, and the grid is&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;updated with method refresh_table_display to display the changes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM save_changes.&lt;/P&gt;&lt;P&gt;DATA: l_traffic_light TYPE c.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Update traffic light field&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Update database table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;MODIFY zsflight FROM g_screen200.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Update grid table , traffic light field and color field.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Note that it is necessary to use structure g_wa_sflight&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;for the update, as the screen structure does not have a&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;traffic light field&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;MOVE-CORRESPONDING g_screen200 TO g_wa_sflight.&lt;/P&gt;&lt;P&gt;IF g_wa_sflight-paymentsum &amp;lt; 100000.&lt;/P&gt;&lt;P&gt;g_wa_sflight-traffic_light = '1'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;C = Color, 6=Color 1=Intesified on, 0: Inverse display off&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;g_wa_sflight-line_color = 'C610'.&lt;/P&gt;&lt;P&gt;ELSEIF g_wa_sflight-paymentsum =&amp;gt; 100000 AND&lt;/P&gt;&lt;P&gt;g_wa_sflight-paymentsum &amp;lt; 1000000.&lt;/P&gt;&lt;P&gt;g_wa_sflight-traffic_light = '2'.&lt;/P&gt;&lt;P&gt;clear g_wa_sflight-line_color.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;g_wa_sflight-traffic_light = '3'.&lt;/P&gt;&lt;P&gt;clear g_wa_sflight-line_color.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;MODIFY gi_sflight INDEX g_selected_row-index FROM g_wa_sflight.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Refresh grid&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CALL METHOD go_grid-&amp;gt;refresh_table_display.&lt;/P&gt;&lt;P&gt;CALL METHOD cl_gui_cfw=&amp;gt;flush.&lt;/P&gt;&lt;P&gt;LEAVE TO SCREEN '100'.&lt;/P&gt;&lt;P&gt;ENDFORM. " save_changes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;chk this blog&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/people/vijaybabu.dudla/blog/2006/07/21/topofpage-in-alv-using-clguialvgrid &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Oct 2007 16:51:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oops-alv/m-p/2810702#M657014</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-02T16:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: oops alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oops-alv/m-p/2810703#M657015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Rao&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will find all necessary information in the excellent tutorial&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907"&amp;gt;An Easy Reference for ALV Grid Control&amp;lt;/a&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check pages 27 - 29.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Oct 2007 21:07:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oops-alv/m-p/2810703#M657015</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2007-10-02T21:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: oops alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oops-alv/m-p/2810704#M657016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mallika,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this below link which is a self explanatory tutorial on ALV OOPS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.abap4.it/download/ALV.pdf" target="test_blank"&gt;http://www.abap4.it/download/ALV.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will resolve your problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Oct 2007 03:12:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oops-alv/m-p/2810704#M657016</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-03T03:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: oops alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oops-alv/m-p/2810705#M657017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mallika,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check this link&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I set the cell color in ALV? &lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=52107" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=52107&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Oct 2007 08:39:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oops-alv/m-p/2810705#M657017</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-03T08:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: oops alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oops-alv/m-p/2810706#M657018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;1.Add a color table of type LVC_T_SCOL to your output table, as shown in the example below:&lt;/P&gt;&lt;P&gt;2. Select your data and copy it into the output table.&lt;/P&gt;&lt;P&gt;3. Read one row of the output table at a time in the loop. &lt;/P&gt;&lt;P&gt;One row of the color table has three fields. &lt;/P&gt;&lt;P&gt;If field NOKEYCOL is set, you can change the color of key fields. &lt;/P&gt;&lt;P&gt;Assign values to the remaining fields as follows:&lt;/P&gt;&lt;P&gt;&amp;amp;#8722; If you want to color the entire row, assign the corresponding values to the fields of structure COLOR. Field fname does not receive a value in this case.&lt;/P&gt;&lt;P&gt;&amp;amp;#8722; If you want to color specific columns of the row only, you must append one row for each column to the color table. Assign the name of the desired column to field fname, and the corresponding values to the fields of structure COLOR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eg:&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF GT_OUTTAB OCCURS 0. &lt;/P&gt;&lt;P&gt;INCLUDE STRUCTURE &amp;lt;DDIC-Struktur&amp;gt;.&lt;/P&gt;&lt;P&gt;DATA: CT TYPE LVC_T_SCOL. "Table for colors&lt;/P&gt;&lt;P&gt;DATA: END OF GT_OUTTAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * frm &amp;lt;tablename&amp;gt; into corresponding fields of table gt_outtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;If a whole row has to be coloured&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;loop at gt_outtab into wa_outtab.&lt;/P&gt;&lt;P&gt;wa_outtab-CT-COLOR = &amp;lt;value of color&amp;gt;.&lt;/P&gt;&lt;P&gt;modify gt_outtab from wa_outtab index sy-tabix.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;If you want to color specific columns of the row only&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;loop at gt_outtab into wa_outtab where &amp;lt;field&amp;gt; = &amp;lt;fieldname&amp;gt;.&lt;/P&gt;&lt;P&gt;wa_outtab-CT-FNAME = &amp;lt;fieldname&amp;gt;.&lt;/P&gt;&lt;P&gt;wa_outtab-CT-COLOR = &amp;lt;value of color&amp;gt;.&lt;/P&gt;&lt;P&gt;modify gt_outtab from wa_outtab index sy-tabix.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope u understood this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Simy Abraham.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Oct 2007 10:21:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oops-alv/m-p/2810706#M657018</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-03T10:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: oops alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oops-alv/m-p/2810707#M657019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_color.htm" target="test_blank"&gt;http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_color.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Oct 2007 10:34:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oops-alv/m-p/2810707#M657019</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-03T10:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: oops alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oops-alv/m-p/2810708#M657020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;by seeing this program you can understand very easily &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

tables:
sbook.

data:
w_table type ref to cl_gui_custom_container,
w_grid type ref to cl_gui_alv_grid.

data:
t_catalog type lvc_t_fcat,
fs_catalog like line of t_catalog,
fs_layout type lvc_s_layo.

data begin of fs_sflight.
data check type c.
include structure sflight.
data t_color type lvc_t_scol.

data end of fs_sflight.

data fs_color type lvc_s_scol.

data :
t_sflight like
standard table
of fs_sflight.

select *
from sflight
into corresponding fields of table t_sflight.

call screen 1985.
*---------------------------------------------------------------------*
* MODULE STATUS_1985 OUTPUT
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
module status_1985 output.

set pf-status 'STATUS_1985'.

create object w_table
exporting container_name = 'CONTAINER'.

create object w_grid
exporting i_parent = w_table.

call function 'LVC_FIELDCATALOG_MERGE'
exporting
* I_BUFFER_ACTIVE =
i_structure_name = 'SFLIGHT'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
changing
ct_fieldcat = t_catalog
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.

if sy-subrc &amp;lt;&amp;gt; 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.

fs_layout-grid_title = 'YASH TECHNOLOGIES'.
fs_layout-smalltitle = 'X'.
*fs_layout-NO_HEADERS = 'X'.
fs_layout-no_hgridln = 'X'.
fs_layout-no_vgridln = 'X'.
*FS_LAYOUT-NO_TOOLBAR = 'X'.
*FS_LAYOUT-NO_ROWMARK = 'X'.
fs_layout-zebra = 'X'.
* fs_layout-info_fname = 'CHECK'.
FS_LAYOUT-CTAB_FNAME = 'T_COLOR'.

fs_layout-NO_TOTLINE = 'X'.
loop at t_catalog into fs_catalog.

case fs_catalog-fieldname.
* WHEN 'CHECK'.
* FS_CATALOG-CHECKBOX = 'X'.
** FS_CATALOG-DO_SUM = 'X'.
** FS_CATALOG-EMPHASIZE = 'C610'.
* MODIFY T_CATALOG FROM FS_CATALOG.
when 'CARRID'.
fs_catalog-hotspot = 'X'.
modify t_catalog from fs_catalog.
when 'CONNID'.
fs_catalog-no_out = 'X'.
modify t_catalog from fs_catalog.
when 'PRICE'.
* fs_catalog-no_sum = 'X'.
fs_catalog-emphasize = 'C310'.
modify t_catalog from fs_catalog.
when 'PLANETYPE'.
fs_catalog-icon = 'X'.
modify t_catalog from fs_catalog.
endcase.

endloop.

clear fs_catalog.

FS_CATALOG-FIELDNAME = 'CHECK'.
FS_CATALOG-CHECKBOX = 'X'.
FS_CATALOG-EMPHASIZE = 'C610'.
FS_CATALOG-OUTPUTLEN = '3'.
FS_CATALOG-COLTEXT = 'BOX'.
APPEND FS_CATALOG TO T_CATALOG.
read table t_sflight index 5 into fs_sflight.
fs_color-fname = 'SEATSMAX'.
fs_color-color-col = '7'.
fs_color-color-int = '1'.
append fs_color to fs_sflight-t_color.
modify t_sflight index 5 from fs_sflight.
read table t_sflight index 7 into fs_sflight.
fs_color-fname = ' '.
fs_color-color-col = '5'.
fs_color-color-int = '1'.
append fs_color to fs_sflight-t_color.
modify t_sflight index 7 from fs_sflight.


call method w_grid-&amp;gt;set_table_for_first_display
exporting
is_layout = fs_layout
* i_structure_name = 'SBOOK'
changing
it_outtab = t_sflight
it_fieldcatalog = t_catalog.

endmodule. "STATUS_1985 OUTPUT

*---------------------------------------------------------------------*
* MODULE USER_COMMAND_1985 INPUT
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
module user_command_1985 input.
leave program.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward if usefull&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Oct 2007 05:51:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oops-alv/m-p/2810708#M657020</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-04T05:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: oops alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oops-alv/m-p/2810709#M657021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Coloring a row is a bit more complicated. To enable row coloring, you should add an additional field to your list data table. It should be of character type and length at least 4. This field will contain the color code for the row. So, let&amp;#146;s modify declaration of our list data table &amp;#147;gt_list&amp;#148;. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Adding the field that will contain row color data &lt;/P&gt;&lt;P&gt;As you guess, you should fill the color code to this field. Its format will be the same as explained before at section C.6.3. But how will ALV Grid know that you have loaded the color data for the row to this field. So, you make it know this by &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--- Internal table holding list data &lt;/P&gt;&lt;P&gt;DATA BEGIN OF gt_list OCCURS 0 . &lt;/P&gt;&lt;P&gt;INCLUDE STRUCTURE SFLIGHT . &lt;/P&gt;&lt;P&gt;DATA rowcolor(4) TYPE c . &lt;/P&gt;&lt;P&gt;DATA END OF gt_list . passing the name of the field containing color codes to the field &amp;#147;INFO_FNAME&amp;#148; of the layout structure. &lt;/P&gt;&lt;P&gt;e.g. &lt;/P&gt;&lt;P&gt;ps_layout-info_fname = &amp;lt;field_name_containing_color_codes&amp;gt;. &amp;#147;e.g. &amp;#145;ROWCOLOR&amp;#146; &lt;/P&gt;&lt;P&gt;You can fill that field anytime during execution. But, of course, due to the flow logic of screens, it will be reflected to your list display as soon as an ALV refresh occurs. &lt;/P&gt;&lt;P&gt;You can color an entire row as described in the next section. However, this method is less time consuming. &lt;/P&gt;&lt;P&gt;Coloring Individual Cells &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the last point about coloring procedures for the ALV Grid. The procedure is similar to coloring an entire row. However, since an individual cell can be addressed with two parameters we will need something more. What is meant by &amp;#147;more&amp;#148; is a table type structure to be included into the structure of the list data table. It seems strange, because including it will make our list data structure deep. But anyhow ALV Grid control handles this. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The structure that should be included must be of type &amp;#147;LVC_T_SCOL&amp;#148;. If you want to color the entire row, this inner table should contain only one row with field &amp;#147;fname&amp;#148; is set to space, some color value at field &amp;#147;col&amp;#148;, &amp;#147;0&amp;#148; or &amp;#147;1&amp;#148; at fields &amp;#147;int&amp;#148; (intensified) and &amp;#147;inv&amp;#148; (inverse). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to color individual cells, then for each cell column, append a line to this inner table which also contains the column name at field &amp;#147;fname&amp;#148;. It is obvious that you can color an entire column by filling this inner table with a row for that column for each row in the list data table. But, it is also obvious that, this will be more time consuming than the method at section C.6.1. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again key field coloring will override your settings. That&amp;#146;s why, we have another field in this inner table called &amp;#147;nokeycol&amp;#148;. For each field represented in the inner table, set this field to &amp;#145;X&amp;#146; to prevent overriding of key color settings. &lt;/P&gt;&lt;P&gt;In this procedure, again we must tell the control the name of the inner table containing color data. The field &amp;#147;CTAB_FNAME&amp;#148; of the layout structure is used for this purpose. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Adding inner table that will contain cell color data &lt;/P&gt;&lt;P&gt;A sample code to make the cell at row 5 and column &amp;#145;SEATSOCC&amp;#146; colored &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--- Internal table holding list data &lt;/P&gt;&lt;P&gt;DATA BEGIN OF gt_list OCCURS 0 . &lt;/P&gt;&lt;P&gt;INCLUDE STRUCTURE SFLIGHT . &lt;/P&gt;&lt;P&gt;DATA rowcolor(4) TYPE c . &lt;/P&gt;&lt;P&gt;DATA cellcolors TYPE lvc_t_scol . &lt;/P&gt;&lt;P&gt;DATA END OF gt_list . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA ls_cellcolor TYPE lvc_s_scol . &lt;/P&gt;&lt;P&gt;... &lt;/P&gt;&lt;P&gt;READ TABLE gt_list INDEX 5 . &lt;/P&gt;&lt;P&gt;ls_cellcolor-fname = 'SEATSOCC' . &lt;/P&gt;&lt;P&gt;ls_cellcolor-color-col = '7' . &lt;/P&gt;&lt;P&gt;ls_cellcolor-color-int = '1' . &lt;/P&gt;&lt;P&gt;APPEND ls_cellcolor TO gt_list-cellcolors . &lt;/P&gt;&lt;P&gt;MODIFY gt_list INDEX 5 . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A juicy-brained guy may ask what happens if all these three procedures applied for coloring at the same time. And again the same answer is given as there is a priority among them. The priority order is: cell setting - row setting - column setting. Beside these, key field setting must be handled. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward if usefull&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Oct 2007 05:52:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oops-alv/m-p/2810709#M657021</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-04T05:52:57Z</dc:date>
    </item>
  </channel>
</rss>

