<?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 Re: ALV REPORTS in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-reports/m-p/3626657#M873736</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is no standard event for that, but you can create you own button. And upon clicking button you can create some code to change the color of a column, row or even cell.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Apr 2008 20:34:15 GMT</pubDate>
    <dc:creator>Sm1tje</dc:creator>
    <dc:date>2008-04-02T20:34:15Z</dc:date>
    <item>
      <title>ALV REPORTS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-reports/m-p/3626656#M873735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there any event in ALV REPORTS to change the colours in the output list.&lt;/P&gt;&lt;P&gt;what is the event.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Apr 2008 20:21:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-reports/m-p/3626656#M873735</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-02T20:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: ALV REPORTS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-reports/m-p/3626657#M873736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is no standard event for that, but you can create you own button. And upon clicking button you can create some code to change the color of a column, row or even cell.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Apr 2008 20:34:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-reports/m-p/3626657#M873736</guid>
      <dc:creator>Sm1tje</dc:creator>
      <dc:date>2008-04-02T20:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: ALV REPORTS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-reports/m-p/3626658#M873737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i can't understand u r answer.&lt;/P&gt;&lt;P&gt;will plz tell the briefly  and what to do.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Apr 2008 20:40:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-reports/m-p/3626658#M873737</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-02T20:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: ALV REPORTS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-reports/m-p/3626659#M873738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;yus ....when you define fieldcatlog &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;add one more field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EMPHASIZE = 'X'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Apr 2008 05:22:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-reports/m-p/3626659#M873738</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-03T05:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: ALV REPORTS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-reports/m-p/3626660#M873739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;check this code...or go to program and select bc*alv and press f4..u will get the sample code &lt;/P&gt;&lt;P&gt;the sample code what i have used is as follows..&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;...
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZIMP1
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*

REPORT  ZIMP4.
*ALV GRID REPORT WITH HEADER AND FOOTER DISPLAY.

TABLES kna1.
TYPE-POOLS SLIS.

*Data Declaration
TYPEs: BEGIN OF t_kna1,
kunnr TYPE kna1-kunnr,
lAND1 TYPE KNA1-LAND1,
 NAME1 TYPE NAME1_GP,
ORT01 TYPE ORT01_GP,
LINE_COLOR(4) TYPE C,
END OF t_kna1.



DATA: It_kna1 TYPE STANDARD TABLE OF t_kna1 INITIAL SIZE 0,
wa_kna1 TYPE t_kna1.


*ALV Data Declaration
DATA: FLDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
GD_LAYOUT TYPE SLIS_LAYOUT_ALV,
GD_REPID TYPE SY-REPID,
I_EVENTS TYPE SLIS_T_EVENT,
W_EVENTS LIKE LINE OF I_EVENTS.
DATA: I_COMMENT TYPE SLIS_T_LISTHEADER,
WA_COMMENT TYPE SLIS_LISTHEADER.

START-OF-SELECTION.
PERFORM DATA_RETRIEVAL.
PERFORM BLD_FLDCAT.
PERFORM BLD_LAYOUT.
PERFORM CALL_EVENTS.
PERFORM DISPLAY_ALV_REPORT.


*Build Field Catalog for ALV Report
FORM BLD_FLDCAT.

FLDCAT-FIELDNAME = 'KUNNR'.
FLDCAT-SELTEXT_M = 'CUSTOMER NUMBER'.
FLDCAT-COL_POS = 0.
FLDCAT-EMPHASIZE = 'C411'.
FLDCAT-KEY = 'X'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.

FLDCAT-FIELDNAME = 'LAND1'.
FLDCAT-SELTEXT_L = 'COUNTRY'.
FLDCAT-COL_POS = 1.
FLDCAT-KEY = 'X'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.

FLDCAT-FIELDNAME = 'NAME1'.
FLDCAT-SELTEXT_L = 'CUSTOMER NAME'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.

FLDCAT-FIELDNAME = 'ORT01'.
FLDCAT-SELTEXT_M = 'CITY'.
FLDCAT-COL_POS = 3.
FLDCAT-EMPHASIZE = 'C110'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.

ENDFORM.


*Build Layout for ALV Grid Report
FORM BLD_LAYOUT.

GD_LAYOUT-NO_INPUT = 'X'.
GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
GD_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.

ENDFORM.


*Display report using ALV grid
FORM DISPLAY_ALV_REPORT.

DATA T_EVENT TYPE SLIS_T_EVENT.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = T_EVENT.
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.

GD_REPID = SY-REPID.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = GD_REPID
IS_LAYOUT = GD_LAYOUT
*I_CALLBACK_HTML_TOP_OF_PAGE = 'TOP_OF_PAGE_SPLIT'
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'

*I_CALLBACK_HTML_END_OF_LIST = 'END_OF_LIST_HTML'
IT_EVENTS = I_EVENTS
IT_FIELDCAT = FLDCAT[]
I_SAVE = 'X'
TABLES
T_OUTTAB = It_kna1
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
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.

ENDFORM.


*Retrieve data from kna1 table and populate itab It_kna1
FORM DATA_RETRIEVAL.

DATA LD_COLOR(1) TYPE C.

SELECT *
UP TO 200 ROWS
FROM kna1
INTO CORRESPONDING FIELDS OF TABLE It_kna1.

LOOP AT It_kna1 INTO wa_kna1.
LD_COLOR = LD_COLOR + 1.
IF LD_COLOR = 8.
LD_COLOR = 1.
ENDIF.
CONCATENATE 'C' LD_COLOR '10' INTO wa_kna1-LINE_COLOR.
MODIFY It_kna1 FROM wa_kna1.
ENDLOOP.

ENDFORM.

FORM TOP_OF_PAGE.

WA_COMMENT-TYP = 'H'.
WA_COMMENT-info = 'REACHING TOP'.
APPEND WA_COMMENT TO I_COMMENT.
CLEAR WA_COMMENT.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
  EXPORTING
    IT_LIST_COMMENTARY       = I_COMMENT
*   I_LOGO                   =
*   I_END_OF_LIST_GRID       =
*   I_ALV_FORM               =
          .

ENDFORM.

FORM CALL_EVENTS.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = I_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
.
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.

IF NOT I_EVENTS[] IS INITIAL.

READ TABLE I_EVENTS INTO W_EVENTS WITH KEY NAME = 'END_OF_LIST'.
W_EVENTS-FORM = 'GENERATE_USERCOMMAND_FOOTER'.
MODIFY I_EVENTS FROM W_EVENTS INDEX SY-TABIX.

ENDIF.

ENDFORM.

FORM GENERATE_USERCOMMAND_FOOTER.
CLEAR I_COMMENT[].
WA_COMMENT-TYP = 'H'.
WA_COMMENT-INFO = ' Sas sucess end-of-page'.
APPEND WA_COMMENT TO I_COMMENT.
clear wa_comment.

WA_COMMENT-TYP = 'H'.
WA_COMMENT-INFO = ' die hard end-of-page'.
APPEND WA_COMMENT TO I_COMMENT.

CLEAR wa_COMMENT.
WA_COMMENT-TYP = 'S'.
WA_COMMENT-INFO =  SY-PAGNO.
APPEND WA_COMMENT TO I_COMMENT.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = I_COMMENT

I_LOGO = ''
I_END_OF_LIST_GRID = 'X'.

ENDFORM.
....... &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this and let me know u have understnad ot not a..rewards points if usefull&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Apr 2008 05:28:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-reports/m-p/3626660#M873739</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-03T05:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: ALV REPORTS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-reports/m-p/3626661#M873740</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;For getting colours in ALVS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use in fieldcat the following field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_fieldcat-emphasize = 'C311'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C is to specify color and must be in caps&lt;/P&gt;&lt;P&gt;3 is a color number ....u can use from 1 to 9.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first one for bold on or off.(1 on and 0 off)&lt;/P&gt;&lt;P&gt;another one is for inverse on or off.(1 on and 0 off)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Reward if helpful&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jagadish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Apr 2008 05:30:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-reports/m-p/3626661#M873740</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-03T05:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: ALV REPORTS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-reports/m-p/3626662#M873741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="blue" __jive_macro_name="color"&gt;
Kanigiri reddy,
Please have a look at this sample program. Comments have been included wherever those are needed. 

&lt;PRE&gt;&lt;CODE&gt;report  zvenkat_alv_color_row_col.

*&amp;amp;---------------------------------------------------------------------*
" Declaration
" To get color for row
" 1.Define color variable with length 3 type char in the final internal
"   which is displayed
" 2.build layout structure type slis_layout_alv by specifying
"   info_fieldname = 'COLOR' and pass layout structure thru FM REUSE*ALV*
" 3.Poplate Final internal with color values for the field COLOR.
*----------------------------------------------------------------------*
"types
types:
     begin of t_pa0001,
       color(3) type c,      "1.Declare this
       pernr    type pa0001-pernr,
       ename    type pa0001-ename,
     end of t_pa0001.
"Work area
data:
      w_pa0001 type t_pa0001.
"Internal tables
data:
      i_pa0001 type standard table of t_pa0001.
*&amp;amp;---------------------------------------------------------------------*
* ALV Declarations
*----------------------------------------------------------------------*
* Types Pools
type-pools:
   slis.
* Types
types:
   t_fieldcat         type slis_fieldcat_alv,
   t_events           type slis_alv_event,
   t_layout           type slis_layout_alv.
* Workareas
data:
   w_fieldcat         type t_fieldcat,
   w_events           type t_events,
   w_layout           type t_layout.
* Internal Tables
data:
   i_fieldcat         type standard table of t_fieldcat,
   i_events           type standard table of t_events.
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;START-OF-SELECTION
*&amp;amp;---------------------------------------------------------------------*
start-of-selection .
  perform get_data.
  perform color_the_row. "Populate Color like this based on ur conditions
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;END-OF-SELECTION
*&amp;amp;---------------------------------------------------------------------*
end-of-selection.

  perform fieldcat.
  perform layout_build.
  perform dispaly .
*&amp;amp;---------------------------------------------------------------------*
  " Form  fieldcat
  "emphasize ===== Set this to highlight column in color
  " Value range: SPACE, 'X' or 'Cxyz' (x:'1'-'9'; y,z: '0'=off '1'=on)
  " 'X' = The column is highlighted in the default color for color highlighting.
  " 'Cxyz' = The column is highlighted in the coded color:
  " C: Color (coding must start with C)
  " x: Color number
  " y: Intensified
  " z: Inverse
*&amp;amp;---------------------------------------------------------------------*
form fieldcat .

  clear :
  w_fieldcat,i_fieldcat[].

  w_fieldcat-fieldname = 'PERNR'.
  w_fieldcat-tabname   = 'I_PA0001'.
  w_fieldcat-emphasize = 'C71'.
  w_fieldcat-seltext_m = 'Employee No'.
  w_fieldcat-no_zero   = 'PERNR'.
  append w_fieldcat to i_fieldcat.
  clear w_fieldcat.


  w_fieldcat-fieldname = 'ENAME'.
  w_fieldcat-tabname   = 'I_PA0001'.
  w_fieldcat-seltext_m = 'ENAME'.
  append w_fieldcat to i_fieldcat.
  clear w_fieldcat.


endform.                    " fieldcat
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  dispaly
*&amp;amp;---------------------------------------------------------------------*
form dispaly .

  data :l_program type sy-repid.
  l_program = sy-repid.
  call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
      i_callback_program          = l_program
*      i_callback_top_of_page      = 'TOP_OF_PAGE'
      i_callback_html_top_of_page = 'TOP_OF_PAGE'
      is_layout                   = w_layout
      it_events                   = i_events
      it_fieldcat                 = i_fieldcat
    tables
      t_outtab                    = i_pa0001.
  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.


endform.                    " dispaly
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  get_data
*&amp;amp;---------------------------------------------------------------------*
form get_data .
  do 20 times.
    select pernr ename
    from pa0001
    appending corresponding fields of table i_pa0001
    up to 10 rows.
  enddo.
endform.                    " get_data
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  layout_build
*&amp;amp;---------------------------------------------------------------------*
form layout_build .

  w_layout-info_fieldname = 'COLOR'. "Pass COLOR field name like this.

endform.                    " layout_build
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  color_the_row
*&amp;amp;---------------------------------------------------------------------*
form color_the_row .

  loop at i_pa0001 into w_pa0001.
    if sy-tabix &amp;gt; 3.
      w_pa0001-color = 'C31'.
      modify i_pa0001 from w_pa0001 index sy-tabix.
    endif.
  endloop.

endform.                    " color_the_row
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  top_of_page
*&amp;amp;---------------------------------------------------------------------*
form top_of_page using document type ref to cl_dd_document.
  data:
        l_text type sdydo_text_element.

  l_text = 'xyz'.
  call method document-&amp;gt;add_text
    exporting
      text         = l_text
      sap_emphasis = cl_dd_document=&amp;gt;strong
      sap_style    = cl_dd_document=&amp;gt;key.

  call method document-&amp;gt;new_line.
  l_text = 'lmn'.
  call method document-&amp;gt;add_text
    exporting
      text         = l_text
      sap_fontsize = cl_dd_document=&amp;gt;medium
      sap_color    = cl_dd_document=&amp;gt;list_positive
      sap_style    = cl_dd_document=&amp;gt;key.

  call method document-&amp;gt;underline.

endform.                    "top_of_page&lt;/CODE&gt;&lt;/PRE&gt;

I hope that it helps u.
&lt;STRONG&gt;Regards,&lt;/STRONG&gt;
&lt;STRONG&gt;Venkat.O&lt;/STRONG&gt;
&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Apr 2008 05:49:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-reports/m-p/3626662#M873741</guid>
      <dc:creator>venkat_o</dc:creator>
      <dc:date>2008-04-03T05:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: ALV REPORTS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-reports/m-p/3626663#M873742</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;Check the following link:&lt;/P&gt;&lt;P&gt;&lt;A href="http://sapdev.co.uk/reporting/alv/alvgrid_color.htm" target="test_blank"&gt;http://sapdev.co.uk/reporting/alv/alvgrid_color.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bhaskar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Apr 2008 07:56:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-reports/m-p/3626663#M873742</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-03T07:56:41Z</dc:date>
    </item>
  </channel>
</rss>

