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

hi guru's i am learning ,iknow alv classical ,interactive how to use oops.

hi guru's i know alv classical ,interactive how to use oops concept in that ,

some one is telling oops using of oops to dovelope alv grid , actually i don't know alv grid,

plz explain to me brefley diffrence between alv and alv grid...plz...

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Nov 23, 2007 at 05:10 AM

    Hi,

    This is the sample report for the oops concept. kindly go through that one. U will get some idea about that one.

    REPORT YMS_CHECKBOXOOPSALV NO STANDARD PAGE HEADING.

    TYPE-POOLS: slis.

    DATA: BEGIN OF i_data OCCURS 0,

    qmnum LIKE qmel-qmnum,

    qmart LIKE qmel-qmart,

    qmtxt LIKE qmel-qmtxt,

    ws_row TYPE i,

    ws_char(5) TYPE c,

    chk,

    END OF i_data.

    DATA: report_id LIKE sy-repid.

    DATA: ws_title TYPE lvc_title VALUE 'An ALV Report'.

    DATA: i_layout TYPE slis_layout_alv.

    DATA: i_fieldcat TYPE slis_t_fieldcat_alv.

    DATA: i_events TYPE slis_t_event.

    DATA: i_header TYPE slis_t_listheader.

    DATA: i_extab TYPE slis_t_extab.

    SELECT qmnum

    qmart

    qmtxt

    INTO TABLE i_data

    FROM qmel

    WHERE qmnum <= '00030000010'.

    LOOP AT i_data.

    i_data-ws_row = sy-tabix.

    i_data-ws_char = 'AAAAA'.

    MODIFY i_data.

    ENDLOOP.

    report_id = sy-repid.

    PERFORM f1000_layout_init CHANGING i_layout.

    PERFORM f2000_fieldcat_init CHANGING i_fieldcat.

    PERFORM f3000_build_header CHANGING i_header.

    PERFORM f4000_events_init CHANGING i_events.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    • I_INTERFACE_CHECK = ' '

    • I_BYPASSING_BUFFER =

    • I_BUFFER_ACTIVE = ' '

    i_callback_program = report_id

    • I_CALLBACK_PF_STATUS_SET = ' '

    • I_CALLBACK_USER_COMMAND = ' '

    • I_CALLBACK_TOP_OF_PAGE = ' '

    • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

    • I_CALLBACK_HTML_END_OF_LIST = ' '

    • i_structure_name = ' '

    • I_BACKGROUND_ID = ' '

    i_grid_title = ws_title

    • I_GRID_SETTINGS =

    is_layout = i_layout

    it_fieldcat = i_fieldcat

    • IT_EXCLUDING =

    • IT_SPECIAL_GROUPS =

    • IT_SORT =

    • IT_FILTER =

    • IS_SEL_HIDE =

    • I_DEFAULT = 'X'

    i_save = 'A'

    • IS_VARIANT =

    it_events = i_events

    • IT_EVENT_EXIT =

    • IS_PRINT =

    • IS_REPREP_ID =

    • I_SCREEN_START_COLUMN = 0

    • I_SCREEN_START_LINE = 0

    • I_SCREEN_END_COLUMN = 0

    • I_SCREEN_END_LINE = 0

    • IT_ALV_GRAPHICS =

    • IT_ADD_FIELDCAT =

    • IT_HYPERLINK =

    • IMPORTING

    • E_EXIT_CAUSED_BY_CALLER =

    • ES_EXIT_CAUSED_BY_USER =

    TABLES

    t_outtab = i_data

    EXCEPTIONS

    program_error = 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.

    &----


    *& Form F1000_Layout_Init

    &----


    FORM f1000_layout_init USING i_layout TYPE slis_layout_alv.

    CLEAR i_layout.

    i_layout-colwidth_optimize = 'X'.

    i_layout-edit = 'X'.

    ENDFORM. " F1000_Layout_Init

    &----


    *& Form f2000_fieldcat_init

    &----


    FORM f2000_fieldcat_init CHANGING i_fieldcat TYPE slis_t_fieldcat_alv.

    DATA: line_fieldcat TYPE slis_fieldcat_alv.

    CLEAR line_fieldcat.

    line_fieldcat-fieldname = 'QMNUM'. " The field name and the table

    line_fieldcat-tabname = 'I_DATA'. " name are the two minimum req.

    line_fieldcat-key = 'X'. " Specifies the column as a key (Blue)

    line_fieldcat-seltext_m = 'Notification No.'. " Column Header

    APPEND line_fieldcat TO i_fieldcat.

    CLEAR line_fieldcat.

    line_fieldcat-fieldname = 'QMART'.

    line_fieldcat-ref_tabname = 'I_DATA'.

    line_fieldcat-hotspot = 'X'. " Shows the field as a hotspot.

    line_fieldcat-seltext_m = 'Notif Type'.

    APPEND line_fieldcat TO i_fieldcat.

    CLEAR line_fieldcat.

    line_fieldcat-fieldname = 'QMTXT'.

    line_fieldcat-tabname = 'I_DATA'.

    line_fieldcat-seltext_m = 'Description'.

    APPEND line_fieldcat TO i_fieldcat.

    CLEAR line_fieldcat.

    line_fieldcat-fieldname = 'WS_ROW'.

    line_fieldcat-tabname = 'I_DATA'.

    line_fieldcat-seltext_m = 'Row Number'.

    APPEND line_fieldcat TO i_fieldcat.

    CLEAR line_fieldcat.

    line_fieldcat-fieldname = 'WS_CHAR'.

    line_fieldcat-tabname = 'I_DATA'.

    line_fieldcat-seltext_l = 'Test Character Field'.

    line_fieldcat-datatype = 'CHAR'.

    line_fieldcat-outputlen = '15'. " You can specify the width of a

    APPEND line_fieldcat TO i_fieldcat. " column.

    CLEAR line_fieldcat.

    line_fieldcat-fieldname = 'CHK'.

    line_fieldcat-tabname = 'I_DATA'.

    line_fieldcat-seltext_l = 'Checkbox'.

    line_fieldcat-checkbox = 'X'. " Display this field as a checkbox

    line_fieldcat-edit = 'X'. " This option ensures that you can

    " edit the checkbox. Else it will

    " be protected.

    APPEND line_fieldcat TO i_fieldcat.

    ENDFORM. " f2000_fieldcat_init

    &----


    *& Form f3000_build_header

    &----


    FORM f3000_build_header USING i_header TYPE slis_t_listheader.

    DATA: gs_line TYPE slis_listheader.

    CLEAR gs_line.

    gs_line-typ = 'H'.

    gs_line-info = 'This is line of type HEADER'.

    APPEND gs_line TO i_header.

    CLEAR gs_line.

    gs_line-typ = 'S'.

    gs_line-key = 'STATUS 1'.

    gs_line-info = 'This is line of type STATUS'.

    APPEND gs_line TO i_header.

    gs_line-key = 'STATUS 2'.

    gs_line-info = 'This is also line of type STATUS'.

    APPEND gs_line TO i_header.

    CLEAR gs_line.

    gs_line-typ = 'A'.

    gs_line-info = 'This is line of type ACTION'.

    APPEND gs_line TO i_header.

    ENDFORM. " f3000_build_header

    &----


    *& Form f4000_events_init

    &----


    FORM f4000_events_init CHANGING i_events TYPE slis_t_event.

    DATA: line_event TYPE slis_alv_event.

    CLEAR line_event.

    line_event-name = 'TOP_OF_PAGE'.

    line_event-form = 'F4100_TOP_OF_PAGE'.

    APPEND line_event TO i_events.

    CLEAR line_event.

    line_event-name = 'PF_STATUS_SET'.

    line_event-form = 'F4200_PF_STATUS_SET'.

    APPEND line_event TO i_events.

    ENDFORM. " f3000_events_init

    ----


    • FORM F4100_TOP_OF_PAGE *

    ----


    FORM f4100_top_of_page.

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    it_list_commentary = i_header.

    ENDFORM.

    ----


    • FORM F4200_PF_STATUS_SET *

    ----


    FORM f4200_pf_status_set USING i_extab TYPE slis_t_extab.

    REFRESH i_extab.

    PERFORM f4210_exclude_fcodes CHANGING i_extab.

    SET PF-STATUS 'STANDARD' OF PROGRAM 'SAPLSALV' EXCLUDING i_extab.

    ENDFORM.

    &----


    *& Form f4210_exclude_fcodes

    &----


    FORM f4210_exclude_fcodes USING i_extab TYPE slis_t_extab.

    DATA: ws_fcode TYPE slis_extab.

    CLEAR ws_fcode.

    ws_fcode = '&EB9'. " Call up Report.

    APPEND ws_fcode TO i_extab.

    ws_fcode = '&ABC'. " ABC Analysis.

    APPEND ws_fcode TO i_extab.

    ws_fcode = '&NFO'. " Info Select.

    APPEND ws_fcode TO i_extab.

    ws_fcode = '&LFO'. " Information.

    APPEND ws_fcode TO i_extab.

    ENDFORM. " f4210_exclude_fcodes

    Thanks,

    Sankar M

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 23, 2007 at 05:14 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 23, 2007 at 05:18 AM

    Hi

    this is a small report

    REPORT YSIMPLEALVINTERACTIVE .

    TABLES : VBAK,VBAP,LIKP,VBRK,VTTK.

    PARAMETERS : P_KUNNR LIKE VBAK-KUNNR.

    SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN,

    S_ERDAT FOR VBAK-ERDAT.

    DATA:WA TYPE YLINE22,

    ITAB TYPE YROW22.

    DATA : REPID LIKE SY-REPID,

    CONTAINER TYPE SCRFNAME VALUE 'ALVCONTROL',

    CUST TYPE REF TO CL_GUI_CUSTOM_CONTAINER,

    GRID TYPE REF TO CL_GUI_ALV_GRID.

    *CLASS DEFINITATION.

    CLASS CL_GRID DEFINITION.

    PUBLIC SECTION .

    METHODS: DC FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID IMPORTING

    E_ROW E_COLUMN.

    ENDCLASS. "

    *CLASS IMPLEMENTATION.

    CLASS CL_GRID IMPLEMENTATION.

    METHOD DC.

    DATA : WA1 TYPE YLINE22.

    READ TABLE ITAB INDEX E_ROW-INDEX INTO WA1.

    SET PARAMETER ID 'AVN' FIELD WA1-VBELN.

    CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN .

    ENDMETHOD. "DC

    ENDCLASS. "CL_GRID IMPLEMENTATION

    • CALLING CLASS.

    DATA : OBJ_CL_GRID TYPE REF TO CL_GRID.

    START-OF-SELECTION.

    PERFORM CALLSUB.

    IF SY-SUBRC = 0.

    CALL SCREEN 100.

    ELSE.

    MESSAGE I000(0) WITH 'no data for your salesorder'.

    ENDIF.

    &----


    *& Module STATUS_0100 OUTPUT

    &----


    • text

    ----


    MODULE STATUS_0100 OUTPUT.

    • SET PF-STATUS 'xxxxxxxx'.

    • SET TITLEBAR 'xxx'.

    REPID = SY-REPID.

    IF CUST IS INITIAL.

    CREATE OBJECT CUST EXPORTING CONTAINER_NAME = CONTAINER .

    CREATE OBJECT GRID EXPORTING I_PARENT = CUST.

    CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY

    EXPORTING

    I_STRUCTURE_NAME = 'YLINE22'

    CHANGING

    IT_OUTTAB = ITAB.

    CREATE OBJECT OBJ_CL_GRID.

    SET HANDLER OBJ_CL_GRID->DC FOR GRID.

    ENDIF.

    ENDMODULE. " STATUS_0100 OUTPUT

    FORM CALLSUB.

    SELECT VBAPVBELN VBAPKWMENG VBAPNETWR LIPSERDAT VTTP~ERDAT

    VBRK~FKDAT INTO TABLE ITAB FROM VBAK

    INNER JOIN VBAP ON VBAKVBELN = VBAPVBELN INNER JOIN LIPS ON VBAP~VBELN

    = LIPSVGBEL INNER JOIN VTTP ON LIPSVBELN = VTTP~VBELN INNER JOIN VBRP

    ON LIPSVBELN = VBRPVGBEL INNER JOIN VBRK ON VBRKVBELN = VBRKVBELN

    WHERE

    VBAK~KUNNR = P_KUNNR AND

    VBAKVBELN IN S_VBELN AND VBAKERDAT IN S_ERDAT.

    ENDFORM. "CALL

    &----


    *& Module USER_COMMAND_0100 INPUT

    &----


    • text

    ----


    MODULE USER_COMMAND_0100 INPUT.

    CASE SY-UCOMM.

    WHEN'EXIT'.

    LEAVE PROGRAM.

    ENDCASE.

    ENDMODULE.

    Interactive reports

    Alv

    /community [original link is broken]

    <b>Reward if usefull</b>

    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.