54
IBM Global Business Services © IBM Corporation 2013 Overview of ABAP List Viewer (ALV) Dec-2008 ABAP List Viewer (ALV)

Day 10 Classical ALV Reporting - Overview of ALV

Embed Size (px)

DESCRIPTION

Day 10 Classical ALV Reporting - Overview of ALV

Citation preview

IBM Global Business Services

© IBM Corporation 2013Overview of ABAP List Viewer (ALV) Dec-2008

ABAP List Viewer (ALV)

IBM Global Business Services

© IBM Corporation 20132 Dec-2008Overview of ABAP List Viewer (ALV) |

Objectives

The participants will be able to : Describe the features and advantages of ALV.

Describe the different function modules that should be used to properly produce a report output in ALV.

Create simple ALV reports.

Format the layout of the ALV reports.

IBM Global Business Services

© IBM Corporation 20133 Dec-2008Overview of ABAP List Viewer (ALV) |

ALV (ABAP List Viewer)

ABAP List Viewer (ALV) is a simple, user friendly and better looking reporting tool as compared to the usage of write statements in a conventional / interactive report.

SAP provides a set of ALV (ABAP LIST VIEWER) function modules, which can be put into use to embellish the output of a report. This set of ALV functions are used to enhance the readability and functionality of any report output.

IBM Global Business Services

© IBM Corporation 20134 Dec-2008Overview of ABAP List Viewer (ALV) |

Advantages of ALV

Looks better.

User friendly Filtering / Sorting

Layout Change / Save

Summation, Download to excel, E-Mail

Data can be open for input / change etc.

Better Event handling

Width of more than 256 characters possible

Programming overhead of mentioning exact positions in write statements not needed.

IBM Global Business Services

© IBM Corporation 20135 Dec-2008Overview of ABAP List Viewer (ALV) |

ALV Features

Column Heading

Row(s)

Selection

Sorting

Filtering

Email

Download to Excel

Change Layout

IBM Global Business Services

© IBM Corporation 20136 Dec-2008Overview of ABAP List Viewer (ALV) |

ALV Features (Contd.)

Fields Open For

Input

Display Graphics

IBM Global Business Services

© IBM Corporation 20137 Dec-2008Overview of ABAP List Viewer (ALV) |

ALV Programming

Three Approaches Conventional (Using SAP Standard Function Modules).

Object Oriented (Using SAP Standard Classes and Methods).

Object model ( Using CL_SALV* classes ).

IBM Global Business Services

© IBM Corporation 20138 Dec-2008Overview of ABAP List Viewer (ALV) |

Common ALV functions

The commonly used ALV function modules are: REUSE_ALV_VARIANT_DEFAULT_GET

REUSE_ALV_VARIANT_F4

REUSE_ALV_VARIANT_EXISTENCE

REUSE_ALV_EVENTS_GET

REUSE_ALV_COMMENTARY_WRITE

REUSE_ALV_FIELDCATALOG_MERGE

REUSE_ALV_POPUP_TO_SELECT

REUSE_ALV_LIST_DISPLAY

REUSE_ALV_GRID_DISPLAY

IBM Global Business Services

© IBM Corporation 20139 Dec-2008Overview of ABAP List Viewer (ALV) |

Major Steps to construct an ALV Report

Step 1 : Data Declaration.

Step 2 : Selecting the Variant for initial list display (Default Variant). Optional : Used only if report layout is maintained through variant management.

Step 3 : Defining output characteristics: Preparing display Field-catalog, REUSE_ALV_FIELDCATALOG_MERGE : this function Module is required to build the field catalog.

Step 4 : Build a table for Events, which are used for firing both user commands and the system dependent events i.e. top of page, end of page etc.

Optional : Required if the report has custom buttons, interactive properties etc or you need to display something at the top of page or end of page sections.

Continued to next slide…

IBM Global Business Services

© IBM Corporation 201310 Dec-2008Overview of ABAP List Viewer (ALV) |

Major Steps to construct an ALV Report (Contd.)

Step 5 : Build the Layout for report display.

Step 6 : Get the Selection Screen information in the report output. Optional : Required only if you need to display selection screen values in the report

output.

Step 7 : Specify the Sorting and/or Subtotaling of the basic list. Optional : Required when sorting and/or subtotaling is required for some columns in

the report output.

Step 8 : Prepare the final internal table that needs to be passed to the ALV function module and display report output, using the following ALV functions modules:

REUSE_ALV_LIST_DISPLAY

Or

REUSE_ALV_GRID_DISPLAY

IBM Global Business Services

© IBM Corporation 201311 Dec-2008Overview of ABAP List Viewer (ALV) |

Step 1: Data Declaration

SAP Standard type pools: SLIS , KKBLO .

SAP Standard tables types taken from the type pools are: SLIS_LAYOUT_ALV ,SLIS_T_FIELDCAT_ALV,SLIS_T_LISTHEADER,SLIS_T_EVENT,SLIS_SELFIELD.

Internal tables to be used in the program declared based on the above table types:DATA: I_LAYOUT TYPE SLIS_LAYOUT_ALV,

I_FIELDTAB TYPE SLIS_T_FIELDCAT_ALV, I_HEADING TYPE SLIS_T_LISTHEADER, I_EVENTS TYPE SLIS_T_EVENT. TYPES: KKBLO_SELFIELD TYPE SLIS_SELFIELD.

IBM Global Business Services

© IBM Corporation 201312 Dec-2008Overview of ABAP List Viewer (ALV) |

CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'

* EXPORTING

I_SAVE = Variant save condition ( A=all, U = user-specific )

CHANGING

cs_variant = Internal table containing the program name ( and the default variant: Optional )

* EXCEPTIONS

* WRONG_INPUT = 1

* NOT_FOUND = 2

* PROGRAM_ERROR = 3

* OTHERS = 4.

.

Step 2: Selecting the Variant for initial list display (Default Variant).

IBM Global Business Services

© IBM Corporation 201313 Dec-2008Overview of ABAP List Viewer (ALV) |

ALV Function Modules : REUSE_ALV_VARIANT_F4

CALL FUNCTION 'REUSE_ALV_VARIANT_F4'

EXPORTING

is_variant =

* I_TABNAME_HEADER =

* I_TABNAME_ITEM =

* IT_DEFAULT_FIELDCAT =

* I_SAVE = ' '

* I_DISPLAY_VIA_GRID = ' '

* IMPORTING

* E_EXIT =

* ES_VARIANT =

* EXCEPTIONS

* NOT_FOUND = 1

* PROGRAM_ERROR = 2

* OTHERS = 3.

IBM Global Business Services

© IBM Corporation 201314 Dec-2008Overview of ABAP List Viewer (ALV) |

CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'

* EXPORTING

* I_SAVE = ' '

CHANGING

cs_variant =

* EXCEPTIONS

* WRONG_INPUT = 1

* NOT_FOUND = 2

* PROGRAM_ERROR = 3

* OTHERS = 4.

ALV Function Modules : REUSE_ALV_VARIANT_EXISTENCE

IBM Global Business Services

© IBM Corporation 201315 Dec-2008Overview of ABAP List Viewer (ALV) |

Step 3: Defining output characteristics: preparing display Field-catalog

A field catalog is prepared using the internal table (I_FIELDCAT) of type SLIS_T_FIELDCAT_ALV.

The field catalog for the output table is built-up in the caller's coding. The build-up can be completely or partially automated by calling the REUSE_ALV_FIELDCATALOG_MERGE module.

Step 3 continued …….

IBM Global Business Services

© IBM Corporation 201316 Dec-2008Overview of ABAP List Viewer (ALV) |

Step 3: Defining output characteristics: preparing display Field-catalog (Contd.)

A field catalog is prepared using the internal table (I_FIELDCAT) of type SLIS_T_FIELDCAT_ALV.

The field catalog for the output table is built-up in the caller's coding. The build-up can be completely or partially automated by calling the REUSE_ALV_FIELDCATALOG_MERGE module.

IBM Global Business Services

© IBM Corporation 201317 Dec-2008Overview of ABAP List Viewer (ALV) |

Specifying attributes for fields in Field Catalog

All the values entered in the catalog is specific to the particular field whose name is entered in the field FIELDNAME of the field catalog structure. The name of the table is also entered in the corresponding Fieldname TABNAME of the structure.

Some important attributes that can be defined for a field are: Col_pos (column position)

Fieldname (field name)

Tabname (internal output table)

Ref_fieldname (reference field name)

Ref_tabname (reference table/structure field name

Link to currency unit

Cfieldname (currency unit field name)

Ctabname (internal currency unit field output table)

IBM Global Business Services

© IBM Corporation 201318 Dec-2008Overview of ABAP List Viewer (ALV) |

Specifying attributes for fields in Field Catalog (Contd.)

Link to measurement unit

Qfieldname (measurement unit field name)

Qtabname (internal measurement unit field output table)

Outputlen (column width)

Key (key column)

No_out (field in field list)

Emphasize (highlight columns in color)

Hotspot (column as hotspot)

IBM Global Business Services

© IBM Corporation 201319 Dec-2008Overview of ABAP List Viewer (ALV) |

Specifying attributes for fields in Field Catalog (Contd.)

Fix_column (fix column)

Do_sum (sum over column)

No_sum (sums forbidden)

Icon

Just (justification)

Lzero (leading zeros)

No_sign (no +/- sign)

Edit_mask (field formatting)

The following parameters are used for customizing the texts in the heading of the output of the columns.

Seltext_l (long field label)

Seltext_m (medium field label)

Seltext_s (short field label)

IBM Global Business Services

© IBM Corporation 201320 Dec-2008Overview of ABAP List Viewer (ALV) |

Step 4: Build a table for Events

*Internal Table needed for eventsDATA: i_events TYPE slis_t_event. *Calling Function module to populate table with possible events CALL FUNCTION 'REUSE_ALV_EVENTS_GET' EXPORTING i_list_type = 0 IMPORTING et_events = i_events EXCEPTIONS list_type_wrong = 1 OTHERS = 2.

SORT i_events BY name.

Continued to next page…

IBM Global Business Services

© IBM Corporation 201321 Dec-2008Overview of ABAP List Viewer (ALV) |

Step 4: Build a table for Events (Contd.)

SORT i_events BY name.

*Reading events table READ TABLE i_events into wa_events WITH KEY name = 'TOP_OF_PAGE' BINARY SEARCH. IF sy-subrc IS INITIAL.*Assign event name to variable MOVE 'TOP_OF_PAGE' TO wa_events-form. MODIFY i_events from wa_events INDEX sy-tabix. ENDIF.

form TOP_OF_PAGE call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting it_list_commentary = heading[] exceptions others = 1. endform.

IBM Global Business Services

© IBM Corporation 201322 Dec-2008Overview of ABAP List Viewer (ALV) |

Step 5: Build the Layout for report display

A layout is build for the report output description USING the internal table for Layout (I_LAYOUT).

The layout parameters are described under the following heads: Display options

Exceptions

Totals

Interaction

Detail screen

Color

Other

IBM Global Business Services

© IBM Corporation 201323 Dec-2008Overview of ABAP List Viewer (ALV) |

Preparing the Layout (Contd.)

DATA: st_layout TYPE slis_layout_alv, " ALV Layout

st_layout-box_fieldname = 'BOX'. " Box Fieldname st_layout-get_selinfos = 'X'. " Get info of select records st_layout-colwidth_optimize = 'X'. " To optimize coloumn width st_layout-no_keyfix = 'X'. " To scroll Key fields

IBM Global Business Services

© IBM Corporation 201324 Dec-2008Overview of ABAP List Viewer (ALV) |

Step 6 : Get the Selection Screen information in the report output.

For this you need to set the parameter LAYOUT-GET_SELINFOS of the Layout structure

If the calling program is a report with an ABAP/4 selection screen, setting this parameter makes ALV read the selection screen again. If the selections are read successfully, a pushbutton, via which the user can call a popup which lists the report selections in a simple form, becomes active on the results list output by ALV.

IBM Global Business Services

© IBM Corporation 201325 Dec-2008Overview of ABAP List Viewer (ALV) |

Step 7 : Specify the Sorting and/or Subtotaling of the basic list.

The Table IT_SORT is populated with the sort criteria for the different fields.

The caller specifies the Sorting and/or Subtotaling of the basic list in the internal table IT_SORT.

This internal table has the following fields: spos : Sort sequence

fieldname : Internal output table field name

tabname : Only relevant for hierarchical-sequential lists. Name of the internal output table.

up : 'X' = sort in ascending order

down : 'X' = sort in descending order

subtot : 'X' = subtotal at group value change

group : '* ' = new page at group value change ,'UL' = underline at group value change

IBM Global Business Services

© IBM Corporation 201326 Dec-2008Overview of ABAP List Viewer (ALV) |

Step 8 : Display the Report output

Finally display report output, using the following ALV functions modules:

REUSE_ALV_LIST_DISPLAY

OR

REUSE_ALV_GRID_DISPLAY

IBM Global Business Services

© IBM Corporation 201327 Dec-2008Overview of ABAP List Viewer (ALV) |

Display ALV List

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY' EXPORTING I_CALLBACK_PROGRAM = WS_REPNAME I_STRUCTURE_NAME = Internal output table field name IS_LAYOUT = I_LAYOUT IT_FIELDCAT = I_FIELDTAB I_DEFAULT = 'A' I_SAVE = 'A' IS_VARIANT = 'X' IT_EVENTS = I_EVENTS[] IT_SORT = I_SORT IS_SEL_HIDE = I_SELINFO TABLES T_OUTTAB = Internal output table field name.

IBM Global Business Services

© IBM Corporation 201328 Dec-2008Overview of ABAP List Viewer (ALV) |

ALV Function Modules : Important Parameters

IMPORTING

I_CALLBACK_PROGRAM

I_CALLBACK_USER_COMMAND

I_STRUCTURE_NAME

IS_LAYOUT

IT_FIELDCAT

IT_EXCLUDING

IT_SPECIAL_GROUPS

IT_SORT

IT_FILTER

IS_SEL_HIDE

I_DEFAULT

I_SAVE

IS_VARIANT

IS_PRINT

RE

US

E_A

LV

_LIS

T_D

ISP

LA

Y

RE

US

E_A

LV

_GR

ID_D

ISP

LA

Y

EXPORTING

E_EXIT_CAUSED_BY_CALLER

ES_EXIT_CAUSED_BY_USER

TABLES

T_OUTTAB

IBM Global Business Services

© IBM Corporation 201329 Dec-2008Overview of ABAP List Viewer (ALV) |

REPORT Y_DEMO_ALV_LIST NO STANDARD PAGE HEADING.

* Data to be displayed

DATA: I_SFLIGHT TYPE STANDARD TABLE OF SFLIGHT.

 

* Selection

SELECT * FROM SFLIGHT INTO TABLE I_SFLIGHT.

 

* Call ABAP List Viewer (ALV)

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_STRUCTURE_NAME = 'SFLIGHT'

TABLES

T_OUTTAB = I_SFLIGHT.

Simple Program Walkthrough : REUSE_ALV_LIST_DISPLAY

IBM Global Business Services

© IBM Corporation 201330 Dec-2008Overview of ABAP List Viewer (ALV) |

Result: REUSE_ALV_LIST_DISPLAY

IBM Global Business Services

© IBM Corporation 201331 Dec-2008Overview of ABAP List Viewer (ALV) |

Demonstration

Creation of a simple ALV list report using the function module REUSE_ALV_LIST_DISPLAY.

IBM Global Business Services

© IBM Corporation 201332 Dec-2008Overview of ABAP List Viewer (ALV) |

Practice

Creation of a simple ALV list report using the function module REUSE_ALV_LIST_DISPLAY.

IBM Global Business Services

© IBM Corporation 201333 Dec-2008Overview of ABAP List Viewer (ALV) |

REPORT Y_DEMO_ALV_GRID .

* Data to be displayed

DATA: I_SFLIGHT TYPE STANDARD TABLE OF SFLIGHT.

* Selection

SELECT * FROM SFLIGHT INTO TABLE I_SFLIGHT.

* Call ABAP List Viewer (ALV)

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_STRUCTURE_NAME = 'SFLIGHT'

TABLES

T_OUTTAB = I_SFLIGHT.

Simple Program Walkthrough: REUSE_ALV_GRID_DISPLAY

IBM Global Business Services

© IBM Corporation 201334 Dec-2008Overview of ABAP List Viewer (ALV) |

Result : REUSE_ALV_GRID_DISPLAY

IBM Global Business Services

© IBM Corporation 201335 Dec-2008Overview of ABAP List Viewer (ALV) |

Demonstration

Create a simple ALV grid report using the function module REUSE_ALV_GRID_DISPLAY

IBM Global Business Services

© IBM Corporation 201336 Dec-2008Overview of ABAP List Viewer (ALV) |

Practice

Create a simple ALV grid report using the function module REUSE_ALV_GRID_DISPLAY

IBM Global Business Services

© IBM Corporation 201337 Dec-2008Overview of ABAP List Viewer (ALV) |

In the PARAMETERS give I_GRID_TITLE = 'Flight Information‘ and Call the function 'REUSE_ALV_GRID_DISPLAY'

Title

Simple Program Walkthrough:Including Title in the Report for GRID DISPLAY

IBM Global Business Services

© IBM Corporation 201338 Dec-2008Overview of ABAP List Viewer (ALV) |

Simple Program Walkthrough: Using FIELDCAT to Position Columns

DATA: i_fcat TYPE slis_t_fieldcat_alv, wa_fcat TYPE slis_fieldcat_alv.

wa_fcat-tabname = 'I_SFLIGHT'.wa_fcat-col_pos = '1'.wa_fcat-fieldname = 'CARRID'.append wa_fcat to i_fcat.

wa_fcat-col_pos = '2'.wa_fcat-fieldname = 'FLDATE'.append wa_fcat to i_fcat.

wa_fcat-col_pos = '3'.wa_fcat-fieldname = 'CONNID'.append wa_fcat to i_fcat.

wa_fcat-col_pos = '4'.wa_fcat-fieldname = 'PRICE'.APPEND wa_fcat TO i_fcat.

wa_fcat-fieldname = 'CURRENCY'.wa_fcat-no_out = 'X'.wa_fcat-cfieldname = ‘CURRENCY’.Wa_fcat-ctabname = ‘SFLIGHT’.APPEND wa_fcat TO i_fcat.

wa_fcat-fieldname = 'PLANETYPE'.wa_fcat-no_out = 'X'.APPEND wa_fcat TO i_fcat.

In the function module pass :

IT_FIELDCAT = i_fcat

IBM Global Business Services

© IBM Corporation 201339 Dec-2008Overview of ABAP List Viewer (ALV) |

Result :

CARRID

PRICE

CONNID

FLDATE

IBM Global Business Services

© IBM Corporation 201340 Dec-2008Overview of ABAP List Viewer (ALV) |

Demonstration

Creating a simple ALV report by populating the field catalog table, using the function module REUSE_ALV_GRID_DISPLAY.

IBM Global Business Services

© IBM Corporation 201341 Dec-2008Overview of ABAP List Viewer (ALV) |

Practice

Creating a simple ALV report by populating the field catalog table, using the function module REUSE_ALV_GRID_DISPLAY.

IBM Global Business Services

© IBM Corporation 201342 Dec-2008Overview of ABAP List Viewer (ALV) |

1. Go to Transaction SE41(Menu Painter).

2. Give the Program as SAPLKKBL and the Status as STANDARD.

3. Now copy the STANDARD status of the Program SAPLKKBL to a customized status ‘YALVGRID’ for Program Y_DEMO_ALV_GRID.

4. Go to the Program Y_DEMO_ALV_GRID and create a Subroutine

SET_PF_STATUS using rt_extab TYPE SLIS_T_EXTAB for setting the standard ALV PF-STATUS to the customized PF-STATUS ‘YALVGRID’.

FORM set_pf_status USING p_rt_extab TYPE slis_t_extab.

SET PF-STATUS 'YALVGRID'.

ENDFORM. " set_pf_status

Simple Program Walkthrough: Changing the Default Status Bar of ALV

IBM Global Business Services

© IBM Corporation 201343 Dec-2008Overview of ABAP List Viewer (ALV) |

Simple Program Walkthrough: Changing the Default Status Bar of ALV (Contd.)

IBM Global Business Services

© IBM Corporation 201344 Dec-2008Overview of ABAP List Viewer (ALV) |

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_STRUCTURE_NAME = 'SFLIGHT'

I_CALLBACK_PROGRAM = 'Y_DEMO_ALV_GRID'

I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'

IT_FIELDCAT = i_fcat

I_GRID_TITLE = 'Flight Information'

TABLES

T_OUTTAB = I_SFLIGHT.

Call the function module ‘REUSE_ALV_GRID_DISPLAY’ as:

Simple Program Walkthrough: Changing the Default Status Bar of ALV (Contd.)

IBM Global Business Services

© IBM Corporation 201345 Dec-2008Overview of ABAP List Viewer (ALV) |

Result : Changing the Default Status Bar of ALV (Contd.)

Custom Button for adding extra

functionality

IBM Global Business Services

© IBM Corporation 201346 Dec-2008Overview of ABAP List Viewer (ALV) |

Demonstration

Creating a simple ALV report by changing the default status bar, using the function module REUSE_ALV_GRID_DISPLAY.

IBM Global Business Services

© IBM Corporation 201347 Dec-2008Overview of ABAP List Viewer (ALV) |

Practice

Creating a simple ALV report by changing the default status bar, using the function module REUSE_ALV_GRID_DISPLAY.

IBM Global Business Services

© IBM Corporation 201348 Dec-2008Overview of ABAP List Viewer (ALV) |

Simple Program Walkthrough : Adding Function Codes

Create a Subroutine user_command USING v_ucomm TYPE sy-ucomm v_selfield TYPE slis_selfield.

During the Call to the function module ‘REUSE_ALV_GRID_DISPLAY’, add another parameter I_CALLBACK_USER_COMMAND = USER_COMMAND'.

Form user_command USING v_ucomm TYPE sy-ucomm

v_selfield TYPE slis_selfield

CASE v_ucomm.

WHEN ‘BACK”

*when back button is pressed – leave list

LEAVE LIST-PROCESSING.

ENDCASE.

ENDFORM.

IBM Global Business Services

© IBM Corporation 201349 Dec-2008Overview of ABAP List Viewer (ALV) |

Simple Program Walkthrough : Make some fields Editable

Make the field ‘PRICE’ editable by updating the field catalog.

wa_fcat-col_pos = '4'.

wa_fcat-fieldname = 'PRICE'.

wa_fcat-edit = 'X'.

append wa_fcat to i_fcat.

clear wa_fcat.

To make PRICE field editable

IBM Global Business Services

© IBM Corporation 201350 Dec-2008Overview of ABAP List Viewer (ALV) |

Result : Field Editable

IBM Global Business Services

© IBM Corporation 201351 Dec-2008Overview of ABAP List Viewer (ALV) |

Demonstration

Creating a simple ALV report by making one of its column editable, using the function module REUSE_ALV_GRID_DISPLAY.

IBM Global Business Services

© IBM Corporation 201352 Dec-2008Overview of ABAP List Viewer (ALV) |

Practice

Creating a simple ALV report by making one of its column editable, using the function module REUSE_ALV_GRID_DISPLAY.

IBM Global Business Services

© IBM Corporation 201353 Dec-2008Overview of ABAP List Viewer (ALV) |

Summary

ABAP List Viewer (ALV) is a simple, user friendly and better looking reporting tool as compared to the usage of write statements in a conventional / interactive report.

ALV report has several inbuilt User Friendly properties as:Filtering / Sorting

Layout Change / Save

Summation, Download to excel, E-Mail

Data can be open for input / change etc.

The main ALV Function Modules are:REUSE_ALV_LIST_DISPLAY

REUSE_ALV_GRID_DISPLAY

REUSE_ALV_FIELDCATALOG_MERGE

Status STANDARD of the main program SAPLKKBL is copied and then changed to create a new customized GUI status for any ALV report.

IBM Global Business Services

© IBM Corporation 201354 Dec-2008Overview of ABAP List Viewer (ALV) |

Questions

What is ALV ?

What are the main differences between an ALV report and a classical report?

What are the main function modules used to create an ALV List?

What are the main differences between ALV list and ALV grid?

What are the different ways to populate the FIELD CATALOG table?

How can we change the default status bar of an ALV List?

How can we handle custom function code in ALV ?

How can we make a certain columns of an ALV list editable?