Skip to Content
author's profile photo Former Member
Former Member

ALV with OOP

Hi All,

I have worked on ALV. But i am new into OOABAP. I have the requirement to work on ALV with OOABAP. Any body have the documentation on this, i request you to send it to me ASAP.

I am very thankful to you in advance.

Regards,

Nagarjuna.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 11, 2008 at 06:09 AM

    hi,

    Process to create ALV with OOPs:

    Step 1:

    Create a container. There are 2 type of containers: docking and custom.

    Go to SE38.Create a program. Use Pattern button to create object for docking container. Click ABAP Object Pattern radio button. Click Create object radio button. Give Instance as o_docking and class as cl_gui_docking_contianer.

    Step 2:

    Create a grid inside the container.

    Use Pattern button to create the same. Make the parent of grid as container.

    Click ABAP Object Pattern radio button. Click Create object radio button. Give Instance as o_grid and class as cl_gui_alv_grid. Create object o_grid.

    Step 3:

    Call the function lvc_fieldcatalog_merge to get the field catalog.

    Pass the structure name.

    Step 4:

    Call the method of grid set_table_for_first_display to display the output.

    Click ABAP Object Pattern radio button. Click Call Method radio button. Give Instance as o_grid and Class/Interface as cl_gui_alv_grid and Method as set_table_for_first_display.

    w_variant-report = sy-repid.

    Call method o_grid->set_table_for_first_display

    Step 5:

    Fill the internal table itab with values by using logic.

    select * from mara into table itab up to 100 rows.

    call screen 9000.

    Create a screen by double clicking 9000 in the above line. Fill the description for the screen. In the flow logic, uncomment the PBO and PAI module and create those in main program (for simplicity).

    Step 6:

    Create GUI status. Create GUI Title if required. That can be done by using display object List (CtrlShiftF5).Then in left side, right click the program and create GUI Status and Title.

    Step 7:

    Free the memory occupied once the BACK, EXIT or CANCEL button is clicked. Use Pattern button to call the method FREE of cl_gui_alv_grid and cl_gui_docking_container.

    Click ABAP Object Pattern radio button. Click Call Method radio button. Give Instance as o_grid and Class/Interface as cl_gui_alv_grid and Method as Free.

    Similarly Click Call Method radio button. Give Instance as o_docking and Class/Interface as cl_gui_docking_container and Method as Free.

    Hope this helps, Do reward.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 11, 2008 at 06:18 AM

    Hi,

    some links.

    http://www.sapgenie.com

    http://www.abap4u.com

    http://help.sap.com/saphelp_nw2004s/helpdata/en/5e/88d440e14f8431e10000000a1550b0/frameset.htm

    download the PDF from following link.

    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf

    The ALV object Grid methods allow the same functionality as ALV grid report function modules but are displayed within

    a screen (dialog program). SAP has provided a suit of programs which demonstrate how to For examples see standard SAP

    programs as detailed below:

    BCALV_EDIT_01 This report illustrates the simplest case of using an editable/noneditable ALV Grid Control.

    BCALV_EDIT_02 This report illustrates how to set chosen cells of an ALV Grid Control editable.

    BCALV_EDIT_03 In this example the user may change values of fields SEATSOCC (occupied seats) and/or PLANETYPE.

    The report checks the input value(s) semantically and provides protocol messages in case of error

    BCALV_EDIT_04 This report illustrates how to add and remove lines to a table using the ALV Grid Control and how to

    implement the saving of the new data.

    BCALV_EDIT_05 This example shows how to use checkboxes within an ALV Grid Control. You learn:

    (1) how to define a column for editable checkboxes for an attribute of your list

    (2) how to evaluate the checked checkboxes

    (3) how to switch between editable and non-editable checkboxes

    BCALV_EDIT_06 This example shows how to define a dropdown listbox for all cells of one column in an editable ALV

    Grid Control.

    BCALV_EDIT_07 This example shows how to define dropdown listboxes for particular cells of your output table.

    BCALV_EDIT_08 This report implements an ALV Grid Control with an application specific F4 help. The following aspects

    are dealt with:

    (1) how to replace the standard f4 help

    (2) how to pass the selected value to the ALV Grid Control

    (3) how to build an f4 help, whose value range depend on a value of another cell.

    Regards,

    Priyanka.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 11, 2008 at 06:27 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 11, 2008 at 07:36 AM

    hi,

    for reference programs pls check this one standard program bcalv_edit_02

    it helps u lot using OOPs ABAP with ALv concepts

    and go through this link for reference

    /people/vijaybabu.dudla/blog/2006/07/21/topofpage-in-alv-using-clguialvgrid

    -


    alv logo using oo concept

    search in BLOG of SDN, u can find number of examples on alv ooops

    https://www.sdn.sap.com/irj/sdn/advancedsearch?query=alvoops&cat=sdn_all

    Its My Program -


    Displays Alv in Three TabStrips Using Alv OOPs

    &----


    *& Report ZTEST_READ_CLUSTER

    *&

    &----


    *&

    *&

    &----


    REPORT ztest_read_cluster.

    TABLES: vbak, likp.

    TYPES: BEGIN OF types_vbak ,

    vbeln TYPE vbeln,

    vkorg TYPE vkorg,

    netwr TYPE netwr,

    END OF types_vbak,

    BEGIN OF types_likp ,

    vbeln TYPE vbeln_vl,

    vstel TYPE vstel,

    vkorg TYPE vkorg,

    netwr TYPE netwr,

    END OF types_likp.

    DATA: w_cntx_menu TYPE REF TO cl_rsdme_ui_context_menu_gen,

    t_vbak TYPE STANDARD TABLE OF types_vbak,

    t_likp TYPE STANDARD TABLE OF types_likp,

    w_sale TYPE char01.

    CONSTANTS: c_check TYPE c VALUE 'X'.

    • ALV relavent Data

    DATA: w_grid TYPE REF TO cl_gui_alv_grid,

    wl_ref_container TYPE REF TO cl_gui_custom_container,

    w_container TYPE scrfname VALUE 'C_CONTAINER',

    t_fcat TYPE lvc_t_fcat,

    t_sort TYPE lvc_t_sort.

    CONTROLS: c_tab TYPE TABSTRIP.

    DATA: c_dynnr TYPE sy-dynnr.

    SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-011.

    SELECT-OPTIONS: s_vbeln FOR vbak-vbeln,

    s_delvr FOR likp-vbeln.

    SELECTION-SCREEN: END OF BLOCK b1.

    START-OF-SELECTION.

    SELECT vbeln

    vkorg

    netwr

    FROM vbak INTO TABLE t_vbak

    WHERE vbeln IN s_vbeln.

    IF sy-subrc = 0.

    SORT t_vbak BY vbeln.

    ENDIF.

    SELECT vbeln

    vstel

    vkorg

    netwr

    FROM likp INTO TABLE t_likp

    WHERE vbeln IN s_delvr.

    IF sy-subrc = 0.

    SORT t_likp BY vbeln.

    ENDIF.

    CALL SCREEN '9001'.

    &----


    *& Module STATUS_9001 OUTPUT

    &----


    • text

    ----


    MODULE status_9001 OUTPUT.

    SET PF-STATUS ' '.

    SET TITLEBAR 'MAIN'.

    IF c_tab-activetab IS INITIAL OR

    c_dynnr IS INITIAL.

    c_tab-activetab = 'TAB1'.

    c_dynnr = '9002'.

    ENDIF.

    ENDMODULE. " STATUS_9001 OUTPUT

    &----


    *& Module USER_COMMAND_9001 INPUT

    &----


    • text

    ----


    MODULE user_command_9001 INPUT.

    CASE sy-ucomm.

    WHEN 'BACK' OR

    '%EX' OR

    'CANC'.

    SET SCREEN 0.

    WHEN 'TAB1'.

    c_dynnr = '9002'.

    WHEN 'TAB2'.

    c_tab-activetab = 'TAB2'.

    c_dynnr = '9003'.

    WHEN 'TAB3'.

    c_tab-activetab = 'TAB3'.

    c_dynnr = '9004'.

    ENDCASE.

    ENDMODULE. " USER_COMMAND_9001 INPUT

    &----


    *& Module STATUS_9002 OUTPUT

    &----


    • text

    ----


    MODULE status_9002 OUTPUT.

    • Create the Container

    CREATE OBJECT wl_ref_container

    EXPORTING

    container_name = w_container.

    • Create the Grid object

    CREATE OBJECT w_grid

    EXPORTING

    i_parent = wl_ref_container

    EXCEPTIONS

    error_cntl_create = 1

    error_cntl_init = 2

    error_cntl_link = 3

    error_dp_create = 4

    OTHERS = 5.

    CHECK sy-subrc = 0.

    PERFORM sub_fill_fcat_sale.

    CALL METHOD w_grid->set_table_for_first_display

    CHANGING

    it_outtab = t_vbak

    it_fieldcatalog = t_fcat

    EXCEPTIONS

    invalid_parameter_combination = 1

    program_error = 2

    too_many_lines = 3

    OTHERS = 4.

    ENDMODULE. " STATUS_9002 OUTPUT

    &----


    *& Module STATUS_9004 OUTPUT

    &----


    • text

    ----


    MODULE status_9003 OUTPUT.

    • Create the Container

    CREATE OBJECT wl_ref_container

    EXPORTING

    container_name = w_container.

    • Create the Grid object

    CREATE OBJECT w_grid

    EXPORTING

    i_parent = wl_ref_container

    EXCEPTIONS

    error_cntl_create = 1

    error_cntl_init = 2

    error_cntl_link = 3

    error_dp_create = 4

    OTHERS = 5.

    CHECK sy-subrc = 0.

    PERFORM sub_fill_fcat_delv.

    CALL METHOD w_grid->set_table_for_first_display

    CHANGING

    it_outtab = t_likp

    it_fieldcatalog = t_fcat

    EXCEPTIONS

    invalid_parameter_combination = 1

    program_error = 2

    too_many_lines = 3

    OTHERS = 4.

    ENDMODULE. " STATUS_9004 OUTPUT

    &----


    *& Form sub_fill_fcat

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM sub_fill_fcat_sale .

    DATA: wa_fcat TYPE lvc_s_fcat.

    REFRESH t_fcat.

    CLEAR wa_fcat.

    wa_fcat-row_pos = 1.

    wa_fcat-fieldname = wa_fcat-rollname = 'VBELN'.

    APPEND wa_fcat TO t_fcat.

    CLEAR wa_fcat.

    wa_fcat-row_pos = 2.

    wa_fcat-fieldname = wa_fcat-rollname = 'VKORG'.

    APPEND wa_fcat TO t_fcat.

    CLEAR wa_fcat.

    wa_fcat-row_pos = 3.

    wa_fcat-fieldname = wa_fcat-rollname = 'NETWR'.

    APPEND wa_fcat TO t_fcat.

    ENDFORM. " sub_fill_fcat

    &----


    *& Form sub_fill_fcat_delv

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM sub_fill_fcat_delv .

    DATA: wa_fcat TYPE lvc_s_fcat.

    REFRESH t_fcat.

    CLEAR wa_fcat.

    wa_fcat-row_pos = 1.

    wa_fcat-fieldname = 'VBELN'.

    wa_fcat-rollname = 'VBELN_VL'.

    APPEND wa_fcat TO t_fcat.

    CLEAR wa_fcat.

    wa_fcat-row_pos = 2.

    wa_fcat-fieldname = wa_fcat-rollname = 'VKORG'.

    APPEND wa_fcat TO t_fcat.

    CLEAR wa_fcat.

    wa_fcat-row_pos = 3.

    wa_fcat-fieldname = wa_fcat-rollname = 'VSTEL'.

    APPEND wa_fcat TO t_fcat.

    CLEAR wa_fcat.

    wa_fcat-row_pos = 4.

    wa_fcat-fieldname = wa_fcat-rollname = 'NETWR'.

    APPEND wa_fcat TO t_fcat.

    ENDFORM. " sub_fill_fcat_delv

    Do Reward Points If Usefull To u,

    Regards,

    Fareedas.

    Edited by: Fareeda Tabassum S on Apr 11, 2008 1:08 PM

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.