<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ABAP Tutorials &#187; ALV</title>
	<atom:link href="http://www.abap-tutorials.com/category/sap-alv/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.abap-tutorials.com</link>
	<description>ABAP Tutorials, Guides, Training, Manuals</description>
	<lastBuildDate>Thu, 17 Nov 2011 07:43:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>ABAP Pending Purchase Orders (PO) Report</title>
		<link>http://www.abap-tutorials.com/2011/11/17/abap-pending-purchase-orders-po-report/</link>
		<comments>http://www.abap-tutorials.com/2011/11/17/abap-pending-purchase-orders-po-report/#comments</comments>
		<pubDate>Thu, 17 Nov 2011 07:38:00 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[ABAP]]></category>
		<category><![CDATA[ALV]]></category>
		<category><![CDATA[Report]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[pending POs]]></category>
		<category><![CDATA[Pending Purchase Order]]></category>
		<category><![CDATA[PO]]></category>
		<category><![CDATA[Purchase Order]]></category>

		<guid isPermaLink="false">http://www.abap-tutorials.com/?p=1996</guid>
		<description><![CDATA[This sample report shows the basic structure for getting the report for the Pending Purchase Orders based on various selection options on screen. The report loops throgh the required Tables of Purchase Order and based on the data entered on screen, displays the desired data. The report is to be modified/tweaked as per the custom [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">This sample report shows the basic  structure for getting the report for the Pending Purchase Orders  based on various selection options on screen.</p>
<p style="text-align: justify;">The report loops throgh the required  Tables of Purchase Order and based on the data entered on screen,  displays the desired data. The report is to be modified/tweaked as per  the custom need.</p>
<div style="width: 100%; float: left;">
<p style="text-align: center;"><a href="http://www.abap-tutorials.com/wp-content/uploads/2011/11/po.jpg"><img class="aligncenter size-full wp-image-1997" title="Purchase Order" src="http://www.abap-tutorials.com/wp-content/uploads/2011/11/po.jpg" alt="Purchase Order" width="406" height="365" /></a></p>
</div>
<p style="text-align: justify;">&nbsp;</p>
<p style="text-align: justify;"><span id="more-1996"></span></p>
<p style="text-align: justify;">&nbsp;</p>
<p style="text-align: justify;">&nbsp;</p>
<p style="text-align: justify;">The basic purpose of the report is to develop a programatical flow of the language, the way normally ABAP programs are written.</p>
<p style="text-align: justify;">Download Source Code : <a href="http://www.abap-tutorials.com/wp-content/uploads/2011/11/Z_PENDING_POS_REPORT.txt">Z_PENDING_POS_REPORT</a></p>
<p style="text-align: justify;">&nbsp;</p>


<p>You might also be interested in these posts:<ol><li><a href='http://www.abap-tutorials.com/2011/10/30/abap-pending-purchase-recquisition-pr-report/' rel='bookmark' title='ABAP Pending Purchase Recquisition (PR) Report'>ABAP Pending Purchase Recquisition (PR) Report</a></li>
<li><a href='http://www.abap-tutorials.com/2009/09/17/abap-program-to-add-colors-in-alv-grid/' rel='bookmark' title='ABAP Program to add Colors in ALV Grid'>ABAP Program to add Colors in ALV Grid</a></li>
<li><a href='http://www.abap-tutorials.com/2010/05/07/abap-programs-for-beginners/' rel='bookmark' title='ABAP Programs for Beginners'>ABAP Programs for Beginners</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.abap-tutorials.com/2011/11/17/abap-pending-purchase-orders-po-report/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Complete Reference to ABAP Basics</title>
		<link>http://www.abap-tutorials.com/2010/03/16/complete-reference-to-abap-basics/</link>
		<comments>http://www.abap-tutorials.com/2010/03/16/complete-reference-to-abap-basics/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 18:16:32 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[ABAP]]></category>
		<category><![CDATA[Abap Objects]]></category>
		<category><![CDATA[ALV]]></category>
		<category><![CDATA[BDC / LSMW]]></category>
		<category><![CDATA[DDIC]]></category>
		<category><![CDATA[Enhancement/Modification]]></category>
		<category><![CDATA[Formatting]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Function Modules]]></category>
		<category><![CDATA[Module Pool]]></category>
		<category><![CDATA[Quick Reference]]></category>
		<category><![CDATA[SAP]]></category>
		<category><![CDATA[SAP Query]]></category>
		<category><![CDATA[ABAP Basics]]></category>
		<category><![CDATA[Complete Reference]]></category>

		<guid isPermaLink="false">http://www.abap-tutorials.com/?p=1393</guid>
		<description><![CDATA[The following ebook is for the ABAP beginners giving an overview of basic topics in ABAP. This reference guide focuses on following topics: ENTERPRISE RESOURCE PLANNING (ERP) SAP ADVANTAGES Role of ABAPer R/3 ARCHITECTURE COMPONENTS WHAT IS CLIENT IN SAP Developemt Obects -  REPOSITORY OBJECTS and  DATA DICTIONARY OBJECTS ABAP GUI DATA DICTIONARY INTERNAL TABLES SUBROUTINES [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">The following ebook is for the ABAP beginners giving an overview of basic topics in ABAP.</p>
<p style="text-align: justify;">
<div style="float: left; width: 100%;"><img class="aligncenter size-full wp-image-1398" title="References" src="http://www.abap-tutorials.com/wp-content/uploads/2010/03/references.jpg" alt="" width="288" height="285" /></div>
</p>
<p style="text-align: justify;">This reference guide focuses on following topics:</p>
<ul>
<li>
<div style="text-align: justify;">ENTERPRISE RESOURCE PLANNING (ERP)</div>
</li>
<li>
<div style="text-align: justify;">SAP ADVANTAGES</div>
</li>
<li>
<div style="text-align: justify;">Role of ABAPer</div>
</li>
<li>
<div style="text-align: justify;">R/3 ARCHITECTURE COMPONENTS</div>
</li>
<li>
<div style="text-align: justify;">WHAT IS CLIENT IN SAP</div>
</li>
<li style="text-align: justify;">Developemt Obects -  REPOSITORY OBJECTS and  DATA DICTIONARY OBJECTS</li>
<li style="text-align: justify;">ABAP GUI</li>
<li style="text-align: justify;">DATA DICTIONARY</li>
<li style="text-align: justify;">INTERNAL TABLES</li>
<li style="text-align: justify;">SUBROUTINES</li>
<li style="text-align: justify;">Reports</li>
<li style="text-align: justify;">MODULE POOL PROGRAMMING</li>
<li style="text-align: justify;">Menu Painter</li>
<li style="text-align: justify;">BATCH DATA COMMUNICATION</li>
<li style="text-align: justify;">LSMW ( Legacy System Migration Workbench)</li>
<li style="text-align: justify;">SAPSCRIPTS</li>
<li style="text-align: justify;">SMARTFORMS</li>
</ul>
<p style="text-align: justify;"> <span id="more-1393"></span></p>
<p style="text-align: justify;"> </p>
<p style="text-align: justify;">Link : <a href="http://www.abap-tutorials.com/wp-content/uploads/pdfs/Complete_Reference_to_ABAP_Basics.pdf" target="_blank">Complete Reference to ABAP Basics</a></p>


<p>You might also be interested in these posts:<ol><li><a href='http://www.abap-tutorials.com/2009/07/28/display-se78-pictures-on-screen/' rel='bookmark' title='ABAP Program to Display SE78 pictures on Screen'>ABAP Program to Display SE78 pictures on Screen</a></li>
<li><a href='http://www.abap-tutorials.com/2010/05/07/abap-programs-for-beginners/' rel='bookmark' title='ABAP Programs for Beginners'>ABAP Programs for Beginners</a></li>
<li><a href='http://www.abap-tutorials.com/2009/08/19/lock-objects-in-sap/' rel='bookmark' title='Lock Objects in SAP'>Lock Objects in SAP</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.abap-tutorials.com/2010/03/16/complete-reference-to-abap-basics/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ABAP Program to add Colors in ALV Grid</title>
		<link>http://www.abap-tutorials.com/2009/09/17/abap-program-to-add-colors-in-alv-grid/</link>
		<comments>http://www.abap-tutorials.com/2009/09/17/abap-program-to-add-colors-in-alv-grid/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 11:01:33 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[ABAP]]></category>
		<category><![CDATA[ALV]]></category>
		<category><![CDATA[Formatting]]></category>
		<category><![CDATA[Report]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[ALV grid]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[SAP]]></category>

		<guid isPermaLink="false">http://www.abap-tutorials.com/?p=976</guid>
		<description><![CDATA[Normally, there are requirements to display set of rows differently based to certain conditions in ALV. To distinguish them easily, in a one go, we can add colors to the rows(based on condition of course). The following program adds strokes of different color to your ALV Grid.    Program Code *&#038;---------------------------------------------------------------------* *&#038; Report ZCOLOR_IN_ALV *&#038; [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Normally, there are requirements to display set of rows differently based to certain conditions in ALV. To distinguish them easily, in a one go, we can add colors to the rows(based on condition of course).<br />
The following program adds strokes of different color to your ALV Grid.</p>
<p style="text-align: center;"> </p>
<div style="float: left; width: 100%;"><img class="aligncenter size-full wp-image-977" title="Add Color in ALV" src="http://www.abap-tutorials.com/wp-content/uploads/2009/09/color_in_alv.jpg" alt="Add Color in ALV" width="517" height="263" /></div>
<p><span style="color: #00ff00;"><span id="more-976"></span></span></p>
<p><span style="color: #00ff00;"> <strong><span style="color: #339966;">Program Code</span></strong></span></p>
<pre lang="ABAP">
*&#038;---------------------------------------------------------------------*
*&#038; Report  ZCOLOR_IN_ALV
*&#038;
*&#038;---------------------------------------------------------------------*
*&#038;
*&#038;
*&#038;---------------------------------------------------------------------*

REPORT  ZCOLOR_IN_ALV.

TABLES: ekko.

type-pools: slis. "ALV Declarations
*Data Declaration*----------------
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
line_color(4) type c, "Used to store row color attributes
END OF t_ekko.

DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid.

*Start-of-selection.
START-OF-SELECTION.

  perform data_retrieval.

  perform build_fieldcatalog.

  perform build_layout.

  perform display_alv_report.

*&#038;---------------------------------------------------------------------
**&#038; Form BUILD_FIELDCATALOG
*&#038;---------------------------------------------------------------------
** Build Fieldcatalog for ALV Report
*----------------------------------------------------------------------*
form build_fieldcatalog.

  fieldcatalog-fieldname = 'EBELN'.
  fieldcatalog-seltext_m = 'Purchase Order'.
  fieldcatalog-col_pos = 0.
  fieldcatalog-outputlen = 10.
  fieldcatalog-emphasize = 'X'.
  fieldcatalog-key = 'X'.
  append fieldcatalog to fieldcatalog.
  clear fieldcatalog.

  fieldcatalog-fieldname = 'EBELP'.
  fieldcatalog-seltext_m = 'PO Item'.
  fieldcatalog-col_pos = 1.
  append fieldcatalog to fieldcatalog.
  clear fieldcatalog.

  fieldcatalog-fieldname = 'STATU'.
  fieldcatalog-seltext_m = 'Status'.
  fieldcatalog-col_pos = 2.
  append fieldcatalog to fieldcatalog.
  clear fieldcatalog.

  fieldcatalog-fieldname = 'AEDAT'.
  fieldcatalog-seltext_m = 'Item change date'.
  fieldcatalog-col_pos = 3.
  append fieldcatalog to fieldcatalog.
  clear fieldcatalog.

  fieldcatalog-fieldname = 'MATNR'.
  fieldcatalog-seltext_m = 'Material Number'.
  fieldcatalog-col_pos = 4.
  append fieldcatalog to fieldcatalog.
  clear fieldcatalog.

  fieldcatalog-fieldname = 'MENGE'.
  fieldcatalog-seltext_m = 'PO quantity'.
  fieldcatalog-col_pos = 5.
  append fieldcatalog to fieldcatalog.
  clear fieldcatalog.

  fieldcatalog-fieldname = 'MEINS'.
  fieldcatalog-seltext_m = 'Order Unit'.
  fieldcatalog-col_pos = 6.
  append fieldcatalog to fieldcatalog.
  clear fieldcatalog.

  fieldcatalog-fieldname = 'NETPR'.
  fieldcatalog-seltext_m = 'Net Price'.
  fieldcatalog-col_pos = 7.
  fieldcatalog-outputlen = 15.
  fieldcatalog-datatype = 'CURR'.
  append fieldcatalog to fieldcatalog.
  clear fieldcatalog.

  fieldcatalog-fieldname = 'PEINH'.
  fieldcatalog-seltext_m = 'Price Unit'.
  fieldcatalog-col_pos = 8.
  append fieldcatalog to fieldcatalog.
  clear fieldcatalog.
endform. " BUILD_FIELDCATALOG

*&#038;---------------------------------------------------------------------
**&#038; Form BUILD_LAYOUT
*&#038;---------------------------------------------------------------------
** Build layout for ALV grid report
*----------------------------------------------------------------------*
form build_layout.
  gd_layout-no_input          = 'X'.
  gd_layout-colwidth_optimize = 'X'.
  gd_layout-totals_text       = 'Totals'(201).
  gd_layout-info_fieldname    = 'LINE_COLOR'.

endform. " BUILD_LAYOUT

*&#038;---------------------------------------------------------------------
**&#038; Form DISPLAY_ALV_REPORT
*&#038;---------------------------------------------------------------------
** Display report using ALV grid
*----------------------------------------------------------------------*
form display_alv_report.
  gd_repid = sy-repid.
  call function 'REUSE_ALV_GRID_DISPLAY'
  exporting
  i_callback_program = gd_repid
  is_layout          = gd_layout
  it_fieldcat        = fieldcatalog[]
  i_save             = 'X'
*is_variant = z_template
  tables
  t_outtab          = it_ekko .

endform. " DISPLAY_ALV_REPORT
*&#038;---------------------------------------------------------------------
**&#038; Form DATA_RETRIEVAL
*&#038;---------------------------------------------------------------------
** Retrieve data form EKPO table and populate itab it_ekko
*----------------------------------------------------------------------
form data_retrieval.
  data: ld_color(1) type c.

  select ebeln
  ebelp
  statu
  aedat
  matnr
  menge
  meins
  netpr
  peinh
  up to 10 rows
  from ekpo
  into table it_ekko.

*Populate field with color attributes
  loop at it_ekko into wa_ekko.
* Populate color variable with colour properties
* Char 1 = C (This is a color property)
* Char 2 = 3 (Color codes: 1 - 7)
* Char 3 = Intensified on/off ( 1 or 0 )
* Char 4 = Inverse display on/off ( 1 or 0 )
* i.e. wa_ekko-line_color = 'C410'
    ld_color = ld_color + 1.
* Only 7 colours so need to reset color value
    if ld_color = 8.
      ld_color = 1.
    endif.

    concatenate 'C' ld_color '10' into wa_ekko-line_color.
* wa_ekko-line_color = 'C410'.
    modify it_ekko from wa_ekko.
  endloop.

endform. " DATA_RETRIEVAL
</pre>


<p>You might also be interested in these posts:<ol><li><a href='http://www.abap-tutorials.com/2009/09/10/displaying-icons-in-alv-abap/' rel='bookmark' title='Displaying Icons in ALV Grid using ABAP'>Displaying Icons in ALV Grid using ABAP</a></li>
<li><a href='http://www.abap-tutorials.com/2009/08/06/search-for-smartforms-in-your-language/' rel='bookmark' title='ABAP Program to Search For SMARTFORMS in your Language'>ABAP Program to Search For SMARTFORMS in your Language</a></li>
<li><a href='http://www.abap-tutorials.com/2009/07/09/alv-grid-the-oops-way/' rel='bookmark' title='ABAP Program for ALV Grid, the OOPS way'>ABAP Program for ALV Grid, the OOPS way</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.abap-tutorials.com/2009/09/17/abap-program-to-add-colors-in-alv-grid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Displaying Icons in ALV Grid using ABAP</title>
		<link>http://www.abap-tutorials.com/2009/09/10/displaying-icons-in-alv-abap/</link>
		<comments>http://www.abap-tutorials.com/2009/09/10/displaying-icons-in-alv-abap/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 12:25:24 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[ABAP]]></category>
		<category><![CDATA[ALV]]></category>
		<category><![CDATA[Formatting]]></category>
		<category><![CDATA[Function Modules]]></category>
		<category><![CDATA[Report]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[ALV grid]]></category>
		<category><![CDATA[icon]]></category>
		<category><![CDATA[icons]]></category>
		<category><![CDATA[icons in ALV]]></category>
		<category><![CDATA[SAP]]></category>

		<guid isPermaLink="false">http://www.abap-tutorials.com/?p=930</guid>
		<description><![CDATA[The following code adds an icon  (exclamation) to the ALV grid/list. It also includes the code for adding hot-spot to ALV column. Program Code REPORT ZICON_IN_ALV. ************************************************************************ * Include Programs ************************************************************************ *INCLUDE . ************************************************************************ * Database Tables ************************************************************************ TABLES: kna1. "Customer Master ************************************************************************ * Types ************************************************************************ TYPE-POOLS: kkblo. ************************************************************************ * Structures ************************************************************************ * Structure to [...]]]></description>
			<content:encoded><![CDATA[<p>The following code adds an icon  (exclamation) to the ALV grid/list. It also includes the code for adding hot-spot to ALV column.</p>
<div style="width:100%;float:left">
<p style="text-align: center;"><img src="http://www.abap-tutorials.com/wp-content/uploads/2009/09/icons_in_alv.jpg" alt="icons_in_alv" width="550" height="312" /></p>
</div>
<p style="text-align: center;">
<p style="text-align: center;">
<p><span id="more-930"></span></p>
<p style="text-align: center;">
<p style="text-align: center;">
<p style="text-align: center;">
<p style="text-align: center;">
<p style="text-align: center;">
<p style="text-align: center;">
<p style="text-align: center;">
<p style="text-align: center;">
<p style="text-align: center;">
<p style="text-align: center;">
<p style="text-align: center;">
<p style="text-align: center;">
<p><strong><span style="color: #339966;">Program Code</span></strong></p>
<pre lang="ABAP">REPORT  ZICON_IN_ALV.

************************************************************************

* Include Programs

************************************************************************

*INCLUDE .

************************************************************************

* Database Tables

************************************************************************

TABLES: kna1. "Customer Master

************************************************************************

* Types

************************************************************************

TYPE-POOLS: kkblo.

************************************************************************

* Structures

************************************************************************

* Structure to hold the Color Information

DATA: BEGIN OF st_color,

color(3) TYPE c,

END OF st_color.

* Structure to hold the Icon Information

DATA: BEGIN OF st_icon,

icon(4) TYPE c,

END OF st_icon.

* ALV Field Catalog Structure

DATA: st_fieldcat TYPE slis_fieldcat_alv.

* ALV Layout Structure

DATA: st_layout TYPE slis_layout_alv.

************************************************************************

* Internal Tables

************************************************************************

* Output Table

DATA: BEGIN OF tbl_kna1 OCCURS 0.

INCLUDE STRUCTURE st_icon. "Icon Structure

INCLUDE STRUCTURE kna1. "Customer Master Structure

INCLUDE STRUCTURE st_color. "Color Structure

DATA: END OF tbl_kna1.

* ALV Field Catalog Table

DATA: tbl_fieldcat TYPE slis_t_fieldcat_alv.

************************************************************************

* Variables

************************************************************************

DATA: fieldname(30) TYPE c,

g_repid LIKE sy-repid.

************************************************************************

* Start of Selection

************************************************************************

START-OF-SELECTION.

g_repid = sy-repid.

PERFORM get_data.

************************************************************************

* End of Selection

************************************************************************

END-OF-SELECTION.

PERFORM do_fancy_stuff.

PERFORM get_layout.

PERFORM get_fieldcat.

PERFORM create_report.

*&amp;---------------------------------------------------------------------*

*&amp; Form CREATE_REPORT

*&amp;---------------------------------------------------------------------*

* Learn to read the subroutine name!

*----------------------------------------------------------------------*

FORM create_report.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_interface_check = ' '

i_callback_program = g_repid

i_callback_user_command = 'PROCESS_USER_COMMANDS'

it_fieldcat = tbl_fieldcat

i_default = 'X'

i_save = ' '

is_layout = st_layout

TABLES

t_outtab = tbl_kna1

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc &lt;&gt; 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM. " CREATE_REPORT

*&amp;---------------------------------------------------------------------*

*&amp; Form GET_FIELDCAT

*&amp;---------------------------------------------------------------------*

* Build the Field Catalog

*----------------------------------------------------------------------*

FORM get_fieldcat.

* Here the field catalog is created. To display more fields simply

* 'uncomment' the additional lines and add the field name. Also note

* that the field catalog is much more powerful than this. You can

* intensify fields, change the colour, assign reference fields, etc.

* Look at type slis_fieldcat_alv for more options.

PERFORM write_fieldcat USING 'ICON' 'TBL_KNA1' ' ' 'X' 1 '2' 'X'

' '.

PERFORM write_fieldcat USING 'KUNNR' 'TBL_KNA1' 'KNA1' 'X' 2 ' ' ' '

' '.

PERFORM write_fieldcat USING 'NAME1' 'TBL_KNA1' 'KNA1' ' ' 3 '10' ' '

'X'.

PERFORM write_fieldcat USING 'STRAS' 'TBL_KNA1' 'KNA1' ' ' 4 ' ' ' '

' '.

PERFORM write_fieldcat USING 'TELF1' 'TBL_KNA1' 'KNA1' ' ' 5 ' ' ' '

' '.

PERFORM write_fieldcat USING 'ORT01' 'TBL_KNA1' 'KNA1' ' ' 6 ' ' ' '

' '.

PERFORM write_fieldcat USING 'PSTLZ' 'TBL_KNA1' 'KNA1' ' ' 7 ' ' ' '

' '.

PERFORM write_fieldcat USING 'SORTL' 'TBL_KNA1' 'KNA1' ' ' 8 ' ' ' '

' '.

PERFORM write_fieldcat USING 'ERNAM' 'TBL_KNA1' 'KNA1' ' ' 9 ' ' ' '

' '.

PERFORM write_fieldcat USING 'SPRAS' 'TBL_KNA1' 'KNA1' ' ' 10 ' ' ' '

' '.

* perform write_fieldcat using ' ' 'TBL_KNA1' 'KNA1' ' ' 10 ' '.

* perform write_fieldcat using ' ' 'TBL_KNA1' 'KNA1' ' ' 11 ' '.

* perform write_fieldcat using ' ' 'TBL_KNA1' 'KNA1' ' ' 12 ' '.

ENDFORM. " GET_FIELDCAT

*&amp;---------------------------------------------------------------------*

*&amp; Form WRITE_FIELDCAT

*&amp;---------------------------------------------------------------------*

* Write the Field Catalog data to the Field Catalog Table

*----------------------------------------------------------------------*

* --&gt;name Field name

* --&gt;tab Table name

* --&gt;st Structure Name

* --&gt;key Is this field a Key?

* --&gt;pos Position Number

* --&gt;length Field Length

* --&gt;icon Display as Icon

* --&gt;hot Hotspot

*----------------------------------------------------------------------*

FORM write_fieldcat USING name tab st key pos length icon hot.

st_fieldcat-fieldname = name.

st_fieldcat-tabname = tab.

st_fieldcat-ref_tabname = st.

st_fieldcat-key = key.

st_fieldcat-col_pos = pos.

st_fieldcat-outputlen = length.

st_fieldcat-icon = icon.

st_fieldcat-hotspot = hot.

APPEND st_fieldcat TO tbl_fieldcat.

CLEAR st_fieldcat.

ENDFORM. " WRITE_FIELDCAT

*&amp;---------------------------------------------------------------------*

*&amp; Form PROCESS_USER_COMMANDS

*&amp;---------------------------------------------------------------------*

* Interactive Reporting Commands

*----------------------------------------------------------------------*

FORM process_user_commands USING syst-ucomm LIKE syst-ucomm

selfield TYPE slis_selfield.

* This subroutine is called when there is user interaction in the output

* In this case if the user double clicks the Customer Number then the

* program will call transaction XD03 and display the Customer Master

* Data

CASE syst-ucomm.

WHEN '&amp;IC1'.

* get cursor field fieldname.

READ TABLE tbl_kna1 INDEX selfield-tabindex.

SET PARAMETER ID 'KUN' FIELD tbl_kna1-kunnr.

CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.

ENDCASE.

ENDFORM. " PROCESS_USER_COMMANDS

*&amp;---------------------------------------------------------------------*

*&amp; Form GET_LAYOUT

*&amp;---------------------------------------------------------------------*

* set the layout of the ALV.

* add color to the row?

*----------------------------------------------------------------------*

FORM get_layout.

st_layout-info_fieldname = 'COLOR'.

st_layout-colwidth_optimize = 'X'.

st_layout-get_selinfos = 'X'.

ENDFORM. " GET_LAYOUT

*&amp;---------------------------------------------------------------------*

*&amp; Form get_data

*&amp;---------------------------------------------------------------------*

* Get some data to play with

*----------------------------------------------------------------------*

FORM get_data.

SELECT * FROM kna1 INTO CORRESPONDING FIELDS OF TABLE tbl_kna1

UP TO 30 ROWS.

ENDFORM. " get_data

*&amp;---------------------------------------------------------------------*

*&amp; Form do_fancy_stuff

*&amp;---------------------------------------------------------------------*

* Do some fancy pants stuff for example changing the color of

* lines and adding icons

*----------------------------------------------------------------------*

FORM do_fancy_stuff.

* Here we will demonstrate changing the color of ALV Record lines as

* well as displaying Icons

LOOP AT tbl_kna1.

* All records where NAME1 begins with 'M', will be displayed in Bluish

* Green

IF tbl_kna1-name1(1) EQ 'M'.

tbl_kna1-color = 'C41'. "Bluish Green

MODIFY tbl_kna1 TRANSPORTING color.

ENDIF.

* All records with no TELF1 will be displayed in White and have a

* Warning Icon

IF tbl_kna1-telf1 IS INITIAL.

tbl_kna1-color = 'C00'. "White

tbl_kna1-icon = '@AH@'. "Warning Icon

MODIFY tbl_kna1 TRANSPORTING icon color.

ENDIF.

ENDLOOP.

ENDFORM. " do_fancy_stuff</pre>


<p>You might also be interested in these posts:<ol><li><a href='http://www.abap-tutorials.com/2009/09/17/abap-program-to-add-colors-in-alv-grid/' rel='bookmark' title='ABAP Program to add Colors in ALV Grid'>ABAP Program to add Colors in ALV Grid</a></li>
<li><a href='http://www.abap-tutorials.com/2009/07/09/alv-grid-the-oops-way/' rel='bookmark' title='ABAP Program for ALV Grid, the OOPS way'>ABAP Program for ALV Grid, the OOPS way</a></li>
<li><a href='http://www.abap-tutorials.com/2009/07/28/edit-alv-grid-contents/' rel='bookmark' title='ABAP Program with Editable ALV Grid Contents'>ABAP Program with Editable ALV Grid Contents</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.abap-tutorials.com/2009/09/10/displaying-icons-in-alv-abap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ABAP Program with Editable ALV Grid Contents</title>
		<link>http://www.abap-tutorials.com/2009/07/28/edit-alv-grid-contents/</link>
		<comments>http://www.abap-tutorials.com/2009/07/28/edit-alv-grid-contents/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 23:01:41 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[ABAP]]></category>
		<category><![CDATA[Abap Objects]]></category>
		<category><![CDATA[ALV]]></category>
		<category><![CDATA[Quick Reference]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[editable]]></category>
		<category><![CDATA[editable ALV]]></category>
		<category><![CDATA[SAP]]></category>

		<guid isPermaLink="false">http://naveenvishal.wordpress.com/?p=463</guid>
		<description><![CDATA[Using ALV Grid is always beneficial in terms operations and activities we can perform on the data. It even allow us to download data in various formats. But when compared to Table Control, its main disadvantage is, un-editable / read-only data. Here is a simple program to make certain cells of an ALV grid control editable.   In [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Using ALV Grid is always beneficial in terms operations and activities we can perform on the data. It even allow us to download data in various formats. But when compared to Table Control, its main disadvantage is, un-editable / read-only data.</p>
<p style="text-align:justify;">Here is a simple program to make certain cells of an ALV grid control editable.</p>
<div id="attachment_499" class="wp-caption aligncenter" style="width: 460px"><img class="size-full wp-image-499" title="Editable Table Grid" src="http://naveenvishal.files.wordpress.com/2009/07/editable_table_grid.jpg" alt="Editable Table Grid" width="450" height="326" /><p class="wp-caption-text">Editable Table Grid</p></div>
<p> </p>
<p style="text-align:justify;"><span id="more-463"></span></p>
<p style="text-align:justify;">In present context the VBRK details  are displayed where the <!-- SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } --> KALSM is editable only where Sales Organization(VKORG) is &#8217;0300&#8242;.</p>
<p style="text-align:justify;">Note: Please do the following before executing the program.</p>
<p style="text-align:justify;">1) create the gui interface &#8216;pf-status&#8217; (with BACK and EXIT buttons) and a container ( give name as CONTAINER) for the screen.</p>
<p style="text-align:justify;">2) In PBO of screen, write &#8216;<!-- SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } .L0S52 { color: #0000FF; } -->MODULE LIST.&#8217; after &#8216;<!-- SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } .L0S52 { color: #0000FF; } -->MODULE STATUS_0100&#8242;.</p>
<p style="text-align:justify;"> </p>
<p style="text-align:justify;">Sample Code:</p>
<p style="text-align:justify;">REPORT Z_ALV_EDIT_CELL.</p>
<p style="text-align:justify;"><span style="color:#3366ff;">*internal table declaration<br />
<span style="color:#000000;">DATA:<br />
BEGIN OF t_itab OCCURS 0.<br />
INCLUDE STRUCTURE VBRK.</span></span></p>
<p style="text-align:justify;"><span style="color:#3366ff;">*Adding a table of type LVC_T_SCOL to the output table that holds the status of editable cells<br />
<span style="color:#000000;">DATA t_editcell TYPE lvc_t_styl.<br />
DATA END OF t_itab.</span></span></p>
<p style="text-align:justify;"><span style="color:#3366ff;">*Style table for cells and its work area<br />
<span style="color:#000000;">DATA: t_editcell TYPE lvc_t_styl,<br />
fs_editcell LIKE LINE OF t_editcell.<br />
</span></span></p>
<p style="text-align:justify;"><span style="color:#3366ff;"><span><span style="color:#3366ff;">*declaring the container &amp; grid for output table display</span></span></span></p>
<p style="text-align:justify;">DATA:<br />
r_container TYPE REF TO cl_gui_custom_container,<br />
r_grid TYPE REF TO cl_gui_alv_grid.</p>
<p style="text-align:justify;"><span style="color:#3366ff;">*structure of layout</span></p>
<p style="text-align:justify;">DATA:<br />
fs_layout TYPE lvc_s_layo.</p>
<p style="text-align:justify;">START-OF-SELECTION.</p>
<p style="text-align:justify;">SELECT * FROM VBRKt INTO CORRESPONDING FIELDS OF TABLE t_itab <!-- SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } .L0S32 { color: #3399FF; } .L0S52 { color: #0000FF; } --> UP TO 20 ROWS.</p>
<p style="text-align:justify;"><span style="color:#3366ff;">*&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</span></p>
<p style="text-align:justify;"><span style="color:#3366ff;">*populating layout</span></p>
<p style="text-align:justify;">fs_layout-stylefname = &#8216;T_EDITCELL&#8217;.</p>
<p style="text-align:justify;"><span style="color:#3366ff;">*&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</span></p>
<p style="text-align:justify;">LOOP AT t_itab.</p>
<p style="text-align:justify;">REFRESH t_editcell.</p>
<p style="text-align:justify;"><span style="color:#3366ff;">*making the KALSM editable for editing data for specific Sales Organization(0300)<br />
<span style="color:#000000;">IF t_itab-vkorg = &#8217;0300&#8242;.</span></span></p>
<p style="text-align:justify;"><span style="color:#3366ff;">*populating t_editcell which contains fieldname+style of cell</span></p>
<p style="text-align:justify;">fs_editcell-fieldname = &#8216;<!-- SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } --> KALSM&#8217;.</p>
<p style="text-align:justify;"><!-- SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } --> fs_editcell-style = cl_gui_alv_grid=&gt;MC_STYLE_ENABLED. <span style="color:#3366ff;">&#8221; the value represents EDIT ENABLED</span></p>
<p style="text-align:justify;">APPEND fs_editcell TO t_editcell.</p>
<p style="text-align:justify;">ENDIF.</p>
<p style="text-align:justify;">INSERT LINES OF t_editcell INTO TABLE t_itab-t_editcell.</p>
<p style="text-align:justify;">MODIFY t_itab.</p>
<p style="text-align:justify;">ENDLOOP.</p>
<p style="text-align:justify;"> </p>
<p style="text-align:justify;">CALL SCREEN 100.</p>
<p style="text-align:justify;"> </p>
<p style="text-align:justify;"><span style="color:#3366ff;">*&amp;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</span></p>
<p style="text-align:justify;"><span style="color:#3366ff;">*&amp;Module STATUS_0100 OUTPUT</span></p>
<p style="text-align:justify;"><span style="color:#3366ff;">*&amp;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</span></p>
<p style="text-align:justify;"><span style="color:#3366ff;">* text</span></p>
<p style="text-align:justify;"><span style="color:#3366ff;">*&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</span></p>
<p style="text-align:justify;">MODULE status_0100 OUTPUT.</p>
<p style="text-align:justify;">SET PF-STATUS &#8216;SCREEN1&#8242;.</p>
<p style="text-align:justify;">ENDMODULE.<span style="color:#3366ff;">&#8221; STATUS_0100 OUTPUT</span></p>
<p style="text-align:justify;"><span style="color:#3366ff;">*&amp;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</span></p>
<p style="text-align:justify;"><span style="color:#3366ff;">*&amp;Module USER_COMMAND_0100 INPUT</span></p>
<p style="text-align:justify;"><span style="color:#3366ff;">*&amp;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</span></p>
<p style="text-align:justify;"><span style="color:#3366ff;">* text</span></p>
<p style="text-align:justify;"><span style="color:#3366ff;">*&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</span></p>
<p style="text-align:justify;">MODULE user_command_0100 INPUT.</p>
<p style="text-align:justify;">CASE sy-ucomm.</p>
<p style="text-align:justify;">WHEN &#8216;BACK&#8217;.</p>
<p style="text-align:justify;">LEAVE TO SCREEN 0.</p>
<p style="text-align:justify;">WHEN &#8216;EXIT&#8217;.</p>
<p style="text-align:justify;">LEAVE PROGRAM.</p>
<p style="text-align:justify;">ENDCASE.</p>
<p style="text-align:justify;">ENDMODULE.<span style="color:#3366ff;">&#8221; USER_COMMAND_0100 INPUT</span></p>
<p style="text-align:justify;"><span style="color:#3366ff;">*&amp;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</span></p>
<p style="text-align:justify;"><span style="color:#3366ff;">*&amp; Module LIST OUTPUT</span></p>
<p style="text-align:justify;"><span style="color:#3366ff;">*&amp;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</span></p>
<p style="text-align:justify;"><span style="color:#3366ff;">* text</span></p>
<p style="text-align:justify;"><span style="color:#3366ff;">*&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</span></p>
<p style="text-align:justify;">MODULE list OUTPUT.</p>
<p style="text-align:justify;">CREATE OBJECT r_container</p>
<p style="text-align:justify;">EXPORTING</p>
<p style="text-align:justify;">container_name = &#8216;CONTAINER&#8217;.</p>
<p style="text-align:justify;">CREATE OBJECT r_grid</p>
<p style="text-align:justify;">EXPORTING</p>
<p style="text-align:justify;">i_parent = r_container.</p>
<p style="text-align:justify;"><span style="color:#3366ff;">*call this method to make the cell ready for input</span></p>
<p style="text-align:justify;">CALL METHOD r_grid-&gt;set_ready_for_input</p>
<p style="text-align:justify;">EXPORTING</p>
<p style="text-align:justify;">i_ready_for_input = 1.</p>
<p style="text-align:justify;"><span style="color:#3366ff;">*passing the layout structure, fieldcatalog and output table for display</span></p>
<p style="text-align:justify;">CALL METHOD r_grid-&gt;set_table_for_first_display</p>
<p style="text-align:justify;">EXPORTING</p>
<p style="text-align:justify;">i_structure_name = &#8216;SFLIGHT&#8217;</p>
<p style="text-align:justify;">is_layout = fs_layout</p>
<p style="text-align:justify;">CHANGING</p>
<p style="text-align:justify;">it_outtab = t_itab[].</p>
<p style="text-align:justify;">ENDMODULE. <span style="color:#3366ff;">&#8221; LIST OUTPUT</span></p>
<p style="text-align:justify;"> </p>
<p style="text-align:justify;"><span style="color:#3366ff;"><br />
</span></p>


<p>You might also be interested in these posts:<ol><li><a href='http://www.abap-tutorials.com/2009/07/09/alv-grid-the-oops-way/' rel='bookmark' title='ABAP Program for ALV Grid, the OOPS way'>ABAP Program for ALV Grid, the OOPS way</a></li>
<li><a href='http://www.abap-tutorials.com/2009/07/17/creating-an-alv-grid-in-3-lines/' rel='bookmark' title='ABAP Program for Creating an ALV Grid in 3 lines'>ABAP Program for Creating an ALV Grid in 3 lines</a></li>
<li><a href='http://www.abap-tutorials.com/2009/07/28/display-se78-pictures-on-screen/' rel='bookmark' title='ABAP Program to Display SE78 pictures on Screen'>ABAP Program to Display SE78 pictures on Screen</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.abap-tutorials.com/2009/07/28/edit-alv-grid-contents/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

