Skip to Content
avatar image
Former Member

ALV in OOPS

Hi,

I want to know how to write a program in ALV with oops concept, i know ALV with function module.

Please send me a small programe and with explanation.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Aug 21, 2007 at 12:34 PM

    Hi,

    Goto the package SLIS.

    There you can find all the sample programs using OOPS ALV.

    Regards,

    Sesh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 21, 2007 at 12:35 PM

    Hi,

    some links.

    www.sapgenie.com

    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.

    DATA: alv_grid TYPE REF TO cl_gui_alv_grid,

    custom_container TYPE REF TO cl_gui_custom_container,

    field_cat TYPE lvc_t_fcat,

    layout TYPE lvc_s_layo.

    DATA BEGIN OF i_list OCCURS 0.

    INCLUDE STRUCTURE MARA.

    DATA END OF i_list.

    DATA ok_code TYPE ok_code.

    SELECT * FROM MARA INTO TABLE i_list

    UP TO 100 ROWS.

    CALL SCREEN 100.

    ----


    • MODULE STATUS_0100

    ----


    *

    ----


    MODULE alv_display OUTPUT.

    SET PF-STATUS 'STATUS'.

    PERFORM display_alv.

    ENDMODULE. "STATUS_0100

    ----


    • MODULE USER_COMMAND_0100 INPUT

    ----


    *

    ----


    MODULE user_command_0100 INPUT.

    CASE ok_code.

    • when 'SAVE'.

    • perform save_data.

    WHEN 'BACK'.

    LEAVE TO SCREEN 0.

    ENDCASE.

    ENDMODULE. "USER_COMMAND_0100 INPUT

    &----


    *& Form display_alv

    &----


    • text

    ----


    FORM display_alv.

    IF alv_grid IS INITIAL.

    CREATE OBJECT custom_container

    EXPORTING

    • PARENT =

    container_name = 'CONTRL'

    .

    CREATE OBJECT alv_grid

    EXPORTING

    i_parent = custom_container

    .

    CALL METHOD alv_grid->set_table_for_first_display

    EXPORTING

    i_structure_name = 'MARA'

    CHANGING

    it_outtab = i_list[]

    • IT_FIELDCATALOG =

    • IT_SORT =

    • IT_FILTER =

    • EXCEPTIONS

    • INVALID_PARAMETER_COMBINATION = 1

    • PROGRAM_ERROR = 2

    • TOO_MANY_LINES = 3

    • others = 4

    .

    ELSE.

    CALL METHOD alv_grid->refresh_table_display

    • EXPORTING

    • IS_STABLE =

    • I_SOFT_REFRESH =

    • EXCEPTIONS

    • FINISHED = 1

    • others = 2

    .

    ENDIF.

    ENDFORM. "display_alv

    reward if it helps..

    Regards,

    Omkar.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 21, 2007 at 12:37 PM

    Hi,

    check this code.

    &----


    *

    *& Report ZNA_CLASS_ALV

    *&

    &----


    *&

    *&

    &----


    REPORT ZNA_CLASS_ALV.

    TABLES: KNA1.

    DATA: IT_KNA1 TYPE STANDARD TABLE OF KNA1 INITIAL SIZE 0.

    DATA: WA_KNA1 LIKE LINE OF IT_KNA1.

    DATA: OK_CODE TYPE SY-UCOMM.

    DATA: CONT TYPE REF TO CL_GUI_CUSTOM_CONTAINER.

    DATA: ALV_DISP TYPE REF TO CL_GUI_ALV_GRID.

    INITIALIZATION.

    SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

    SELECT-OPTIONS: KUNNR FOR KNA1-KUNNR.

    SELECTION-SCREEN: END OF BLOCK B1.

    START-OF-SELECTION.

    SELECT * FROM KNA1

    INTO TABLE IT_KNA1

    WHERE

    KUNNR IN KUNNR.

    IF SY-SUBRC = 0.

    SORT IT_KNA1 BY KUNNR.

    ENDIF.

    CALL SCREEN '1001'.

    &----


    *& Module STATUS_1001 OUTPUT

    &----


    • text

    ----


    MODULE STATUS_1001 OUTPUT.

    SET PF-STATUS 'STATUS_1001'.

    IF CONT IS INITIAL.

    CREATE OBJECT CONT

    EXPORTING

    CONTAINER_NAME = 'CONTAINER1'.

    ENDIF.

    CREATE OBJECT ALV_DISP

    EXPORTING

    I_PARENT = CONT.

    CALL METHOD ALV_DISP->SET_TABLE_FOR_FIRST_DISPLAY

    EXPORTING

    I_STRUCTURE_NAME = 'KNA1'

    CHANGING

    IT_OUTTAB = IT_KNA1

    EXCEPTIONS

    INVALID_PARAMETER_COMBINATION = 1

    PROGRAM_ERROR = 2

    TOO_MANY_LINES = 3

    OTHERS = 4.

    IF SY-SUBRC <> 0.

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    CALL METHOD ALV_DISP->REFRESH_TABLE_DISPLAY

    EXCEPTIONS

    FINISHED = 1

    OTHERS = 2

    .

    IF SY-SUBRC <> 0.

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    ENDMODULE. " STATUS_1001 OUTPUT

    &----


    *& Module USER_COMMAND_1001 INPUT

    &----


    • text

    ----


    MODULE USER_COMMAND_1001 INPUT.

    CASE OK_CODE.

    WHEN 'BACK'.

    CALL SELECTION-SCREEN '1000'.

    WHEN 'EXIT'.

    LEAVE PROGRAM.

    ENDCASE.

    ENDMODULE. " USER_COMMAND_1001 INPUT

    Dont forget the points.

    Regards

    Gurprit Bhatia

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 21, 2007 at 12:37 PM

    Hi

    Give me your mail id, i'll send you a complete PDF

    Regards

    Ravish

    Add comment
    10|10000 characters needed characters exceeded