Sie sind auf Seite 1von 59

ALV Documentation with Examples

Introduction
This is a discussion on ALV reporting-a step by step operation manual about creating an ALV report of medium
complexity. This documentation will not mae you an expert in ALV. !ut" definitely" it will come handy at the time of
need. It refers an example report #$%!ALV" as a reference and will represent rele&ant blocs of the code at different
areas of discussion.
Contents
ALV (ABAP LIST VIEWER) ...................................................................................................... 2
$tep '( DATA DE)LA*ATI+, ............................................................................................................................... -
Example: - ...................................................................................................................................... 3
$tep .( $electing the &ariants /+ptional0 ................................................................................................................... 1
$tep- /Defining +utput )haracteristics0 ................................................................................................................... 2
$tep 1/!uild up e&ents table0 ................................................................................................................................... '-
$tep 3/*eport +utput list description0 ..................................................................................................................... '2
$tep 2/4ass $election-screen Information0 .............................................................................................................. .'
$tep 5/Deciding $ort )riteria0 ................................................................................................................................. ..
$tep 6/7inal $tep0 .................................................................................................................................................... ..
Do!mentat"on on #!nt"on mo$!le: RE%SE&ALV&'RID&DISPLA( ................................ 2)
,otes ........................................................................................................................................................................ .3
I8)ALL!A)98478$TAT%$8$ET( $et E:IT runtime to status ......................................... .5
$ample code ............................................................................................................................................................ 12
' of 3;
ALV Documentation with Examples
ALV (ABAP LIST VIEWER)
$ap pro&ides a set of ALV /A!A4 LI$T VIE<E*0 function modules" which can be put into use to
embellish the output of a report. This set of ALV functions is used to enhance the readability and
functionality of any report output. )ases arise in sap when the output of a report contains columns
extending more than .33 characters in length. In such cases" this set of ALV functions can help
choose selected columns and arrange the different columns from a report output and also sa&e
different &ariants for report display. This is a &ery efficient tool for dynamically sorting and
arranging the columns from a report output. The report output can contain up to ;= columns in the
display with the wide array of display options.
The commonly used ALV functions used for this purpose are>
1. REUSE_ALV_VARIANT_DEFAULT_GET
2. REUSE_ALV_VARIANT_F4
3. REUSE_ALV_VARIANT_EXISTENCE
4. REUSE_ALV_EVENTS_GET
5. REUSE_ALV_COMMENTARY_WRITE
6. REUSE_ALV_FIELDCATALOG_MERGE
7. REUSE_ALV_LIST_DISPLAY
8. REUSE_ALV_GRID_DISPLAY
9. REUSE_ALV_POPUP_TO_SELECT
The different steps used for getting the abo&e function modules into use are described below.
. of 3;
ALV Documentation with Examples
Step 1: DATA DECLARATION
$ap standard type pools( $LI$" 99!L+.
$ap standard tables types taen from the type pools are(
SLIS_LAYOUT_ALV
SLIS_T_FIELDCAT_ALV
SLIS_T_LIST!EADER
SLIS_T_EVENT
SLIS_SELFIELD.
Internal tables to be used in the program declared based on the abo&e table types
DATA" I_LAYOUT TYPE SLIS_LAYOUT_ALV
I_FIELDTA$ TYPE SLIS_T_FIELDCAT_ALV
I_!EADING TYPE SLIS_T_LIST!EADER
I_EVENTS TYPE SLIS_T_EVENT.
TYPES" %%$LO_SELFIELD TYPE SLIS_SELFIELD.
E&'()*+" ,
REPORT YSU$ALV.
-,,,,,,,,,,,D+.*'/'0123 24 5'/1'6*+7,,,,,,,,,,,,,,,,,,-
TYPE,POOLS" SLIS.
- T2 )'77 3'(+ 24 08+ /+)2/0 13 493.0123 (2:9*+ 42/ ALV
D'0'" V_REPID LI%E SY,REPID.
- T2 )'77 08+ 25+/'** 70/9.09/+ 24 08+ ALV /+)2/0
D'0'" STRUCT_LAYOUT TYPE SLIS_LAYOUT_ALV.
D'0'" STRUCT_LAYOUT1 TYPE SLIS_LAYOUT_ALV.
- I30+/3'* 0'6*+ 02 .')09/+ 5'/1297 +5+307 13 ALV
D'0'" I_EVENTS TYPE SLIS_T_EVENT.
- T'6*+ 42/ .'0'*2; 24 08+ 41+*:7 02 6+ :17)*'<+:
D'0'" I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
D'0'" X_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
D'0'" I_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV.
D'0'" X_FIELDCAT1 TYPE SLIS_FIELDCAT_ALV.
- I30+/3'* 0'6*+ 02 (+30123 08+ 72/0 7+=9+3.+
D'0'" IT_SORT TYPE SLIS_T_SORTINFO_ALV.
D'0'" X_SORT TYPE SLIS_SORTINFO_ALV.
- I30+/3'* 0'6*+ 02 :17)*'< 02) 24 )';+
D'0'" 1_*170_02)_24_)';+ 0<)+ 7*17_0_*1708+':+/.
- S0/9.09/+ 02 :17)*'< 5'/1'307
D'0'" 1_5'/1'30 *1>+ :175'/1'30
I_5'/1'301 *1>+ :175'/1'30.
- I30+/3'* 0'6*+ 02 )'77 :'0'
DATA" $EGIN OF I_TA$ OCCURS ?
M6*3/ *1>+ (7+;,(6*3/
M'03/ *1>+ (7+;,('03/
M'>0; *1>+ ('>0,('>0;
C8'/; *1>+ (7+;,.8'/;
W+/>7 *1>+ (7+;,@+/>7
- of 3;
ALV Documentation with Examples
L;2/0 *1>+ (7+;,*;2/0
(+3;+ *1>+ (7+;,(+3;+
(+137 *1>+ (7+;,(+137
:(60/ *1>+ (7+;,:(60/
+6+*3 *1>+ (7+;,+6+*3
1.3A4B 0<)+ .
7<(A4B 0<)+ .
+&.)0A2B 0<)+ .
62&A1B
END OF I_TA$.
-ECECT
D'0'" 6+;13 24 1_:2. 2..9/7 ?.
INCLUDE STRUCTURE MSEG.
D'0'" +3: 24 1_:2..
Step 2: Selet"n* t+e ,a-"ants (.pt"onal)
SELECTI/' T0E VARIA/TS 1.R I/ITIAL LIST DISPLA( (DE1A%LT VARIA/T)
The &ariants in the list display can be both user-specific and general. The user can programmatically set the initial
/default0 &ariant for list display.
The default &ariant can be found using the function module DREUSE_ALV_VARIANT_DEFAULT_GETD.
S'()*+ .2:+"
CALL FUNCTION DREUSE_ALV_VARIANT_DEFAULT_GETD
EXPORTING
1_7'5+ E 5'/1'30 7'5+ .23:10123 AAE'** U E 97+/,7)+.141.B
C!ANGING
.7_5'/1'30 E 130+/3'* 0'6*+ .230'1313; 08+ )/2;/'( 3'(+ A'3: 08+ :+4'9*0 5'/1'30,,,2)0123'*B
EXCEPTIONS
320_4293: E 2.
The user can also choose from the list of existing &ariants using the function module ?*E%$E8ALV8VA*IA,T871@.
E&'()*+"
I3101'*1F'0123.
5_/+)1: E 7<,/+)1:.
- D17)*'< :+4'9*0 5'/1'30
PERFORM SU$_VARIANT_INIT.
AT SELECTION,SCREEN ON P_VAR.
- O3.+ 08+ 97+/ 8'7 +30+/+: 5'/1'30 .8+.> '6290 107 +&170+3.+
PERFORM SU$_C!EC%_PVAR.
AT SELECTION,SCREEN ON VALUE,REGUEST FOR P_VAR.
- D17)*'< ' *170 24 5'/1297 5'/1'307 24 08+ /+)2/0 @8+3 08+ U7+/ )/+77+7 F4 >+< 13 08+ 5'/1'30 41+*:
PERFORM SU$_VARIANT_F4.
1 of 3;
ALV Documentation with Examples
-H,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-
-H F2/( SU$_VARIANT_INIT
-H,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-
- D17)*'< :+4'9*0 5'/1'30
-H,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-
F2/( SU$_VARIANT_INIT.
I_VARIANT1,REPORT E SY,REPID.
- S+'/.8 :+4'9*0 5'/1'30 42/ 08+ /+)2/0
CALL FUNCTION DREUSE_ALV_VARIANT_DEFAULT_GETD
EXPORTING
1_7'5+ E DAD
C!ANGING
.7_5'/1'30 E 1_5'/1'301
EXCEPTIONS
320_4293: E 2.
- I4 :+4'9*0 5'/1'30 17 4293: 97+ 10 '7 :+4'9*0.
- E*7+ 97+ 08+ 5'/1'30 LAYOUT1.
IF 7<,796/. E ?.
)_5'/ E 1_5'/1'301,5'/1'30.
ELSE.
)_5'/ E DLAYOUT1D.
ENDIF.
+3:42/(. ISU$_VARIANT_INIT
-H,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-
-H F2/( SU$_C!EC%_PVAR
-H,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-
- O3.+ 08+ 97+/ 8'7 +30+/+: 5'/1'30 .8+.> '6290 107 +&170+3.+
-H,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-
FORM SU$_C!EC%_PVAR.
- I4 08+ 3'(+ 24 08+ 5'/1'6*+ 17 320 6*'3> .8+.> '6290 107 +&170+3.+
14 320 )_5'/ 17 13101'*.
.*+'/ 1_5'/1'30.
1_5'/1'30,/+)2/0 E 7<,/+)1:.
1_5'/1'30,5'/1'30 E )_5'/.
CALL FUNCTION DREUSE_ALV_VARIANT_EXISTENCED
EXPORTING
I_SAVE E DAD
C!ANGING
CS_VARIANT E I_VARIANT.
- I4 32 79.8 5'/1'30 4293: 4*'78 +//2/ (+77';+
I4 7<,796/. 3+ ? .
M+77';+ +398A??B @108 DN2 79.8 5'/1'30 +&1707D.
E*7+.
- I4 5'/1'30 +&1707 97+ 08+ 5'/1'30 3'(+ 02 )2)9*'0+ 70/9.09/+
- I_VARIANT1 @81.8 @1** 6+ 97+: 42/ +&)2/0 )'/'(+0+/" IS_VARIANT
- 13 08+ 493.0123 (2:9*+ " REUSE_ALV_GRID_DISPLAY
C*+'/ 1_5'/1'301.
M25+ )_5'/ 02 1_5'/1'301,5'/1'30.
M25+ 7<,/+)1: 02 1_5'/1'301,/+)2/0.
+3:14.
E*7+.
C*+'/ 1_5'/1'30.
+3:14.
ENDFORM. ISU$_C!EC%_PVAR
3 of 3;
ALV Documentation with Examples
-H,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-
-H F2/( SU$_VARIANT_F4
-H,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-
- D17)*'< ' *170 24 5'/1297 5'/1'307 24 08+ /+)2/0 @8+3 08+ U7+/ )/+77+7 F4 >+< 13 08+ 5'/1'30 41+*:
-H,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-
F2/( SU$_VARIANT_F4.
1_5'/1'30,/+)2/0 E 7<,/+)1:.
- U01*1F13; 08+ 3'(+ 24 08+ /+)2/0 0817 493.0123 (2:9*+ @1** 7+'/.8 42/ ' *170 24
- 5'/1'307 '3: @1** 4+0.8 08+ 7+*+.0+: 23+ 1302 08+ )'/'(+0+/ 41+*: 42/ 5'/1'307
CALL FUNCTION DREUSE_ALV_VARIANT_F4D
EXPORTING
IS_VARIANT E I_VARIANT
I_SAVE E DAD
I_DISPLAY_VIA_GRID E DXD
IMPORTING
ES_VARIANT E I_VARIANT1
EXCEPTIONS
NOT_FOUND E 1
PROGRAM_ERROR E 2
OT!ERS E 3.
IF SY,SU$RC E ?.
P_VAR E I_VARIANT1,VARIANT.
ENDIF.
+3:42/(. ISU$_VARIANT_F4
Step3 (De#"n"n* .!tp!t C+a-ate-"st"s)
DE1I/I/I/' .%TP%T C0ARACTERISTICS: PREPARI/' DISPLA( 1IELDS CATAL.'
A 41+*: .'0'*2; 17 )/+)'/+: 9713; 08+ 130+/3'* 0'6*+ AI_FIELDCATB 24 0<)+ SLIS_T_FIELDCAT_ALV. F1+*:
.'0'*2; .230'1313; :+7./1)01237 24 08+ *170 290)90 41+*:7 A979'**< ' 7967+0 24 08+ 130+/3'* 290)90 0'6*+ 41+*:7B.
A 41+*: .'0'*2; 17 /+=91/+: 42/ +5+/< ALV *170 290)90 02 ':: :+71/+: 493.0123'*10< A1.+. %+< !207)20 S)+.141.
8+':13;7 C97014< C2*. )2710123 +0.B 02 .+/0'13 41+*:7 24 08+ 290)90. I4 320 (+30123+: 7)+.141.'**< 08+3 08+
:+4'9*07 '/+ 0'>+3. T8+ )27716*+ 5'*9+7 '3: :+4'9*07 '/+ *170+: 6+*2@.
T8+ 41+*: .'0'*2; 42/ 08+ 290)90 0'6*+ 17 691*0,9) 13 08+ .'**+/D7 .2:13;. T8+ 691*:,9) .'3 6+ .2()*+0+*< 2/
)'/01'**< '902('0+: 6< .'**13; 08+
REUSE_ALV_FIELDCATALOG_MERGE (2:9*+.
T8+ (131('* 41+*: .'0'*2; 17 :2.9(+30+: 6+*2@. T817 .'3 6+ :23+ 13 ' /29013+ 9713; ' *2.'* 5'/1'6*+. T8+ 97+/
.'3 97+ 08+ 208+/ 2)0123'* )'/'(+0+/7 02 '771;3 290)90 '00/1690+7 02 :144+/+30 41+*:7 13 08+ 290)90 @81.8 :144+/
4/2( 08+ :+4'9*0.
A 41+*: .'0'*2; 3++: 320 6+ 691*0,9) '3: )'77+: +&)*1.10*< 23*< 93:+/ 08+ 42**2@13; .23:101237"
1. T8+ 130+/3'* 0'6*+ 02 6+ 290)90 8'7 08+ 7'(+ 70/9.09/+ '7 ' D'0' D1.0123'/< 70/9.09/+ @81.8 17 /+4+//+: 02
13 08+ 130+/3'* 0'6*+ :+.*'/'0123 9713; LI%E 2/ INCLUDE STRUCTURE. I3 0817 .'7+ 08+ '00/1690+7 24 08+
:144+/+30 41+*:7 17 0'>+3 :1/+.0*< 4/2( 08+ 0'6*+ '3: 08+ '00/1690+7 A>+< 41+*:7 *+3;08 0+&07 +0.B 3++: 02 70'0+
+&)*1.10*<.
.. A** 41+*:7 13 0817 70/9.09/+ '/+ 02 6+ 290)90
3. T8+ 70/9.09/+ 3'(+ 17 )'77+: 02 ALV 13 08+ )'/'(+0+/ I_STRUCTURE_NAME 24 08+ 493.0123 (2:9*+
REUSE_ALV_LIST_DISPLAY.
A** 08+ 5'*9+7 +30+/+: 13 08+ .'0'*2; '/+ 7)+.141. 02 08+ )'/01.9*'/ 41+*: @827+ 3'(+ 17 +30+/+: 13 08+ 41+*:3'(+
FIELDNAME 24 08+ 41+*:.'0 70/9.09/+. T8+ 3'(+ 24 08+ 0'6*+ 17 '*72 +30+/+: 13 08+ .2//. F1+*:3'(+ TA$NAME
24 08+ 70/9.09/+.
2 of 3;
ALV Documentation with Examples
T8+ :144+/+30 )27716*+ '00/1690+7 '/+"
Row_pos A/2@ )2710123B" O3*< /+*+5'30 14 08+ *170 290)90 17 02 6+ (9*01,*13+ A0@2 2/ 08/++ *13+7B 6<
:+4'9*0. S2 0817 '00/1690+ .'3 6+ 97+: ('130'13 .+/0'13 *+5+* 24 '*1;3(+30 13 08+ 290)90.
V'*9+ 7+0" ? 1 J 3
Col_pos A.2*9(3 )2710123B" T817 )'/'(+0+/ 17 /+*+5'30 @8+3 08+ 41+*:7 13 08+ 290)90 '/+ 02 6+
:144+/+30 4/2( 08+ 7+=9+3.+ 24 08+ 41+*:7 13 08+ 130+/3'* 0'6*+ 97+: 42/ :17)*'<. T8+ )'/'(+0+/
7)+.141+7 08+ /+*'015+ .2*9(3 )2710123 24 08+ 41+*: 13 08+ *170 290)90. T8+ .2*9(3 2/:+/ .'3 6+
.8'3;+: 130+/'.015+*< 6< 08+ 97+/. I4 0817 )'/'(+0+/ 17 13101'* 42/ '** 41+*: .'0'*2; +30/1+7 .2*9(37
'))+'/ 13 08+ 130+/3'* 0'6*+ 41+*: 7+=9+3.+.
V'*9+ 7+0" ? 1 J 6?
Field!"e A41+*: 3'(+B" T817 17 08+ 3'(+ 24 08+ 130+/3'* 0'6*+ 41+*: 42/ @81.8 08+ )'/'(+0+/7 '/+
)'77+: 13 08+ .'0'*2;.
V'*9+ 7+0" 130+/3'* 290)90 0'6*+ 41+*: 3'(+ A/+=91/+: )'/'(+0+/B

T!#!"e A130+/3'* 290)90 0'6*+B" N'(+ 24 08+ 130+/3'* 290)90 0'6*+ 08'0 .230'137 08+ 41+*:
FIELDCAT,FIELDNAME '625+.
V'*9+ 7+0" SPACE 130+/3'* 290)90 0'6*+ 3'(+.
Re$_$ield!"e A/+4+/+3.+ 41+*: 3'(+B" N'(+ 24 08+ D'0' D1.0123'/< 41+*: /+4+//+: 02. T817
)'/'(+0+/ 17 23*< 97+: @8+3 08+ 130+/3'* 290)90 0'6*+ 41+*: :+7./16+: 6< 08+ .9//+30 41+*: .'0'*2;
+30/< 8'7 ' /+4+/+3.+ 02 08+ D'0' D1.0123'/< A320 ' )/2;/'( 41+*:B '3: 08+ 41+*: 3'(+ 13 08+
130+/3'* 290)90 0'6*+ 17 :144+/+30 4/2( 08+ 3'(+ 24 08+ 41+*: 13 08+ D'0' D1.0123'/<. I4 08+ 41+*:
3'(+7 '/+ 1:+301.'* 3'(13; 08+ D'0' D1.0123'/< 70/9.09/+ 2/ 0'6*+ 13 08+ FIELDCAT,
REF_TA$NAME )'/'(+0+/ 17 79441.1+30.
V'*9+ 7+0" SPACE D'0' D1.0123'/< 41+*: 3'(+.
Re$_t!#!"e A/+4+/+3.+ 0'6*+K70/9.09/+ 41+*: 3'(+B" S0/9.09/+ 2/ 0'6*+ 3'(+ 24 08+ /+4+//+: D'0'
D1.0123'/< 41+*:. T817 )'/'(+0+/ 17 23*< 97+: @8+3 08+ 130+/3'* 290)90 0'6*+ 41+*: :+7./16+: 6< 08+
.9//+30 41+*: .'0'*2; +30/< 8'7 ' D'0' D1.0123'/< /+4+/+3.+ A320 ' )/2;/'( 41+*:B.
V'*9+ 7+0" SPACE 3'(+ 24 ' D'0' D1.0123'/< 70/9.09/+ 2/ 0'6*+

L13> 02 .9//+3.< 9310
C$ield!"e A.9//+3.< 9310 41+*: 3'(+B" T817 17 97+: 42/ .9//+3.< 41+*:7 08'0 8'5+ ' /+4+/+3.+ 02
'3< 9310 41+*:. T817 17 23*< /+*+5'30 42/ '(2930 .2*9(37 @108 '772.1'0+: 9310. T817 )'/'(+0+/
.230'137 08+ N'(+ 24 08+ 130+/3'* 290)90 0'6*+ 41+*: .230'1313; 08+ .9//+3.< 9310 '772.1'0+: @108
08+ '(2930 41+*: FIELDCAT,FIELDNAME. T8+ 41+*: 13 FIELDCAT,CFIELDNAME (970 8'5+ 107
2@3 41+*: .'0'*2; +30/<.
V'*9+ 7+0" SPACE 290)90 0'6*+ 41+*: 3'(+.
Ct!#!"e A130+/3'* .9//+3.< 9310 41+*: 290)90 0'6*+B" N'(+ 24 08+ 130+/3'* 290)90 0'6*+ .230'1313;
08+ FIELDCAT,CFIELDNAME 41+*:.
V'*9+ 7+0" SPACE 290)90 0'6*+ 41+*: 3'(+.
L13> 02 (+'79/+(+30 9310
%$ield!"e A(+'79/+(+30 9310 41+*: 3'(+B" O3*< /+*+5'30 42/ =9'3010< .2*9(37 @108 9310 *13>.
N'(+ 24 08+ 130+/3'* 290)90 0'6*+ 41+*: .230'1313; 08+ (+'79/+(+30 9310 '772.1'0+: @108 08+
=9'3010< 41+*: FIELDCAT,FIELDNAME. T8+ 41+*: 13 FIELDCAT,GFIELDNAME (970 8'5+ 107 2@3
41+*: .'0'*2; +30/<.
V'*9+ 7+0" SPACE 290)90 0'6*+ 41+*: 3'(+.
%t!#!"e A130+/3'* (+'79/+(+30 9310 41+*: 290)90 0'6*+B" N'(+ 24 08+ 130+/3'* 290)90 0'6*+
.230'1313; 08+ FIELDCAT,GFIELDNAME 41+*:.
V'*9+ 7+0" SPACE 290)90 0'6*+ 41+*: 3'(+.
5 of 3;
ALV Documentation with Examples
O&tp&tle A.2*9(3 @1:08B" T817 )'/'(+0+/ 17 97+: 14 08+ :+71/+: 290)90 *+3;08 42/ ' 41+*: 17
:+71/+: 02 6+ :144+/+30 4/2( 08+ 130+/3'* 290)90 0'6*+ 41+*:. F2/ 41+*:7 @108 ' D'0' D1.0123'/< *13> 0817
)'/'(+0+/ .'3 6+ *+40 13101'*. F2/ 41+*:7 @108290 ' D'0' D1.0123'/< *13> A)/2;/'( 41+*:B 08+ )'/'(+0+/
(970 6+ ;15+3 08+ 5'*9+ 24 08+ :+71/+: 41+*: *170 290)90 *+3;08 A.2*9(3 @1:08B.
I3101'* E .2*9(3 @1:08 17 08+ 290)90 *+3;08 24 08+ /+4+//+: D'0' D1.0123'/< 41+*: A:2('13B.
N E .2*9(3 @1:08 17 3 .8'/'.0+/7.
V'*9+ 7+0" ? A13101'*B 3.
'e( A>+< .2*9(3B" $< :+4'9*0 08+ 7<70+( ('>+7 72(+ 41+*:7 13 08+ 290)90 '7 >+< 41+*:7 )/251:+:
08+ 41+*:7 '/+ >+< 41+*:7 13 08+1/ /+4+/+3.13; 0'6*+. U713; 0817 )'/'(+0+/ 41+*:7 208+/ 08'3 >+< 41+*:7
24 08+ /+4+/+3.13; 0'6*+ .'3 6+ (':+ >+< 41+*:. T817 )'/'(+0+/ 17 (270 1()2/0'30 14 08+ 290)90
3++:7 02 .230'13 72(+ 41+*: @81.8 '/+ 320 7./2**'6*+ 2/ .'3320 6+ 81::+3.
I4 08+ 130+/3'* 290)90 0'6*+ .230'137 41+*:7 08'0 '/+ >+< 41+*:7 4/2( :144+/+30 0'6*+7 08+3 '** 0827+
41+*:7 13 08+ /+)2/0 290)90 6+.2(+7 93,7./2**'6*+ '3: .'3320 6+ 81::+3. S2 08+ 41+*:7 13 08+
290)90 130+/3'* 0'6*+ 7829*: 320 6+ /+4+/+3.+: 4/2( 0'6*+7 13 @81.8 08+< '/+ >+< 41+*:7. I370+':
08+< 7829*: 6+ /+4+/+3.+: 02 08+ 0'6*+7 13 @81.8 08+< '/+ 320 >+< 41+*:7 13.'7+ 08+< '/+ 320
:+71/+: '7 >+< 41+*: 13 08+ 290)90.
DXD E >+< 41+*: A>+< 41+*: 290)90 13 .2*2/B '3: %+< 41+*:7 .'3320 6+ 130+/'.015+*< 81::+3. P'/'(+0+/
FIELDCAT,NO_OUT (970 6+ *+40 13101'*.
V'*9+ 7+0" SPACE DXD.
'e(_sel A81:+,'6*+ >+< .2*9(3B" T817 )'/'(+0+/ 17 23*< /+*+5'30 42/ 08+ 41+*:7 @81.8 '/+ (':+
>+< 41+*:7 9713; FIELDCAT,%EY E DXD. U713; 0817 )'/'(+0+/ 08+ %+< 41+*: .'3 6+ 81::+3
130+/'.015+*<.
T8+ >+< .2*9(3 7+=9+3.+ .'3320 6+ .8'3;+: 130+/'.015+*< 6< 08+ 97+/. T8+ 290)90 17 .230/2**+:
6< 08+ FIELDCAT,NO_OUT )'/'(+0+/ '3'*2;297*< 02 323,>+< 41+*:7.
V'*9+ 7+0" SPACE DXD.
No_o&t A41+*: 13 41+*: *170B" T817 )'/'(+0+/ 17 97+: 02 /+(25+ .+/0'13 41+*:7 4/2( 08+ 290)90 :9/13;
13101'* :17)*'<. T8+ 97+/ .'3 82@+5+/ 130+/'.015+*< .8227+ 08+ 41+*: 42/ 290)90 4/2( 08+ 41+*: *170 13
08+ :17)*'< 5'/1'30.
DXD E 41+*: 17 320 :17)*'<+: 13 08+ .9//+30 *170.
V'*9+ 7+0" SPACE DXD.
Te)* A0+.831.'* 41+*:B" T817 )'/'(+0+/ 17 97+: 02 ('>+ .+/0'13 41+*: :17)*'< 23*< 13 08+ 41+*:
.'0'*2;. T8+ 41+*:7 @108 0817 )'/'(+0+/ 7+0 .'3320 6+ 290)90 13 08+ *170 32/ .'3 08+< 6+ :17)*'<+:
130+/'.015+*< 4/2( 08+ .'0'*2;.
DXD E 0+.831.'* 41+*:.
V'*9+ 7+0" SPACE DXD.
E"p*!si+e A81;8*1;80 .2*9(37 13 .2*2/B" A7 3'(+ 79;;+707 0817 41+*: )'/'(+0+/ 17 97+: 02
81;8*1;80 .+/0'13 41+*: @108 .827+3 .2*2/7.
V'*9+ 7+0" SPACE DXD 2/ DC&<FD A&"D1D,D9DL <F" D?DE244 D1DE23B.
DXD E .2*9(3 17 .2*2/+: @108 08+ :+4'9*0 .2*9(3 81;8*1;80 .2*2/.
DC&<FD E .2*9(3 17 .2*2/+: @108 ' .2:+: .2*2/"
, C" C2*2/ A.2:13; (970 6+;13 @108 CB
, X" .2*2/ 39(6+/
, Y" 62*:
, M" 135+/7+
,otspot A.2*9(3 '7 8207)20B" T817 )'/'(+0+/ 17 97+: 02 ('>+ .+/0'13 41+*: '))+'/ '7 8207)20 1.+.
' 8'3: 17 :17)*'<+: 14 08+ .9/72/ 17 )2710123+: 23 08+ 41+*: 5'*9+. S13;*+ .*1.> 23 79.8 41+*:7 .'97+
08+ PIC% OR F2 +5+307 02 8'))+3.
V'*9+ 7+0" SPACE DXD.
DXD E .2*9(3 .+**7 '/+ 290)90 '7 8207)207.
6 of 3;
ALV Documentation with Examples
Fi-_)ol&" A41& .2*9(3B" T817 )'/'(+0+/ 17 97+: 02 41& .+/0'13 .2*9(37 13 08+ 290)90. A** .2*9(37
02 6+ 41&+: (970 8'5+ 0817 4*'; 70'/013; 4/2( 08+ *+40. I4 ' .2*9(3 @108290 0817 4*'; 17 290)90 23*<
08+ .2*9(37 02 08+ *+40 24 0817 .2*9(3 '/+ 41&+:. T8+ 97+/ .'3 .8'3;+ 08+ .2*9(3 41&13;
130+/'.015+*<.
V'*9+ 7+0" SPACE DXD.
DXD E .2*9(3 41&+: A:2+7 320 7./2** 82/1F230'**<B.

Do_s&" A79( 25+/ .2*9(3B" 08+ 97+/ .'3 '*72 .'** 0817 493.0123 130+/'.015+*<.
V'*9+ 7+0" SPACE DXD.
DXD E ' 79( 17 .'*.9*'0+: 25+/ 0817 130+/3'* 290)90 0'6*+ 41+*:.
No_s&" A79(7 42/61::+3B" N2 79( .'3 6+ .'*.9*'0+: 25+/ 0817 41+*: '*0829;8 08+ :'0' 0<)+ 24 08+
41+*: @29*: '**2@ 79((13;.
V'*9+ 7+0" SPACE DXD.
I)o: T8+ )'/'(+0+/ :17)*'<7 .+/0'13 .2*9(3 .230+307 '7 1.237. T8+ 130+/3'* 290)90 0'6*+ .2*9(3
.230+307 (970 6+ 5'*1: 1.23 70/13;7.
V'*9+ 7+0" SPACE DXD.
DXD E .2*9(3 .230+307 02 6+ 290)90 '7 '3 1.23.
S("#ol: T8+ 130+/3'* 290)90 0'6*+ .2*9(3 (970 6+ ' 5'*1: 7<(62* .8'/'.0+/.
V'*9+ 7+0" SPACE DXD
DXD E .2*9(3 .230+307 '/+ 02 6+ 290)90 '7 ' 7<(62*.
.&st AN970141.'0123B" T817 )'/'(+0+/ 17 97+: 42/ '*1;3(+30 24 08+ .230+307 24 08+ 290)90 0'6*+. T817
17 23*< /+*+5'30 42/ C!AR 2/ NUMC 41+*:7 13 08+ 290)90 130+/3'* 0'6*+. T8+ N970141.'0123 24 08+
.2*9(3 8+':+/ '*@'<7 42**2@7 08+ N970141.'0123 24 08+ .2*9(37. I3:+)+3:+30 N970141.'0123 24 08+
.2*9(3 8+':+/ 17 320 )27716*+.
V'*9+ 7+0" SPACE DRD DLD '3: OCP.
D D E D+4'9*0 N970141.'0123 42/ 0817 :'0' 0<)+
DRD E /1;80,N970141+: 290)90
DLD E *+40,N970141+: 290)90
DCD E .+30+/+: 290)90.

L+e/o A*+':13; F+/27B" $< :+4'9*0 ALV 290)907 NUMC 41+*:7 /1;80,N970141+: @108290 *+':13; F+/27.
U713; 0817 )'/'(+0+/ 23*< 08+ NUMC 41+*:7 .'3 6+ :17)*'<+: @108 *+':13; F+/2+7.
V'*9+ 7+0" SPACE DXD.
DXD E 290)90 @108 *+':13; F+/27.
No_si0 A32 QK, 71;3B" T817 )'/'(+0+/ 17 97+: 02 79))/+77 08+ 71;37 24 08+ 290)90 41+*:7. I0 17 23*<
/+*+5'30 42/ 08+ 5'*9+ 41+*:7.
V'*9+ 7+0" SPACE DXD.
DXD E 5'*9+ 290)90 @108290 QK 71;3.
No_+e/o A79))/+77 F+/27B" O3*< /+*+5'30 42/ 5'*9+ 41+*:7.
V'*9+ 7+0" SPACE DXD.
DXD E 79))/+77 F+/27.
Edit_"!s1 A41+*: 42/('0013;B" T2 '))*< 08+ /+)2/0 290)90 42/('0013; 2)01237 7'(+ '7 13 08+ WRITE
70'0+(+30 13 /+)2/0 @/1013;.
V'*9+ 7+0" SPACE 0+()*'0+.

T8+ 42**2@13; )'/'(+0+/7 '/+ 97+: 42/ .9702(1F13; 08+ 0+&07 13 08+ 8+':13; 24 08+ 290)90 24 08+ .2*9(37.
T8+ 0+&07 '/+ 0'>+3 4/2( 08+ D'0' D1.0123'/< 42/ 41+*:7 @108 ' D'0' D1.0123'/< /+4+/+3.+. I4 0817 17 320
:+71/+: 08+ 0+&0 )'/'(+0+/7 .'3 '*72 6+ 7)+.141+:. T8+ D'0' D1.0123'/< 0+&07 '/+ 08+3 1;32/+:.
I4 08+ 97+/ .8'3;+7 08+ .2*9(3 @1:08 130+/'.015+*< 08+ .2*9(3 8+':+/ 0+&0 @108 08+ '))/2)/1'0+ *+3;08 17
'*@'<7 97+:.
; of 3;
ALV Documentation with Examples
T8+ 130+/'.015+ 493.0123 DO)01(1F+ .2*9(3 @1:08D 0'>+7 '..2930 24 6208 08+ 41+*: .230+307 '3: 08+ .2*9(3
8+':+/7" 14 '** 41+*: .230+307 '/+ 782/0+/ 08'3 08+ 782/0+70 .2*9(3 8+':+/ 08+ .2*9(3 @1:08 :+)+3:7 23
08+ .2*9(3 8+':+/.
T8+ D*23; 41+*: *'6+*D 17 '*72 97+: 13 :17)*'< 5'/1'30 :+41310123
S2/0 +0.. P2)9).
selte-t_l A*23; 41+*: *'6+*B
selte-t_" A(+:19( 41+*: *'6+*B
selte-t_s A782/0 41+*: *'6+*B
/epte-t_ddi) A8+':+/B A3'*2;297 02 08+ D'0' +*+(+30 ('13 8+':+/
Ddi)t-t A7)+.14< 0+&0B" Y29 .'3 7)+.14< @108 5'*9+7 DLD DMD '3: DSD 08+ >+<@2/: 08'0 7829*: '*@'<7
6+ 97+: '7 .2*9(3 8+':+/. I4 08+ .2*9(3 @1:08 .8'3;+7 32 '00+()0 17 (':+ 13 0817 .'7+ 02 413:
'3 '))/2)/1'0+ 8+':+/ 42/ 08+ 3+@ 290)90 @1:08.
V'*9+ 7+0" SPACE DLD DMD '3: OSP.
S!"ple )ode:
AB---------------------------------------------------------------------A
AB 7orm $%!84*E4A*E87IELD)ATAL+C
AB---------------------------------------------------------------------A
A 4repare field catalog for the main report. $tate the name of the field" name of internal table" &arious formatting options etc
A----------------------------------------------------------------------A
7orm $%!84*E4A*E87IELD)ATAL+C.
:87IELD)AT-)+L84+$ D '. A 7irst field to appear in ALV list
:87IELD)AT-7IELD,AEE D F$#EF. A ,ame of the internal table field
:87IELD)AT-TA!,AEE D FI8TA!F. A ,ame of the internal table
:87IELD)AT-$ELTE:T8E D F$tatF. A Geading for the field
:87IELD)AT-$#E!+L D F:F. A The field is going to contain a symbol
A Append the specifications to the internal table for field catalog.
A44E,D :87IELD)AT T+ I87IELD)AT.
)LEA* :87IELD)AT.
:87IELD)AT-)+L84+$D .. A $econd field to appear in ALV list
:87IELD)AT-7IELD,AEE D FEAT,*F. A ,ame of the field in the internal table
:87IELD)AT-TA!,AEE D FI8TA!F. A ,ame of the internal table
:87IELD)AT-$ELTE:T8E D FEatItemF. A Geading for the column
A It is going to be the ey field.The color for this field is going to be different
:87IELD)AT-9E# D F:F.
:87IELD)AT-9E#8$EL D F:F.
A $ingle clic on the field will trigger double clic e&ent. Also" a hand will appear when the cursor na&igates to the field
:87IELD)AT-G+T$4+T D F:F.
:87IELD)AT-7I:8)+L%E, D F:F. A The column and those left to it will not scroll
:87IELD)AT-*E78TA!,AEE D FE$ECF. A 7' help will come as it is referenced to DDI) table
A44E,D :87IELD)AT T+ I87IELD)AT.
)LEA* :87IELD)AT.
:87IELD)AT-)+L84+$ D -.
:87IELD)AT-7IELD,AEE D FEA9TCF.
:87IELD)AT-TA!,AEE D FI8TA!F.
:87IELD)AT-$ELTE:T8E D FDescriptionF.
A :87IELD)AT-+%T4%TLE, D 3=.
:87IELD)AT-G+T$4+T D space.
:87IELD)AT-H%$T D F)F. A The field is centre/) for centre" * and L for left and right0 Iustified
'= of 3;
ALV Documentation with Examples
:87IELD)AT-9E# D F:F.
:87IELD)AT-7I:8)+L%E, D F:F.
A:8fieldcat-no8out D F:F.
:87IELD)AT-7I:8)+L%E, D F:F.
A44E,D :87IELD)AT T+ I87IELD)AT.
)LEA* :87IELD)AT.
:87IELD)AT-)+L84+$D 1.
:87IELD)AT-7IELD,AEE D F)GA*CF.
:87IELD)AT-TA!,AEE D FI8TA!F.
:87IELD)AT-$ELTE:T8E D F!atchF.
A :87IELD)AT-+%T4%TLE, D '=.
:87IELD)AT-G+T$4+T D space.
A44E,D :87IELD)AT T+ I87IELD)AT.
)LEA* :87IELD)AT.
:87IELD)AT-)+L84+$ D 3.
:87IELD)AT-7IELD,AEE D FE!EL,F.
:87IELD)AT-TA!,AEE D FI8TA!F.
:87IELD)AT-$ELTE:T8E D F4urchase +rderF.
A :87IELD)AT-+%T4%TLE, D '1.
:87IELD)AT-EE4GA$IJE D F)3''F. A The field will be colored differently /)xyK0
:87IELD)AT-,+8+%T D F:F. A Initially the field will be hidden
A44E,D :87IELD)AT T+ I87IELD)AT.
)LEA* :87IELD)AT.
:87IELD)AT-)+L84+$ D 2.
:87IELD)AT-7IELD,AEE D FE!L,*F.
:87IELD)AT-TA!,AEE D FI8TA!F.
:87IELD)AT-$ELTE:T8E D FDocument noF.
A :87IELD)AT-+%T4%TLE, D '1.
:87IELD)AT8EE4GA$IJE D F)5''F.
:87IELD)AT-,+8+%T D F:F.
A44E,D :87IELD)AT T+ I87IELD)AT.
)LEA* :87IELD)AT.
:87IELD)AT-)+L84+$ D 5.
:87IELD)AT-7IELD,AEE D F<E*9$F.
:87IELD)AT-TA!,AEE D FI8TA!F.
:87IELD)AT-$ELTE:T8E D F4lantF.
A :87IELD)AT-+%T4%TLE, D 3.
:87IELD)AT-EE4GA$IJE D F)-'=F.
A44E,D :87IELD)AT T+ I87IELD)AT.
)LEA* :87IELD)AT.
:87IELD)AT-)+L84+$ D 6.
:87IELD)AT-7IELD,AEE D FLC+*TF.
:87IELD)AT-TA!,AEE D FI8TA!F.
:87IELD)AT-$ELTE:T8E D F$t.LocF.
A :87IELD)AT-+%T4%TLE, D 5.
A :87IELD)AT-,+8+%T D F:F.
A44E,D :87IELD)AT T+ I87IELD)AT.
)LEA* :87IELD)AT.
:87IELD)AT-)+L84+$ D ;.
:87IELD)AT-7IELD,AEE D FEE,CEF.
:87IELD)AT-TA!,AEE D FI8TA!F.
:87IELD)AT-$ELTE:T8E D FLuantityF.
'' of 3;
ALV Documentation with Examples
:87IELD)AT-+%T4%TLE, D '..
:87IELD)AT-D+8$%E D F:F. A $ummation is allowed for this field
:87IELD)AT-*E78TA!,AEE D FE$ECF.
A44E,D :87IELD)AT T+ I87IELD)AT.
)LEA* :87IELD)AT.
:87IELD)AT-)+L84+$ D '=.
:87IELD)AT-7IELD,AEE D FI),F.
:87IELD)AT-TA!,AEE D FI8TA!F.
:87IELD)AT-$ELTE:T8E D FF.
:87IELD)AT-+%T4%TLE, D ..
:87IELD)AT-I)+, D F:F.
A :87IELD)AT-,+8+%T D F:F.
A44E,D :87IELD)AT T+ I87IELD)AT.
)LEA* :87IELD)AT.
:87IELD)AT-)+L84+$ D ''.
:87IELD)AT-7IELD,AEE D FEEI,$F.
:87IELD)AT-TA!,AEE D FI8TA!F.
:87IELD)AT-$ELTE:T8E D F%nitF.
:87IELD)AT-+%T4%TLE, D 3.
:87IELD)AT-7IELD,AEE D FEEI,$F.
A44E,D :87IELD)AT T+ I87IELD)AT.
)LEA* :87IELD)AT.
:87IELD)AT-)+L84+$ D '..
:87IELD)AT-7IELD,AEE D FDE!T*F.
:87IELD)AT-TA!,AEE D FI8TA!F.
:87IELD)AT-$ELTE:T8E D FLocal currF.
:87IELD)AT-+%T4%TLE, D '..
:87IELD)AT-I,TT#4E D F4F.
:87IELD)AT-H%$T D F*F.
:87IELD)AT-D+8$%E D F:F.
A44E,D :87IELD)AT T+ I87IELD)AT.
)LEA* :87IELD)AT.
:87IELD)AT-)+L84+$ D '-.
:87IELD)AT-7IELD,AEE D FE:)4TF.
:87IELD)AT-TA!,AEE D FI8TA!F.
:87IELD)AT-$ELTE:T8E D FF.
:87IELD)AT-+%T4%TLE, D -.
A44E,D :87IELD)AT T+ I87IELD)AT.
)LEA* :87IELD)AT.
E,D7+*E. M$%!84*E4A*E87IELD)ATAL+C
'. of 3;
ALV Documentation with Examples
Step 2(B!"l$ !p e,ents ta3le)
The next step is to build an e&ent table" which are used for firing both user commands and the system dependent e&ents
i.e. top of page" end of page etc.
A list of possible e&ents is populated into an e&ent table /I8EVE,T$0 when this table is passed from the function module
*E%$E8ALV8EVE,T8,AEE$8CET. The return table from this function module contains all the possible e&ents.
The function module contains following import and export parameters.
IE4+*TI,C 4A*AEETE*$( I8LI$T8T#4E
This parameter has possible &alues from =-1.
The parameter I8LI$T8T#4E is of T#4E $LI$8LI$T8T#4E and is DE7A%LT = .
E:4+*TI,C 4A*AEETE*$( I8EVE,T$ table.
This table is of T#4E $LI$8T8EVE,T and returns to the program the name of all the possible e&ents.
The table structure contains the fields(
I8EVE,T$-,AEE( ,ame of the )allbac e&ent.
I8EVE,T$-7+*E( ,ame of the form routine that should be called in the calling program at the e&ent.
+nly e&ents with a form routine name are processed.
The I8EVE,T$ table returns with the following possible constants(
4. Sl"s&e,&"tem&$ata&expan$ T(PE sl"s&#o-mname VAL%E 5ITE6&DATA&E7PA/D5.
+nly rele&ant for hierarchical-seNuential lists using the layout parameter I$8LA#+%T-E:4A,D87IELD,AEE
of the structure I$8LA#+%T. Exit for passing item entries /ITEE table0 for a header record that was expanded
interacti&ely by the user.
2. Sl"s&e,&-ep-ep&sel&mo$"#8 T(PE sl"s&#o-mname VAL%E 5REPREP&SEL&6.DI1(5.
*$8$EL7IELD-TA!I,DE: contains the header table index for which the item entries are to be put in the
global item output table /T8+%TTA!8$LAVE0. The )allbac is only called if ALV has no items for a header
that is to be expanded.
*7LC8ALL is passed with F:F if the user shows all items. The application must ensure that entries are not
repeated in the item table.
*$8$EL7IELD is initial in this case.
3. Sl"s&e,&alle-&ex"t&at&sta-t T(PE sl"s&#o-mname VAL%E 5CALLER&E7IT5.
Is called at the beginning of the function module to mae special settings. It is not usually used.
2. Sl"s&e,&!se-&omman$ T(PE sl"s&#o-mname VAL%E 5%SER&C.66A/D5.
As this is a freNuently-used )allbac e&ent" the form routine can also be passed directly in the interface by
passing the user command in the IE4+*TI,C parameter I8)ALL!A)98%$E*8)+EEA,D.
). Sl"s&e,&top&o#&pa*e T(PE sl"s&#o-mname VAL%E 5T.P&.1&PA'E5.
ENui&alent to the list processing T+4-+7-4ACE e&ent.
9. Sl"s&e,&top&o#&o,e-pa*e T(PE sl"s&#o-mname VAL%E 5T.P&.1&C.VERPA'E5.
The selection information and list status are output together /if they exist0 on a separate page by default
:. Sl"s&e,&en$&o#&o,e-pa*e T(PE sl"s&#o-mname VAL%E 5E/D&.1&C.VERPA'E5.
Analogously to T+48+78)+VE*4ACE the user can add other information
to the information output by ALV /selection information" list status0 at this e&ent.
;. Sl"s&e,&#o-e"*n&top&o#&pa*e T(PE sl"s&#o-mname VAL%E <1.REI'/&T.P&.1&PA'E5.
The Top-of-page e&ent is always processed in ALV and is only passed to the caller &ia the )allbac mechanism.
This is still the case if the caller" e.g. by a user action" processes a branch list which was not formatted by ALV
/e.g. a popup with additional information about the list record selected and displayed by ALV0.
In this case" top-of-page cannot be formatted by ALV analogously to the basic list" it must be handled completely
by the caller. The e&ent top-of-page still occurs in ALV. <hen ALV notices a top-of-page which was not caused
by an ALV output" the form routine in 7+*EIC,8T+48+784ACE is called.
=. Sl"s&e,&#o-e"*n&en$&o#&pa*e T(PE sl"s&#o-mname VAL%E 51.REI'/&E/D&.1&PA'E5.
'- of 3;
ALV Documentation with Examples
The e&ent end-of-page is always processed in ALV and only passed to the caller &ia callbac. This is still the
case" e.g. when the caller processes a details list which was not formatted by ALV /e.g. a popup with further
information about selected list records which were displayed by ALV0.
In this case" end-of-page cannot be formatted by ALV analogously to the basic list" it must be handled completely
by the caller. The e&ent end-of-page still occurs in ALV. <hen ALV notices an end-of-page that was not caused
by an ALV output" the form routine in 7+*EIC,8E,D8+784ACE is called.
4>. Sl"s&e,&p#&stat!s&set T(PE sl"s&#o-mname VAL%E 5P1&STAT%S&SET5.
If a user list status is to be set" it must be done in the form routine assigned to this e&ent. The ALV function
codes" which must not be acti&e" are in the 4arameter *T8E:TA!. This table must be passed with the $ET 47-
$TAT%$ command /with inacti&e user function codes as well" if necessary0.
The $TA,DA*D status of the function group $ALV should be used as a template for a user-specific status. As
this is a freNuently used )allbac e&ent" its form routine can also be passed directly in the interface in the
IE4+*TI,C parameter I8)ALL!A)98478$TAT%$8$ET.
44. Sl"s&e,&l"st&mo$"#8 T(PE sl"s&#o-mname VAL%E 5LIST&6.DI1(5.
LI$T8E+DI7# %$I,C *8TA!,AEE T#4E $LI$8TA!,AEE
*8I,DE: LI9E $#-TA!I:
*8I,DE:8ITEE LI9E $#-TA!I:
*8I,DE:8$%E LI9E $#-TA!I:.
42. Sl"s&e,&top&o#&l"st T(PE sl"s&#o-mname VAL%E 5T.P&.1&LIST5.
Information output at the start of the list
43. Sl"s&e,&en$&o#&pa*e T(PE sl"s&#o-mname VAL%E 5E/D&.1&PA'E5.
Information output at the end of a page. This is only called for printing.
42. Sl"s&e,&en$&o#&l"st T(PE sl"s&#o-mname VAL%E 5E/D&.1&LIST5.
Information output at the end of the list
4). Sl"s&e,&a#te-&l"ne&o!tp!t T(PE sl"s&#o-mname VAL%E 5A1TER&LI/E&.%TP%T5.
+utput information after each output line. $hould only be used in Iustified cases because it costs a lot of
performance.
49. Sl"s&e,&3e#o-e&l"ne&o!tp!t T(PE sl"s&#o-mname VAL%E 5BE1.RE&LI/E&.%TP%T5.
+utput information before each output line. $hould only be used in Iustified cases because it costs a lot of
performance.
'5. Sl"s&e,&s!3total&text T(PE sl"s&#o-mname VAL%E 5S%BT.TAL&TE7T5.
This e&ent table /I8EVE,T$0 is now checed with the desired constants. If the desired constant is found" then the
corresponding field for the 7+*E ,AEE is populated with the name of the routine containing the corresponding
e&ent.
Sample o$e :
7+*E,AEE8T+48+784ACE T#4E $LI$87+*E,AEE VAL%E FT+48+784ACEF"
7+*E,AEE8E,D8+784ACE T#4E $LI$87+*E,AEE VAL%E FE,D8+784ACEF"
7+*E,AEE8%$E*8)+EEA,D T#4E $LI$87+*E,AEE VAL%E F%$E*8)+EEA,DF.
DATA( L8I8EVE,T T#4E $LI$8ALV8EVE,T.
)ALL 7%,)TI+, F*E%$E8ALV8EVE,T$8CETF
E:4+*TI,C
I8LI$T8T#4E D =
IE4+*TI,C
ET8EVE,T$ D I8EVE,T$.
*EAD TA!LE I8EVE,T$ <ITG 9E# ,AEE D $LI$8EV8T+48+784ACE I,T+ L8I8EVE,T.
I7 $#-$%!*) D =.
E+VE 7+*E,AEE8T+48+784ACE T+ L8I8EVE,T-7+*E.
A44E,D L8I8EVE,T T+ I8EVE,T$.
E,DI7.
*EAD TA!LE I8EVE,T$ <ITG 9E# ,AEE D $LI$8EV8E,D8+784ACE I,T+ L8I8EVE,T.
I7 $#-$%!*) D =.
'1 of 3;
ALV Documentation with Examples
E+VE 7+*E,AEE8E,D8+784ACE T+ L8I8EVE,T-7+*E.
A44E,D L8I8EVE,T T+ I8EVE,T$.
E,DI7.
)LEA* L8I8EVE,T.
*EAD TA!LE I8EVE,T$ <ITG 9E# ,AEE D $LI$8EV8%$E*8)+EEA,D I,T+ L8I8EVE,T.
I7 $#-$%!*) D =.
E+VE 7+*E,AEE8%$E*8)+EEA,D T+ L8I8EVE,T-7+*E.
A44E,D L8I8EVE,T T+ I8EVE,T$.
E,DI7.
This will prepare the e&ents table for the report.
The report will contain three forms for the abo&e e&ents(
'. 7+*E T+48+784ACE( This form will contain the top of page e&ent for the report i.e. header etc
%sing the function module ?*E%$E8ALV8)+EEE,TA*#8<*ITE@" the internal table containing the
headings for top of page e&ent can be passed to the list output. Also" any logo specific to the report can be
passed to the function module.
.. 7+*E E,D8+784ACE( This form will contain the end of page e&ent for the report i.e. footer etc
-. 7+*E %$E*8)+EEA,D( This form will contain the desired user command i.e. picOline selection
'3 of 3;
ALV Documentation with Examples
Step 2(Repo/t O&tp&t list des)/iptio)
A *'<290 17 691*: 42/ 08+ /+)2/0 290)90 *170 :+7./1)0123 USING 08+ 130+/3'* 0'6*+ :+.*'/+: '625+ AI_LAYOUTB.
O90)90 *170 :+7./1)0123 70/9.09/+.
T8+ )'/'(+0+/7 '/+ :+7./16+: 93:+/ 08+ 42**2@13; 8+':7"
D17)*'< 2)01237
E&.+)01237
T20'*7
I30+/'.0123
D+0'1* 7./++3
D17)*'< 5'/1'307 A23*< 42/ 81+/'/.81.'*,7+=9+301'* *1707B
C2*2/
O08+/
T8+ *'<290 0'6*+ 17 24 0<)+ 7*17_*'<290_'*5_7)+. '3: 8'7 08+ 42**2@13; 41+*:7"

D17)*'< 2)01237
1. Colwidt*_opti"i+e A1B TYPE ." T817 )'/'(+0+/ 2)01(1F+7 08+ *+3;08 24 08+ :144+/+30 .2*9(37 13 08+
290)90. T8+ @1:08 24 08+ :144+/+30 .2*. 32@ :+)+3:7 23 08+ ('&. L+3;08 24 08+ :'0' 13 08+ .2*9(3.
V'*9+ 7+0" SPACE DXD
DXD E 2)01(1F+7 08+ .2*9(3 @1:08 72 08'0 '** .230+307 '/+ :17)*'<+: .2()*+0+*<.
2. No_)ol*e!d A1B TYPE ." T817 )'/'(+0+/ 79))/+77+7 08+ .2*9(3 8+':13;7
V'*9+ 7+0" SPACE DXD.
DXD E .2*9(3 8+':+/7 '/+ 320 290)90
33 No_*otspotA1B TYPE . " T8+ 8+':13;7 24 08+ /+)2/0 290)90 '/+ 320 290)90 '7 8207)20.
V'*9+ 7+0" SPACE DXD.
DXD E .2*9(3 8+':+/7 '/+ 320 290)90 '7 8207)20
43 4e#/!A1B TYPE . " T8+ /+)2/0 17 290)90 13 08+ 70/1)+: )'00+/3.
V'*9+ 7+0" SPACE DXD.
DXD E 70/1)+: )'00+/3 A+.;. 42/ @1:+ *1707B
5. No_5lie A1B TYPE ." T8+ /+)2/0 290)90 .230'137 .2*9(37 23*< 7+)'/'0+: 6< 7)'.+ '3: 32 *13+7. I0 17
320 /+*+5'30 42/" 81+/'/.81.'*,7+=9+301'* *1707 '3: (9*01)*+,*13+ *1707.
V'*9+ 7+0" SPACE DXD.
DXD E .2*9(37 7+)'/'0+: 6< SPACE
6. No_"i_liesi+eA1B TYPE . " T8+ /+)2/0 *13+ 71F+ 17 +=9'* 02 08+ @1:08 24 08+ *170. I0 17 320 /+*+5'30 42/
6*2.> *1707.
V'*9+ 7+0" SPACE DXP.
DXD E *13+ 71F+ :+)+3:7 23 *170 @1:08
D D E L13+ 71F+ 17 7+0 02 8? 2/ MIN_LINESIME A14 R ?B .
7. 6i_liesi+e LI%E 7<,*137F" T8+ /+)2/0 290)90 .230'137 ' (131(9( )27716*+ *+3;08 24 *13+. I4 13101'*
(13_*13+71F+ 17 7+0 02 8? 6< :+4'9*0 08+3 0817 )'/'(+0+/ 17 97+: 02 .9702(1F+ 10. T8+ )/+/+=91710+ 42/ 0817 17
08'0 08+ )'/'(+0+/ 32_(13_*13+71F+ 7829*: 6+ D D.
V'*9+ 7+0" ? 1? , 25?
I4 08+ *170 17 @1:+/ 08+ 42/('0 97+7 08+ *170 @1:08 A('&1(9( 25? 2/ MAX_LINESIME A14 R ?BB.
8. 6!-_liesi+e LI%E 7<,*137F" T8+ :+4'9*0 ('&. L13+71F+ 17 25?. T2 .8'3;+ 0817 :+4'9*0 5'*9+ 0817
)'/'(+0+/ .'3 130+/'.015+*<,:+413+ 08+ ('&1(9( *170 @1:08 7+0013;.
V'*9+ 7+0" ? 8? , 1?2?
9. Widow_title#!/ LI%E /7()+,0100+&0" T2 7+0 08+ 010*+6'/ 23 08+ /+)2/0 290)90.
1?. No_&lie_*sA1B TYPE ..
'2 of 3;
ALV Documentation with Examples

E&.+)01237
11. Li0*ts_$ield!"e TYPE 7*17_41+*:3'(+" I30+/3'* 290)90 0'6*+ 41+*: .230'1313; 08+ .2:+7 24 +&.+)01237
02 6+ 290)90.
O90)90 0'6*+ 41+*: .2:+" D1D E /+: 0/'441. *1;80
D2D E <+**2@ 0/'441. *1;80
D3D E ;/++3 0/'441. *1;80 F1+*:3'(+ 42/ +&.+)0123
V'*9+ 7+0" SPACE 130+/3'* 290)90 0'6*+ 41+*: 3'(+.

12. Li0*ts_t!#!"e TYPE 7*17_0'63'(+" N'(+ 24 08+ 130+/3'* 290)90 0'6*+ 08'0 .230'137 08+ 41+*: 13 08+
)'/'(+0+/ LIG!TS_FIELDNAME. I4 LIG!TS_FIELDNAME 17 320 +()0< 0817 41+*: (970 '*72 6+ 41**+: 42/
81+/'/.81.'*,7+=9+301'* *1707. O3*< /+*+5'30 42/ 81+/'/.81.'*,7+=9+301'* *1707.
V'*9+ 7+0" SPACE 130+/3'* 290)90 0'6*+ 3'(+.
13. Li0*ts_/oll!"e LI%E :41+7,/2**3'(+" T8+ :2.9(+30'0123 24 0817 :'0' +*+(+30 17 :17)*'<+: @8+3 <29
.'** F1 8+*) 42/ '3 +&.+)0123 .2*9(3.
V'*9+ 7+0" SPACE :'0' +*+(+30 3'(+.
14. Li0*ts_)odese A1B TYPE . " I4 ' *170 /+.2/: 17 290)90 @108 D/+: 0/'441. *1;80D +'.8 S96020'* 08'0
13.*9:+7 0817 /+.2/: 17 '*72 290)90 @108 D/+: 0/'441. *1;80D.
V'*9+ 7+0" SPACE DXD
DXD E 08+ D('&1(9(D +&.+)0123 24 08+ 10+(7 13 08+ 796020'* 17 290)90 '0 796020'* *+5+*.
S9(7
153 No_s&")*oi)e A1B TYPE ." T817 )'/'(+0+/ '**2@7 08+ .821.+ 42/ 79((13; 9) O3*< 6< 41+*: .'0'*2;.
V'*9+ 7+0" SPACE DXD
DXD E 41+*:7 @81.8 '/+ 02 6+ 79((+: )'77+: 6< 08+ .'**13; )/2;/'( AFIELDCAT,DO_SUM E DXDB. T8+
97+/ 7829*: 320 6+ '6*+ 02 .8'3;+ 0817 5'*9+ 130+/'.015+*<.
16. No_tot!llieA1B TYPE . " R+(25+7 08+ 2)0123 24 8'513; 020'*7 '40+/ 796,020'*7.
V'*9+ 7+0" SPACE DXD
DXD E 32 020'* /+.2/: 17 02 6+ 290)90. S96020'*7 .'3 701** 6+ .'*.9*'0+: '3: 290)90. T8+ 41+*:7 13 08+
796020'*7 '/+ 4*';;+: DO_SUM E DXD 13 08+ 41+*: *170.
17. No_s&#)*oi)eA1B TYPE . " D2+7 320 '**2@ 08+ 97+/ 02 130+/'.015+*< .8'3;+ 08+ 41+*: .827+3 42/
796020'*7.
V'*9+ 7+0" SPACE DXD
DXD E 5'*9+ @827+ .8'3;+ 0/1;;+/7 796020'*7 )/251:+: 6< 08+ .'**13; )/2;/'(. T8+ 97+/ 7829*: 320 6+
'6*+ 02 .8'3;+ 0817 5'*9+ 130+/'.015+*<.

18. No_s&#tot!lsA1B TYPE . " N2 796020'*7 )27716*+
V'*9+ 7+0" SPACE DXD
DXD E 32 796020'*7.
193 N&")_s&"A1B TYPE . " T20'*7 23*< )27716*+ 42/ NUMC,F1+*:7.
2?. No_&it_splitti0 TYPE ." N2 7+)'/'0+ 020'* *13+7 6< 138.93107
21.tot!ls_#e$o/e_ite"s TYPE ." D17)*'< 020'*7 6+42/+ 08+ 10+(7
22. Tot!ls_ol(A1B TYPE . " S82@ 23*< 020'*7
V'*9+ 7+0" SPACE DXD
DXD E 23*< 020'* /+.2/:7 '/+ 290)90.
23. Tot!ls_te-tA6?B TYPE . " T+&0 42/ 170 .2*. 13 020'*7
V'*9+ 7+0" SPACE 70/13; A('&.6?B
'5 of 3;
ALV Documentation with Examples
D D E T8+ 41/70 .2*9(3 13 08+ 020'* /+.2/: .230'137 '3 '))/2)/1'0+ 39(6+/ 24 D-D7 02 13:1.'0+ 08+ 020'* 6<
:+4'9*0. I4 08+ 41/70 .2*9(3 17 @1:+ +329;8 08+ 70/13; DT20'*D 17 290)90 '40+/ 08+ '70+/17>7.
DS0/13;P E T8+ 70/13; )'77+: 17 290)90 '40+/ 08+ 020'* 13:1.'0+: 6< D-D 14 08+ .2*9(3 17 @1:+ +329;8.
24. S&#tot!ls_te-tA6?B TYPE . " T+&07 42/ 796020'*7
V'*9+ 7+0" SPACE 70/13; A('&.6?B
D D E I3 08+ 41/70 .2*9(3 24 796020'* /+.2/:7 08+ 796020'* 17 13:1.'0+: 6< '3 '))/2)/1'0+ 39(6+/ 24 D-D 6<
:+4'9*0. I4 08+ 41/70 .2*9(3 17 320 ' 796020'* ./10+/123 08+ 70/13; DT20'*D 17 290)90 '40+/ 08+ '70+/17>7 14 08+
.2*9(3 17 @1:+ +329;8.
DS0/13;P E 08+ 70/13; )'77+: 17 290)90 '40+/ 08+ 796020'* 13:1.'0+: 6< D-D 14 08+ .2*9(3 17 @1:+ +329;8
'3: 08+ 41/70 .2*9(3 17 320 ' 796020'* ./10+/123. I4 10 17 ' 796020'* ./10+/123 107 5'*9+ 17 /+)+'0+: '40+/ 08+
020'* 14 08+ .2*9(3 17 @1:+ +329;8.
I30+/'.0123
25. Bo-_$ield!"e TYPE 7*17_41+*:3'(+" F1+*:3'(+ 42/ .8+.>62& 13 08+ /+)2/0 290)90. I4 08+ *170 8'7
.8+.>62&+7 '0 08+ 70'/0 24 /+.2/:7 A42/ 7+*+.013; 7+5+/'* /+.2/:7B 0817 )'/'(+0+/ .230'137 08+ 130+/3'*
290)90 0'6*+ 41+*: 3'(+ 13:1.'0+: 6< 08+ .8+.>62& 7+*+.0123 .2*9(3. T8+ 41+*: 17 ' .8+.>62& '0 08+ 70'/0 24
*170 /+.2/:7 @108290 ' *170 8+':+/.
V'*9+ 7+0" SPACE 130+/3'* 290)90 0'6*+ 41+*: 3'(+

26. Bo-_t!#!"e TYPE 7*17_0'63'(+" N'(+ 24 08+ 130+/3'* 290)90 0'6*+ 08'0 .230'137 08+ 41+*: 13 08+
)'/'(+0+/ $OX_FIELDNAME. I4 $OX_FIELDNAME 17 320 +()0< 0817 41+*: (970 '*72 6+ 41**+: 42/
81+/'/.81.'*,7+=9+301'* *1707.
V'*9+ 7+0" SPACE 130+/3'* 290)90 0'6*+ 3'(+.
27. Bo-_/oll!"e LI%E ::?3),/2**3'(+" /2**3'(+ 42/ .8+.>62&
28. E-p!d_$ield!"e TYPE 7*17_41+*:3'(+" 41+*:3'(+ 4*'; O+&)'3:P. T8+ 97+/ .'3 782@ 2/ 81:+ 08+
10+(7 6< .*1.>13; 23 08+ 42*:+/ 7<(62* A8207)20B. I4 08+ 10+(7 42/ ' 8+':+/ +30/< '/+ 23*< 02 6+ /+': 6< 08+
.'**13; )/2;/'( '3: )'77+: 02 ALV @8+3 ' 8+':+/ 8'7 6++3 +&)'3:+: 130+/'.015+*< 0817 .'3 6+
.230/2**+: 51' 08+ CALL$AC% +5+30 DITEM_DATA_EXPANDD.
29. ,otspot_$ield!"e TYPE 7*17_41+*:3'(+" U7+: 02 ('>+ 08+ 41+*:3'(+ 4*'; 8207)20.
3?. No_ip&tA1B TYPE . " T8+ 41+*:7 '/+ 23*< :17)*'< 41+*:7.
V'*9+ 7+0" SPACE DXD
DXD E '** /+':<,42/,13)90 41+*:7 13 ' *170 '/+ :17)*'<+: '7 320 /+':<,42/,13)90. AR+.2/: 7+*+.0123
.8+.>62&+7 '3: 41+*:7 @81.8 .'3 6+ (':+ /+':<,42/,13)90 51' 08+ 41+*: *170 )'/'(+0+/ FIELDCAT,
INPUT E DXDB
31. F7)ode LI%E 7<,9.2((" T2 '771;3 '3 ALV 70'3:'/: 493.0123 .2:+ 02 :296*+,.*1.> AF2B '771;3 08+
493.0123 .2:+ 02 0817 )'/'(+0+/. E&." 02 '771;3 08+ ALV 70'3:'/: 493.0123 DD+0'1*D ADHETADB 02 F2.
ER LAYOUT,F2CODE E DHETAD.
V'*9+ 7+0" SPACE 493.0123 .2:+

32. Co$i/"!tio_p/o"pt" .2341/(. P/2()0 @8+3 *+'513;
V'*9+ 7+0" SPACE DXD
DXD E 14 23+ 24 08+ 493.01237 O$'.> AF?3BD OE&10 AF15BD 2/ OC'3.+* AF12BD 2..9/7 ' .2341/('0123 )/2()0
'))+'/7.
33. 'e(_*otspotA1B TYPE . " T8+ >+< 41+*:7 '/+ :17)*'<+: '7 8207)20. T8+ .2*9(37 :+413+: 13 08+ 41+*:
.'0'*2; '7 >+< 41+*:7 AFIELDCAT,%EY E DXDB '/+ 290)90 '7 8207)207 1.+. .*1.>13; 23 ' >+< .2*9(3
A81;8*1;80+: 13 .2*2/ 13 08+ *170B .'**7 08+ 493.0123 93:+/ F2.
V'*9+ 7+0" SPACE DXD.
34. Rep/epA1B TYPE . " /+)2/0 /+)2/0 130+/4'.+ '.015+.
'6 of 3;
ALV Documentation with Examples
35. 8/o&p_#&ttos A1B TYPE . " ;/29),6900237 42/ COL1 , COL5 . G/29) 290)90 41+*:7 51' FIELDCAT,
SP_GROUP 13 08+ 41+*: *170 '3: )'77 08+ ;/29) 3'(+ 02 08+ *170 (2:9*+ 13 08+ 130+/4'.+ )'/'(+0+/
IT_SPECIAL_GROUPS.
V'*9+ 7+0" SPACE DXD.
36. No_1e($i-A1B TYPE . " U7+: 02 ('>+ 08+ >+< 41+*:7 7./2**'6*+.
V'*9+ 7+0" SPACE DXD.
D D E T8+ >+< .2*9(37 :+413+: 13 08+ 41+*: .'0'*2; 6< FIELDCAT,%EY E DXD '/+ 41&+: 13 08+ *170 290)90.
T8+7+ .2*9(37 :2 320 7./2** 82/1F230'**<. T8+ 10+( 0'6*+ >+< .2*9(37 '/+ 41&+: 13 81+/'/.81.'*,
7+=9+301'* *1707. T8+ 8+':+/ 0'6*+ >+< 41+*:7 '/+ 320 .2371:+/+: 8+/+.
DXD E >+< .2*9(37 320 41&+:
37. 8et_seli$osA1B TYPE . " T2 /+': 7+*+.0123 7./++3.
V'*9+ 7+0" SPACE DXD.
I4 08+ .'**13; )/2;/'( 17 ' /+)2/0 @108 '3 A$APK4 7+*+.0123 7./++3 7+0013; 0817 )'/'(+0+/ ('>+7 ALV
/+': 08+ 7+*+.0123 7./++3 ';'13. I4 08+ 7+*+.01237 '/+ /+': 79..+7749**< ' )978690023 51' @81.8 08+
97+/ .'3 .'** ' )2)9) @81.8 *1707 08+ /+)2/0 7+*+.01237 13 ' 71()*+ 42/( 6+.2(+7 '.015+ 23 08+ /+79*07
*170 290)90 6< ALV.
-6. 0/o&p_)*!0e_editA1B TYPE . " S+0013;7 6< 97+/ 42/ 3+@ ;/29)
V'*9+ 7+0" SPACE DXD
DXD E 08+ 97+/ .'3 +30+/ ' 42/('0 2)0123 42/ +'.8 72/0 ./10+/123 13 08+ 72/0K796020'* )2)9) 42/ 08+ *170
42/('0 @8+3 0817 5'*9+ .8'3;+7 A+.;. 3+@ )';+ 2/ 93:+/*13+B.
-;. No_s)/olli0A1B TYPE . " D2+7 320 '**2@ 7./2**13; 24 08+ *170 02 08+ /1;80.
V'*9+ 7+0" SPACE DXD.
4?. E-p!d_!llA1B TYPE . " E&)'3: '** )27101237
D+0'1*+: 7./++3
1=. Det!il_pop&pA1B TYPE . " 782@ :+0'1* 13 )2)9).
V'*9+ 7+0" SPACE DXD
D D E L170 /+.2/: :+0'1* :17)*'< 13 49**,7./++3 (2:+ @108 02),24,)';+.
DXD E *170 /+.2/: :+0'1* :17)*'< 13 )2)9) A@108290 02),24,)';+B.
41. Det!il_iiti!l_liesA1B TYPE . " 782@ '*72 13101'* *13+7
V'*9+ 7+0" SPACE DXD
D D E O3*< 41+*:7 @827+ .230+307 '/+ 320 13101'* '/+ 290)90 13 08+ :+0'1* 51+@.
DXD E 13101'* 41+*: .230+307 '/+ '*72 290)90 13 :+0'1*.
1'. det!il_title#!/A3?B 0<)+ . " T10*+6'/ 42/ :+0'1* 7./++3
V'*9+ 7+0" SPACE 70/13; A('&.3?B
O O E D D+0'1*" D17)*'<D 17 290)90 '7 08+ 010*+ 24 08+ :+0'1* @13:2@.
DS0/13;P E 08+ 70/13; )'77+: 17 290)90 '7 08+ 010*+ 24 08+ :+0'1* @13:2@.

D17)*'< 5'/1'307
42. ,e!de/_te-t A2?B TYPE ." T+&0 42/ 8+':+/ 690023. O3*< /+*+5'30 42/ 81+/'/.81.'*,7+=9+301'* *1707. Y29
.'3 02;;*+ 6+0@++3 :17)*'< 41+*: '3: 41+*: *170 51+@7 51' )9786900237 13 08+ :17)*'< 5'/1'30 :+41310123 )2)9)
42/ 81+/'/.81.'*,7+=9+301'* *1707. T8+ 51+@7 /+4+/ 02 08+ 81+/'/.8< *+5+* 24 08+ 41+*:7. T817 17 0+.831.'**< '
02;;*+ 6+0@++3 08+ 8+':+/ 0'6*+ '3: 10+( 0'6*+ 41+*:7.
V'*9+ 7+0" SPACE C!AR A2?B
D D E T8+ 8+':+/ 0'6*+ 41+*: )978690023 0+&0 17 D!+':+/D 6< :+4'9*0.
C!AR A2?B E 8+':+/ 0'6*+ 41+*: )978690023 0+&0.
43.ite"_te-tA2?B TYPE . " T+&0 42/ 10+( 690023. O3*< /+*+5'30 42/ 81+/'/.81.'*,7+=9+301'* *1707. Y29 .'3
02;;*+ 08+ 51+@ 6+0@++3 08+ :17)*'< 41+*:7 '3: 08+ 41+*: *170 51' )9786900237 13 08+ :17)*'< 5'/1'30 :+41310123
'; of 3;
ALV Documentation with Examples
)2)9) 42/ 81+/'/.81.'*,7+=9+301'* *1707. T8+ 51+@7 /+4+/ 02 08+ 81+/'/.8< *+5+* 24 08+ 41+*:7. T817 17
0+.831.'**< ' 02;;*+ 6+0@++3 08+ 8+':+/ 0'6*+ '3: 10+( 0'6*+ 41+*:7.
V'*9+ 7+0" SPACE C!AR A2?B
D D E T8+ )978690023 0+&0 42/ 08+ 10+( 0'6*+ 41+*:7 17 DI0+(D 6< :+4'9*0.
C!AR A2?B E 10+( 0'6*+ 41+*: )978690023 0+&0.
44.de$!&lt_ ite"A1B TYPE . " I0+(7 '7 :+4'9*0. O3*< /+*+5'30 42/ 81+/'/.81.'*,7+=9+301'* *1707.
V'*9+ 7+0" SPACE DXD
D D E T8+ 8+':+/ 0'6*+ 41+*:7 '/+ :17)*'<+: 6< :+4'9*0 13 08+ :17)*'< 5'/1'30 :+41310123 )2)9). T8+ 97+/
.'3 7@10.8 02 08+ 10+( 0'6*+ 41+*:7 130+/'.015+*<.
DXD E 08+ 10+( 0'6*+ 41+*:7 '/+ :17)*'<+: 6< :+4'9*0 13 08+ :17)*'< 5'/1'30 D+41310123 P2)9). T8+ 97+/
.'3 7@10.8 02 08+ 8+':+/ 0'6*+ 41+*:7 130+/'.015+*<.
C2*29/
45. I$o_$ield!"e TYPE 7*17_41+*:3'(+" 134241+*: 42/ *170290)90. A @82*+ *170 /+.2/: .'3 6+ .2*2/+:
13:151:9'**< 9713; ' .2*2/ .2:+ 13 ' .2*9(3 24 08+ 130+/3'* 290)90 0'6*+ 42/ 08+ /+.2/:. A771;3 08+ 3'(+ 24
08+ 41+*: .230'1313; 08+ .2*2/ .2:+ 02 0817 )'/'(+0+/.
V'*9+ 7+0" SPACE 130+/3'* 290)90 0'6*+ 41+*: 3'(+
T8+ 130+/3'* 290)90 0'6*+ 41+*: (970 6+ 24 0<)+ C!ARA3B.
T8+ .2:+ (970 8'5+ 08+ 42**2@13; 7<30'&" DC&<D"
C E .2*2/ A'** .2:+7 (970 70'/0 @108 DCDB
X E .2*2/ 39(6+/ AD1D,D9DB
Y E 62*: AD?D E 244 D1D E 23B
46. Colt!#_$ield!"e TYPE 7*17_41+*:3'(+" C+**7 .'3 6+ .2*2/+: 13:151:9'**< 9713; ' .2*2/ .2:+ @81.8 17
.230'13+: 13 ' .2*9(3 24 08+ 130+/3'* 290)90 0'6*+ 42/ 08+ /+.2/: .230'1313; 08+ .+**. A771;3 08+ 3'(+ 24
08+ 41+*: 02 0817 )'/'(+0+/.
O08+/7
47. List_!ppedA1B TYPE . " 32 .'** 7./++3. I0 17 23*< 97+49* 02 290)90 6*2.>,*1707 @108290 7)+.14<13; 08+
'625+ (2:9*+7 14 08+ 39(6+/ 24 *170 6*2.>7 +&.++:7 2/ ('< +&.++: 08+ ('&1(9( 39(6+/ 7)+.141+: 13
08+ 6*2.> (2:9*+ :2.9(+30'0123. T8+7+ 2)+/'01237 '/+ 320 )27716*+ 42/ 97+/,:+413+: 6*2.> *1707.
E-!"ple )ode :
I8LA#+%T-f.code D ws8fcode.
I8LA#+%T-Kebra D F:F.
I8LA#+%T-colwidth8optimiKe D F:F.
I8LA#+%T-no8eyfix D F:F.
I8LA#+%T-get8selinfos D F:F.
I8LA#+%T-no8hotspot D F:F.
I8LA#+%T-no8input D F:F.
I8LA#+%T-hotspot8fieldname D 7IELD,AEE.
I8LA#+%T-no8input D ?:@.
I8LA#+%T-no8&line D P:@.
I8LA#+%T-no8colhead D ? ?.
I8LA#+%T-lights8condense D P P.
I8LA#+%T-totals8text D P P.
I8LA#+%T-subtotals8text D P P.
I8LA#+%T-totals8only D P P.
I8LA#+%T-ey8hotspot D ?:@.
I8LA#+%T-detail8popup D ?:@.
I8LA#+%T-group8change8edit D ?:@.
I8LA#+%T-C*+%48!%TT+,$ D ?:@.
.= of 3;
ALV Documentation with Examples
Step 9(P!ss Sele)tio:s)/ee I$o/"!tio)
This step is reNuired to get the selection screen information in the report output.
The prereNuisite for this is to set the parameter LA#+%T-CET8$ELI,7+$ of the IE4+*TI,C structure.
The parameters to be passed in the I$8$EL8GIDE table are(
o mode( F*F D only the entries passed in the internal table I$8$EL8GIDE-T8E,T*IE$
Are output in the pop up. $election info" which the list tool read in the selection screen /when called by
a report with a selection screen0" is replaced by the &alues passed.
F$F D the selection info which the list tool read in the selection screen of the calling report are modified
by the entries in the table I$8$EL8GIDE-T8E,T*IE$.
t8entries( $election info table
t8entries-mode( FAF D output the selection info for the current table record in the info popup.
FDF D do not output select option or $EL,AEE parameter selection info in the popup.
t8entries-selname( /only used in t8entries-mode D FDF0 ( ,ame of the select option or parameter.
The following table fields are only used in t8entries-mode D FAF. They contain the selection information to be added.
t8entries-field( DDI) field name of the field for which selection information is to be output.
t8entries-table( DDI) table names of t8entries-field.
t8entries-stext( 7ield name in info popup.
If t8entries-field and t8entries-table ha&e been entered" this text is taen from DDI).
t8entries-&aluf( $election condition FfromF &alue /external format0
t8entries-&alut( $election condition FtoF &alue /external format0
t8entries-sign=( /I0nclusi&e /E0xclusi&e
t8entries-option( All &alues of the select options +ption field allowed.
.' of 3;
ALV Documentation with Examples
Step ;(De)idi0 So/t C/ite/i!)
T8+ T'6*+ IT_SORT 17 )2)9*'0+: @108 08+ 72/0 ./10+/1' 42/ 08+ :144+/+30 41+*:7.
T8+ .'**+/ 7)+.141+7 08+ 72/013; '3:K2/ 796020'*13; 24 08+ 6'71. *170 13 08+ 130+/3'* 0'6*+ IT_SORT.
T817 130+/3'* 0'6*+ 8'7 08+ 42**2@13; 41+*:7"
7)27 " S2/0 7+=9+3.+
41+*:3'(+ " I30+/3'* 290)90 0'6*+ 41+*: 3'(+
0'63'(+ " O3*< /+*+5'30 42/ 81+/'/.81.'*,7+=9+301'* *1707. N'(+ 24 08+ 130+/3'* 290)90 0'6*+.
9) " DXD E 72/0 13 '7.+3:13; 2/:+/
:2@3 " DXD E 72/0 13 :+7.+3:13; 2/:+/
796020 " DXD E 796020'* '0 ;/29) 5'*9+ .8'3;+
;/29) " D- D E 3+@ )';+ '0 ;/29) 5'*9+ .8'3;+ DULD E 93:+/*13+ '0 ;/29) 5'*9+ .8'3;+
Step <(Fi!l Step)
The final step in the output of the report is the use of two ALV functions modules.
'. *E%$E8ALV87IELD)ATAL+C8EE*CE
.. *E%$E8ALV8LI$T8DI$4LA#
The first function module is used to pass the field catalog to the report output and merge it with the internal
output table.
7%,)TI+, reuse8al&8fieldcatalog8merge.
AQ---------------------------------------------------------------------
AQAQLoale $chnittstelle(
AR IE4+*TI,C
AQ VAL%E/I84*+C*AE8,AEE0 LI9E $#-*E4ID +4TI+,AL
AQ VAL%E/I8I,TE*,AL8TA!,AEE0 T#4E $LI$8TA!,AEE +4TI+,AL
AQ VAL%E/I8$T*%)T%*E8,AEE0 LI9E DD=.L-TA!,AEE +4TI+,AL
AQ VAL%E/I8)LIE,T8,EVE*8DI$4LA#0 T#4E $LI$8)GA*8' default ?:@
AQ VAL%E/I8I,)L,AEE0 LI9E T*DI*-,AEE +4TI+,AL
AQ )GA,CI,C
AQ VAL%E/)T87IELD)AT0 T#4E $LI$8T87IELD)AT8ALV
AQ E:)E4TI+,$
AQ I,)+,$I$TE,T8I,TE*7A)E
AQ 4*+C*AE8E**+*
AQ---------------------------------------------------------------------
Import parameters
I84*+C*AE8,AEE( 4rogram in which the internal output table is declared and populated
I8I,TE*,AL8TA!,AEE( Internal output table name
I8$T*%)T%*E8,AEE( $tructure name /structure" table" and &iew0
I8)LIE,T8,EVE*8DI$4L( Gide client fields default ?:@
I8I,)L,AEE( Data declarations include name
)GA,CI,C parameter
)T87IELD)AT( 7ield catalog with field descriptions
The &ariant based on a program-internal table should only be used for rapid prototyping since the following restrictions
apply(

'. 4erformance is affected since the code of the table definition must always be read and interpreted at runtime.
.. Dictionary reference are only considered if the eywords LI9E or I,)L%DE $T*%)T%*E /not T#4E0 are used.
.. of 3;
ALV Documentation with Examples
Step ;(D"spla8 Inte-nal .!tp!t Ta3le)
The other function module is used to display the internal output table with the contents
7%,)TI+, reuse8al&8list8display.
AQ----------------------------------------------------------------------
AQAQLoale $chnittstelle(
R IE4+*TI,C
AQ VAL%E/I8I,TE*7A)E8)GE)90 DE7A%LT $4A)E
AQ VAL%E/I8)ALL!A)984*+C*AE0 LI9E $#-*E4ID DE7A%LT $4A)E
AQ VAL%E/I8)ALL!A)98478$TAT%$8$ET0 T#4E $LI$87+*E,AEE DE7A%LT $4A)E
AQ VAL%E/I8)ALL!A)98%$E*8)+EEA,D0 T#4E $LI$87+*E,AEE DE7A%LT $4A)E
AQ VAL%E/I8$T*%)T%*E8,AEE0 LI9E DD=.L-TA!,AEE +4TI+,AL
AQ VAL%E/I$8LA#+%T0 T#4E $LI$8LA#+%T8ALV +4TI+,AL
AQ VAL%E/IT87IELD)AT0 T#4E $LI$8T87IELD)AT8ALV +4TI+,AL
AQ VAL%E/IT8E:)L%DI,C0 T#4E $LI$8T8E:TA! +4TI+,AL
AQ VAL%E/IT8$4E)IAL8C*+%4$0 T#4E $LI$8T8$48C*+%48ALV +4TI+,AL
AQ VAL%E/IT8$+*T0 T#4E $LI$8T8$+*TI,7+8ALV +4TI+,AL
AQ VAL%E/IT87ILTE*0 T#4E $LI$8T87ILTE*8ALV +4TI+,AL
AQ VAL%E/I$8$EL8GIDE0 T#4E $LI$8$EL8GIDE8ALV +4TI+,AL
AQ VAL%E/I8DE7A%LT0 DE7A%LT F:F
AQ VAL%E/I8$AVE0 DE7A%LT $4A)E
AQ VAL%E/I$8VA*IA,T0 LI9E DI$VA*IA,T $T*%)T%*E DI$VA*IA,T DE7A%LT $4A)E
AQ VAL%E/IT8EVE,T$0 T#4E $LI$8T8EVE,T +4TI+,AL
AQ VAL%E/IT8EVE,T8E:IT0 T#4E $LI$8T8EVE,T8E:IT +4TI+,AL
AQ VAL%E/I$84*I,T0 T#4E $LI$84*I,T8ALV +4TI+,AL
AQ VAL%E/I$8*E4*E48ID0 T#4E $LI$8*E4*E48ID +4TI+,AL
AQ VAL%E/I8$)*EE,8$TA*T8)+L%E,0 DE7A%LT =
AQ VAL%E/I8$)*EE,8$TA*T8LI,E0 DE7A%LT =
AQ VAL%E/I8$)*EE,8E,D8)+L%E,0 DE7A%LT =
AQ VAL%E/I8$)*EE,8E,D8LI,E0 DE7A%LT =
Q E:4+*TI,C
AQ VAL%E/E8E:IT8)A%$ED8!#8)ALLE*0
AQ VAL%E/E$8E:IT8)A%$ED8!#8%$E*0 T#4E $LI$8E:IT8!#8%$E*
Q TA!LE$
AQ T8+%TTA!
Q E:)E4TI+,$
AQ 4*+C*AE8E**+*
Import parameters
I8I,TE*7A)E8)GE)9( Interface consistency chec log output.
I8)ALL!A)984*+C*AE( ,ame of the calling program
I8)ALL!A)98478$TAT%$8$ET( $et E:IT routine to status.
I8)ALL!A)98%$E*8)+EEA,D( E:IT routine for command handling
I8$T*%)T%*E8,AEE( Internal output table structure name
I$8LA#+%T( List layout specifications
IT87IELD)AT( 7ield catalog with field descriptions
IT8E:)L%DI,C( Table of inacti&e function codes
IT8$4E)IAL8C*+%4$( Crouping fields for column selection
IT8$+*T( $ort criteria for first list display
IT87ILTE*( 7ilter criteria for first list output
I$8$EL8GIDE( $election information modification
I8DE7A%LT( Initial &ariant acti&eOinacti&e logic
I8$AVE( Variants can be sa&ed
I$8VA*IA,T( Variant information
IT8EVE,T$( Table of e&ents to perform
IT8EVE,T8E:IT( $tandard fcode exit reNuests table
I$84*I,T( 4rint information
.- of 3;
ALV Documentation with Examples
I$8*E4*E48ID( InitialiKation eys for *eO*e interface
I8$)*EE,8$TA*T8)+L%E,( )oordinates for list in dialog box
I8$)*EE,8$TA*T8LI,E( )oordinates for list in dialog box
I8$)*EE,8E,D8)+L%E,( )oordinates for list in dialog box
I8$)*EE,8E,D8LI,E( )oordinates for list in dialog box
IT8EVE,T8E:IT( $tandard fcode exit reNuests table
I$84*I,T( 4rint information
I$8*E4*E48ID( InitialiKation eys for *eO*e interface
I8$)*EE,8$TA*T8)+L%E,( )oordinates for list in dialog box
I8$)*EE,8$TA*T8LI,E( )oordinates for list in dialog box
I8$)*EE,8E,D8)+L%E,( )oordinates for list in dialog box
I8$)*EE,8E,D8LI,E( )oordinates for list in dialog box
Export parameters
E8E:IT8)A%$ED8!#8)ALLE*( Delete list in )ALL!A)98%$E*8)+EEA,D
E$8E:IT8)A%$ED8!#8%$E*( Gow the user left the list Tables
T8+%TTA!( Table with data to be displayed ---mandatory
.1 of 3;
ALV Documentation with Examples
D2.9(+30'0123 23 493.0123 (2:9*+: RE=SE_ALV_8RID_DISPLA>
The function module outputs an internal table with whate&er structure in the form of a formatted single- or multi-line list.
P-oess:
4assing an internal table with the set of information to be output
4assing a structure with general layout specifications for list layout
4assing a field catalog in the form of an internal table
The field catalog describes the fields to be output in the list.
/otes
All interactions performed on the list refer directly to the internal output table. $orting the list" for example"
also in&ol&es a resorting of the internal output table passed /since it was passed by reference0.
An important factor determining the usability of the tool or of &arious generic functions /totals" subtotals0 is
the expected amount of data to be displayed.
P!/!"ete/s :
I8I,TE*7A)E8)GE)9
I8!#4A$$I,C8!%77E*
I8!%77E*8A)TIVE
I8)ALL!A)984*+C*AE
I8)ALL!A)98478$TAT%$8$ET
I8)ALL!A)98%$E*8)+EEA,D
I8)ALL!A)98T+48+784ACE
I8)ALL!A)98GTEL8T+48+784ACE
I8)ALL!A)98GTEL8E,D8+78LI$T
I8$T*%)T%*E8,AEE
I8!A)9C*+%,D8ID
I8C*ID8TITLE
I8C*ID8$ETTI,C$
I$8LA#+%T
IT87IELD)AT
IT8E:)L%DI,C
IT8$4E)IAL8C*+%4$
IT8$+*T
IT87ILTE*
I$8$EL8GIDE
I8DE7A%LT
I8$AVE
I$8VA*IA,T
IT8EVE,T$
IT8EVE,T8E:IT
I$84*I,T
I$8*E4*E48ID
I8$)*EE,8$TA*T8)+L%E,
I8$)*EE,8$TA*T8LI,E
I8$)*EE,8E,D8)+L%E,
I8$)*EE,8E,D8LI,E
IT8ALV8C*A4GI)$
IT8ADD87IELD)AT
IT8G#4E*LI,9
E8E:IT8)A%$ED8!#8)ALLE*
.3 of 3;
ALV Documentation with Examples
E$8E:IT8)A%$ED8!#8%$E*
.2 of 3;
ALV Documentation with Examples
I_CALLBAC'_PRO8RA6: N!"e o$ t*e )!lli0 p/o0/!"
P/2;/'( 4/2( @81.8 08+ 493.0123 (2:9*+ 17 .'**+: '3: 08'0 .230'137 08+ +&10 /29013+7. T8+ )/2;/'( 7829*:
'*@'<7 6+ ' /+)2/0 493.0123 ;/29) (2:9*+ )22* 2/ 42/( /29013+ )22* A10 7829*: 320 6+ '3 13.*9:+B.
C!&tio: N+5+/ )'77 SY,REPID :1/+.0*< '0 08+ 130+/4'.+. I4 41+*: SY,REPID .230'137 08+ :+71/+: )/2;/'(
3'(+ <29 (970 '672*90+*< '771;3 0817 3'(+ 02 '3 '9&1*1'/< 5'/1'6*+ '3: )'77 0817 5'/1'6*+ 02 08+ 130+/4'.+.
I&CALLBAC?&P1&STAT%S&SET: Set E7IT -!nt"me to stat!s
4assing an E:IT routine indicates to the ALV that the caller wants to set a self-defined user status. As a result" the
default status of the ALV is not set. The interface of the form routine specified must be defined as follows(
1.R6 set8pf8status %SI/' rt8extab T(PE slis8t8extab
Table *T8E:TA! contains the function codes that would be hidden on the standard user interface.
If the caller wants to use a self-defined user interface /for example" in order to pro&ide additional list functions or use
existing functions0" we recommend that you copy standard status $TA,DA*D from function group $ALV and modify
it accordingly. ALV standard function codes always start with FBF.
$ee also the documentation on parameter I8)ALL!A)98%$E*8)+EEA,D.
If a self-defined user interface is used that includes function codes of the standard user interface" the function codes of
the excluding table passed should be taen into account.
This means that the user status should generally be set as follows(
SET P1-STAT%S user status E7CL%DI/' rt8extab.
Application functions can be added to excluding table rt8extab if they are to be disabled.
The routine is called whene&er the standard user interface would be set with $ET 47-$TAT%$.
De#a!lt
If no E:IT routine is specified" the ALV sets a status that corresponds to status $TA,DA*D of function group $ALV.
I&CALLBAC?&%SER&C.66A/D: E:IT routine for command handling
Description
4assing an E:IT routine indicates to the ALV that the application wants to respond to certain function codes.
Cenerally" these are function codes that are unnown to the ALV /that is" are not standard ALV functions0 and
that were defined and set by a user status.
$ee also the documentation on parameter I8)ALL!A)98478$TAT%$8$ET.
The interface of the form routine specified must be defined as follows(
1.R6 user8command %SI/' r8ucomm LI?E sy-ucomm rs8selfield T(PE slis8selfield.
4arameter *8%)+EE contains the function code triggered.
$tructure *$8$EL7IELD contains the following information(

o ta3name : ,ame of the internal output table
.5 of 3;
ALV Documentation with Examples
o ta3"n$ex : Index of the internal output table
o #"el$name: 7ield name
o en$s!m : )ursor is located on the totals line
o s!m"n$ex : If S=" the cursor is located on a subtotals line
o ,al!e : Value of the field on the list
o -e#-es+ : /Exporting0 List should be set up again
o ol&sta3le: /Exporting0 9eep column position when list is set up again
o -o@&sta3le: /Exporting0 9eep row position when list is set up again
o ex"t : /Exporting0 Exit list /and ALV0
o 3e#o-e&at"on: )all before standard action execution
o a#te-&at"on : )all after standard action execution" before list setup
o "*no-e&m!lt" : Internal use
o sel&ta3&#"el$: Internal use
The E:IT routine is called whene&er a function unnown to the ALV is triggered or if the routine call beforeOafter the
execution of a standard function code has been defined by interface parameter
IT8EVE,T8E:IT.
$ee also the documentation on parameter IT8EVE,T8E:IT.
The function code and the current cursor position are then passed on to the calling program through the E:IT routine.
If the user has selected multiple rows by selecting checboxes" the output table field designated as the checbox contains
the current state of the checbox in the list.
I_CALLBAC'_TOP_OF_PA8E
E:IT routine for handling T+4-+7-4ACE
Description
If the caller specifies an E:IT routine" this routine must ha&e the following form(
7+*E top8of8page.
Eodule *E%$E8ALV8)+EEE,TA*#8<*ITE can then be called within the E:IT routine. This module is
responsible for formatting the header information and also ensures online GTEL formatting. In the print pre&iew or in
batch mode" the text passed is then output in the normal format.
If module *E%$E8ALV8)+EEE,TA*#8<*ITE cannot be used" you must use two parameters instead. In
I8)ALL!A)98T+48+784ACE you pass the form routine that is responsible for normal formatting in batch mode or in
the print pre&iew mode. The form routine that is responsible for online formatting" is passed in parameter
I8)ALL!A)98GTEL8T+48+784ACE. If one of these parameters is not filled" top-of-page is not output in the
respecti&e mode.
.6 of 3;
ALV Documentation with Examples
I_CALLBAC'_,T6L_TOP_OF_PA8E
E:IT routine for GTEL T+4-+7-4ACE
Description
If function module *E%$E8ALV8)+EEE,TA*#8<*ITE is not used in the form for
)ALL!A)98T+48+784ACE" the form routine must be passed in parameter
I8)ALL!A)98GTEL8T+48+784ACE for the online mode. The form should then
ha&e the following format(
form top8of8page using cl8dd type ref to cl8dd8document.
In the form" you can" for example" use methods of class )L8DD8D+)%EE,T
to display text in GTEL format.
I_CALLBAC'_,T6L_END_OF_LIST
E:IT routine for GTEL E,D-+7-LI$T
Description
In this parameter" you can pass a form for the online handling of end-of-list. The form must ha&e the followiong format(

7orm End8of8List using )l8dd type ref to cl8dd8document.
I_STR=CT=RE_NA6E
Internal output table structure name
Description
If the internal output table is defined through an A!A4 Dictionary structure /I,)L%DE $T*%)T%*E struct or
LI9E struct0" you can automatically set up the field catalog by passing the structure name.
The field catalog is then internally set up for this structure as follows(
o All fields are on the list /,+8+%T D $4A)E0 except fields of data type )L,T.
o The ey fields of the Dictionary structure are adopted in the field catalog as ey fields.
o *eferences to unit fields stored in the Dictionary are adopted pro&ided that the reference fields are contained in the
structure.
o If you additionally pass a field catalog as parameter" the structure information is merged with this field catalog.
7or more information on how to set up the field catalog automatically" see the documentation on function module
*E%$E8ALV87IELD)ATAL+C8EE*CE.
I_8RID_TITLE
)ontrol title
Description ( $pecifies the title of the control. This text is displayed abo&e the grid.
.; of 3;
ALV Documentation with Examples
I_8RID_SETTIN8S
Crid settings
Description
If Top-of-4age or End-of-List are output online" these areas are displayed in a splitter abo&e or below the list. %sing
I8C*ID8$ETTI,C$ you can reduce the default siKe to =T. To do this" you use two fields(
)+LL8T+484( $ets Top-of-4age to =T
)+LL8E,D8L( $ets End-of-List to =T
IS_LA>O=T
List layout specifications
Description
$tructure for describing the list to be output.
The parameters are described and grouped based on the following
categories(
Display options
Exceptions
Totals
Interaction
Detail screen
)olor
+ther
,ote the section on pre-defined settings.
Displ!( optios
)olwidt*_opti"i+e
V'*9+ /'3;+" SPACE DXD
XD E O)01(1F+7 08+ .2*9(3 @1:08 02 +379/+ 08'0 08+ .230+30 17 :17)*'<+: .2()*+0+*<.
o_)ol*e!d
V'*9+ /'3;+" SPACE DXD
DXD E D2 320 290)90 .2*9(3 8+':13;7.
+e#/!
V'*9+ /'3;+" SPACE DXD
DXD E S0/1)+: )'00+/3 A42/ @1:+ *1707 42/ +&'()*+B
o_5lie
V'*9+ /'3;+" SPACE DXD
OXD E S+)'/'0+ .2*9(37 6< SPACE.
-= of 3;
ALV Documentation with Examples
E-)eptios
li0*ts_$ield!"e
Value range( $4A)E" field name of the internal output table field of the internal output table that contains the coding of
the exceptions to be output .
)oding in the field of the output table(
F'F D red traffic light
F.F D yellow traffic light
F-F D green traffic light
li0*ts_t!#!"e
Value range( $4A)E" table name of the internal output table Table name of the internal output table that contains the
specified field in parameter LICGT$87IELD,AEE.
li0*ts_/oll!"e
Value range( $4A)E" data element name
The documentation defined for this data element is displayed when the 7' help for an exception column is called.
li0*ts_)odese
Value range( $4A)E" F:F
F:F D The system outputs the FmaximumF exception of the items included in the total at subtotal le&el.
Example( If a list row is output with a Fred traffic lightF" each subtotal included in this list row is also displayed with a Fred
traffic lightF.
Tot!ls
o_s&")*oi)e
Value range( $4A)E" F:F
F:F D Value fields for which totals are calculated are communicated by the calling program /7IELD)AT-D+8$%E
D F:F0. The user should not be allowed to change this pre-defined setting interacti&ely.
o_tot!llie
Value range( $4A)E" F:F
F:F D ,o o&erall totals line should be displayed. If reNuired" subtotals can ne&ertheless be calculated and displayed.
The fields which are used for calculating subtotals are to be mared with
D+8$%E D F:F in the field catalog.
o_s&#)*oi)e
Value range( $4A)E" F:F
F:F D )haracteristics at whose control le&el subtotals should be calculated are communicated by the calling program.
The user should not be allowed to change this pre-defined setting interacti&ely.
$ee also the documentation on IE4+*TI,C parameter IT8$+*T.
o_s&#tot!ls
Value range( $4A)E" F:F
F:F D )alculating subtotals should not be allowed.
tot!ls_ol(
Value range( $4A)E" F:F
F:F D Data is output in compressed format only at totals line le&el.
4rereNuisite( IE4+*TI,C parameter IT8$+*T is filled accordingly with the sort criteria and the subtotals indicator.
$ee also the documentation on IE4+*TI,C parameter IT8$+*T.
-' of 3;
ALV Documentation with Examples
tot!ls_te-t
Value range( $4A)E" string /not more than 2=0
F F D In the first column" the standard system indicates the totals le&el by displaying an adeNuate number of FAF for
the o&erall total.After the asteriss" the system displays the string FtotalF pro&ided
that the column width of the first output column is large enough. If the column width is not sufficient" only the
asteriss are displayed.
FstringF D After the totals le&el indicated &isually by means of FAF" the system displays the string passed pro&ided
that the column width is sufficient.
s&#tot!ls_te-t
Value range( $4A)E" string /not more than 2=0 F F D In the first column" the standard system indicates the totals
le&el by displaying an adeNuate number of FAF for the subtotals line. After the asteriss" the system displays the string
AtotalA pro&ided that the column width of the first output column is large enough and the characteristic of the first
column is not a subtotal criterion. If the column width is not sufficient" only the asteriss are displayed.
FstringF D After the totals le&el indicated &isually by means of FAF" the system displays the string passed pro&ided that
the column width is sufficient and the characteristic of the first column is not a subtotal criterion.
If the characteristic is a subtotal criterion" the system repeats the characteristic &alue for which subtotals were
calculated after the totals le&el pro&ided that the column width is sufficient.
&")_s&"
Value range( $4A)E" F:F
F F D In the standard system" it is not possible to calculate totals for ,%E) fields.
F:F D It is generally possible to calculate totals for ,%E) fields. If this indicator is set" you can use parameter
7IELD)AT-,+8$%E to control for each ,%E) column whether totals can be calculated or not.
Ite/!)tio
#o-_$ield!"e
Value range( $4A)E" field name of the internal output table. If the list should ha&e checboxes at the beginning of
each list row /to allow the user to select multiple rows at once0" you must fill this parameter with the field name of
the internal output table that represents the selection column for selecting rows with the help of checboxes. The
field is always displayed as a checbox at the beginning of each list row without a list heading.
#o-_t!#!"e
Value range( $4A)E" table name of the internal output table
$7)ode
Value range( $4A)E" function code
Eeaning when the ALV standard interface is used(
If you want to assign a standard ALV function code to a double-clic /7.0" you must assign this function code to
this parameter.
Example( #ou want to assign the standard ALV function FDetailF
/FBETAF0 to 7..
DS LA#+%T-7.)+DE D FBETAF
Eeaning if a self-defined interface is used(
C!se 1:
#ou lea&e the standard ALV function code for 7. FBI)'F in the copied interface of the application. Gowe&er" you
want to ha&e a function executed with 7. that is not assigned to 7. in the interface
/standard ALV function or application function0. #ou must communicate this function code to the ALV using
parameter 7.)+DE.
-. of 3;
ALV Documentation with Examples
C!se 7:
#ou remo&e the standard ALV function code for 7. FBI)'F from the interface of the application and use another
function code instead /standard ALV function or application function0. #ou must
communicate this function code to the ALV using parameter 7.)+DE.
This is reNuired if you want to allow columns to be selected.
)o$i/"!tio_p/o"pt
Value range( $4A)E" F:F
F:F D If one of the functions F!ac/7=-0F" FExit/7'30F or F)ancel/7'.0F is triggered" the system ass the user if he wants
to lea&e the list.
1e(_*otspot
Value range( $4A)E" F:F
The columns defined as ey fields in the field catalog /7IELD)AT-9E# D F:F0 are output as a hotspot. This means
that single-clicing a ey field /highlighted in color in the list0 triggers the function assigned to 7..
/ep/ep
Value range( $4A)E" F:F
F:F D Enable reportOreport interface
4rereNuisite( Application system /DS report *99!*$TI exists0.
The list module acts as a potential sender in the reportOreport interface /interface initialiKation" if reNuired0.
The calling reportOmodule pool entered in I8)ALL!A)984*+C*AE is declared to the reportOreport interface as
the sender report with type *TD*eport. If the sender report is assigned to recei&er reports in table T*$TI" function
code !E!x is set to acti&e. / x D function code class0
E-!"ple:
If sender *9T7C$'3 has a recei&er assignment for *eport <riter report group 59+I with function code class F-F
/$A4 setting0" this recei&er report group is called through the reportOreport interface
at function code F!E!-F. The selections passed to the reportOreport interface are the report selections and the ey
information of the selected row.
7or more information on the reportOreport interface" see the documentation on function group F*$TIF.
Det!il s)/ee
det!il_iiti!l_lies
Value range( $4A)E" F:F
F F D In the detail &iew" the system displays only fields whose content is not set to initial.
F:F D Initial field contents are also displayed on the detail screen.
det!il_title#!/
Value range( $4A)E" string /not more than -=0
F F D The system displays FDetail( DisplayF as the title of the detail screen.
FstringF D The system displays the string passed as the title of the detail screen.
Colo/
i$o_$ield!"e
Value range( $4A)E" field name of the internal output table.
#ou can color an entire list row indi&idually by using a color code that is set for each row in a column of the internal
output table. #ou must assign the field name of the field with the color code to
this parameter.
-- of 3;
ALV Documentation with Examples
The field of the internal output table must be of type )GA*/-0.
The code must comply with the following syntax( F)xyF(
) D )olor /each code must begin with F)F0
x D )olor number /F'F-F;F0
y D Intensified /F=F D off" F'F D on0
,ote( The color of the ey column is not affected. If you also want
to color the ey column at row or cell le&el" you can use complex
coloring which is described below for parameter )+LTA!87IELD,AEE.
7or information on coloring columns" see the documentation on field catalog parameter 7IELD)AT-
EE4GA$IJE of IE4+*TI,C parameter IT87IELD)AT.
)olt!#_$ield!"e
Value range( $4A)E" field name of the internal output table
#ou can color cells indi&idually by using a color code that is set for the row of the cells in a column of the internal
output table. #ou must assign the field name of the field with the color code to this parameter.
The field of the internal output table must be of type $LI$8T8$4E)IAL)+L8ALV.
4rinciple( The field for the color code is filled in the row in which the cells to be colored are located. The field then
contains an internal table of the abo&e structure that includes the field names of the cells to be colored with the color
code. The cell coordinates are therefore deri&ed from the row position in which the color code is written and the
column information contained in the color table. The row structure of the internal color table of type
$LI$8T8$4E)IAL)+L8ALV is as follows(
7arbtabelle-,AEE D 7ield name of cell to be colored
7arbtabelle-)+L+*-)+L D )olor number /' - ;0
7arbtabelle-)+L+*-I,T D Intensified /= D off" ' D on0
7arbtabelle-)+L+*-I,V D In&erse /= D off" ' D on0
7arbtabelle-,+9E#)+L D Ignore ey coloring /F:F D yes" F F D no0
If parameter 7arbtabelle-,AEE is not filled" all color specifications refer to all fields. As a result" the entire row is
colored.
Default
In many cases" the default layout settings can be ept so that you freNuently do not need to pass this structure with
modified flags.
IT_FIELDCAT
7ield catalog with field descriptions
Des-"pt"on
7ield catalog containing the field descriptions of the fields to be considered for the list output /usually" this is a
subset of the fields in the internal output table0.
!asically" you need a field catalog for each list output that uses the ALV.
The field catalog associated with the output table is generated in the code of the caller. #ou can generate the field
catalog automatically or semi-automatically by calling function module
*E%$E8ALV87IELD)ATAL+C8EE*CE.
$ee also the documentation on function module ( *E%$E8ALV87IELD)ATAL+C8EE*CE.
-1 of 3;
ALV Documentation with Examples
The minimum &alues reNuired for the field catalog are documented in the FDefaultF section. The caller can optionally
use all other parameters to assign non-standard output attributes to a field.
It is only in the following cases that you are not reNuired to generate the field catalog and pass it explicitly(
The structure of the internal table to be output corresponds to a structure stored in the Data Dictionary and is
referenced with LI9E or I,)L%DE $T*%)T%*E in the declaration of the internal table.
All fields of this structure should be output in the list.
The structure name is declared to the ALV using parameter I8$T*%)T%*E8,AEE.
$ee also the documentation on IE4+*T,C parameter I8$T*%)T%*E8,AEE.
P271012313;
)ol_pos ()ol&" positio)
V'*9+ /'3;+" ? 1 , 6?
O3*< /+*+5'30 14 08+ /+*'015+ .2*9(3 )27101237 7829*: 6< :+4'9*0 320 6+ 1:+301.'* 02 08+ 7+=9+3.+ 24 08+
41+*:7 13 08+ 41+*: .'0'*2;.
T8+ )'/'(+0+/ :+0+/(13+7 08+ /+*'015+ .2*9(3 )2710123 24 08+ 41+*: 13 08+ *170 290)90. T8+ .2*9(3
7+=9+3.+ .'3 130+/'.015+*< 6+ .8'3;+: 6< 08+ 97+/. I4 0817 )'/'(+0+/ 17 7+0 02 107 13101'* 5'*9+ 42/ +'.8 41+*:
.'0'*2; +30/< 08+ .2*9(37 '/+ '//'3;+: 13 08+ 2/:+/ 24 08+ 41+*:7 13 08+ 41+*: .'0'*2;.
I:+30141.'0123
41+*:3'(+ A41+*: 3'(+B
Value range( 7ield name of the internal output table /reNuired parameter0
7ield name of the field in the internal output table that is described by this field catalog entry.
*eference to the Data Dictionary
/e$_$ield!"e ($ield !"e o$ t*e /e$e/e)e $ield)
Value range( $4A)E" name of a field in the Data Dictionary ,ame of the referenced field in the Data
Dictionary.
This parameter is only reNuired if the field in the internal output table that is described by the current entry in the
field catalog has a reference to the Data Dictionary /that is" is not a program field0 and if the field name in the internal
output table is not identical to the field name of the field in the Data Dictionary. If both field names are identical" it is
sufficient to specify the Data Dictionary structure or table in parameter 7IELD)AT-*E78TA!,AEE.
/+4_0'63'(+ A41+*: 3'(+ 24 08+ /+4+/+3.+ 0'6*+K70/9.09/+B
Value range( $4A)E" name of a structure or table in the Data Dictionary $tructure or table name of the referenced
field in the Data Dictionary.
This parameter is only reNuired if the field in the internal output table that is described by the current entry in the field
catalog has a reference to the Data Dictionary /that is" is not a program field0.
*eference to fields with currency unitsOunits of measure
Each amount or Nuantity field of the internal output table whose decimal places are to be displayed with the proper
unit in the list output" must comply with the following con&entions(
- The field is of data type L%A, or )%** /internal type 40.
/4hysically" the field must actually belong to this data type.
+&erriding the physical data type with parameter 7IELD)AT-DATAT#4E has no effect.0
- There is one field in the internal output table that contains the rele&ant unit.
-3 of 3;
ALV Documentation with Examples
- There is also an entry for the unit field in the field catalog.
/If the unit should not be displayed as a column in the list and the user should not be able to show the unit
interacti&ely" for example" because the unit is always uniNue and therefore explicitly output by the caller in the list
header" then you can assign parameter 7IELD)AT-TE)G D F:F to the field catalog entry for the unit field.
If a &alue field has a reference to a unit" this has the following effects when the list is output(
- The decimal places are displayed with the proper unit.
- An initial &alue field with reference to a non-initial unit is displayed as F=F /pro&ided that 7IELD)AT-
,+8JE*+ is initial0. If unit-specific totals are calculated for this &alue field" the unit is considered in the analysis of
whether homogeneous units exist.
- An initial &alue field with reference to an initial unit is displayed as $4A)E. If unit-specific totals are
calculated for this &alue field" the unit $4A)E has no effect on the homogeneity of the unit if the &alue field is initial.
- 7or non-initial &alue fields with initial unit" the unit $4A)E is considered as a unit when unit-specific totals
are calculated.
*eference to the currency unit
.41+*:3'(+ A41+*: 3'(+ 24 08+ .9//+3.< 9310 41+*:B
Value range( $4A)E" name of a field of the output table +nly rele&ant to amount columns with unit reference.
7ield name of the field in the internal output table that contains the currency unit for the amount field 7IELD)AT-
7IELD,AEE.
There must be a separate field catalog entry for the field specified in 7IELD)AT-)7IELD,AEE.
*eference to the unit of measure
=41+*:3'(+ A41+*: 3'(+ 24 08+ 9310 24 (+'79/+ 41+*:B
Value range( $4A)E" name of a field of the output table
+nly rele&ant to Nuantity columns with unit reference.
7ield name of the field in the internal output table that contains the unit of measure for the amount field 7IELD)AT-
7IELD,AEE.
There must be a separate field catalog entry for the field specified in 7IELD)AT-L7IELD,AEE.
+utput options for a column
o&tp&tle ()ol&" widt*)
Value range( = /initial0" n
7or fields with reference to the Data Dictionary you can lea&e this parameter set to initial.
7or fields without reference to the Data Dictionary /program fields0 you must set the parameter to the desired field
output length on the list /column width0.
initial D The column width is deri&ed from the output length of the referenced field /domain0 in the Data Dictionary.
n D The column width is n characters.
>+< A>+< .2*9(3B
Value range( $4A)E" F:F
F:F D 9ey field /colored output for ey fields0
9ey fields cannot be hidden interacti&ely by the user.
4arameter 7IELD)AT-,+8+%T must be left set to initial.
7or exceptions" see the documentation on parameter 7IELD)AT-9E#8$EL.
>+<_7+* A>+< .2*9(3 08'0 .'3 6+ 81::+3B
Value range( $4A)E" F:F
-2 of 3;
ALV Documentation with Examples
+nly rele&ant if 7IELD)AT-9E# D F:F
9ey field that can be hidden interacti&ely by the user.
The user cannot interacti&ely change the seNuence of the ey columns.
As with non-ey fields" output control is performed using parameter 7IELD)AT-,+8+%T.
32_290 A41+*: 13 08+ '5'1*'6*+ 41+*:7 *170B
Value range( $4A)E" F:F
F:F D 7ield is not displayed on the current list.
The field is a&ailable to the user in the field list and can be interacti&ely selected as a display field.
At row le&el" the user can use the detail function to display the content of these fields.
$ee also the documentation on the FDetail screenF section of parameter I$8LA#+%T.
0+.8 A0+.831.'* 41+*:B
Value range( $4A)E" F:F
F:F D Technical field
The field cannot be output on the list and cannot be shown interacti&ely by the user.
The field may only be used in the field catalog /not in IT8$+*T" ...0.
+()8'71F+ A81;8*1;80 .2*9(3 13 .2*2/B
Value range( $4A)E" F:F or F)xyKF /x(F'F-F;F> y"K( F=FDoff F'FDon0
F:F D The column is highlighted in the default color for color highlighting.
F)xyKF D The column is highlighted in the coded color(
- )( )olor /coding must start with )0
- x( )olor number
- y( Intensified
- K( In&erse
8207)20 A.2*9(3 '7 8207)20B
Value range( $4A)E" F:F
F:F D The cells of the column are output as a hotspot.
:2_79( A.'*.9*'0+ 020'*7 42/ .2*9(3B
Value range( $4A)E" F:F
F:F D Totals are calculated for this field of the internal output table.
This function can also be used interacti&ely by the user.
32_79( A020'*7 .'*.9*'0123 320 '**2@+:B
Value range( $4A)E" F:F
F:F D ,o totals may be calculated for this field although the data type of the field allows totalling.
7ormatting column contents
1.23 A1.23B
Value range( $4A)E" F:F
F:F D The column contents are displayed as an icon.
The column contents of the internal output table must consist of &alid icon strings /UxxU0.
The caller should consider the problem of printing icons.
7<(62* A7<(62*B
Value range( $4A)E" F:F
F:F D The column contents are output as a symbol.
-5 of 3;
ALV Documentation with Examples
The column contents of the internal output table must consist of &alid symbol characters.
The caller should consider the problem of printing symbols.
Although symbols can generally be printed" they are not always shown correctly depending on the printer
configuration.
N970 AN970141.'0123B
Value range( $4A)E" F*F" FLF" F)F
+nly rele&ant to fields of data type )GA* or ,%E)
F F D Default Iustification according to data type
F*F D *ight-Iustified output
FLF D Left-Iustified output
F)F D )entered output
The Iustification of the column header depends on the Iustification of the column contents. #ou cannot Iustify
the column header independently of the column contents.
*F+/2 A*+':13; F+/27B
Value range( $4A)E" F:F
+nly rele&ant to fields of data type ,%E)
!y default" ,%E) fields are output in the ALV right-Iustified without leading Keros.
F:F D +utput with leading Keros
32_71;3 A32 QK, 71;3B
Value range( $4A)E" F:F
+nly rele&ant to &alue fields
F:F D Value output without VO- signs.
32_F+/2 A79))/+77 F+/27B
Value range( $4A)E" F:F
+nly rele&ant to &alue fields
F:F D $upress Keros
+:10_('7> A41+*: 42/('0013;B
Value range( $4A)E" mas
mas D $ee documentation on the <*ITE formatting option
%$I,C EDIT EA$9 mas
%sing mas D FDD con&F you can force an output con&ersion con&.
T+&07
The following parameters for texts are always reNuired for program fields without reference to the Data
Dictionary.
7or fields with reference to the Data Dictionary" the texts are retrie&ed from the Data Dictionary. If you do not
want this" you can fill the text parameters also for fields with reference to the Data Dictionary. If you do this" the
corresponding texts from the Data Dictionary will be ignored.
If the user changes the column width interacti&ely" the text with the appropriate length is always used as the
column header.
If the user optimiKes the column width interacti&ely" both the field contents and the column headings are
considered for the list output(
If all field contents are shorter than the shortest column heading" the column width is set based on the column
heading.
The long field label is also used in the dialog boxes for defining the display &ariant" the sort order" and so on.
7+*0+&0_* A*23; 41+*: *'6+*B
-6 of 3;
ALV Documentation with Examples
7+*0+&0_( A(+:19( 41+*: *'6+*B
7+*0+&0_7 A782/0 41+*: *'6+*B
/+)0+&0_::1. A8+':13;B
$ame as the FheadingF for data element maintenance.
<hen the list is output" the system does not necessarily retrie&e the text stored here" but uses the text that fits best.
::1.0&0 A:+0+/(13+ 0+&0B
Value range( $4A)E" FLF" FEF" F$F" F*F
%sing possible &alues FLF" FEF" F$F" F*F you can predefine the eyword that should always be retrie&ed as the
column header. If the column width is changed" the system tries to find a heading that fits the new output width.
4arameter for program fields without reference to the Data Dictionary
$ee also the parameter in the FTextsF section.
:'0'0<)+ A:'0' 0<)+B
Value range( $4A)E" data type from the Data Dictionary /)GA*" ,%E)"...0
+nly rele&ant to fields without reference to the Data Dictionary. Data type of program field
::1._290)90*+3 A+&0+/3'* 290)90 *+3;08B
Value range( = /initial0" n
+nly rele&ant to fields without reference to the Data Dictionary whose output should ne&ertheless be modified
using a con&ersion exit.
4rereNuisites(
- 7IELD)AT-EDIT8EA$9 D FDDcon&F
$ee also the documentation on parameter 7IELD)AT-EDIT8EA$9
- 7IELD)AT-I,TLE, D n
$ee documentation on parameter 7IELD)AT-I,TLE,
n D 7ield output length of the external display
The column width 7IELD)AT-+%T4%TLE, must not be eNui&alent to the output length of the external display
/7IELD)AT-DDI)8+%T4%TLE,0.
2 130*+3 A130+/3'* 290)90 *+3;08B
Value range( = /initial0" n
+nly rele&ant to fields without reference to the Data Dictionary whose output should ne&ertheless be modified
using a con&ersion exit.
4rereNuisites(
- 7IELD)AT-EDIT8EA$9 D FDDcon&F
$ee also the documentation on parameter 7IELD)AT-EDIT8EA$9
- 7IELD)AT-DDI)8+%T4%TLE, D n
$ee also the documentation on parameter 7IELD)AT-DDI)8+%T4%TLE,
n D 7ield output length of the internal display
2 /2**3'(+ A:'0' +*+(+30B
Value range( $4A)E" name of a data element from the Data Dictionary
#ou can use this parameter to pro&ide an 7' help for a program field without reference to the Data Dictionary or
to pro&ide an 7' help other than that of the Data Dictionary for a field with reference to the Data Dictionary.
<hen the 7' help is called for this field" the documentation for the data element assigned is displayed.
If" for fields with reference to the Data Dictionary"
-; of 3;
ALV Documentation with Examples
7IELD)AT-*+LL,AEE is initial" the documentation for the data element of the referenced field in the Data
Dictionary is displayed.
+ther
2 7)_;/29) A41+*: ;/29) >+<B
Value range( $4A)E" )GA*/'0
9ey for grouping fields
#ou assign the ey to the group description using parameter
IT8$4E)IAL8C*+%4$ /see also the documentation on parameter IT8$4E)IAL8C*+%4$0.
If you define such an assignment in the field catalog using
IT8$4E)IAL8C*+%4$" the fields in the field list of the display &ariant dialog box are grouped accordingly.
2 /+)/+) A7+*+.0123 ./10+/123 24 08+ /+)2/0K/+)2/0 130+/4'.+B
Value range( $4A)E" F:F
4rereNuisites(
- The reportOreport interface exists in the system.
/function group *$TI" table T*$TI0
- 4arameter LA#+%T-*E4*E4 D F:F
/$ee also the documentation on parameter
LA#+%T-*E4*E4 of IE4+*TI,C parameter I$8LA#+%T0
F:F D If the reportOreport interface is called" the &alue of this field is passed as a selection criterion in the selected
branch line of the interface.
Default
o 7or internal table fields with reference to a field defined in the
Data Dictionary" it is normally sufficient to mae the following specifications(
- fieldname
- ref8tabname
,ote(
All fields not explicitly mentioned here are either not rele&ant in this context or are not releasedW
All other information is retrie&ed by the ALV from the Data Dictionary.
If you do not specify the relati&e column position /)+L84+$0" the fields are output in the list in the order in which
they were added to the field catalog.
*E787IELD,AEE must only be specified if the field name of the internal table field is not identical to the field
name of the referenced field in the Data Dictionary.
4riority rule(
$pecifications made in the field catalog tae priority o&er specifications in the Data Dictionary.
7or internal table fields without reference to the Data Dictionary /program fields0" it is normally sufficient to
mae the following specifications(
- fieldname
- outputlen
- datatype /without data type" character is the default0
- seltext8s
1= of 3;
ALV Documentation with Examples
- seltext8l
,ote(
If you assign a data element to parameter *+LL,AEE" you can" for example" implement an 7' help for program fields.
IT_E?CL=DIN8
Table of inacti&e function codes
Description
+ptional IE4+*TI,C parameter IT8E:)L%DI,C is an internal table. #ou must only fill this table if the caller uses
the standard interface of the list tool but does not need certain interface functions and therefore wants to disable them.
In this case" you must enter the function codes of these standard functions into the table.
IT_SORT
$ort criteria for first list display
Description
%sing internal table IT8$+*T" the caller determines the sort order andOor the subtotalling of the basic list.
The following fields of this internal table must be filled(
o spos ( $ort order
o fieldname ( 7ield name in the internal output table
o up ( F:F D $orted in ascending order
o down ( F:F D $orted in descending order
o subtot ( F:F D $ubtotals for control le&el changes
o comp /I,TE*,AL %$E +,L#0
o expa
4erNuisites(
IT8$+*T-$%!T+T D F:F" that is" the sort criterion is also the subtotals criterion.
If no complete breadown but only a breadown to totals le&el n that can be further expanded by the user should be
displayed when the list is output for the first time" you must set the indicator for the totals le&el criterion of le&el n.
IT_FILTER
7ilter criteria for first list output
Description
Table with filter criteria
%sing this parameter" you can pass on filter criteria resulting from explicitly loading a display &ariant in ad&ance" for
example" to list output.
This table should ne&er be set up FmanuallyF.
1' of 3;
ALV Documentation with Examples
IS_SEL_,IDE
$election information modification
Description
This parameter is currently not supportedW
+nly rele&ant if layout parameter LA#+%T-CET8$ELI,7+$ of IE4+*TI,C structure I$8LA#+%T is set.
)omplex type for modifying information displayed on the selection dialog box(
o mode( F*F D +nly entries passed in internal table I$8$EL8GIDE-T8E,T*IE$ are output on the dialog
box. $election information obtained by the list tool by reading the selection screen again /only if the report is called
with selection screen0 are replaced by the entries passed.
F$F D The selection information obtained by the list tool by reading the selection screen of the
calling report again" are modified by the entries of table I$8$EL8GIDE-T8E,T*IE$.
o t8entries( Table with selection information
o t8entries-mode( FAF D Display selection information of the current table row on the information dialog box.
FDF D Do not display selection information of the $elect option or of parameter $EL,AEE on the
dialog box.
o t8entries-selname( /reNuired only if t8entries-mode D FDF0 name of $elect option or parameter
The following table fields are only reNuired if t8entries-mode D FAF.
They contain the selection information to be added.
o t8entries-field( DDI) field name of the field for which selection information is to be displayed
o t8entries-table( DDI) table name of t8entries-field.
o t8entries-stext( 7ield description on the information dialog box.
If t8entries-field and t8entries-table were filled" this text is taen from the DDI).
o t8entries-&aluf( $election condition from-&alue /external format0
o t8entries-&alut( $election condition to-&alue /external format0
o t8entries-sign=( /I0nclusi&e /E0xclusi&e
o t8entries-optio( All &alues of the option field of the $elect option are allowed.
The remaining fields are used internally and are irrele&ant to the caller.
1. of 3;
ALV Documentation with Examples
I_DEFA=LT
Initial &ariant acti&eOinacti&e logic
Description
Initial &ariant maintenance acti&eOinacti&e. .
4rereNuisite( 4arameter I$8VA*IA,T is filled accordingly.
$ee also the documentation on the IE4+*TI,C parameter I$8VA*IA,T.
Value *ange
$4A)E D Definition of initial &ariants not allowed
F:F D Definition of initial &ariants allowed
Default ( $4A)E
I_SAVE
Variants can be sa&ed
Description
)ontrols the sa&e mode
4rereNuisite(
4arameter I$8VA*IA,T is filled accordingly.
$ee also the documentation on IE4+*TI,C parameter I$8VA*IA,T.
Value *ange
o F F D Display &ariants cannot be sa&ed
Defined display &ariants /such as deli&ered display &ariants0 can be selected for presentation regardless of this
indicator. Gowe&er" changes cannot be sa&ed.
o F:F D $tandard sa&e mode
Display &ariants can be sa&ed as standard display &ariants.
$a&ing display &ariants as user-specific is not possible.
o F%F D %ser-specific sa&e mode
Display &ariants can only be sa&ed as user-specific.
o FAF D $tandard and user-specific sa&e mode
Display &ariants can be sa&ed both as user-specific and as standard &ariants. %sers mae their choice on the
dialog box for sa&ing the display &ariant.
Default ( $4A)E .
IS_VARIANT
Variant information
Description
This structure is only rele&ant if display &ariants are to be sa&ed andOor read.
1- of 3;
ALV Documentation with Examples
Variant information including the name of the list &ariant that is used to output the list.
To allow display &ariants to be read within the ALV" you must specify the access path using fields *E4+*T
/reNuired field0" GA,DLE /optional field0 andOor L+C8C*+%4 /optional field0.
If you also want to allow display &ariants to be sa&ed" you must additionally fill parameter I8$AVE accordingly.
$ee also the documentation on IE4+*TI,C parameter I8$AVE.
A &ariant is uniNuely described through(
o The program to which the &ariant is assigned /*E4+*T0
o The handle /GA,DLE0" if" for example" multiple lists with different structures and data are called in a
program /I8)ALL!A)984*+C*AE0.
The handle is a )GA*/10 field that must be uniNuely defined and describes the assignment of the call to the
current structure of the internal output table.
Example(
Depending on the user interaction" se&eral types of lists can be output in program x.
The user should be able to define display &ariants for each type of list.
#ou pro&ide this function to the user by assigning a GA,DLE to each list. If &ariants for the program and the
handle are sa&ed" the handle must not be modified any more.
o The logical group" if" for example" the same list is created with different settings through &arious transactions
/L+C8C*+%40.
The logical group is a )GA*/10 that must be uniNuely defined and specifies the assignment.
Example(
4rogram x is called through transactions T' and T.. Depending on the transaction code" the fields a&ailable to the
user through the field catalog differ in their assignment to different logical groups.
If &ariants for the program and the logical group are sa&ed" the logical group must not be modified any more.
o The user name" if user-specific &ariants are sa&ed /%$E*,AEE0.
#ou do not ha&e to fill this parameter manually since the &ariant name is uniNue.
o The &ariant name /VA*IA,T0.
#ou only ha&e to fill this parameter if this structure is to be used to read a concrete &ariant and the list is to be
output with this &ariant.
Value *ange
To call a list with a &ariant" you must specify the abo&e fields.
Default
If the structure is initial" but sa&ing is acti&e /I8$AVE is not initial0" then I$8VA*IA,T-*E4+*T D
I8)ALL!A)984*+C*AE is set.
7or a possible entries help for &ariants" function module *E%$E8ALV8VA*IA,T871 is a&ailable.

I_SCREEN_START_COL=6N
I_SCREEN_START_LINE
I_SCREEN_END_COL=6N
I_SCREEN_END_LINE

11 of 3;
+nly reNuired if the list is to be output in a dialog box.
ALV Documentation with Examples
E-!"ple Code
<$8*E4,AEE D $#-*E4ID.
)ALL 7%,)TI+, F*E%$E8ALV87IELD)ATAL+C8EE*CEF
E:4+*TI,C
I84*+C*AE8,AEE D <$8*E4,AEE
I8I,TE*,AL8TA!,AEE D Internal output table field name
I8I,)L,AEE D <$8*E4,AEE
)GA,CI,C
)T87IELD)AT D I87IELDTA!.
I7 $#-$%!*) XS =.
<*ITE( F$#-$%!*)( F" $#-$%!*)" F*E%$E8ALV87IELD)ATAL+C8EE*CEF.
E,DI7.
)ALL 7%,)TI+, F*E%$E8ALV8LI$T8DI$4LA#F
E:4+*TI,C
I8)ALL!A)984*+C*AE D <$8*E4,AEE
I8$T*%)T%*E8,AEE D Internal output table field name
I$8LA#+%T D I8LA#+%T
IT87IELD)AT D I87IELDTA!
I8DE7A%LT D FAF
I8$AVE D FAF
I$8VA*IA,T D F:F
IT8EVE,T$ D I8EVE,T$YZ
IT8$+*T D I8$+*T
I$8$EL8GIDE D I8$ELI,7+
TA!LE$
T8+%TTA! D Internal output table field name.

I7 $#-$%!*) XS =.
<*ITE( F$#-$%!*)( F" $#-$%!*)" F*E%$E8ALV8LI$T8DI$4LA#F.
E,DI7
%sing other function module F*E%$E8ALV8C*ID8DI$4LA#@ can help us get list output in the form of a grid and also
attach logos to the report output.
13 of 3;
ALV Documentation with Examples
S!"ple )ode
1 Si"ple list o&tp&t "
*E4+*T #8DEE+8ALV ,+ $TA,DA*D 4ACE GEADI,C.
A Data to be displayed
DATA( I8$7LICGT T#4E TA!LE +7 $7LICGT.
A---------------------------------------------------------------------A
A $election
$ELE)T A 7*+E $7LICGT I,T+ TA!LE I8$7LICGT.
A )all A!A4 List Viewer /ALV0
)ALL 7%,)TI+, F*E%$E8ALV8LI$T8DI$4LA#F
E:4+*TI,C
I8$T*%)T%*E8,AEE D F$7LICGTF
TA!LE$
T8+%TTA! D I8$7LICGT.
2.Si"ple 0/id o&tp&t:
*E4+*T #8DEE+8ALV8'.
A
A Data to be displayed
DATA( I8$7LICGT T#4E TA!LE +7 $7LICGT.
A---------------------------------------------------------------------A
A $election
$ELE)T A 7*+E $7LICGT I,T+ TA!LE I8$7LICGT.
A )all A!A4 List Viewer /ALV0
)ALL 7%,)TI+, F*E%$E8ALV8C*ID8DI$4LA#F
E:4+*TI,C
I8$T*%)T%*E8,AEE D F$7LICGTF
TA!LE$
T8+%TTA! D I8$7LICGT.
@3 De"o $o/ ARE=SE_ALV_POP=P_TO_SELECTA
*E4+*T y8demo8al&8-.
T#4E-4++L$( slis.
DATA( !ECI, +7 i8outtab +))%*$ =.
I,)L%DE $T*%)T%*E sflight.
DATA( w8ch T#4E c. Q7or multiple selection
DATA( E,D +7 i8outtab.
A I8+%TTA! T#4E $7LICGT +))%*$ ="
DATA( i8pri&ate T#4E slis8data8caller8exit"
i8selfield T#4E slis8selfield"
<8exit/'0 T#4E c.
4A*AEETE*$( p8title T#4E sy-title.
12 of 3;
ALV Documentation with Examples
$TA*T-+7-$ELE)TI+,.
$ELE)T A 7*+E sflight I,T+ TA!LE i8outtab.
)ALL 7%,)TI+, F*E%$E8ALV84+4%48T+8$ELE)TF
E:4+*TI,C
i8title D p8title
i8selection D F:F
i8Kebra D F:F
A I8$)*EE,8$TA*T8)+L%E, D =
A I8$)*EE,8$TA*T8LI,E D =
A I8$)*EE,8E,D8)+L%E, D =
A I8$)*EE,8E,D8LI,E D =
i8checbox8fieldname D F<8)G9F
A I8LI,EEA*987IELD,AEE D
A I8$)*+LL8T+8$EL8LI,E D F:F
i8tabname D FI8+%TTA!F
i8structure8name D F$7LICGTF
A IT87IELD)AT D
A IT8E:)L%DI,C D
A I8)ALL!A)984*+C*AE D
A I8)ALL!A)98%$E*8)+EEA,D D
A I$84*IVATE D I84*IVATE
IE4+*TI,C
es8selfield D i8selfield
e8exit D w8exit
TA!LE$
t8outtab D i8outtab
E:)E4TI+,$
program8error D '
+TGE*$ D ..
I7 sy-subrc XS =.
A EE$$ACE i===/=0 <ITG sy-subrc.
E,DI7.
AAAAAthe internal table is modified with a cross sign for maring the rows selected
L++4 AT i8outtab <GE*E w8ch D F:F.
<*ITE( O i8outtab-carrid" i8outtab-price.
E,DL++4.
15 of 3;
ALV Documentation with Examples
23 W*ole S!"ple Code
*E4+*T #$%!ALV.
A-----------Declaration of &ariables------------------A
T#4E-4++L$( $LI$.
A To pass name of the report in function module for ALV
DATA( V8*E4ID LI9E $#-*E4ID .
A To pass the o&erall structure of the ALV report
DATA( $T*%)T8LA#+%T T#4E $LI$8LA#+%T8ALV.
DATA( $T*%)T8LA#+%T' T#4E $LI$8LA#+%T8ALV.
A Internal table to capture &arious e&ents in ALV
DATA ( I8EVE,T$ T#4E $LI$8T8EVE,T.
A Table for catalog of the fields to be displayed
DATA( I87IELD)AT T#4E $LI$8T87IELD)AT8ALV.
data ( x8fieldcat T#4E $LI$87IELD)AT8ALV.
DATA( I87IELD)AT' T#4E $LI$8T87IELD)AT8ALV.
data ( x8fieldcat' T#4E $LI$87IELD)AT8ALV.
A Internal table to mention the sort seNuence
DATA ( IT8$+*T T#4E $LI$8T8$+*TI,7+8ALV.
DATA ( :8$+*T T#4E $LI$8$+*TI,7+8ALV.
A Internal table to display top of page
data ( i8list8top8of8page type slis8t8listheader.
A $tructure to display &ariants
data ( i8&ariant lie dis&ariant"
i8&ariant' lie dis&ariant.
A Internal table to pass data
DATA( !ECI, +7 I8TA! +))%*$ ="
mblnr lie mseg-mblnr "
matnr lie mseg-matnr"
matg lie mat-matg "
charg lie mseg-charg "
wers lie mseg-wers"
lgort lie mseg-lgort"
menge lie mseg-menge "
meins lie mseg-meins "
dmbtr lie mseg-dmbtr"
ebeln lie mseg-ebeln"
icn/10 type c "
sym/10 type c "
excpt/.0 type c "
box/'0"
E,D +7 I8TA!.
AEHE)T
DATA ( begin of i8doc occurs = .
I,)L%DE $T*%)T%*E E$EC.
DATA ( end of i8doc.
A ---------End of Data Declaration---------------A
16 of 3;
ALV Documentation with Examples
4A*AEETE*$ ( 48VA* LI9E DI$VA*IA,T-VA*IA,T.
initialiKation.
&8repid D sy-repid.
A Display default &ariant
4E*7+*E $%!8VA*IA,T8I,IT.
AT $ELE)TI+,-$)*EE, +, 48VA*.
A +nce the user has entered &ariant" chec about its existence
4E*7+*E $%!8)GE)984VA*.
AT $ELE)TI+,-$)*EE, +, VAL%E-*EL%E$T 7+* 48VA*.
A Display a list of &arious &ariants of the report when the user presses 71 ey in the &ariant field
4E*7+*E $%!8VA*IA,T871.
$TA*T-+7-$ELE)TI+,.
A 4repare field catalog for the main report. $tate the name of the field " name of internal table " &arious formatting options etc
4E*7+*E $%!84*E4A*E87IELD)ATAL+C.
A 7etches records from database into table i8tab to be passed as export
A parameter t8outtab in function module ( *E%$E8ALV8C*ID8DI$4LA#
4E*7+*E $%!8$ELE)T8*E)+*D.
A 4opulate stat and icon columns of internal table i8tab with specific
A columns and symbols based on some logic for Nuantity and &alue fields.
4E*7+*E $%!8E+DI7#8*E)+*D$.
A Defines the o&erall layout of the report
4E*7+*E $%!8DETE*EI,E8ALV8LA#+%T.
A Defines the sort seNuence of the report
4E*7+*E $%!8DETE*EI,E8$+*T8$EL%E,)E.
A Defines the e&ent table
4E*7+*E $%!8EVE,TTA!8!%ILD %$I,C I8EVE,T$.
A Things to be written at the top of the page
4E*7+*E $%!8)+EEE,T8!%ILD %$I,C i8list8top8of8page.
A Display the ALV list
4E*7+*E $%!8$G+<8ALV8LI$T.
A struct8layout-hotspot8fieldname D F:F.
AT LI,E-$ELE)TI+,.
4E*7+*E $%!8G+T$4+T.
AB---------------------------------------------------------------------A
AB 7orm $%!8VA*IA,T8I,IT
AB---------------------------------------------------------------------A
A Display default &ariant
A----------------------------------------------------------------------A
form $%!8VA*IA,T8I,IT.
I8VA*IA,T'-*E4+*T D $#-*E4ID.
A $earch default &ariant for the report
)ALL 7%,)TI+, F*E%$E8ALV8VA*IA,T8DE7A%LT8CETF
E:4+*TI,C
i8sa&e D FAF
)GA,CI,C
cs8&ariant D i8&ariant'
E:)E4TI+,$
not8found D ..
A If default &ariant is found " use it as default.
1; of 3;
ALV Documentation with Examples
A Else " use the &ariant LA#+%T'.
I7 sy-subrc D =.
p8&ar D i8&ariant'-&ariant.
EL$E.
p8&ar D FLA#+%T'F.
E,DI7.
endform. Q $%!8VA*IA,T8I,IT
AB---------------------------------------------------------------------A
AB 7orm $%!8)GE)984VA*
AB---------------------------------------------------------------------A
A +nce the user has entered &ariant" chec about its existence
A----------------------------------------------------------------------A
7+*E $%!8)GE)984VA*.
A If the name of the &ariable is not blan" chec about its existence
if not p8&ar is initial.
clear i8&ariant.
i8&ariant-report D sy-repid.
i8&ariant-&ariant D p8&ar.
)ALL 7%,)TI+, F*E%$E8ALV8VA*IA,T8E:I$TE,)EF
E:4+*TI,C
I8$AVE D FAF
)GA,CI,C
)$8VA*IA,T D I8VA*IA,T.
A If no such &ariant found " flash error message
if sy-subrc ne = .
message e-;6/==0 with F,o such &ariant existsF.
else.
A If &ariant exists " use the &ariant name to populate structure
A I8VA*IA,T' which will be used for export parameter ( I$8VA*IA,T
A in the function module ( *E%$E8ALV8C*ID8DI$4LA#
clear i8&ariant'.
mo&e p8&ar to i8&ariant'-&ariant.
mo&e sy-repid to i8&ariant'-report.
endif.
else.
clear i8&ariant.
endif.
E,D7+*E. Q $%!8)GE)984VA*
AB---------------------------------------------------------------------A
AB 7orm $%!84*E4A*E87IELD)ATAL+C
AB---------------------------------------------------------------------A
A 4repare field catalog for the main report. $tate the name of
A the field " name of internal table " &arious formatting options etc
A----------------------------------------------------------------------A
form $%!84*E4A*E87IELD)ATAL+C.
A 7irst field to appear in ALV list
:87IELD)AT-)+L84+$ D '.
A ,ame of the internal table field
:87IELD)AT-7IELD,AEE D F$#EF.
A ,ame of the internal table
:87IELD)AT-TA!,AEE D FI8TA!F.
A Geading for the field
:87IELD)AT-$ELTE:T8E D F$tatF.
A The field is going to contain a symbol
x8fieldcat-symbol D F:F.
3= of 3;
ALV Documentation with Examples
A Append the specifications to the internal table for field catalog.
append :8fieldcat T+ I87IELD)AT.
clear x8fieldcat.
A $econd field to appear in ALV list
:87IELD)AT-)+L84+$ D ..
A ,ame of the field in the internal table
:87IELD)AT-7IELD,AEE D FEAT,*F.
A ,ame of the internal table
:87IELD)AT-TA!,AEE D FI8TA!F.
A Geading for the column
:87IELD)AT-$ELTE:T8E D FEatItemF.
A It is going to be the ey field.The color for this field is going to
A be different
:8fieldcat-ey D F:F.
:8fieldcat-ey8sel D F:F.
A $ingle clic on the field will trigger double clic e&ent.Also" a hand
A will appear when the cursor na&igates to the field
:8fieldcat-hotspot D F:F.
A The column and those left to it will not scroll
:8fieldcat-fix8column D F:F.
A 7' help will come as it is referenced to DDI) table
x8fieldcat-ref8tabname D FE$ECF.
append :8fieldcat T+ I87IELD)AT.
clear x8fieldcat.
:87IELD)AT-)+L84+$ D -.
:87IELD)AT-7IELD,AEE D FEA9TCF.
:87IELD)AT-TA!,AEE D FI8TA!F.
:87IELD)AT-$ELTE:T8E D FDescriptionF.
A :87IELD)AT-+%T4%TLE, D 3=.
x8fieldcat-hotspot D space.
A The field is centre/) for centre" * and L for left and
A right0 Iustified
x8fieldcat-Iust D F)F.
x8fieldcat-ey D F:F.
x8fieldcat-fix8column D F:F.
A :8fieldcat-no8out D F:F.
:8fieldcat-fix8column D F:F.
append :8fieldcat T+ I87IELD)AT.
clear x8fieldcat.
:87IELD)AT-)+L84+$ D 1.
:87IELD)AT-7IELD,AEE D F)GA*CF.
:87IELD)AT-TA!,AEE D FI8TA!F.
:87IELD)AT-$ELTE:T8E D F!atchF.
A :87IELD)AT-+%T4%TLE, D '=.
x8fieldcat-hotspot D space.
append :8fieldcat T+ I87IELD)AT.
clear x8fieldcat.
:87IELD)AT-)+L84+$ D 3.
:87IELD)AT-7IELD,AEE D FE!EL,F.
:87IELD)AT-TA!,AEE D FI8TA!F.
:87IELD)AT-$ELTE:T8E D F4urchase +rderF.
A :87IELD)AT-+%T4%TLE, D '1.
3' of 3;
ALV Documentation with Examples
A The field will be colored differently/)xyK0
x8fieldcat-emphasiKe D F)3''F.
A Initially the field will be hidden
x8fieldcat-no8out D F:F.
append :8fieldcat T+ I87IELD)AT.
clear x8fieldcat.
:87IELD)AT-)+L84+$ D 2.
:87IELD)AT-7IELD,AEE D FE!L,*F.
:87IELD)AT-TA!,AEE D FI8TA!F.
:87IELD)AT-$ELTE:T8E D FDocument noF.
A :87IELD)AT-+%T4%TLE, D '1.
x8fieldcat-emphasiKe D F)5''F.
x8fieldcat-no8out D F:F.
append :8fieldcat T+ I87IELD)AT.
clear x8fieldcat.
:87IELD)AT-)+L84+$ D 5.
:87IELD)AT-7IELD,AEE D F<E*9$F.
:87IELD)AT-TA!,AEE D FI8TA!F.
:87IELD)AT-$ELTE:T8E D F4lantF.
A :87IELD)AT-+%T4%TLE, D 3.
x8fieldcat-emphasiKe D F)-'=F.
append :8fieldcat T+ I87IELD)AT.
clear x8fieldcat.
:87IELD)AT-)+L84+$ D 6.
:87IELD)AT-7IELD,AEE D FLC+*TF.
:87IELD)AT-TA!,AEE D FI8TA!F.
:87IELD)AT-$ELTE:T8E D F$t.LocF.
A :87IELD)AT-+%T4%TLE, D 5.
A :8fieldcat-no8out D F:F.
append :8fieldcat T+ I87IELD)AT.
clear x8fieldcat.
:87IELD)AT-)+L84+$ D ;.
:87IELD)AT-7IELD,AEE D FEE,CEF.
:87IELD)AT-TA!,AEE D FI8TA!F.
:87IELD)AT-$ELTE:T8E D FLuantityF.
:87IELD)AT-+%T4%TLE, D '..
A $ummation is allowed for this field
x8fieldcat-do8sum D F:F.
:87IELD)AT-ref8tabname D FE$ECF.
append :8fieldcat T+ I87IELD)AT.
clear x8fieldcat.
:87IELD)AT-)+L84+$ D '=.
:87IELD)AT-7IELD,AEE D FI),F.
:87IELD)AT-TA!,AEE D FI8TA!F.
:87IELD)AT-$ELTE:T8E D FF.
:87IELD)AT-+%T4%TLE, D ..
x8fieldcat-icon D F:F.
A :8fieldcat-no8out D F:F.
append :8fieldcat T+ I87IELD)AT.
clear x8fieldcat.
3. of 3;
ALV Documentation with Examples
:87IELD)AT-)+L84+$ D ''.
:87IELD)AT-7IELD,AEE D FEEI,$F.
:87IELD)AT-TA!,AEE D FI8TA!F.
:87IELD)AT-$ELTE:T8E D F%nitF.
:87IELD)AT-+%T4%TLE, D 3.
x8fieldcat-Nfieldname D FEEI,$F.
append :8fieldcat T+ I87IELD)AT.
clear x8fieldcat.
:87IELD)AT-)+L84+$ D '..
:87IELD)AT-7IELD,AEE D FDE!T*F.
:87IELD)AT-TA!,AEE D FI8TA!F.
:87IELD)AT-$ELTE:T8E D FLocal currF.
:87IELD)AT-+%T4%TLE, D '..
x8fieldcat-I,TT#4E D F4F.
x8fieldcat-Iust D F*F.
x8fieldcat-do8sum D F:F.
append :8fieldcat T+ I87IELD)AT.
clear x8fieldcat.
:87IELD)AT-)+L84+$ D '-.
:87IELD)AT-7IELD,AEE D FE:)4TF.
:87IELD)AT-TA!,AEE D FI8TA!F.
:87IELD)AT-$ELTE:T8E D FF.
:87IELD)AT-+%T4%TLE, D -.
append :8fieldcat T+ I87IELD)AT.
clear x8fieldcat.
endform. Q $%!84*E4A*E87IELD)ATAL+C
AB---------------------------------------------------------------------A
AB 7orm $%!8$ELE)T8*E)+*D
AB---------------------------------------------------------------------A
A 7etches records from database into table i8tab to be passed as export
A parameter t8outtab in function module ( *E%$E8ALV8C*ID8DI$4LA#
A----------------------------------------------------------------------A
form $%!8$ELE)T8*E)+*D.
$ELE)T mblnr A[matnr A[matg charg
wers lgort menge meins dmbtr ebeln
7*+E mat as a Ioin mseg as b
on / a[matnr D b[matnr 0
I,T+ TA!LE I8TA!
where b[bwart D F'='F .
endform. Q $%!8$ELE)T8*E)+*D
AB---------------------------------------------------------------------A
AB 7orm $%!8E+DI7#8*E)+*D$
AB---------------------------------------------------------------------A
A 4opulate stat and icon columns of internal table i8tab with specific
A columns and symbols based on some logic for Nuantity and &alue fields.
A----------------------------------------------------------------------A
form $%!8E+DI7#8*E)+*D$.
loop at i8tab.
if i8tab-dmbtr gt '====.
A 7ield icn of internal table is going to contain icon . 7or this column
Aicon8allowed is set in the field catalog table. 7or &arious icons"see
A type pool XI)+,S
i8tab-icn D FU'VUF.
modify i8tab transporting icn.
endif.
3- of 3;
ALV Documentation with Examples
if i8tab-menge gt 3=.
A 7ield icn of internal table is going to contain symbol . 7or this
A column symbol8allowed is set in the field catalog table. 7or &arious
A icons"see type pool X$#E!+LS
i8tab-sym D F,F.
modify i8tab transporting sym.
endif.
I7 I8TA!-<E*9$ ,E F$D)'F.
A This field will contain lights " traffic signals ( red.yellow"green
A That this field will be used as a light will be specified in the
A column of structure $T*%)T8LA#+%T.
I8TA!-E:)4T D F'F.
E+DI7# I8TA! T*A,$4+*TI,C E:)4T.
endif.
endloop.
endform. Q $%!8E+DI7#8*E)+*D$
AB---------------------------------------------------------------------A
AB 7orm $%!8DETE*EI,E8ALV8LA#+%T A
AB---------------------------------------------------------------------A
AB Defines the o&erall structure of the report layout A
A----------------------------------------------------------------------A
form $%!8DETE*EI,E8ALV8LA#+%T.
A 7ield E:)4T will show the light signal
$T*%)T8LA#+%T-LICGT$87IELD,AEE D FE:)4TF.
A 7ield !+$ of the internal table will act as pushbutton and will appear
A at the left of the grid display. %ser will press that to select a
A record
struct8layout-box8fieldname D F!+:F.
$T*%)T8layout-totals8text D FTotNty F.
$T*%)T8LA#+%T-JE!*A D F:F.
struct8layout-confirmation8prompt D F:F.
struct8layout-detail8titlebar D FDetails of $toringF.
struct8layout-no8sumchoice D F:F.
struct8layout-totals8only D F:F.
endform. Q $%!8DETE*EI,E8ALV8LA#+%T
AB---------------------------------------------------------------------A
AB 7orm $%!8DETE*EI,E8$+*T8$EL%E,)E
AB---------------------------------------------------------------------A
A Defines the sort seNuence of the report
A----------------------------------------------------------------------A
form $%!8DETE*EI,E8$+*T8$EL%E,)E.
:8sort-spos D '. Q $ort order
:8sort-fieldname D FEAT,*F.
:8sort-tabname D FI8TA!F.
:8sort-up D F:F.
:8sort-subtot D F:F. Q $ub total allowed
append :8sort T+ IT8$+*T.
clear :8sort.
endform. Q $%!8DETE*EI,E8$+*T8$EL%E,)E
31 of 3;
ALV Documentation with Examples
AB---------------------------------------------------------------------A
AB 7orm $%!8$G+<8ALV8LI$T
AB---------------------------------------------------------------------A
A $hows ALV list in grid form
A----------------------------------------------------------------------A
form $%!8$G+<8ALV8LI$T.
)ALL 7%,)TI+, F*E%$E8ALV8C*ID8DI$4LA#F
E:4+*TI,C
I8)ALL!A)984*+C*AE D V8*E4ID MA ,ame of the program
I8C*ID8TITLE D FDetails of $toringF MA title
I8callbac8pf8status8set D F478$TAT%$8$ETF MA calls subroutine ( 478$TAT%$8$ET
i8callbac8user8command D F%$E*8)+EEA,DF MA )alls subroutine ( user8command
I$8LA#+%T D $T*%)T8LA#+%T MA +&erall structure of the report
IT87IELD)AT D I87IELD)AT MA 4asses the field catg internal table
IT8$+*T D IT8$+*T MA 4asses the sort seNuence internal table
I8DE7A%LT D F:F
I8$AVE D FAF
I$8VA*IA,T D i8&ariant'
A fetches different e&ents into internal table i8e&ents
it8e&ents D i8e&entsYZ
TA!LE$
A 4asses data table for ALV display
T8+%TTA! D I8TA!
E:)E4TI+,$
4*+C*AE8E**+* D '
+TGE*$ D ..
I7 $#-$%!*) XS =.
A EE$$ACE ID $#-E$CID T#4E $#-E$CT# ,%E!E* $#-E$C,+
A <ITG $#-E$CV' $#-E$CV. $#-E$CV- $#-E$CV1.
E,DI7.
endform. Q $%!8$G+<8ALV8LI$T
AB---------------------------------------------------------------------A
AB 7orm set8status
AB---------------------------------------------------------------------A
A 7orm used to set the )ustom pf-status of the List Display
A----------------------------------------------------------------------A
A rt8extab (
A----------------------------------------------------------------------A
7+*E pf8status8set %$I,C i8rt8extab T#4E slis8t8extab.
data ( x8extab type slis8extab.
x8extab-fcode D FBL7+F.
append x8extab to i8rt8extab.
A 4f-status $TA,DA*D of program $A4L$ALV is copied to J$TA,DA*D of the
A current program and the pushbutton for Information /ocodeDBL7+0 is
A excluded
$ET 47-$TAT%$ FJ$TA,DA*DF excluding i8rt8extab .
E,D7+*E.
33 of 3;
ALV Documentation with Examples
AB---------------------------------------------------------------------A
AB 7orm user8command
AB---------------------------------------------------------------------A
A 7orm used to handle %$E*8)+EEA,D e&ents
A----------------------------------------------------------------------A
A rf8ucomm( 7unction )ode
A rs ( Internal Table containing the selection information.
A----------------------------------------------------------------------A
7+*E user8command %$I,C rf8ucomm LI9E sy-ucomm
rs T#4E slis8selfield.
data ( &8mblnr lie mseg-mblnr.
case rf8ucomm.
A A custom pushbutton for record deletion is set in the C%I status. <hen a record is selected " the field !+) for that
Arecord becomes F:F.
A The records are traced and deleted and the fields are refreshed/ rs of type slis8selfield is refreshed0
when FBDELF. Q4rint button cliced.
delete i8tab where box D F:F.
rs-refresh D F:F.
A <hen the user selects a row and presses the $elect pushbutton / user defined 0 from the application toolbar" the details
A of the document will be shown in another ALV list
when FB$ELF.
4E*7+*E $%!8$ELE)T8D+)%EE,T.
A set parameter id FE!,F field i8tab-mblnr.
A call transaction FE!=-F.
A + code for double clic is BI)' for ALV report
when FBI)'F.
perform sub8hotspot.
endcase.
E,D7+*E.
AB---------------------------------------------------------------------A
AB 7orm $%!8G+T$4+T
AB---------------------------------------------------------------------A
A text
A----------------------------------------------------------------------A
A --S p' text
A X-- p. text
A----------------------------------------------------------------------A
form $%!8G+T$4+T.
message i-;6/==0 with FGelloF.
endform. Q $%!8G+T$4+T
32 of 3;
ALV Documentation with Examples
AB---------------------------------------------------------------------A
AB 7orm $%!8VA*IA,T871
AB---------------------------------------------------------------------A
A Display a list of &arious &ariants of the report when the user presses 71 ey in the &ariant field
A------------------------------------------------------------------------A
form $%!8VA*IA,T871.
i8&ariant-report D sy-repid.
A %tilising the name of the report " this function module will search for a list of &ariants and will fetch the selected one
A into the parameter field for &ariants
)ALL 7%,)TI+, F*E%$E8ALV8VA*IA,T871F
E:4+*TI,C
I$8VA*IA,T D I8VA*IA,T
I8$AVE D FAF
I8DI$4LA#8VIA8C*ID D F:F
IE4+*TI,C
E$8VA*IA,T D I8VA*IA,T'
E:)E4TI+,$
,+T87+%,D D '
4*+C*AE8E**+* D .
+TGE*$ D -.
I7 $#-$%!*) D =.
48VA* D I8VA*IA,T'-VA*IA,T.
E,DI7.
E,D7+*E. Q $%!8VA*IA,T871
AB---------------------------------------------------------------------A
AB 7orm $%!8$ELE)T8D+)%EE,T
AB---------------------------------------------------------------------A
form $%!8$ELE)T8D+)%EE,T.
data ( &8lines type i .
read table i8tab with ey box D F:F.
$elect A from mseg I,T+ TA!LE I8D+) <GE*E E!L,* D I8TA!-E!L,*.
I7 $#-$%!*) EL = .
)ALL 7%,)TI+, F*E%$E8ALV87IELD)ATAL+C8EE*CEF
E:4+*TI,C
I84*+C*AE8,AEE D V8*E4ID
I8I,TE*,AL8TA!,AEE D FI8D+)F
I8$T*%)T%*E8,AEE D FE$ECF
)GA,CI,C
)T87IELD)AT D I87IELD)AT'
E:)E4TI+,$
I,)+,$I$TE,T8I,TE*7A)E D '
4*+C*AE8E**+* D .
+TGE*$ D -.
I7 $#-$%!*) XS =.
EE$$ACE ID $#-E$CID T#4E $#-E$CT# ,%E!E* $#-E$C,+
<ITG $#-E$CV' $#-E$CV. $#-E$CV- $#-E$CV1.
E,DI7.
clear struct8layout'.
$T*%)T8layout'-colwidth8optimiKe D F:F.
refresh it8sort.
clear it8sort.
35 of 3;
ALV Documentation with Examples
)ALL 7%,)TI+, F*E%$E8ALV8C*ID8DI$4LA#F
E:4+*TI,C
I8)ALL!A)984*+C*AE D V8*E4ID
I8C*ID8TITLE D FDetails of DocumentF
I$8LA#+%T D $T*%)T8LA#+%T'
IT87IELD)AT D I87IELD)AT'
i8structure8name D FE$ECF
I8DE7A%LT D F:F
I8$AVE D FAF
TA!LE$
T8+%TTA! D I8D+)
E:)E4TI+,$
4*+C*AE8E**+* D '
+TGE*$ D .
.
I7 $#-$%!*) XS =.
EE$$ACE ID $#-E$CID T#4E $#-E$CT# ,%E!E* $#-E$C,+
<ITG $#-E$CV' $#-E$CV. $#-E$CV- $#-E$CV1.
E,DI7.
E,DI7.
endform. Q $%!8$ELE)T8D+)%EE,T
AB---------------------------------------------------------------------A
AB 7orm $%!8)+EEE,T8!%ILD
AB---------------------------------------------------------------------A
form $%!8)+EEE,T8!%ILD using I8top8of8page T#4E slis8t8listheader.
DATA( ls8line T#4E slis8listheader.
AAAGeader
)LEA* ls8line.
ls8line-typ D FGF.
A L$8LI,E-9E#( not used for this type
ls8line-info D FGeading listF.
A44E,D ls8line T+ I8top8of8page.
AAA$election
)LEA* ls8line.
ls8line-typ D F$F.
ls8line-ey D F9ey 'F.
ls8line-info D FEaterial F.
A44E,D ls8line T+ i8top8of8page.
ls8line-ey D F9ey .F.
ls8line-info D FDocument noF.
A44E,D ls8line T+ I8top8of8page.
AAAAction
)LEA* ls8line.
endform. Q $%!8)+EEE,T8!%ILD
36 of 3;
ALV Documentation with Examples
AB---------------------------------------------------------------------A
AB 7orm $%!8EVE,TTA!8!%ILD
AB---------------------------------------------------------------------A
A Defines the e&ent table
AB---------------------------------------------------------------------A
7+*E sub8e&enttab8build %$I,C l8e&ents T#4E slis8t8e&ent.
DATA( ls8e&ent T#4E slis8al&8e&ent.
A Cet the different e&ents of the ALV
)ALL 7%,)TI+, F*E%$E8ALV8EVE,T$8CETF
E:4+*TI,C
i8list8type D =
IE4+*TI,C
et8e&ents D l8e&ents.
A $earch the top of page e&ents
*EAD TA!LE l8e&ents <ITG 9E# name D slis8e&8top8of8page I,T+ ls8e&ent.
I7 sy-subrc D =.
E+VE FT+48+784ACEF T+ ls8e&ent-form.
A44E,D ls8e&ent T+ l8e&ents.
E,DI7.
endform. Q $%!8EVE,TTA!8!%ILD
AB---------------------------------------------------------------------A
A 7+*E T+48+784ACE A
AB---------------------------------------------------------------------A
A <hen T+4-+7-4ACE will be fired " this e&ent will be called and it
A will use the contents of i8list8top8of8page for output in the header
AB---------------------------------------------------------------------A
7+*E top8of8page.
)ALL 7%,)TI+, F*E%$E8ALV8)+EEE,TA*#8<*ITEF
E:4+*TI,C
i8logo D FE,H+#$A48L+C+F
it8list8commentary D i8list8top8of8page.
E,D7+*E.
3; of 3;

Das könnte Ihnen auch gefallen