0% found this document useful (0 votes)
37 views27 pages

Sap Abap

Uploaded by

Bhanu prakash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views27 pages

Sap Abap

Uploaded by

Bhanu prakash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 27

SAP-ABAP

z
z

ALV (ABAP LIST VIEWERS): -


ALV reports are mainly used to display the data in the form of
either grid format or list format with good look and feel.
The main advantages of ALV reports are:
a) Sort the list in descending order
b) Sort the list in Ascending order
c) Tables
d) Filtering
e) Down the list
f) Send an attachment
g) Word processing
h) Excel sheet
i) Change the layout
j) Graphics
k) Print previews
ALV is introduced from 4.6C version onwards.
ALV is used to display the data from internal table only.
z

Steps to work with ALV: -


1. Declare the final data internal table (which data we want to
display) and implement
the retrieving logic.
2. Prepare the field CatLog (about the display field) i.e.
1. Filed name
2. Column position
3. Column Heading
4. Colour
5. Hotspot

3. Call the ‘REUSE_ALV_GRID_DISPLAY’ function


module.
(OR)
CALL THE ‘RESUE_ALV_LIST_DISPLAY’ function
module.
z

Note: -
REUSE_ALV_GIRD_DISPLAY is the function module which
is used to display the output in a grid format.
REUSE_ALV_LIST_DISPLAY is the function module which
is used to display the output in a list format.
The input for the above two functions modules are two internal
tables.
1. Data internal table
2. Field CatLog internal table
z

Display the all sales documents details by using ALV.


Data IT_VBAP like table of VBAP.
Select * from VBAP into table IT_VBAP.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_STRUCTURE_NAME = 'VBAP'
TABLES
T_OUTTAB = IT_VBAP.
Whenever we are working with all the fields from any one of
the database table on structure, then we no need to prepare field
cat log internal table. We simply pass i_structure_name as data
base table name structure.
Note: - Here the function module picks the column headings
from the data element of each field and also display the fields in
the similar order of the fields in the table.
z

Note: -
In SLIS we have one type i.e. SLIS_T_FIELDCAT_ALV which
contains all the fields related to field CatLog internal table. So
we simply declare our internal table by referring this.
SLIS is the type group which contains all the types related to
ALV.
Note: -
Whenever we are referring any type under any type group then
we must include the type group name by using “type-pools”
keyword.
z

Function modules for developing ALV Reports


REUSE_ALV_GRID_DISPLAY _ Display ALV data in GRID
format
REUSE_ALV_LIST_DISPLAY _ Display ALV data in LIST
format
REUSE_ALV_COMMENTARY_WRITE _ Display TOP-OF-
PAGE, LOGO,
END-OF-LIST.
REUSE_ALV_FIELDCATELOG_MERGE_ Generate
field cat log automatically
REUSE_ALV_EVENTS_GET _ Display ALV Events
REUSE_ALV_HIERSEQ_LIST_DISPLAY_ Display
hierarchical ALV
REUSE_ALV_BLOCKED_LIST_DISPLAY _ Display
blocked ALV
z

List of ALV’s
ALV with structure
ALV with field cat log
ALV with layout options
ALV with field cat log merge
ALV with totals and sub totals
ALV with LOGO/ TOP OF PAGE / END OF LIST
Interactive ALV
Interactive ALV by calling a transaction
hierarchical ALV
Blocked ALV
ALV with Structures
Business Requirement
Develop a material master Report which displays all the fields
z

STEPS
Declare an internal table and work area for MARA table
Write an select statement to fetch the data
Call the function module REUSE_ALV_GRID_DISPLAY and
specify the Below parameters
Structure Name
Program Name
Itab Name
z

Field Cat log:


It is an IT. which contains the list of the fields along with field
properties to be displayed
in ALV Report
The properties/options are:
1. COL_POS = 1.
2. FIELD NAME_ Specifies the name of the field
3. TABLE NAME_ Specifies the name of the internal table
4. SELTEXT_S _ Specifies short
SELTEXT_L _ Specifies Long
SELTEXT_M_ Specifies medium
5. DO_SUM = ‘X’ _ For grand totals
z
6. SUBTOT = ‘X’ _ Sub totals to be calculated
7. EDIT = ‘X’ _ Field can be editable
8. EMPHASIZE = ‘CXYZ’ _ Specifies the Colour to the
fields
C – Indicates colour
X – Colour Numbers
Y – Background colour – 1 On BG colour
0 off BG colour
Z – Font colour 1 On Font colour
0 Off font colour
9. REFERENCE TABLENAME
REFERENCE FIELDNAME _ To copy all the properties
from data dictionary to a field catalog field.
10. KEY _ Specify the key field
11. HOTSPOT _ For selection
12. NO_OUT _ Field will not be displayed in output
z

ALV with field catalog merge


We can create a field catalog either manually or by
automatically
REUSE_ALV_FIELDCATELOG_MERGE is the function
module which is
used to create field catalog automatically
But this is obsolete because, the function module uses the old
syntax for
declaring internal tables
I.e. the internal table should be created as below and all the
fields
in the internal table must be declared using LIKE statement not
the TYPE statement.
z ALV with Layout
Layout:
It is a structure or work area which is used to decorate or
embellish the output of ALV Report
Layout contains the few properties to decorate the ALV output
It is a structure or work area which is used to decorate or
embellish
the output of ALV Report
Layout contains the few properties to decorate the ALV output
The properties are,
1. ZEEBRA = ‘X’. Displays ALV with alternative
colours
2. COLWIDTH-OPTIMIZE = ‘X’. Each column in ALV
o/p displayed with maximum length, to display the entire
data.
3. EDIT = ‘X’. All the columns are displayed
in editable mode.
4. NO_VLINE = ‘X’. Vertical lines will not be
displayed
5. NO_HLINE = ‘X’. Horizontal lines will not be
displayed
z

ALV Reports with Totals


The totals can be calculated in two ways
By clicking on Σ ALV output field.
By programmatically setting the option
DO_SUM = ‘X’, for an currency/quantity field in FCAT
WA_FCAT-COL_POS = ’5’.
WA_FCAT-FIELDNAME = 'NETWR'.
WA_FCAT-SELTEXT_M = 'NETPRICE‘.
WA_FCAT-DO_SUM = 'X'.
APPEND WA_FCAT TO I_FCAT.
z

ALV Reports with and sub totals


To calculate sub totals, we need to find out on what basis (field
name) the sub totals need to be calculated.
We need to sort the field in ascending order.
Then we need to set the property
SUBTOT = ‘X’ in FCAT.
 SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 26
WA_SORT-spos = ‘1’.
WA_SORT-FIELDNAME = 'VBELN'.
WA_SORT-UP = 'X'.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO I_SORT.
Steps :
z Declare the internal table and work area for the sorting
DATA : I_SORT TYPE SLIS_T_SORTINFO_ALV.
DATA : WA_SORT TYPE SLIS_SORTINFO_ALV.
Specify the field and subtot = ‘X’ .
WA_SORT-FIELDNAME = 'VBELN'.
 SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 27
WA_SORT-UP = 'X'.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO I_SORT.
Call the function module and send the SORT internal table as
exporting parameters to IT_SORT
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = I_FCAT
IT_SORT = I_SORT
TABLES
 SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 28
T_OUTTAB = I_VBAP.
z EVENTS IN ALV
In ALV, events are handle through ‘sub-routines’ (form, end
form)
1. Top_of_page
2. Top_of_list
3. End_of_page
4. End_of_list
5. User command
6. Pf_status_set

Top_of_page: -
It’s an event which is triggered at the top of each page.
Top_of_list: -
It’s an event which is triggered at the top of displayed output
list.
End_of_page: -
It’s an event which is triggered at the end of each page.
End_of_list: -
It’s an event which is triggered at the end of displayed output
list.
z

User command: -
It’s an event which is triggered at the time of user clicks on any
record of any list as well as any menu item.
This event acts like both at line-selection & at user-command.
Pf_status_set: -
It’s an event which is triggered at the time of attaching our GUI
to the program.
z

Whenever we are working with events then we must declare an event internal Table which
contains 2 Fields.

event
z

Note: - In slis we have one type I.e. slis_t_event which contains


the above fields. So we simply declare the internal table by
referring slis_t_event
Note: - We can also print the data in start-of-selection event
when ever we are fetching the data from data base. Then we
must use end-of-selection to print the data.

Note: - When ever we are working with events then we must


provide “I_callback_program” as current program name in the
grid or list display.
Note: - If you want to print the logo in the top of page then list
display doesn’t support. Only grid display supports the logo, but
we can’t print the text in the top or bottom events by using write
statements
in grid display.
z

REUSE_ALV_COMMENTARY_WRITE: -
It’s the function module which is used to display the text top or
bottom events.
The input for the above function module is an IT which contains
two fields.
z
z

Note: - In slis we have one type i.e. slis_t_listheader which


contains the above two fields. So we simply declare our internal
table by reffering slis_t_listheader.

Some of the standard transaction codes: -


1. XK03  Display the vendor
2. XD03  Display the customer
3. MM03  Display the material
4. ME23N  Display purchasing order
5. VA03  Display sales order
6. FB03  Display the accounting document
z

Note: - 1  create 2 change 3  display


Syntax of call the transaction: -
Call transaction ‘<transaction code>’
If you want to skip the first screen: -
Call transaction ‘<transaction code>’ and skip first screen.
Syntax of set the value before call the transaction: -
Set parameter id ‘<IDNAME>’ field ‘<VALUE>’.
Steps to identify the parameter id at transaction: -
Execute the transaction code XK03. Place the cursor on input
field. Click on technical information. Identify the parameter id.
EX: -
Parameter p_lifnr type lfa1-lifnr.
Set parameter id ‘LIF’ field p_lifnr.
Call transaction ‘XK03’ and skip first screen.
z

Steps to work with row colour: -


1. Declare the one additional colour field in the data IT, which
is char and length 4.
2. Fill the data IT based on given input.
3. Modify the colour field based on the requirement.
4. Pass the colour field name into layout WA (info_field name).
5. Fill the field catalog (not colour field)
6. Display output
z

1. REUSE_ALV_LIST_DISPLAY
2. REUSE_ALV_GRID_DISPLAY
3. REUSE_ALV_HIERSEQ_LIST_DISPLAY
4. REUSE_ALV_COMMENTARY_WRITE
5. REUSE_ALV_BLOCK_LIST_DISPLAY
6. REUSE_ALV_FIELD CATALOG_MERGE

1. SLIS_T_FIELDCAT_ALV
2. SLIS_T_ALV
3. SLIS_T_LIST HEADER
4. SLIS_SELFIELD
5. SLIS_T_EXTAB
6. SLIS_LAYOUT_ALV
7. SLIS_KEYINFO_ALV
z

THANK YOU

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy