Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ALV GRID / LIST

Former Member
0 Likes
2,985

what is alv grid programmin ? or alv list programmin ? Can any one tell me full form of alv ?

9 REPLIES 9
Read only

Former Member
0 Likes
1,338

ALV full form = s(A)p (L)ist (V)iewer

To know more about ALV

http://help.sap.com/saphelp_nw70/helpdata/en/bc/e5eb40c4f8712ae10000000a155106/frameset.htm

Read only

Former Member
0 Likes
1,338

Hi,

ALV is ABAP LIST VIEWER

Goto SE38 transaction & type BCALV* and click F4.

You will get a list of sample ALV programs. Execute them to check the output.

For more details:

http://www.sap-img.com/abap/what-is-alv-programming.htm

Best regards,

Prashant

Read only

Former Member
0 Likes
1,338

hi,

ALV meand ABAP List Viewer.

It using for outputing data in table form (means in column and row).

I am giving u example for GRID ALV.

LIST and GRID almost same but with GRID u can make ur output editable.

&----


*& Report ZALV_DS

*&

&----


*&

*&

&----


REPORT zalv_ds LINE-SIZE 35.

TYPE-POOLS:slis.

TABLES:mara,

makt,

marc.

DATA:BEGIN OF itab OCCURS 0,

matnr LIKE mara-matnr,

maktx LIKE makt-maktx,

werks LIKE marc-werks,

mtart LIKE mara-mtart,

matkl LIKE mara-matkl,

meins LIKE mara-meins,

ntgew LIKE mara-ntgew,

  • rowcolor(4) TYPE c,

cellcolors TYPE lvc_t_scol,

END OF itab.

DATA:t_fcat TYPE slis_t_fieldcat_alv,

t_eve TYPE slis_t_event.

DATA : st_layout TYPE slis_layout_alv.

SELECTION-SCREEN:BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.

SELECT-OPTIONS:mat FOR mara-matnr. " no intervals no-extension.

*PARAMETERS:mat LIKE mara-matnr.

SELECTION-SCREEN:END OF BLOCK blk1.

INITIALIZATION.

PERFORM build_cata USING t_fcat.

PERFORM build_event.

START-OF-SELECTION.

PERFORM data_retrieval.

PERFORM display_data.

&----


*& Form build_cata

&----


  • text

----


  • -->TEMP_FCAT text

----


FORM build_cata USING temp_fcat TYPE slis_t_fieldcat_alv.

sy-tvar0 = sy-uname.

WRITE sy-datum TO sy-tvar1.

DATA:wa_fcat TYPE slis_fieldcat_alv.

wa_fcat-tabname = 'ITAB'.

wa_fcat-fieldname = 'MATNR'.

wa_fcat-seltext_m = 'Material'.

  • wa_fcat-key = ''. "To color e column

APPEND wa_fcat TO temp_fcat.

wa_fcat-tabname = 'ITAB'.

wa_fcat-fieldname = 'MAKTX'.

wa_fcat-seltext_m = 'Description'.

wa_fcat-fix_column = 'x'.

  • wa_fcat-key = ''.

APPEND wa_fcat TO temp_fcat.

wa_fcat-tabname = 'ITAB'.

wa_fcat-fieldname = 'WERKS'.

wa_fcat-seltext_m = 'Plant'.

  • wa_fcat-fix_column = 'x'.

APPEND wa_fcat TO temp_fcat.

wa_fcat-tabname = 'ITAB'.

wa_fcat-fieldname = 'MTART'.

wa_fcat-seltext_m = 'Type'.

APPEND wa_fcat TO temp_fcat.

wa_fcat-tabname = 'ITAB'.

wa_fcat-fieldname = 'MATKL'.

wa_fcat-seltext_m = 'Group'.

APPEND wa_fcat TO temp_fcat.

wa_fcat-tabname = 'ITAB'.

wa_fcat-fieldname = 'MEINS'.

wa_fcat-seltext_m = 'Measurement Unit'.

APPEND wa_fcat TO temp_fcat.

wa_fcat-tabname = 'ITAB'.

wa_fcat-fieldname = 'NTGEW'.

wa_fcat-seltext_m = 'Net Value'.

APPEND wa_fcat TO temp_fcat.

ENDFORM. "build_cata

&----


*& Form build_event

&----


  • text

----


FORM build_event.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = t_eve

EXCEPTIONS

list_type_wrong = 1

OTHERS = 2.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. "build_event

&----


*& Form data_retrieval

&----


  • text

----


FORM data_retrieval.

SELECT maramatnr maramtart maramatkl marameins mara~ntgew

maktmaktx marcwerks

INTO CORRESPONDING FIELDS OF TABLE itab

FROM mara INNER JOIN makt ON

maramatnr = maktmatnr

INNER JOIN marc ON

maramatnr = marcmatnr

WHERE mara~matnr IN mat.

SORT itab BY matnr.

DELETE ADJACENT DUPLICATES FROM itab.

ENDFORM. "data_retrieval

&----


*& Form display_data

&----


  • text

----


FORM display_data.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = 'ZALV_DS'

i_save = 'A'

it_fieldcat = t_fcat

it_events = t_eve

TABLES

t_outtab = itab

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. "display_data

For ALV List u need to call REUSE_ALV_LIST_DISPLAY instead of REUSE_ALV_GRID_DISPLAY.

Hope it will b useful.

Reward if useful.

Read only

Former Member
0 Likes
1,338

The ALV Grid Control (ALV = SAP List Viewer) is a flexible tool for displaying lists. The tool provides common list operations as generic functions and can be enhanced by self-defined options. This allows you to use the ALV Grid Control in a large range of application programs.

In SAP development projects, the ALV Grid Control is also used as a tool for changing and creating tables. However, this functionality is currently only used in pilot projects and has not yet been released for customers.

The following graphic shows a list displayed with the ALV Grid Control in a dialog box:

As the user sees it, the ALV Grid Control consists of a toolbar, a title and the output table displayed in a grid control. If required, the user can hide the title and the standard functions of the toolbar.

Implementation Considerations

ALV Object Model

The ALV family consists of three ALV tools: the simple, two-dimensional table (including the Grid Control variant), the hierarchical-sequential list and the tree structure. For all of those you can now use thenew, unified, object-oriented API.

The old API can still be used, however we recommend using the new, unified ALV object model for programming all of your ALV applications. So, even if you plan to use the ALV Grid Control, you can now use the simplified new API.

ALV Grid Control

The ALV Grid Control uses controls technology to achieve state-of-the-art on-screen display. Like all control wrappers, the ALV Grid Control offers methods through a global class in the system which can be used to affect its behavior.

SAP does not guarantee that the methods, events and attributes of this class that are not public will remain unchanged or will be available in future releases. This is why you should not derive the class to access protected objects of the class. Using these objects makes it more difficult to upgrade to subsequent releases.

As a result of using ABAP Objects, lists are displayed through an ALV instance, and programmers make use of the event management of ABAP Objects.

Integration

Controls are software components that are installed on the local PC. In order to communicate with these components, all control wrappers use methods of the Control Framework. In this context, the ALV Grid Control is a special case as it uses a control that is already wrapped: the grid control. For the programmer, this can eliminate certain steps in the process of event management for controls.

The ALV Grid Control uses the SAP context menu to integrate standard functions. This menu can be customized to meet individual requirements.

This documentation focuses on using the ALV Grid Control in the SAP GUI for the WindowsäEnvironment or the SAP GUI for the Javaä Environment. It is also possible to display the ALV Grid Control in the Web.

Features

This is an overview of the functions provided by the ALV Grid Control. You can:

· Display non-hierarchical lists consistently with a modern design

· Use typical list functions - such as sorting and filtering - without extra programming effort

· Adapt predefined list functions and their enhancements

· Program responses to user actions (such as double-clicking a line) individually

· Connect to the report/report interface.

For practical examples of the ALV Grid Control, see development class SLIS.

Constraints

The ALV Grid Control does not allow you to display block or hierarchical lists. Currently, simple lists can be displayed in single-line format only. However, users can define multiple-line format in the print preview and print the list as such.

At the moment, you cannot use tables that have object references. Similarly, the only deep structures that can be used are those described in the documentation covering the extended functionality of the ALV Grid Control (such as, structures for drag-and-drop).

SAP List Viewer (ALV): Classic :

The SAP List Viewer unifies and simplifies the use of lists in the R/3 System. A uniform user interface and list format is available for all lists. This prevents redundant functions.

The SAP List Viewer can be used to view both single-level lists and multilevel sequential lists.

Single-level lists contain any number of lines that have no hierarchical relationship to each other.

Multilevel sequential lists consist of any number of lines that have two hierarchical levels. Multilevel lists have header rows and item rows; the item rows are subordinate to the header rows. For each header row there can be any number of subordinate item rows.

You can view subtotals and totals rows in both single-level lists and multilevel sequential lists.

The SAP List Viewer is used in Controlling for reports such as the following:

Reports from cost centers and business processes

Actual line item reports from cost centers and business processes

Commitment line item reports

Plan line item reports from cost centers, orders, business processes, cost objects

Budget reports

Cycle reports

Order selection (CO-PC)

Flexible itemization (CO-PC)

Features

Not all lists in the SAP R/3 components use the full range of functions available in the SAP List Viewer. Some lists in the R/3 System components offer special functions that extend beyond the normal range of the SAP List Viewer.

This documentation covers all the functions of the SAP List Viewer. The description of the lists in the applications includes all of the functions available in the SAP List Viewer as well as the additional functions.

Navigation

The SAP List Viewer unifies and simplifies the use of lists in the R/3 System. A uniform user interface and list format is available for all lists. This prevents redundant functions.

The SAP List Viewer can be used to view both single-level lists and multilevel sequential lists.

Single-level lists contain any number of lines that have no hierarchical relationship to each other.

Multilevel sequential lists consist of any number of lines that have two hierarchical levels. Multilevel lists have header rows and item rows; the item rows are subordinate to the header rows. For each header row there can be any number of subordinate item rows.

You can view subtotals and totals rows in both single-level lists and multilevel sequential lists.

The SAP List Viewer is used in Controlling for reports such as the following:

Reports from cost centers and business processes

Actual line item reports from cost centers and business processes

Commitment line item reports

Plan line item reports from cost centers, orders, business processes, cost objects

Budget reports

Cycle reports

Order selection (CO-PC)

Flexible itemization (CO-PC)

Features

Not all lists in the SAP R/3 components use the full range of functions available in the SAP List Viewer. Some lists in the R/3 System components offer special functions that extend beyond the normal range of the SAP List Viewer.

This documentation covers all the functions of the SAP List Viewer. The description of the lists in the applications includes all of the functions available in the SAP List Viewer as well as the additional functions.

Navigation

Navigating Within the List

Detail

Choosing Detail

Sort

Sorting in Ascending/Descending Order

ABC Analysis

Select

Selecting and Deselecting Rows

Defining Exceptions

Filter

Setting and Deleting Filters

Totaling

Displaying and Deleting Sums

Creating Subtotals

Choosing Summation Levels

Defining the Breakdown of the Summation Levels

Status Display

Displaying the List Status

Columns

Optimizing the Column Width

Freezing to Columns and Unfreezing Columns

Layouts

Choosing Layouts

Changing Layouts

Saving Layouts

Layout Management

Basic List

Displaying the Basic List

Find

Finding Terms

Print

Printing Lists

Sending

Sending the List as a Document

Exporting

Spreadsheet

Text Processing

Transferring a List to a Local File

reward points if helpful................

Read only

Former Member
0 Likes
1,338

Hi Dipankar,

In Simpe list programming u must have noticed that u had to do the formatting of the list etc explicitly in the programming by specifying the positions, use write statements etc.Alv makes the creation of lists a lot more simpler. For u to explore more on this..please send me ur mail id to this id silentstring@gmail.com I will send some good docs on both alv list and grid.

Regards,

Simy Abraham.

Read only

Former Member
0 Likes
1,338

Hi Dipankar,

ALV is application list viewer.When u want data from a table to be displayed acc. to your needs like no of columns,headings of each column ,that is done through ALV.Below is simple code of ALV which will make you understand it better.Just go through it.Run it on your system and you will understand it.

Reward if helpful.

REPORT ZHALV.

tables:ekpo.

data itab_ekpo type ekpo occurs 100 with header line.

types: begin of itab_new,

ebeln type ekpo-ebeln,

matnr type ekpo-matnr,

netpr type ekpo-netpr,

end of itab_new.

data itab1 TYPE STANDARD TABLE OF itab_new initial size 0.

type-pools: slis.

DATA: l_layout TYPE slis_layout_alv.

DATA : l_sort TYPE slis_t_sortinfo_alv,

w_sort TYPE slis_sortinfo_alv.

DATA: lt_fieldcat TYPE slis_t_fieldcat_alv, lf_fieldcat TYPE slis_fieldcat_alv.

DATA: ws_repid TYPE sy-repid VALUE 'ZHALV'.

selection-screen Begin of block block1 with frame title text-111.

select-options : S_EBELN for EKPO-EBELN.

selection-screen end of block block1.

INITIALIZATION.

start-of-selection.

select ebeln matnr netpr from ekpo into table itab1 up to 10 rows WHERE EBELN IN S_EBELN.

PERFORM build_fieldcatalog.

PERFORM build_layout.

PERFORM GET_DETAILS.

PERFORM sort_layout.

end-of-selection.

&----


*& Form build_fieldcatalog

&----


  • text

----


FORM build_fieldcatalog .

  • PURCHASING DOCUMENT NUMBER

CLEAR lf_fieldcat.

lf_fieldcat-fieldname = 'EBELN'.

lf_fieldcat-ref_tabname = 'EKKO'.

lf_fieldcat-ref_fieldname = 'EBELN'.

APPEND lf_fieldcat TO lt_fieldcat.

  • MATERIAL NUMBER

CLEAR lf_fieldcat.

lf_fieldcat-fieldname = 'MATNR'.

lf_fieldcat-ref_tabname = 'EKPO'.

lf_fieldcat-ref_fieldname = 'MATNR'.

APPEND lf_fieldcat TO lt_fieldcat.

  • NET PRICE IN PURCHASING DOCUMENT

CLEAR lf_fieldcat.

lf_fieldcat-fieldname = 'NETPR'.

lf_fieldcat-ref_tabname = 'EKPO'.

lf_fieldcat-ref_fieldname = 'NETPR'.

  • lf_fieldcat-cfieldname = 'WAERS'.

lf_fieldcat-do_sum = 'X'.

APPEND lf_fieldcat TO lt_fieldcat.

ENDFORM. " build_fieldcatalog

&----


*& Form GET_DETAILS

&----


  • text

----


FORM GET_DETAILS.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = ws_repid

IT_FIELDCAT = lt_fieldcat

TABLES

T_OUTTAB = itab1

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

.

IF SY-SUBRC <> 0.

WRITE: 'SY-SUBRC: ', SY-SUBRC .

ENDIF.

ENDFORM. "GET_DETAILS

&----


*& Form build_layout

&----


  • text

----


FORM build_layout .

l_layout-colwidth_optimize = 'X'.

l_layout-zebra = 'X'.

l_layout-box_fieldname = 'CHK'.

l_layout-box_tabname = 'ITAB1' .

ENDFORM. " build_layout

FORM sort_layout .

CLEAR w_sort.

w_sort-fieldname = 'EBELN'.

w_sort-tabname = 'ITAB1'.

w_sort-spos = 1.

w_sort-up = 'X'.

w_sort-subtot = 'X'.

APPEND w_sort TO l_sort.

CLEAR w_sort.

w_sort-fieldname = 'EBELN'.

w_sort-tabname = 'ITAB1'.

w_sort-spos = 1.

w_sort-up = 'X'.

w_sort-subtot = 'X'.

APPEND w_sort TO l_sort.

ENDFORM. " sort_layout

Read only

Former Member
0 Likes
1,338

hI

<b>ALV (ABAP LIST VIEWER)</b>

ABAP LIST VIEWER (ALV) IS A SIMPLE , USER FRIENDLY AND BETTER LOOKING REPORTING TOOL AS COMPARED TO THE USAGE OF WRITE STSTEMENT IN A CONVENTIONAL / INTERACTIVE REPORT

SAP PROVIDED A SET OF ALV ( ABAP LIST VIEWER ) FUNCTION MODULES , WHICH CAN BE PUT INTO USE TO EMBEILISH THE OUTPUT OF A REPORT , THIS SET OF ALV FUNCTIONS IS USED TO ENHANCE THE READABILITY AND FUNCTIONALITY OF ANY REPORT OUTPUT

<b>ADAVANTAGES OF ALV</b>

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

PROGRAMING OVERHEAD OF MENTIONING EXACT POSITIONS INWRITE STATEMENT IS NOT NEEDED

LIST DISPLAY IS NORMAL REPORT DISPLAY

GRID REPORT DISPLAY ID DISPLAYED IN THE FORM OF GRIDS (BOXES)

<b>REWARD IF USEFULL</b>

Read only

Former Member
0 Likes
1,338

HI,

<b>ALV-Abap List Viewer/Application List Viewer/Advanced List Viewer/sAp List Viewer</b>

For all practical purposes, they are the same.

2. Some differences:

a) from abap coding point of view,

alv list is done with Function modules,

alv gris can also be done with FM,

but can also be done using OO concepts.

b) Alv grid (using oo concept) requires

designing the screen layout .

Hence, in one screen, we can show more

then one alv grid

(we cannot show more than

one alv list on one screen)

c) ALV grid uses ActiveX controls

present on the Presentation Server.

Hence, it consumes More Memory

on the presentation server.

d) ALV LIST is Display Only.

Whereas

ALV Grid Can Be made EDITABLE for entry purpose.

e) In alv grid, these options are possible,

but not in alv list.

without horizontal lines

without vertical lines

without cell merging during sorts

display total lines above the entries

ALV LIST Can be coded using only FMs

ALV GRID Can be coded using FMs and object oriented concepts

ALV LIST Can be displayed hieraicharlly

ALV GRID cannot be displayed hierarichally

for help in alv programming see this link

http://www.sap-img.com/abap/what-is-alv-programming.htm

http://www.sapdev.co.uk/reporting/alvhome.htm

rgds,

bharat.

Read only

hymavathi_oruganti
Active Contributor
0 Likes
1,338

alv grid looks like a database table in se11.

alv list and the print out of alv grid look similar