Alv Documentation and Examples11 by Rajagopalan. m

35
ALV DOCUMENTA TION AND EXAMPLES11 Rajagopal an. M ALV (ABAP LIST VIEWER) Sap provides a set of ALV (ABAP LIST VIEWER) function modules, !ic! can "e put into use to em"ellis! t!e output of a report# T!is set of ALV functions is used to en!ance t!e reada"ilit$ and functionalit$ of an$ report output# %ases arise in sap !en t!e output of a report contains columns e&tendin' mo re t!an c! aracters in len't!# In suc! cases, t!is set of ALV functions can !elp c!oose selected columns and arran'e t!e different columns from a report output and also save different variants for report displa$# T!is is a ver$ efficient tool for d$namicall$ sortin' and arran'in' t!e columns from a report output# T!e report output can contain upto *+ columns in t!e displa$ it! t!e ide arra$ of displa$ options# T!e commonl$ used ALV functions used for t!is purpose are -# RE.SE/ALV/VARIA0T/1E2A.LT/3ET # RE.SE/ALV/VAR IA0T/24 5# RE.SE/ALV/VAR IA0T/E6ISTE0%E 4# RE.SE/ALV/EVE0TS/3ET # RE.SE/ALV/%788E0TAR9/WRITE :# RE.SE/ALV/2IEL1%ATAL73/8ER3E ;# RE.SE/ALV/LIST/1ISPLA9 <# RE.SE/ALV/3RI1/1ISPLA9 *# RE.SE/ALV/P7P.P/T7/SELE% T T!e different steps used for 'ettin' t!e a"ove function modules into use are = Step 1 DATA DECLARATION Sap standard t$ pe pools= SLIS , >>BL7 # Sap standard ta"les t$ pes ta?en from t!e t$ pe pools are= SLIS/LA97.T/ALV ,  SLIS/T/2IEL1%AT/ALV, SLIS/T/LIST@EA1ER, SLIS/T/EVE0T, SLIS/SEL2IEL1# Internal ta"les to used in t!e pro'ram declared "ased on t!e a"ove ta"le t$pes 1ATA= I/LA97.T T9PE SLIS/LA97.T/ALV,  I/2IEL1TAB T9PE SLIS/T/2IEL1%AT/ALV,  I/@EA1I03 T9PE SLIS/T/LIST@EA1ER,  I/EVE0TS T9PE SLIS/T/EVE0T# T9PES= >>BL7/SEL2IEL1 T9PE SLIS/SEL2IEL1# Step 2 (Optional) 1 of 35

description

ALV DOCUMENTATION AND EXAMPLES11 by Rajagopalan. M.doc

Transcript of Alv Documentation and Examples11 by Rajagopalan. m

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    1/35

    ALV DOCUMENTATION AND EXAMPLES11 Rajagopalan. M

    ALV (ABAP LIST VIEWER)

    Sap provides a set of ALV (ABAP LIST VIEWER) function modules, !ic! can "e put into

    use to em"ellis! t!e output of a report# T!is set of ALV functions is used to en!ance t!e

    reada"ilit$ and functionalit$ of an$ report output# %ases arise in sap !en t!e output of areport contains columns e&tendin' more t!an c!aracters in len't!# In suc! cases, t!is set

    of ALV functions can !elp c!oose selected columns and arran'e t!e different columns from a

    report output and also save different variants for report displa$# T!is is a ver$ efficient tool

    for d$namicall$ sortin' and arran'in' t!e columns from a report output# T!e report output can

    contain upto *+ columns in t!e displa$ it! t!e ide arra$ of displa$ options#

    T!e commonl$ used ALV functions used for t!is purpose are

    -# RE.SE/ALV/VARIA0T/1E2A.LT/3ET

    # RE.SE/ALV/VARIA0T/24

    5# RE.SE/ALV/VARIA0T/E6ISTE0%E

    4# RE.SE/ALV/EVE0TS/3ET# RE.SE/ALV/%788E0TAR9/WRITE

    :# RE.SE/ALV/2IEL1%ATAL73/8ER3E

    ;# RE.SE/ALV/LIST/1ISPLA9

    >BL7/SEL2IEL1 T9PE SLIS/SEL2IEL1#

    Step 2 (Optional)

    1 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    2/35

    ALV DOCUMENTATION AND EXAMPLES22 Rajagopalan. M

    SELECTING THE VARIANTS FOR INITIAL LIST DISPLA (DEFA!LT

    VARIANT)

    T!e variants in t!e list displa$ can "e "ot! userspecific and 'eneral# T!e user can pro'rammaticall$ set

    t!e initial (default) variant for list displa$#T!e default variant can "e found usin' t!e function module

    RE.SE/ALV/VARIA0T/1E2A.LT/3ET#

    Sample code=

    %ALL 2.0%TI70 RE.SE/ALV/VARIA0T/1E2A.LT/3ET E6P7RTI03

    i/save C variant save condition ( ACall, . C userspecific ) %@A03I03

    cs/variant C internal ta"le containin' t!e pro'ram name (and t!e default variantoptional ) E6%EPTI70S

    not/found C #

    T!e user can also c!oose from t!e list of e&istin' variants usin' t!e function module

    DRE.SE/ALV/VARIA0T/24#

    Step "

    DEFININING O!TP!T CHARACTERISTICS# PREPARING DISPLA FIELDS

    CATALOG

    A field catalo' is prepared usin' t!e internal ta"le (I/2IEL1%AT) of t$pe

    SLIS/T/2IEL1%AT/ALV# 2ield catalo' containin' descriptions of t!e list output fields

    (usuall$ a su"set of t!e internal output ta"le fields)#

    A field catalo' is reFuired for ever$ ALV list output to add desired functionalit$ (i#e# >e$,

    @otspot, Specific !eadin's, Gustif$, %ol# position etc) to certain fields of t!e output# If not

    mentioned specificall$, t!en t!e defaults are ta?en# T!e possi"le values and defaults are listed

    "elo#

    T!e field catalo' for t!e output ta"le is "uiltup in t!e callers codin'# T!e "uildup can "e

    completel$ or partiall$ automated "$ callin' t!e RE.SE/ALV/2IEL1%ATAL73/8ER3E

    module#

    T!e minimal field catalo' is documented "elo# T!is can "e done in a routine usin' a local

    varia"le# T!e user can use t!e ot!er optional parameters to assi'n output attri"utes to different

    fields in t!e output, !ic! differ from t!e default#

    A field catalo' need not "e "uiltup and passed e&plicitl$ onl$ under t!e folloin'

    conditions=-# T!e internal ta"le to "e output !as t!e same structure as a 1ata 1ictionar$ structure

    !ic! is referred to in t!e internal ta"le declaration usin' LI>E or I0%L.1E

    STR.%T.RE# In t!is case t!e attri"utes of t!e different fields is ta?en directl$ from

    t!e ta"le and t!e attri"utes (?e$ fields, len't!, te&ts etc) need to state e&plicitl$#

    # all fields in t!is structure are to "e output

    5# T!e structure name is passed to ALV in t!e parameter I/STR.%T.RE/0A8E of

    t!e function module RE.SE/ALV/LIST/1ISPLA9#

    All t!e values entered in t!e catalo' is specific to t!e particular field !ose name is entered in

    t!e fieldname 2IEL10A8E of t!e fieldcat structure# T!e name of t!e ta"le is also entered int!e corr# 2ieldname TAB0A8E of t!e structure#

    2 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    3/35

    ALV DOCUMENTATION AND EXAMPLES33 Rajagopalan. M

    T!e different possi"le attri"utes are=

    Ro/pos (ro position)= 7nl$ relevant if t!e list output is to "e multiline (to or

    t!ree lines) "$ default# So, t!is attri"ute can "e used maintain certain level of

    ali'nment in t!e output#

    Value set= +, - H 5

    %ol/pos (column position)= T!is parameter is relevant !en t!e fields in t!e

    output are to "e different from t!e seFuence of t!e fields in t!e internal ta"le used

    for displa$# T!e parameter specifies t!e relative column position of t!e field

    in t!e list output# T!e column order can "e c!an'ed interactivel$ "$ t!e user# If

    t!is parameter is initial for all field catalo' entries, columns appear in t!e internal

    ta"le field seFuence#

    Value set= +, - H :+

    2ieldname (field name)= T!is is t!e name of t!e internal ta"le field for !ic! t!e

    parameters are passed in t!e catalo'#

    Value set= internal output ta"le field name (reFuired parameter)

    Ta"name (internal output ta"le)= 0ame of t!e internal output ta"le t!at contains

    t!e field 2IEL1%AT2IEL10A8E a"ove#

    Value set= SPA%E, internal output ta"le name#

    Ref/fieldname (reference field name)= 0ame of t!e 1ata 1ictionar$ field referred

    to# T!is parameter is onl$ used !en t!e internal output ta"le field descri"ed "$

    t!e current field catalo' entr$ !as a reference to t!e 1ata 1ictionar$ (not a

    pro'ram field), and t!e field name in t!e internal output ta"le is different from t!e

    name of t!e field in t!e 1ata 1ictionar$# If t!e field names are identical,

    namin' t!e 1ata 1ictionar$ structure or ta"le in t!e 2IEL1%ATRE2/TAB0A8E parameter is sufficient#

    Value set= SPA%E, 1ata 1ictionar$ field name#

    Ref/ta"name (reference ta"lestructure field name)= Structure or ta"le name of

    t!e referred 1ata 1ictionar$ field# T!is parameter is onl$ used !en t!e

    internal output ta"le field descri"ed "$ t!e current field catalo' entr$ !as a 1ata

    1ictionar$ reference (not a pro'ram field)#

    Value set= SPA%E, name of a 1ata 1ictionar$ structure or ta"le

    Lin? to currenc$ unit

    %fieldname (currenc$ unit field name)= T!is is used for currenc$ fields t!at !ave

    a reference to an$ unit field# T!is is onl$ relevant for amount columns it!

    associated unit# T!is parameter contains t!e 0ame of t!e internal output ta"le

    field containin' t!e currenc$ unit associated it! t!e amount field 2IEL1%AT

    2IEL10A8E# T!e field in 2IEL1%AT%2IEL10A8E must !ave its on field

    catalo' entr$#

    Value set= SPA%E, output ta"le field name

    %ta"name (internal currenc$ unit field output ta"le)= 0ame of t!e internal output

    ta"le containin' t!e 2IEL1%AT%2IEL10A8E field#

    Value set= SPA%E, output ta"le field name#

    Lin? to measurement unit

    3 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    4/35

    ALV DOCUMENTATION AND EXAMPLES44 Rajagopalan. M

    Jfieldname (measurement unit field name)= 7nl$ relevant for Fuantit$ columns

    it! unit lin?# 0ame of t!e internal output ta"le field containin' t!e measurement

    unit associated it! t!e Fuantit$ field 2IEL1%AT2IEL10A8E# T!e field in

    2IEL1%ATJ2IEL10A8E must !ave its on field catalo' entr$#

    Value set= SPA%E, output ta"le field name#

    Jta"name (internal measurement unit field output ta"le)= 0ame of t!e internal

    output ta"le containin' t!e 2IEL1%ATJ2IEL10A8E field#

    Value set= SPA%E, output ta"le field name#

    7utputlen (column idt!)= T!is parameter is used if t!e desired output len't! for

    a field is desired to "e different from t!e internal output ta"le field# 2or fields

    it! a 1ata 1ictionar$ lin? t!is parameter can "e left initial# 2or fields it!out a

    1ata 1ictionar$ lin? (pro'ram field) t!e parameter must "e 'iven t!e value of t!e

    desired field list output len't! (column idt!)#

    Initial C column idt! is t!e output len't! of t!e referred 1ata 1ictionar$ field

    (domain)#

    0 C column idt! is n c!aracters# Value set= + (initial), n#

    >e$ (?e$ column)= B$ default, t!e s$stem ma?es some fields in t!e output as ?e$

    fields, provided t!e fields are ?e$ fields in t!eir referencin' ta"le# .sin' t!is

    parameter, fields ot!er t!an ?e$ fields of t!e referencin' ta"le can "e made ?e$

    field# T!is parameter is most important if t!e output needs to contain some field

    !ic! are not scrolla"le or cannot "e !idden#

    If t!e internal output ta"le contains fields t!at are ?e$ fields from different ta"les,

    t!en all t!ose fields in t!e report output "ecomes unscrolla"le and cannot "e

    !idden# So, t!e fields in t!e output internal ta"le s!ould not "e referenced from

    ta"les in !ic! t!e$ are ?e$ fields# Instead, t!e$ s!ould "e referenced to t!eta"les in !ic! t!e$ are not ?e$ fields, incase t!e$ are not desired as ?e$ field in

    t!e output#

    6 C ?e$ field (?e$ field output in color) and >e$ fields can not "e interactivel$

    !idden# Parameter 2IEL1%AT07/7.T must "e left initial#

    Value set= SPA%E, 6#

    >e$/sel (!idea"le ?e$ column)= T!is parameter is onl$ relevant for t!e fields

    !ic! are made ?e$ fields usin' 2IEL1%AT>E9 C 6# .sin' t!is parameter t!e

    >e$ field can "e !idden interactivel$#

    T!e ?e$ column seFuence cannot "e c!an'ed interactivel$ "$ t!e user# T!e

    output is controlled "$ t!e 2IEL1%AT07/7.T parameter analo'ousl$ to non

    ?e$ fields#Value set= SPA%E, 6#

    0o/out (field in field list)= T!is parameter is used to remove certain fields from

    t!e output durin' initial displa$# T!e user can !oever interactivel$ c!oose t!e

    field for output from t!e field list in t!e displa$ variant#

    6 C field is not displa$ed in t!e current list#

    Value set= SPA%E, 6#

    Tec! (tec!nical field)= T!is parameter is used to ma?e certain field displa$ onl$

    in t!e field catalo'# T!e fields it! t!is parameter set cannot "e output in t!e list

    nor can t!e$ "e displa$ed interactivel$ from t!e catalo'# 6 C tec!nical field#

    Value set= SPA%E, 6#

    4 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    5/35

    ALV DOCUMENTATION AND EXAMPLES55 Rajagopalan. M

    Emp!asiKe (!i'!li'!t columns in color)= As name su''ests, t!is field parameter is

    used to !i'!li'!t certain field it! c!osen colors#

    Value set= SPA%E, 6 or %&$K (&=-* $,K= +Coff ,-Con)#

    6 C column is colored it! t!e default column !i'!li'!t color#

    %&$K C column is colored it! a coded color= %= %olor (codin' must "e'in it! %)

    6= color num"er

    9= "old

    = inverse

    @otspot (column as !otspot)= T!is parameter is used to ma?e certain field appear

    as !otspot i#e# a !and is displa$ed if t!e cursor is positioned on t!e field value#

    Sin'le clic? on suc! fields cause t!e PI%> 7R 2 events to !appen#

    Value set= SPA%E, 6#

    6 C column cells are output as !otspots#

    2i&/column (fi& column)= T!is parameter is used to fi& certain columns in t!eoutput# All columns to "e fi&ed must !ave t!is fla', startin' from t!e left# If a

    column it!out t!is fla' is output, onl$ t!e columns to t!e left of t!is column are

    fi&ed# T!e user can c!an'e t!e column fi&in' interactivel$#

    Value set= SPA%E, 6#

    6 C column fi&ed (does not scroll !oriKontall$)#

    1o/sum (sum over column)= t!e user can also call t!is function interactivel$#

    Value set= SPA%E, 6#

    6 C a sum is calculated over t!is internal output ta"le field#

    0o/sum (sums for"idden)= 0o sum can "e calculated over t!is field, alt!ou'! t!edata t$pe of t!e field ould allo summin'#

    Value set= SPA%E, 6#

    Icon= T!e parameter displa$s certain column contents as icons# T!e internal

    output ta"le column contents must "e valid icon strin's#

    Value set= SPA%E, 6#

    6 C column contents to "e output as an icon#

    S$m"ol= T!e internal output ta"le column must "e a valid s$m"ol c!aracter#

    Value set= SPA%E, 6

    6 C column contents are to "e output as a s$m"ol#

    Gust (Mustification)= T!is parameter is used for ali'nment of t!e contents of t!e

    output ta"le# T!is is onl$ relevant for %@AR or 0.8% fields in t!e output

    internal ta"le# T!e Mustification of t!e column !eader ala$s follos t!e

    Mustification of t!e columns# Independent Mustification of t!e column !eader is not

    possi"le#

    Value set= SPA%E, R, L, and D%#

    C 1efault Mustification for t!is data t$pe

    R C ri'!tMustified output

    L C leftMustified output

    % C centered output#

    5 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    6/35

    ALV DOCUMENTATION AND EXAMPLES66 Rajagopalan. M

    LKero (leadin' Keros)= B$ default ALV outputs 0.8% fields ri'!tMustified

    it!out leadin' Keros# .sin' t!is parameter onl$ t!e 0.8% fields can "e

    displa$ed it! leadin' Keroes#

    Value set= SPA%E, 6#

    6 C output it! leadin' Keros#

    0o/si'n (no N si'n)= T!is parameter is used to suppress t!e si'ns of t!e output

    fields# It is onl$ relevant for t!e value fields#

    Value set= SPA%E, 6#

    6 C value output it!out N si'n#

    0o/Kero (suppress Keros)= 7nl$ relevant for value fields#

    Value set= SPA%E, 6#

    6 C suppress Keros#

    Edit/mas? (field formattin')= To appl$ t!e report output formattin' options same

    as in t!e WRITE statement in report ritin'#

    Value set= SPA%E, template#

    T!e folloin' parameters are used for customiKin' t!e te&ts in t!e !eadin' of t!e output of

    t!e columns# T!e te&ts are ta?en from t!e 1ata 1ictionar$ for fields it! a 1ata 1ictionar$

    reference# If t!is is not desired, t!e te&t parameters can also "e specified# T!e 1ata 1ictionar$

    te&ts are t!en i'nored#

    If t!e user c!an'es t!e column idt! interactivel$, t!e column !eader te&t it! t!e

    appropriate len't! is ala$s used#

    T$e inte%a&ti'e n&tion *Opti+i,e &ol+n -i.t$* ta/e0 a&&ont o ot$ t$e iel.

    &ontent0 an. t$e &ol+n $ea.e%0# i all iel. &ontent0 a%e 0$o%te% t$an t$e 0$o%te0t

    &ol+n $ea.e% t$e &ol+n -i.t$ .epen.0 on t$e &ol+n $ea.e%3

    T!e lon' field la"el is also used in displa$ variant definition,

    Sort, etc# Popup#

    selte&t/l (lon' field la"el)

    selte&t/m (medium field la"el)

    selte&t/s (s!ort field la"el)

    repte&t/ddic(!eader) Analo'ous to t!e 1ata element main !eader

    1dict&t (specif$ te&t) = 9ou can specif$ it! values L, 8, and S, t!e ?e$ord

    t!at s!ould ala$s "e used as column !eader# If t!e column idt! c!an'es, no

    attempt is made in t!is case to find an appropriate !eader for t!e ne output

    idt!#

    Value set= SPA%E, L, 8, and DS#

    Sample code=

    Suppose I/P7/1ETAILS is an internal ta"le containin' to fields EBEL0 (P7 num"er) and

    EBELP (P7 item no)#

    1ATA= L/2IEL1%AT T9PE SLIS/2IEL1%AT/ALV# OLocal varia"le to !old t!e

    parameters

    for a particular field of t!e fieldcatalo'

    6 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    7/35

    ALV DOCUMENTATION AND EXAMPLES Rajagopalan. M

    %LEAR L/2IEL1%AT#

    L/2IEL1%ATTAB0A8E C I/P7/1ETAILS#

    L/2IEL1%AT2IEL10A8E C EBEL0#

    L/2IEL1%AT>E9 C 6# OT!e P7 no is made t!e ?e$ field,

    O%olored and non scrolla"le

    L/2IEL1%AT@7TSP7T C 6# OT!e po no "ecomes a !otspot

    L/2IEL1%ATSELTE6T/S C DP#7 0o#

    L/2IEL1%ATSELTE6T/8 C P order 0o#

    L/2IEL1%ATSELTE6T/L C Purc!ase order 0o#

    APPE01 L/2IEL1%AT T7 I/2IEL1TAB#

    %LEAR L/2IEL1%AT

    L/2IEL1%ATTAB0A8E C I/P7/1ETAILS#

    L/2IEL1%AT2IEL10A8E C EBEL0#

    L/2IEL1%AT>E9 C 6# OT!e po item no is made t!e ?e$ field,

    O%olored and non scrolla"le L/2IEL1%ATSELTE6T/S C Item 0o#

    L/2IEL1%ATSELTE6T/8 C Item 0o#

    L/2IEL1%ATSELTE6T/L C P7 Item 0o#

    APPE01 L/2IEL1%AT T7 I/2IEL1TAB#

    %LEAR L/2IEL1%AT

    T!us t!e catalo' for t!e report output is prepared#

    Step 4

    T!e ne&t step is to "uild an event ta"le, !ic! are used for firin' "ot! user commands and t!e

    s$stem dependent events i#e# top of pa'e, end of pa'e etc#

    A list of possi"le events is populated into an event ta"le (I/EVE0TS) !en t!is ta"le is

    passed to t!e function module RE.SE/ALV/EVE0T/0A8ES/3ET# T!e return ta"le from

    t!is function module contains all t!e possi"le events#

    T!e function module contains folloin' import and e&port parameters#

    I8P7RTI03 PARA8ETERS= I/LIST/T9PE

    T!is parameter !as possi"le values from +4#

    T!e parameter I/LIST/T9PE is of T9PE SLIS/LIST/T9PE and is 1E2A.LT + #

    E6P7RTI03 PARA8ETERS= I/EVE0TS ta"le#

    T!is ta"le is of T9PE SLIS/T/EVE0T and returns to t!e pro'ram t!e name of all t!e

    possi"le events#

    T!e ta"le structure contains t!e fields=

    I/EVE0TS0A8E= 0ame of t!e %all"ac? event#

    I/EVE0TS27R8= 0ame of t!e form routine t!at s!ould "e called in t!e callin'

    pro'ram at t!e event#

    7nl$ events it! a form routine name are processed#

    T!e I/EVE0TS ta"le returns it! t!e folloin' possi"le constants=

    13 Sli05e'5ite+5.ata5e6pan. TPE 0li05o%+na+e VAL!E*ITE75DATA5E8PAND*3

    7 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    8/35

    ALV DOCUMENTATION AND EXAMPLES!! Rajagopalan. M

    7nl$ relevant for !ierarc!icalseFuential lists usin' t!e la$out parameter

    IS/LA97.TE6PA01/2IEL10A8E of t!e structure IS/LA97.T# E&it for

    passin' item entries (ITE8 ta"le) for a !eader record t!at as e&panded

    interactivel$ "$ t!e user#

    23 Sli05e'5%ep%ep50el5+o.i9 TPE 0li05o%+na+e VAL!E

    *REPREP5SEL57ODIF*3

    RS/SEL2IEL1TABI01E6 contains t!e !eader ta"le inde& for !ic! t!e item

    entries are to "e put in t!e 'lo"al item output ta"le (T/7.TTAB/SLAVE)# T!e

    %all"ac? is onl$ called if ALV !as no items for a !eader t!at is to "e e&panded#

    R2L3/ALL is passed it! 6 if t!e user s!os all items# T!e application must

    ensure t!at entries are not repeated in t!e item ta"le#

    RS/SEL2IEL1 is initial in t!is case#

    "3 Sli05e'5&alle%5e6it5at50ta%t TPE 0li05o%+na+e VAL!E *CALLER5E8IT*3

    Is called at t!e "e'innin' of t!e function module to ma?e special settin's# It is not

    usuall$ used#

    43 Sli05e'50e%5&o++an. TPE 0li05o%+na+e VAL!E *!SER5CO77AND*3

    As t!is is a freFuentl$used %all"ac? event, t!e form routine can also "e passed

    directl$ in t!e interface "$ passin' t!e user command in t!e I8P7RTI03parameter I/%ALLBA%>/.SER/%788A01#

    :3 Sli05e'5top5o5pa;e TPE 0li05o%+na+e VAL!E *TOP5OF5PAGE*3

    EFuivalent to t!e list processin' T7P72PA3E event#

    3 Sli05e'5o%ei;n5top5o5pa;e TPE 0li05o%+na+e VAL!E?FOREIGN5TOP5OF5PAGE*3

    T!e Topofpa'e event is ala$s processed in ALV and is onl$ passed to t!e

    caller via t!e %all"ac? mec!anism# T!is is still t!e case if t!e caller, e#'# "$ a

    user action, processes a "ranc! list !ic! as not formatted "$ ALV (e#'# a

    popup it! additional information a"out t!e list record selected and

    displa$ed "$ ALV)#

    In t!is case, topofpa'e cannot "e formatted "$ ALV analo'ousl$ to t!e

    "asic list, it must "e !andled completel$ "$ t!e caller# T!e event topofpa'e

    still occurs in ALV# W!en ALV notices a topofpa'e !ic! as not caused

    "$ an ALV output, t!e form routine in 27REI30/T7P/72/PA3E is called#

    @3 Sli05e'5o%ei;n5en.5o5pa;e TPE 0li05o%+na+e VAL!E

    *FOREIGN5END5OF5PAGE*3

    T!e event endofpa'e is ala$s processed in ALV and onl$ passed to t!e

    caller via call"ac?# T!is is still t!e case, e#'# !en t!e caller processes a

    details list !ic! as not formatted "$ ALV (e#'# a popup it! furt!er

    information a"out selected list records !ic! ere displa$ed "$ ALV)#

    In t!is case, endofpa'e cannot "e formatted "$ ALV analo'ousl$ to t!e

    "asic list, it must "e !andled completel$ "$ t!e caller# T!e event endofpa'e

    still occurs in ALV# W!en ALV notices an endofpa'e t!at as not caused

    "$ an ALV output, t!e form routine in 27REI30/E01/72/PA3E is called#

    13 Sli05e'5p50tat050et TPE 0li05o%+na+e VAL!E *PF5STAT!S5SET*3

    If a user list status is to "e set, it must "e done in t!e form routine assi'ned tot!is event# T!e ALV function codes, !ic! must not "e active, are in t!e

    8 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    9/35

    ALV DOCUMENTATION AND EXAMPLES"" Rajagopalan. M

    Parameter RT/E6TAB# T!is ta"le must "e passed it! t!e SET P2STAT.S

    command (it! inactive user function codes as ell, if necessar$)#

    T!e STA01AR1 status of t!e function 'roup SALV s!ould "e used as a

    template for a userspecific status# As t!is is a freFuentl$ used %all"ac?

    event, its form routine can also "e passed directl$ in t!e interface in t!e

    I8P7RTI03 parameter I/%ALLBA%>/P2/STAT.S/SET#

    113 Sli05e'5li0t5+o.i9 TPE 0li05o%+na+e VAL!E *LIST57ODIF*3

    LIST/871I29 .SI03 R/TAB0A8E T9PE SLIS/TAB0A8E

    R/I01E6 LI>E S9TABI6

    R/I01E6/ITE8 LI>E S9TABI6

    R/I01E6/S.8 LI>E S9TABI6#

    123 Sli05e'5top5o5li0t TPE 0li05o%+na+e VAL!E *TOP5OF5LIST*3

    Information output at t!e start of t!e list

    1"3 Sli05e'5en.5o5pa;e TPE 0li05o%+na+e VAL!E *END5OF5PAGE*3

    Information output at t!e end of a pa'e# T!is is onl$ called for printin'#

    143 Sli05e'5en.5o5li0t TPE 0li05o%+na+e VAL!E *END5OF5LIST*3

    Information output at t!e end of t!e list

    1:3 Sli05e'5ate%5line5otpt TPE 0li05o%+na+e VAL!E*AFTER5LINE5O!TP!T*3

    7utput information after eac! output line# S!ould onl$ "e used in Mustified

    cases "ecause it costs a lot of performance#

    1

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    10/35

    ALV DOCUMENTATION AND EXAMPLES1#1#Rajagopalan. M

    I2 S9S.BR% C +#

    87VE 27R80A8E/E01/72/PA3E T7 L/I/EVE0T27R8#

    APPE01 L/I/EVE0T T7 I/EVE0TS#

    E01I2#

    %LEAR L/I/EVE0T#

    REA1 TABLE I/EVE0TS WIT@ >E9 0A8E C SLIS/EV/.SER/%788A01

    I0T7 L/I/EVE0T#

    I2 S9S.BR% C +#

    87VE 27R80A8E/.SER/%788A01 T7 L/I/EVE0T27R8#

    APPE01 L/I/EVE0T T7 I/EVE0TS#

    E01I2#

    T!is ill prepare t!e events ta"le for t!e report#

    T!e report ill contain t!ree forms for t!e a"ove events=

    -# 27R8 T7P/72/PA3E = T!is form ill contain t!e top of pa'e event for t!e report i#e

    !eader etc

    .sin' t!e function module DRE.SE/ALV/%788E0TAR9/WRITE, t!e internal ta"le

    containin' t!e !eadin's for top of pa'e event can "e passed to t!e list output# Also, an$lo'o specific to t!e report can "e passed to t!e function module#

    # 27R8 E01/72/PA3E = T!is form ill contain t!e end of pa'e event for t!e report i#e

    footer etc

    5# 27R8 .SER/%788A01 = T!is form ill contain t!e desired user command i#e

    pic?line selection

    Step :

    A la$out is "uild for t!e report output list description .SI03 t!e internal ta"le declared a"ove

    (I/LA97.T)#

    7utput list description structure# T!e parameters are descri"ed under t!e folloin' !eads=

    1ispla$ options

    E&ceptions

    Totals

    Interaction

    1etail screen

    1ispla$ variants (onl$ for !ierarc!icalseFuential lists)

    %olor

    7t!er

    T!e la$out ta"le is of t$pe slis/la$out/alv/spec and !as t!e folloin' fields=

    1ispla$ options

    -# %olidt!/optimiKe (-) T9PE c= T!is parameter optimiKes t!e len't! of t!e

    different columns in t!e output# T!e idt! of t!e different col# no depends on t!e

    ma Len't! of t!e data in t!e column#

    Value set= SPA%E, 6

    6 C optimiKes t!e column idt! so t!at all contents are displa$ed completel$#

    # 0o/col!ead(-) T9PE c = T!is parameter suppresses t!e column !eadin's

    Value set= SPA%E, 6#

    6 C column !eaders are not output

    5# 0o/!otspot(-) T9PE c = T!e !eadin' of t!e report output are not output as

    !otspot#

    10 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    11/35

    ALV DOCUMENTATION AND EXAMPLES1111Rajagopalan. M

    Value set= SPA%E, 6#

    6 C column !eaders are not output as !otspot

    4# e"ra(-) T9PE c = T!e report is output in t!e striped pattern#

    Value set= SPA%E, 6#

    6 C striped pattern (e#'# for ide lists)

    # 0o/vline(-) T9PE c = T!e report output contains columns onl$ separated "$ space

    and no lines# It is not relevant for= !ierarc!icalseFuential lists and multipleline lists#

    Value set= SPA%E, 6#

    6 C columns separated "$ SPA%E

    :# 0o/min/linesiKe(-) T9PE c = T!e report line siKe is eFual to t!e idt! of t!e list#

    It is not relevant for "loc? lists#

    Value set= SPA%E, 6#

    6 C line siKe depends on list idt!

    C Line siKe is set to E s$linsK= T!e report output contains a minimum possi"le len't!

    of line# If initial min/linesiKe is set to

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    12/35

    ALV DOCUMENTATION AND EXAMPLES1212Rajagopalan. M

    Sums

    -# 0o/sumc!oice(-) T9PE c = T!is parameter allos t!e c!oice for summin' up

    7nl$ "$ fieldcatalo'#

    Value set= SPA%E, 6

    6 C fields !ic! are to "e summed, passed "$ t!e callin' pro'ram (2IEL1%AT

    17/S.8 C 6)# T!e user s!ould not "e a"le to c!an'e t!is value interactivel$#

    -:# 0o/totalline(-) T9PE c = Removes t!e option of !avin' totals after su"totals#

    Value set= SPA%E, 6

    6 C no total record is to "e output# Su"totals can still "e calculated and output# T!e

    fields in t!e su"totals are fla''ed 17/S.8 C 6 in t!e field list#

    -;# 0o/su"c!oice(-) T9PE c = 1oes not allo t!e user to interactivel$ c!an'e t!e

    field c!osen for su"totals#

    Value set= SPA%E, 6

    6 C value !ose c!an'e tri''ers su"totals, provided "$ t!e callin' pro'ram# T!e

    user s!ould not "e a"le to c!an'e t!is value interactivel$#

    -

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    13/35

    ALV DOCUMENTATION AND EXAMPLES1313Rajagopalan. M

    selection column# T!e field is a c!ec?"o& at t!e start of list records it!out a list

    !eader#

    Value set= SPA%E, internal output ta"le field name

    :# Bo&/ta"name T9PE slis/ta"name= 0ame of t!e internal output ta"le t!at contains

    t!e field in t!e parameter B76/2IEL10A8E# If B76/2IEL10A8E is not empt$,

    t!is field must also "e filled for !ierarc!icalseFuential lists#

    Value set= SPA%E, internal output ta"le name#

    ;# Bo&/rollname LI>E dd+5prollname= rollname for c!ec?"o&

    E9 C 6) are output as

    !otspots, i#e# clic?in' on a ?e$ column (!i'!li'!ted in color in t!e list) calls t!e

    function under 2#

    Value set= SPA%E, 6#

    54# Reprep(-) T9PE c = report report interface active#

    5# 3roup/"uttons(-) T9PE c = 'roup"uttons for %7L- %7L # 3roup output

    fields via 2IEL1%ATSP/3R7.P in t!e field list, and pass t!e 'roup name to t!e

    list module in t!e interface parameter IT/SPE%IAL/3R7.PS#

    Value set= SPA%E, 6#

    5:# 0o/?e$fi&(-) T9PE c = .sed to ma?e t!e ?e$ fields scrolla"le#

    Value set= SPA%E, 6#

    C T!e ?e$ columns defined in t!e field catalo' "$ 2IEL1%AT>E9 C 6 are fi&edin t!e list output# T!ese columns do not scroll !oriKontall$# T!e item ta"le ?e$

    13 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    14/35

    ALV DOCUMENTATION AND EXAMPLES1414Rajagopalan. M

    columns are fi&ed in !ierarc!icalseFuential lists# T!e !eader ta"le ?e$ fields are not

    considered !ere#

    6 C ?e$ columns not fi&ed

    5;# 3et/selinfos(-) T9PE c = To read selection screen#

    Value set= SPA%E, 6#

    If t!e callin' pro'ram is a report it! an ABAP4 selection screen, settin' t!is

    parameter ma?es ALV read t!e selection screen a'ain# If t!e selections are read

    successfull$, a pus!"utton, via !ic! t!e user can call a popup !ic! lists t!e report

    selections in a simple form, "ecomes active on t!e results list output "$ ALV#

    5

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    15/35

    ALV DOCUMENTATION AND EXAMPLES1515Rajagopalan. M

    44#default/ item(-) T9PE c = Items as default# 7nl$ relevant for !ierarc!ical

    seFuential lists#

    Value set= SPA%E, 6

    C T!e !eader ta"le fields are displa$ed "$ default in t!e displa$ variant definition

    popup# T!e user can sitc! to t!e item ta"le fields interactivel$#

    6 C t!e item ta"le fields are displa$ed "$ default in t!e displa$ variant 1efinition

    Popup# T!e user can sitc! to t!e !eader ta"le fields interactivel$#

    %olour

    4# Info/fieldname T9PE slis/fieldname= infofield for listoutput# A !ole list record

    can "e colored individuall$ usin' a color code in a column of t!e internal output ta"le

    for t!e record# Assi'n t!e name of t!e field containin' t!e color code to t!is

    parameter#

    Value set= SPA%E, internal output ta"le field name

    T!e internal output ta"le field must "e of t$pe %@AR(5)#

    T!e code must !ave t!e folloin' s$nta&= %&$=

    % C color (all codes must start it! %) 6 C color num"er (-*)

    9 C "old (+ C off, - C on)

    4:# %olta"/fieldname T9PE slis/fieldname= %ells can "e colored individuall$ usin' a

    color code !ic! is contained in a column of t!e internal output ta"le for t!e record

    containin' t!e cell# Assi'n t!e name of t!e field to t!is parameter#

    7t!ers

    4;# List/append(-) T9PE c = no call screen# It is onl$ useful to output "loc?lists

    it!out specif$in' t!e a"ove modules if t!e num"er of list "loc?s e&ceeds, or ma$

    e&ceed, t!e ma&imum num"er specified in t!e "loc? module documentation# T!ese

    operations are not possi"le for userdefined "loc? lists#

    E6a+ple &o.e #

    I_LAYOUT-f2code = ws_fcode. I_LAYOUT-zebra = 'X'.

    I_LAYOUT-colwidth_optiize = 'X'.I_LAYOUT-!o_"e#fi$ = 'X'.I_LAYOUT-%et_seli!fos = 'X'.I_LAYOUT-!o_hotspot = 'X'.

    I_LAYOUT-!o_i!p&t = 'X'.I_LAYOUT-hotspot_field!ae = I(L)*A+(.

    I_LAYOUT-!o_i!p&t = ,X.I_LAYOUT-!o_li!e = /X.I_LAYOUT-!o_colhead = , ,.I_LAYOUT-li%hts_co!de!se = / /.I_LAYOUT-totals_te$t = / /.I_LAYOUT-s&btotals_te$t = / /.I_LAYOUT-totals_o!l# = / /.I_LAYOUT-"e#_hotspot = ,X.I_LAYOUT-detail_pop&p = ,X.I_LAYOUT-%ro&p_cha!%e_edit = ,X.I_LAYOUT-01OU_3UTTO*4 = ,X.

    Step E or I0%L.1E

    STR.%T.RE (not T9PE) are used#

    Step >

    T!e ot!er function module is used to displa$ t!e internal output ta"le it! t!e contents

    2.0%TI70 reuse/alv/list/displa$#

    Lo?ale Sc!nittstelle=

    U I8P7RTI03

    17 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    18/35

    ALV DOCUMENTATION AND EXAMPLES1!1!Rajagopalan. M

    VAL.E(I/I0TER2A%E/%@E%>) 1E2A.LT SPA%E

    VAL.E(I/%ALLBA%>/PR73RA8) LI>E S9REPI1 1E2A.LT SPA%E

    VAL.E(I/%ALLBA%>/P2/STAT.S/SET) T9PE SLIS/27R80A8E

    1E2A.LT SPA%E

    VAL.E(I/%ALLBA%>/.SER/%788A01) T9PE SLIS/27R80A8E

    1E2A.LT SPA%E

    VAL.E(I/STR.%T.RE/0A8E) LI>E 11+LTAB0A8E 7PTI70AL

    VAL.E(IS/LA97.T) T9PE SLIS/LA97.T/ALV 7PTI70AL

    VAL.E(IT/2IEL1%AT) T9PE SLIS/T/2IEL1%AT/ALV 7PTI70AL

    VAL.E(IT/E6%L.1I03) T9PE SLIS/T/E6TAB 7PTI70AL

    VAL.E(IT/SPE%IAL/3R7.PS) T9PE SLIS/T/SP/3R7.P/ALV

    7PTI70AL

    VAL.E(IT/S7RT) T9PE SLIS/T/S7RTI027/ALV 7PTI70AL

    VAL.E(IT/2ILTER) T9PE SLIS/T/2ILTER/ALV 7PTI70AL

    VAL.E(IS/SEL/@I1E) T9PE SLIS/SEL/@I1E/ALV 7PTI70AL

    VAL.E(I/1E2A.LT) 1E2A.LT 6

    VAL.E(I/SAVE) 1E2A.LT SPA%E

    VAL.E(IS/VARIA0T) LI>E 1ISVARIA0T STR.%T.RE 1ISVARIA0T 1E2A.LT SPA%E

    VAL.E(IT/EVE0TS) T9PE SLIS/T/EVE0T 7PTI70AL

    VAL.E(IT/EVE0T/E6IT) T9PE SLIS/T/EVE0T/E6IT 7PTI70AL

    VAL.E(IS/PRI0T) T9PE SLIS/PRI0T/ALV 7PTI70AL

    VAL.E(IS/REPREP/I1) T9PE SLIS/REPREP/I1 7PTI70AL

    VAL.E(I/S%REE0/START/%7L.80) 1E2A.LT +

    VAL.E(I/S%REE0/START/LI0E) 1E2A.LT +

    VAL.E(I/S%REE0/E01/%7L.80) 1E2A.LT +

    VAL.E(I/S%REE0/E01/LI0E) 1E2A.LT +

    E6P7RTI03

    VAL.E(E/E6IT/%A.SE1/B9/%ALLER)

    VAL.E(ES/E6IT/%A.SE1/B9/.SER) T9PE SLIS/E6IT/B9/.SER TABLES

    T/7.TTAB

    E6%EPTI70S

    PR73RA8/ERR7R

    Import parametersI/I0TER2A%E/%@E%>= Interface consistenc$ c!ec? lo' output#

    I/%ALLBA%>/PR73RA8= 0ame of t!e callin' pro'ram

    I/%ALLBA%>/P2/STAT.S/SET= Set E6IT routine to status#

    I/%ALLBA%>/.SER/%788A01= E6IT routine for command !andlin'

    I/STR.%T.RE/0A8E= Internal output ta"le structure name

    IS/LA97.T= List la$out specifications

    IT/2IEL1%AT= 2ield catalo' it! field descriptions

    IT/E6%L.1I03= Ta"le of inactive function codes

    IT/SPE%IAL/3R7.PS= 3roupin' fields for column selection

    IT/S7RT= Sort criteria for first list displa$

    IT/2ILTER= 2ilter criteria for first list output

    IS/SEL/@I1E = Selection information modification

    I/1E2A.LT= Initial variant activeinactive lo'ic

    I/SAVE= Variants can "e saved

    IS/VARIA0T = Variant information

    IT/EVE0TS= Ta"le of events to performIT/EVE0T/E6IT = Standard fcode e&it reFuests ta"le

    IS/PRI0T= Print information

    18 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    19/35

    ALV DOCUMENTATION AND EXAMPLES1"1"Rajagopalan. M

    IS/REPREP/I1= InitialiKation ?e$s for ReRe interface

    I/S%REE0/START/%7L.80= %oordinates for list in dialo' "o&

    I/S%REE0/START/LI0E= %oordinates for list in dialo' "o&

    I/S%REE0/E01/%7L.80= %oordinates for list in dialo' "o&

    I/S%REE0/E01/LI0E= %oordinates for list in dialo' "o&

    IT/EVE0T/E6IT= Standard fcode e&it reFuests ta"le

    IS/PRI0T= Print information

    IS/REPREP/I1= InitialiKation ?e$s for ReRe interface

    I/S%REE0/START/%7L.80= %oordinates for list in dialo' "o&

    I/S%REE0/START/LI0E= %oordinates for list in dialo' "o&

    I/S%REE0/E01/%7L.80= %oordinates for list in dialo' "o&

    I/S%REE0/E01/LI0E= %oordinates for list in dialo' "o&

    E&port parametersE/E6IT/%A.SE1/B9/%ALLER= 1elete list in %ALLBA%>/.SER/%788A01ES/E6IT/%A.SE1/B9/.SER= @o t!e user left t!e list Ta"les

    T/7.TTAB= Ta"le it! data to "e displa$ed mandator$

    E6a+ple Co.e

    74_1(*A+( = 4Y-1(I).

    6ALL U*6TIO* '1(U4(_AL5_I(L)6ATALO0_+(10(' (XO1TI*0 I_1O01A+_*A+( = 74_1(*A+( I_I*T(1*AL_TA3*A+( = I!ter!al o&tp&t table field !ae I_I*6L*A+( = 74_1(*A+( 68A*0I*0 6T_I(L)6AT = I_I(L)TA3.

    I 4Y-4U316 9: ;. 71IT(< '4Y-4U316< ' 4Y-4U316 '1(U4(_AL5_I(L)6ATALO0_+(10('. (*)I.6ALL U*6TIO* '1(U4(_AL5_LI4T_)I4LAY' (XO1TI*0 I_6ALL3A6>_1O01A+ = 74_1(*A+( I_4T1U6TU1(_*A+( = I!ter!al o&tp&t table field !ae I4_LAYOUT = I_LAYOUT IT_I(L)6AT = I_I(L)TA3 I_)(AULT = 'A' I_4A5( = 'A' I4_5A1IA*T = 'X' IT_(5(*T4 = I_(5(*T4?@

    IT_4O1T = I_4O1TI4_4(L_8I)( = I_4(LI*O

    TA3L(4 T_OUTTA3 = I!ter!al o&tp&t table field !ae.

    I 4Y-4U316 9: ;. 71IT(< '4Y-4U316< ' 4Y-4U316 '1(U4(_AL5_LI4T_)I4LAY'. (*)I

    T@IS IS T@E P7P .P T7 ALL7W T@E .SER T7 190A8I%ALL9 SELE%T T@E 2IEL1S 27R

    1ISPLA9# @E %A0 %@77SE 2R78 T@IS 2IEL1S A%%# T7 REJ.IRE8E0T A01 @I1E T@E7T@ER 2IEL1S

    19 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    20/35

    ALV DOCUMENTATION AND EXAMPLES2#2#Rajagopalan. M

    E&ample report output "ased prior to selection of t!e field

    20 of 35

    output.html

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    21/35

    ALV DOCUMENTATION AND EXAMPLES2121Rajagopalan. M

    T@E .SER @AS @I11E0 S78E 72 T@E 2IEL1 2R78 T@E T7TAL 2IEL1S T7 %.ST78IE

    T@E REP7RT 7.TP.T

    E&ample report output after !idin' some of t!e fields

    21 of 35

    output1.html

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    22/35

    ALV DOCUMENTATION AND EXAMPLES2222Rajagopalan. M

    .SER %A0 %@77SE A PARTI%.LAR SET 72 2IEL1 2R78 T@E 7.TP.T A01 %A0 SAVEIT AS VARIA0TS

    22 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    23/35

    ALV DOCUMENTATION AND EXAMPLES2323Rajagopalan. M

    .sin' ot!er function module RE.SE/ALV/3RI1/1ISPLA9 can !elp us 'et list output in

    t!e form of a 'rid and also attac! lo'os to t!e report output#

    23 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    24/35

    ALV DOCUMENTATION AND EXAMPLES2424Rajagopalan. M

    Sa+ple &o.e

    - Si+ple li0t otpt=

    REP7RT 9/1E87/ALV 07 STA01AR1 PA3E @EA1I03#

    1ata to "e displa$ed

    1ATA= I/S2LI3@T T9PE TABLE 72 S2LI3@T#

    Selection

    SELE%T 2R78 S2LI3@T I0T7 TABLE I/S2LI3@T#

    %all ABAP List Vieer (ALV)

    %ALL 2.0%TI70 RE.SE/ALV/LIST/1ISPLA9

    E6P7RTI03

    I/STR.%T.RE/0A8E C S2LI3@T

    TABLES

    T/7.TTAB C I/S2LI3@T#

    #Si+ple ;%i. otpt#

    REP7RT 9/1E87/ALV/-#

    1ata to "e displa$ed1ATA= I/S2LI3@T T9PE TABLE 72 S2LI3@T#

    Selection

    SELE%T 2R78 S2LI3@T I0T7 TABLE I/S2LI3@T#

    %all ABAP List Vieer (ALV)

    %ALL 2.0%TI70 RE.SE/ALV/3RI1/1ISPLA9

    E6P7RTI03

    I/STR.%T.RE/0A8E C S2LI3@T

    TABLES

    T/7.TTAB C I/S2LI3@T#

    "3 De+o o% *RE!SE5ALV5POP!P5TO5SELECT*

    REP7RT $/demo/alv/5#

    T9PEP77LS= slis#

    1ATA= BE3I0 72 i/outta" 7%%.RS +#

    I0%L.1E STR.%T.RE sfli'!t#

    1ATA= /c!? T9PE c# 2or multiple selection1ATA= E01 72 i/outta"#

    24 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    25/35

    ALV DOCUMENTATION AND EXAMPLES2525Rajagopalan. M

    I/7.TTAB T9PE S2LI3@T 7%%.RS +,

    1ATA= i/private T9PE slis/data/caller/e&it,

    i/selfield T9PE slis/selfield,

    W/e&it(-) T9PE c#

    PARA8ETERS= p/title T9PE s$title#

    START72SELE%TI70#

    SELE%T 2R78 sfli'!t I0T7 TABLE i/outta"#

    %ALL 2.0%TI70 RE.SE/ALV/P7P.P/T7/SELE%T

    E6P7RTI03

    i/title C p/title

    i/selection C 6

    i/Ke"ra C 6

    I/S%REE0/START/%7L.80 C + I/S%REE0/START/LI0E C +

    I/S%REE0/E01/%7L.80 C +

    I/S%REE0/E01/LI0E C +

    i/c!ec?"o&/fieldname C W/%@>

    I/LI0E8AR>/2IEL10A8E C

    I/S%R7LL/T7/SEL/LI0E C 6

    i/ta"name C I/7.TTAB

    i/structure/name C S2LI3@T

    IT/2IEL1%AT C

    IT/E6%L.1I03 C

    I/%ALLBA%>/PR73RA8 C

    I/%ALLBA%>/.SER/%788A01 C IS/PRIVATE C I/PRIVATE

    I8P7RTI03

    es/selfield C i/selfield

    e/e&it C /e&it

    TABLES

    t/outta" C i/outta"

    E6%EPTI70S

    pro'ram/error C -

    7T@ERS C #

    I2 s$su"rc Q +#

    8ESSA3E i+++(+?) WIT@ s$su"rc#

    E01I2#

    t!e internal ta"le is modified it! a cross si'n for mar?in' t!e

    ros selected

    L77P AT i/outta" W@ERE /c!? C 6#

    WRITE= i/outta"carrid, i/outta"price#

    E01L77P#

    43 De+o o% ALV otpt 0in; iel. &atalo; an. la9ot#

    REP7RT $/demo/alv 07 STA01AR1 PA3E @EA1I03#

    25 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    26/35

    ALV DOCUMENTATION AND EXAMPLES2626Rajagopalan. M

    ALV related data declaration

    T9PEP77LS= slis#

    1BTa"le

    TABLES sfli'!t#

    Includes

    I0%L.1E iconQ#

    I0%L.1E s$m"olQ#

    %70STA0TS=

    c/formname/top/of/pa'e T9PE slis/formname VAL.E T7P/72/PA3E#

    1ATA= i/fieldcat T9PE slis/t/fieldcat/alv,

    i/la$out T9PE slis/la$out/alv,

    i/sp/'roup T9PE slis/t/sp/'roup/alv,

    i/events T9PE slis/t/event,

    i/print T9PE slis/print/alv,

    i/sort T9PE slis/t/sortinfo/alv#

    internal ta"le for data to "e displa$ed

    1ATA= BE3I0 72 i/sfli'!t 7%%.RS +#

    I0%L.1E STR.%T.RE sfli'!t#

    1ATA= "o&,

    li'!ts#

    1ATA= E01 72 i/sfli'!t#

    1ATA= /repid LI>E s$repid#

    1ATA= i/list/top/of/pa'e T9PE slis/t/list!eader#

    Report Selections

    SELE%T7PTI70S s/carrid 27R sfli'!tcarrid#

    SELE%T7PTI70S s/connid 27R sfli'!tconnid#SELE%T7PTI70S s/fldate 27R sfli'!tfldate#

    SELE%TI70S%REE0 S>IP -#

    Parameters

    PARA8ETERS= p/ma&ro T9PE i 1E2A.LT 5+#to limit t!e selection

    SELE%TI70S%REE0 S>IP -#

    Variant for ALV displa$

    SELE%TI70S%REE0 BE3I0 72 BL7%> + WIT@ 2RA8E TITLE te&t+++#

    PARA8ETERS= p/varnt LI>E disvariantvariant#

    SELE%TI70S%REE0 E01 72 BL7%> +#

    La$out of t!e report displa$

    SELE%TI70S%REE0 BE3I0 72 BL7%> a WIT@ 2RA8E TITLE te&t++-#

    PARA8ETERS= p/Ke"ra AS %@E%>B76 1E2A.LT , Striped pattern

    p/nocol! AS %@E%>B76 1E2A.LT , 0o column !eadin'

    p/novlin AS %@E%>B76 1E2A.LT , 0o vertical lines

    p/colopt AS %@E%>B76 1E2A.LT , 7ptimiKes col# d

    p/?e$!ot AS %@E%>B76 1E2A.LT , >e$ fields !ot

    p/noinpt AS %@E%>B76 1E2A.LT # 0o field for input

    SELE%TI70S%REE0 E01 72 BL7%> a#

    SELE%TI70S%REE0 BE3I0 72 BL7%> " WIT@ 2RA8E TITLE te&t++#

    PARA8ETERS= p/li'!ts AS %@E%>B76 1E2A.LT 6,

    p/li'!tc AS %@E%>B76 1E2A.LT 6#SELE%TI70S%REE0 E01 72 BL7%> "#

    26 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    27/35

    ALV DOCUMENTATION AND EXAMPLES22Rajagopalan. M

    SELE%TI70S%REE0 BE3I0 72 BL7%> c WIT@ 2RA8E TITLE te&t++5#

    PARA8ETERS= p/totonl AS %@E%>B76 1E2A.LT ,

    p/tote&t(:+),

    p/stte&t(:+)#

    SELE%TI70S%REE0 E01 72 BL7%> c#

    SELE%TI70S%REE0 BE3I0 72 BL7%> d WIT@ 2RA8E TITLE te&t++4#

    PARA8ETERS= p/c!?"o& AS %@E%>B76 1E2A.LT 6,

    p/detpop AS %@E%>B76 1E2A.LT 6,

    p/'roup" AS %@E%>B76 1E2A.LT ,

    p/'roups AS %@E%>B76 1E2A.LT #

    SELE%TI70S%REE0 E01 72 BL7%> d#

    SELE%TI70S%REE0 BE3I0 72 BL7%> e WIT@ 2RA8E TITLE te&t++#

    PARA8ETERS= p/print AS %@E%>B76 1E2A.LT ,

    p/nosinf AS %@E%>B76 1E2A.LT ,

    p/nocove AS %@E%>B76 1E2A.LT ,

    p/nonep AS %@E%>B76 1E2A.LT , p/nolinf AS %@E%>B76 1E2A.LT ,

    p/reserv T9PE i#

    SELE%TI70S%REE0 E01 72 BL7%> e#

    1ATA= /"o&nam T9PE slis/fieldname VAL.E B76,

    /fcode LI>E s$ucomm VAL.E ETA,

    /li'nam T9PE slis/fieldname VAL.E LI3@TS,

    /save(-) T9PE c,

    /default(-) T9PE c,

    /e&it(-) T9PE c,

    i/variant LI>E disvariant,

    i/variant- LI>E disvariant#

    I0ITIALIATI70#

    /repid C s$repid#

    PER27R8 fieldcat/init .SI03 i/fieldcat#

    PER27R8 eventta"/"uild .SI03 i/events#

    PER27R8 comment/"uild .SI03 i/list/top/of/pa'e#

    PER27R8 sp/'roup/"uild .SI03 i/sp/'roup#

    PER27R8 t/sort/"uild .SI03 i/sort#

    Set 7ptions= save variant userspecific or 'eneral

    A or . are for userspecific variants list

    6 or space for 'eneral

    /save C A#

    PER27R8 variant/init#

    3et default variant

    i/variant- C i/variant#

    %ALL 2.0%TI70 RE.SE/ALV/VARIA0T/1E2A.LT/3ET

    E6P7RTI03

    i/save C /save %@A03I03

    cs/variant C i/variant-

    27 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    28/35

    ALV DOCUMENTATION AND EXAMPLES2!2!Rajagopalan. M

    E6%EPTI70S

    not/found C #

    I2 s$su"rc C +#

    p/varnt C i/variant-variant#

    E01I2#

    Process on value reFuest (list of possi"le variants)

    AT SELE%TI70S%REE0 70 VAL.EREJ.EST 27R p/varnt#

    PER27R8 f4/for/variant#

    PAI

    AT SELE%TI70S%REE0#

    PER27R8 pai/of/selection/screen#

    START72SELE%TI70#

    PER27R8 selection#

    E0172SELE%TI70#

    PER27R8 la$out/"uild .SI03 i/la$out# '# Parameters

    PER27R8 print/"uild .SI03 i/print# '# Parameters

    %ALL 2.0%TI70 RE.SE/ALV/2IEL1%ATAL73/8ER3E

    E6P7RTI03

    i/pro'ram/name C /repid

    i/internal/ta"name C I/S2LI3@T

    i/structure/name C S2LI3@T

    i/client/never/displa$ C 6 i/inclname C /repid

    %@A03I03

    ct/fieldcat C i/fieldcatX

    E6%EPTI70S

    inconsistent/interface C -

    pro'ram/error C

    7T@ERS C 5#

    I2 s$su"rc Q +#

    8ESSA3E I1 s$ms'id T9PE S 0.8BER s$ms'no

    WIT@ s$ms'v- s$ms'v s$ms'v5 s$ms'v4#

    E01I2#

    %all ABAP4 List Vieer

    %ALL 2.0%TI70 RE.SE/ALV/3RI1/1ISPLA9

    E6P7RTI03

    I/I0TER2A%E/%@E%> C

    i/call"ac?/pro'ram C /repid

    I/%ALLBA%>/P2/STAT.S/SET C

    I/%ALLBA%>/.SER/%788A01 C

    I/%ALLBA%>/T7P/72/PA3E C

    I/%ALLBA%>/@T8L/T7P/72/PA3E C

    I/%ALLBA%>/@T8L/E01/72/LIST C i/structure/name C S2LI3@T

    i/"ac?'round/id C ALV/BA%>3R7.01

    28 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    29/35

    ALV DOCUMENTATION AND EXAMPLES2"2"Rajagopalan. M

    I/3RI1/TITLE C

    I/3RI1/SETTI03S C

    is/la$out C i/la$out

    it/fieldcat C i/fieldcatX

    IT/E6%L.1I03 C

    it/special/'roups C i/sp/'roupX

    it/sort C i/sortX

    IT/2ILTER C

    IS/SEL/@I1E C

    I/1E2A.LT C 6

    i/save C /save

    is/variant C i/variant

    it/events C i/eventsX

    IT/EVE0T/E6IT C

    is/print C i/print

    IS/REPREP/I1 C

    I/S%REE0/START/%7L.80 C +

    I/S%REE0/START/LI0E C + I/S%REE0/E01/%7L.80 C +

    I/S%REE0/E01/LI0E C +

    I8P7RTI03

    E/E6IT/%A.SE1/B9/%ALLER C

    ES/E6IT/%A.SE1/B9/.SER C

    TABLES

    t/outta" C i/sfli'!t

    E6%EPTI70S

    pro'ram/error C -

    7T@ERS C #

    I2 s$su"rc Q +# 8ESSA3E I1 S98S3I1 T9PE S98S3T9 0.8BER S98S307

    WIT@ S98S3V- S98S3V S98S3V5 S98S3V4#

    E01I2#

    %ALL 2.0%TI70 RE.SE/ALV/LIST/1ISPLA9

    E6P7RTI03

    i/call"ac?/pro'ram C /repid

    i/structure/name C S2LI3@T

    is/la$out C i/la$out

    it/fieldcat C i/fieldcatX

    IT/E6%L.1I03 C

    it/special/'roups C i/sp/'roupX

    it/sort C i/sortX

    IT/2ILTER C

    IS/SEL/@I1E C

    i/default C W/1E2A.LT

    i/save C /save

    is/variant C i/variant

    it/events C i/eventsX

    IT/EVE0T/E6IT C

    is/print C i/print

    I/S%REE0/START/%7L.80 C +

    I/S%REE0/START/LI0E C + I/S%REE0/E01/%7L.80 C +

    I/S%REE0/E01/LI0E C +

    29 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    30/35

    ALV DOCUMENTATION AND EXAMPLES3#3#Rajagopalan. M

    I8P7RTI03

    E/E6IT/%A.SE1/B9/%ALLER C

    TABLES

    t/outta" C i/sfli'!t#

    27R8 2IEL1%AT/I0IT

    Q L/2IEL1%AT

    27R8 fieldcat/init .SI03 l/fieldcat T9PE slis/t/fieldcat/alv#

    1ATA= ls/fieldcat T9PE slis/fieldcat/alv#

    %LEAR ls/fieldcat#

    ls/fieldcatfieldname C SEATS7%%#

    T!e field is not displa$ed in t!e initial output, can "e interactivel$

    c!osen for displa$ ls/fieldcatno/out C 6#

    T!is field is assi'ned to a special 'roup it! tec!# ?e$ A and can "e

    displa$ed usin' t!e special 'roup "uttons

    ls/fieldcatsp/'roup C A#

    T!e field cannot "e summed irrespective of its data t$pe

    ls/fieldcatno/sum C 6#

    APPE01 ls/fieldcat T7 l/fieldcat#

    %LEAR ls/fieldcat#

    ls/fieldcatfieldname C SEATS8A6#

    ls/fieldcatno/out C 6#

    ls/fieldcatsp/'roup C A# APPE01 ls/fieldcat T7 l/fieldcat#

    %LEAR ls/fieldcat#

    ls/fieldcatfieldname C PRI%E#

    ls/fieldcatno/out C 6#

    ls/fieldcatsp/'roup C B#

    APPE01 ls/fieldcat T7 l/fieldcat#

    %LEAR ls/fieldcat#

    ls/fieldcatfieldname C %ARRI1#

    ls/fieldcatoutputlen C ;#

    APPE01 ls/fieldcat T7 l/fieldcat#

    E0127R8#

    27R8 1ATA/A11

    Q L/S2LI3@T

    27R8 data/add TABLES l/sfli'!t STR.%T.RE i/sfli'!t#

    L77P AT l/sfli'!t#

    I2 s$ta"i& Q -+#

    30 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    31/35

    ALV DOCUMENTATION AND EXAMPLES3131Rajagopalan. M

    l/sfli'!t"o& C 6#

    l/sfli'!tli'!ts C 5#

    ELSE#

    I2 s$ta"i& C -#

    l/sfli'!tli'!ts C #

    ELSE#

    l/sfli'!tli'!ts C -#

    E01I2#

    E01I2#

    871I29 l/sfli'!t#

    E01L77P#

    E0127R8#

    27R8 EVE0TTAB/B.IL1

    Q l/EVE0TS

    27R8 eventta"/"uild .SI03 l/events T9PE slis/t/event#

    1ATA= ls/event T9PE slis/alv/event#

    %ALL 2.0%TI70 RE.SE/ALV/EVE0TS/3ET

    E6P7RTI03

    i/list/t$pe C +

    I8P7RTI03

    et/events C l/events#

    REA1 TABLE l/events WIT@ >E9 name C slis/ev/top/of/pa'e I0T7 ls/event#

    I2 s$su"rc C +#

    87VE c/formname/top/of/pa'e T7 ls/eventform#

    APPE01 ls/event T7 l/events#

    E01I2#

    E0127R8#

    27R8 %788E0T/B.IL1

    Q L/T7P/72/PA3E

    27R8 comment/"uild .SI03 l/top/of/pa'e T9PE slis/t/list!eader#

    1ATA= ls/line T9PE slis/list!eader#

    @eader

    %LEAR ls/line#

    ls/linet$p C @#

    LS/LI0E>E9= not used for t!is t$pe ls/lineinfo C @eadin' list#

    APPE01 ls/line T7 l/top/of/pa'e#

    31 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    32/35

    ALV DOCUMENTATION AND EXAMPLES3232Rajagopalan. M

    Selection

    %LEAR ls/line#

    ls/linet$p C S#

    ls/line?e$ C >e$ -#

    ls/lineinfo C Information#

    APPE01 ls/line T7 l/top/of/pa'e#

    ls/line?e$ C >e$ #

    APPE01 ls/line T7 l/top/of/pa'e#

    Action

    %LEAR ls/line#

    ls/linet$p C A#

    LS/LI0E>E9= not used for t!is t$pe

    Ls/lineinfo C Status list#

    APPE01 ls/line T7 l/top/of/pa'e#

    E0127R8#

    27R8 LA97.T/B.IL1

    Q LS/LA97.T

    27R8 la$out/"uild .SI03 ls/la$out T9PE slis/la$out/alv#

    ls/la$outfcode C /fcode#

    ls/la$outKe"ra C p/Ke"ra#

    ls/la$outcolidt!/optimiKe C p/colopt#

    I2 p/c!?"o& C 6#2ieldname for c!ec? "o& on t!e report output

    ls/la$out"o&/fieldname C /"o&nam#

    ELSE#

    ls/la$out"o&/fieldname C space#

    E01I2#

    ls/la$outno/input C p/noinpt#

    ls/la$outno/vline C p/novlin#

    ls/la$outno/col!ead C p/nocol!#

    I2 p/li'!ts C 6 7R p/li'!tc C 6#

    2ieldname for li'!ts on t!e report output

    ls/la$outli'!ts/fieldname C /li'nam#

    ELSE#

    %LEAR ls/la$outli'!ts/fieldname#

    E01I2#

    ls/la$outli'!ts/condense C p/li'!tc#

    ls/la$outtotals/te&t C p/tote&t#

    ls/la$outsu"totals/te&t C p/stte&t#

    ls/la$outtotals/onl$ C p/totonl#

    ls/la$out?e$/!otspot C p/?e$!ot#

    ls/la$outdetail/popup C p/detpop#

    ls/la$out'roup/c!an'e/edit C p/'roups#

    E+/LS/LA97.T3R7.P/B.TT70S C P/3R7.PB# ls/la$out'roup/"uttons C 6#

    32 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    33/35

    ALV DOCUMENTATION AND EXAMPLES3333Rajagopalan. M

    E0127R8#

    27R8 SP/3R7.P/B.IL1

    Q L/SP/3R7.P

    27R8 sp/'roup/"uild .SI03 l/sp/'roup T9PE slis/t/sp/'roup/alv#

    1ATA= ls/sp/'roup T9PE slis/sp/'roup/alv#

    2ields are assi'ned to t!e special 'roup

    %LEAR ls/sp/'roup#

    ls/sp/'roupsp/'roup C A#

    ls/sp/'roupte&t C Reservation status#

    APPE01 ls/sp/'roup T7 l/sp/'roup#

    %LEAR ls/sp/'roup#

    ls/sp/'roupsp/'roup C B# ls/sp/'roupte&t C 2li'!t c!ar'es#

    APPE01 ls/sp/'roup T7 l/sp/'roup#

    E0127R8#

    27R8 SELE%TI70

    27R8 selection#

    SELE%T 2R78 sfli'!t I0T7 %7RRESP701I03 2IEL1S 72 TABLE i/sfli'!t

    .P T7 p/ma&ro R7WS W@ERE carrid I0 s/carrid A01 connid I0 s/connid A01 fldate I0 s/fldate#

    PER27R8 data/add TABLES i/sfli'!t#

    E0127R8#

    27R8 T7P/72/PA3E

    ########

    27R8 top/of/pa'e#

    %ALL 2.0%TI70 RE.SE/ALV/%788E0TAR9/WRITE

    E6P7RTI03

    i/lo'o C E0G79SAP/L737

    it/list/commentar$ C i/list/top/of/pa'e#

    E0127R8#

    27R8 24/27R/VARIA0T

    27R8 f4/for/variant#

    %ALL 2.0%TI70 RE.SE/ALV/VARIA0T/24

    33 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    34/35

    ALV DOCUMENTATION AND EXAMPLES3434Rajagopalan. M

    E6P7RTI03

    is/variant C i/variant

    i/save C /save

    it/default/fieldcat C

    I8P7RTI03

    e/e&it C /e&it

    es/variant C i/variant-

    E6%EPTI70S

    not/found C #

    I2 s$su"rc C #

    8ESSA3E I1 s$ms'id T9PE S 0.8BER s$ms'no

    WIT@ s$ms'v- s$ms'v s$ms'v5 s$ms'v4#

    ELSE#

    I2 /e&it C space#

    p/varnt C i/variant-variant#

    E01I2#

    E01I2#

    E0127R8#

    2orm PAI/72/SELE%TI70/S%REE0

    to c!ec? !et!er ri'!t variant is entered on t!e selection scr

    27R8 pai/of/selection/screen#

    I2 07T p/varnt IS I0ITIAL#

    87VE i/variant T7 i/variant-#

    87VE p/varnt T7 i/variant-variant#

    %ALL 2.0%TI70 RE.SE/ALV/VARIA0T/E6ISTE0%E

    E6P7RTI03

    i/save C /save

    %@A03I03

    cs/variant C i/variant-#

    i/variant C i/variant-#

    ELSE#

    PER27R8 variant/init#

    E01I2#

    E0127R8# PAI/72/SELE%TI70/S%REE0

    2orm VARIA0T/I0IT

    27R8 variant/init#

    %LEAR i/variant#

    i/variantreport C /repid#

    E0127R8# VARIA0T/I0IT

    27R8 PRI0T/B.IL1

    34 of 35

  • 5/26/2018 Alv Documentation and Examples11 by Rajagopalan. m

    35/35

    ALV DOCUMENTATION AND EXAMPLES3535Rajagopalan. M

    ########

    27R8 print/"uild .SI03 l/print T9PE slis/print/alv#

    l/printprint C p/print#

    l/printno/print/selinfos C p/nosinf#

    l/printno/coverpa'e C p/nocove#

    l/printno/ne/pa'e C p/nonep#

    l/printno/print/listinfos C p/nolinf#

    l/printreserve/lines C p/reserv#

    l/printprint C p/print#

    E0127R8#

    27R8 T/S7RT/B.IL1

    27R8 t/sort/"uild .SI03 l/sort T9PE slis/t/sortinfo/alv#

    1ATA= ls/sort T9PE slis/sortinfo/alv#

    ls/sortfieldname C %ARRI1#

    ls/sortspos C -#

    ls/sortup C 6#

    ls/sortsu"tot C 6#

    APPE01 ls/sort T7 l/sort#

    E0127R8#

    35 of 35