ALV Part1
ALV Part1
When displaying data, ALV (ABAP List Viewer) offers a more organized and user-
friendly method than utilizing write statements in ABAP. ALV is recommended for
the following reasons:
1. Flexibility: ALV provides a number of layout choices, including list, grid, and
tree layouts. Users are able to alter the arrangement to suit their tastes.
2. Sorting and Filtering: Without adding extra code, ALV enables users to quickly
and simply sort and filter data. This improves the application's usability.
4. Exporting Data: The built-in functionality of ALV allows for the exportation of
data to multiple formats, including Excel, PDF, and CSV. This feature is useful
when creating reports.
The format of the ALV output is specified in the field catalog. It has details
about the fields (columns) that will be shown, including field names,
descriptions, data types, and formatting choices.
You must tie the field catalog with the real data that will be shown in the
ALV after it has been created.
For presenting ALV output, there are various function modules available, each
with unique characteristics and functionalities:
a) REUSE_ALV_LIST_DISPLAY: The ALV output is shown in a straightforward
list manner by this function module. It works well for tabular data display.
These steps are crucial for configuring an ALV in an ABAP program because they
give the data binding and structure needed to produce the required output format.
Solution :-
Step 1 :- Go to ABAP Editor {SE38} and create a executable program.
Step 6 :- Write the select queries to fetch data from VBAK and VBAP table.
*************************************************
*Declaring the internal table and work area
DATA : lt_vbak type table of ty_vbak,
ls_vbak type ty_vbak,
lt_vbap type table of ty_vbap,
ls_vbap type ty_vbap,
lt_final type table of ty_final,
ls_final type ty_final,
lv_vbeln type vbeln_va.
***************
*Declaring a select option.
SELECT-OPTIONS : s_vbeln for lv_vbeln.
START-OF-SELECTION.
SELECT vbeln erdat erzet ernam vbtyp
from vbak into table lt_vbak
where vbeln in s_vbeln.
***************************************
*Call REUSE ALV fieldcatalog merge
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = 'ZAR_ORDER_DETAILS'
CHANGING
ct_fieldcat = lt_fieldcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
endif.
*****************
*End of Program
*****************************************************