oops alv concept in sap abap

Upload: emils

Post on 25-Feb-2018

228 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/25/2019 Oops Alv Concept in Sap Abap

    1/7

    OOPS ALV Concept in SAP ABAP

    ALV

    ABAP List Viewer is used to enhance the readability and functionality of any reportoutput. We can develop ALV using dierent ways like using type pool SLS or using

    the class !l"#$"ALV"#%&. n case of 'b(ect)'riented concept* the !ontrol

    +ra,ework is re-uired as it provides global classes for various functionalities.

    CL_GUI_ALV_GRID

    t is the wrapper class i,ple,ented to encapsulate ALV #rid functionality for list

    display. ALV #rid control is a e/ible tool which provides following capabilities0

    +or building and displaying interactive* non)hierarchical and ,odern)design

    lists.

    Provides typical list functions such as sorting* 1ltering* su,,ing etc.

    Provides co,,on list operations and can be enhanced by user)de1ned

    options.

    Basic !o,ponents re-uired for ALV #rid !ontrol are0

    2. List &ata 0 &ata to be listed is populated in an internal table. 3his table can be

    of any at type

    4. +ield !atalog0 3his is an internal table which contains the list of 1elds as per

    speci1cation. t co,prises of so,e additional infor,ation about display options for

    each colu,n to be displayed. t ,ust be referenced to the dictionary type

    5LV!"3"+!A36 while the work)area should be of type 5LV!"S"+!A36. +unction

    5LV!"+7L&!A3AL'#"87%#76 can also be used to get 1eld catalog by passing

    structure na,e.

    9. !ontainer0 !ontainer is a storage area where the list will be displayed. t

    should be of type 5!L"#$"!$S3'8"!':3A:7%6. 'ther !ontainer !lasses are0

    !L"#$"&'!;:#"!':3A:7%) +or displaying ,ultiple ALV

  • 7/25/2019 Oops Alv Concept in Sap Abap

    2/7

    !L"#$"&AL'#B'>"!':3A:7%) 3his is used in case of nteractive

    ALV* where details list will be displayed in dialog bo/. +or this functionality refer to

    e/a,ple B!ALV"#%&"?4.

    @. Layout Structure0 t is a structure to specify general layout options for the

    grid. With this structure we can set general display options* grid custo,iing* totals

    options* color ad(ust,ents etc. 3he layout structure ,ust be of type 5LV!"S"LA='6.

    . 7vent Candler0 +or handling events* we need to de1ne and i,ple,ent an

    event handler class triggered by the ALV #rid instance. After creating ALV #rid

    instance* we ,ust register an instance of this event handler class to handle ALV

    #rid events.

    Various 7vents are as follows)

    Print"3op"'f"Page0 $sed for Ceaders. Candler is DS73 CA:&L7%

  • 7/25/2019 Oops Alv Concept in Sap Abap

    3/7

    !reate ob(ect of class !L"#$"!$S3'8"!':3A:7% for container.+or e/a,ple0Ob_custom t!e reference to cl_gu"_custom_conta"ner.

    Create ob#ect ob_custom E$!ort"ng conta"ner_name % CO&TA'&E(.

    !reate ob(ect of class !L"#$"ALV"#%& for putting #rid in above container.+or e/a,ple0Ob_gr") t!e reference to cl_gu"_gr")_)"s!la.Create ob#ect ob_gr")E$!ort"ng"_!arent % ob_custom.

    Populate the internal table that you want to display on the #%&.

    +or e/a,ple0

    3his nternal table is 1lled with data fro, Sight.

    Data: t_sfl"g*t t!e stan)ar) table of +fl"g*t. !all the screen that contains !usto, !ontainer which is done at PB' of

    screen. 8ethod S73"3ABL7"+'%"+%S3"&SPLA= of class !L"#$"ALV"#%& is

    used to display the output.+or e/a,ple0CALL ,ET-OD ob_gr")/set_table_for_f"rst_)"s!la exporting

    "_structure_name % +0L'1-T "s_laout % gs_laout changing

    "t_outtab % T_+0L'1-T 23 "t_f"el)catalog % gt_f"el)cat exceptions

    "n4al")_!arameter_comb"nat"on % 5 !rogram_error % 6 too_man_l"nes % 7 ot*ers % 8.

    Example for Docking Container using Object-Oriented ALV

    Step1:

    !reate 3wo &ocking !ontainers for 3wo #rids using +ollowing !ode.DATA: r_gr")5 TYPE (E0 TO cl_gu"_al4_gr")9r_gr")6 TYPE (E0 TO cl_gu"_al4_gr")9g_)oc5 TYPE (E0 TO cl_gu"_)oc"ng_conta"ner9g_)oc6 TYPE (E0 TO cl_gu"_)oc"ng_conta"ner9'0 g_)oc5 '+ '&'T'AL.C(EATE O;

  • 7/25/2019 Oops Alv Concept in Sap Abap

    4/7

    re!") % sre!") )nnr % s)nnr s")e % g_)oc5/)oc_at_left e$tens"on % 7>>.

    C(EATE O;

  • 7/25/2019 Oops Alv Concept in Sap Abap

    5/7

    E&D'0.

    Screen-shots for Output of ALV for displaing t!o internal tables in t!o different

    Docking Containers along !ith Selection-screen"

    we can display ,ore than one internal table on the sa,e screen as selection)

    screen unlike ALV using 3ype)pool SLS

    Also we can 1lter records by putting in the selection screen and e/ecuting

    the report as follows0

  • 7/25/2019 Oops Alv Concept in Sap Abap

    6/7

    !lick on 7/ecute

    +urther 1ltration is possible by entering Plant e.g. 2??? in above screen

    H

  • 7/25/2019 Oops Alv Concept in Sap Abap

    7/7

    I