Variant in interactive report

Moderator message: please do NOT offer points
Hi Experts,
    I have developed a interactive report with customized PF-Status.
Now my requirement is to use variants in this report.
so Can one please help me to know the code for 'Variant'.
<<text removed>>
regards,
Kishore
Edited by: Matt on Nov 20, 2008 1:17 PM -

Hi,
To select variant use FM
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
       EXPORTING
            i_save        = 'U'
       CHANGING
            cs_variant    = wa_variant
and pass the selected variant to alv and activate saving option in alv by setting U variant save
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            i_callback_program = v_progname
            i_background_id    = ' '
            is_layout          = gs_layout
            it_fieldcat        = i_fieldcat2           
            i_save             = 'U'                    
            is_variant         = wa_variant
Regards,
Nandha

Similar Messages

  • Variants in interactive report

    what is the purpose of using variants in interactive alv reports. how r v suppose to use it?

    Hi,
    Variants are used in order to avoid the tedious work of entering the various different values in the selection screen.
    In case you have some 15 different values to be entered, you it becomes tedious to do that every time you execute the report.
    So, what you have to do is.
    Enter the appropriate values in the selection screen, and click on the save button. It will ask for a variant name , give appropriate name and meaning, so that anybody can understand it, and save once again.
    Now, you can use this variant every time by using " SHIFT + F5" key or the shorcut on the menu.
    Reward if helpful.
    Regards.

  • Need unique Variants in ALV interactive report

    Hello Experts,
                          I have a ALV interactive report in which a layout variant  created in one layout is been reflecting in all other layouts, which i dont want. I want to create different variants for different layouts in interactive report.How can i achieve this.

    Hi,
        Event form names are appended to an internal table and passed to the ALV. And whatever you write inside that form
    can be called through the function module.
    What you are trying to do is modify the internal table with the form name, which does not exsist. Instead of this append it.
    There are lot of example of this ALV list events.
    DATA:     T_EVENT TYPE SLIS_T_EVENT,
         W_EVENT TYPE SLIS_ALV_EVENT.
    CLEAR W_EVENT.
    W_EVENT-FORM = SLIS_EV_AFTER_LINE_OUTPUT.
    W_EVENT-NAME = SLIS_EV_AFTER_LINE_OUTPUT."AFTER_LINE_OUTPUT event
    APPEND W_EVENT TO T_EVENT.
    Thanks & Regards,
    Tapodipta Khan

  • I Need Interactive Report for displaying vendor information. Based on the s

    Interactive Report for displaying vendor information. Based on the selection made by the corresponding Vendor Bank Details are listed such that the line selected in the basic list was visible along with the secondary list.

    hi
    Hi
    Use the Table LFA1 and LFB1 in the basic list
    and LFBK table details in the secondary list
    see the sample code related to customer Sales orders
    modify it with the Vendor tables
    REPORT ZTEJ_INTAB1 LINE-SIZE 103 LINE-COUNT 35(5) NO STANDARD PAGE
    HEADING.
    *TABLES DECLARATION
    TABLES : KNA1, VBAK, VBAP.
    *SELECT OPTIONS
    SELECT-OPTIONS: CUST_NO FOR KNA1-KUNNR.
    *INITIALIZATION
    INITIALIZATION.
    CUST_NO-LOW = '01'.
    CUST_NO-HIGH = '5000'.
    CUST_NO-SIGN = 'I'.
    CUST_NO-OPTION = 'BT'.
    APPEND CUST_NO.
    *SELECTION SCREEN VALIDATION
    AT SELECTION-SCREEN ON CUST_NO.
    LOOP AT SCREEN.
    IF CUST_NO-LOW < 1 OR CUST_NO-HIGH > 5000.
    MESSAGE E001(ZTJ1).
    ENDIF.
    ENDLOOP.
    *BASIC LIST SELECTION
    START-OF-SELECTION.
    SELECT KUNNR NAME1 ORT01 LAND1 INTO
    (KNA1-KUNNR, KNA1-NAME1,KNA1-ORT01,KNA1-LAND1)
    FROM KNA1
    WHERE KUNNR IN CUST_NO.
    WRITE:/1 SY-VLINE,
    KNA1-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON,
    16 SY-VLINE,
    KNA1-NAME1 UNDER 'NAME',
    61 SY-VLINE,
    KNA1-ORT01 UNDER 'CITY',
    86 SY-VLINE,
    KNA1-LAND1 UNDER 'COUNTRY',
    103 SY-VLINE.
    HIDE: KNA1-KUNNR.
    ENDSELECT.
    ULINE.
    *SECONDARY LIST ACCESS
    AT user-command.
    IF SY-UCOMM = 'IONE'.
    PERFORM SALES_ORD.
    ENDIF.
    IF SY-UCOMM = 'ITWO'.
    PERFORM ITEM_DET.
    ENDIF.
    *TOP OF PAGE
    TOP-OF-PAGE.
    FORMAT COLOR 1.
    WRITE : 'CUSTOMER DETAILS'.
    FORMAT COLOR 1 OFF.
    ULINE.
    FORMAT COLOR 3.
    WRITE : 1 SY-VLINE,
    3 'CUSTOMER NO.',
    16 SY-VLINE,
    18 'NAME',
    61 SY-VLINE,
    63 'CITY',
    86 SY-VLINE,
    88 'COUNTRY',
    103 SY-VLINE.
    ULINE.
    FORMAT COLOR 3 OFF.
    *TOP OF PAGE FOR SECONDARY LISTS
    TOP-OF-PAGE DURING LINE-SELECTION.
    *TOP OF PAGE FOR 1ST SECONDARY LIST
    IF SY-UCOMM = 'IONE'.
    ULINE.
    FORMAT COLOR 1.
    WRITE : 'SALES ORDER DETAILS'.
    ULINE.
    FORMAT COLOR 1 OFF.
    FORMAT COLOR 3.
    WRITE : 1 SY-VLINE,
    3 'CUSTOMER NO.',
    16 SY-VLINE,
    18 'SALES ORDER NO.',
    40 SY-VLINE,
    42 'DATE',
    60 SY-VLINE,
    62 'CREATOR',
    85 SY-VLINE,
    87 'DOC DATE',
    103 SY-VLINE.
    ULINE.
    ENDIF.
    FORMAT COLOR 3 OFF.
    *TOP OF PAGE FOR 2ND SECONDARY LIST
    IF SY-UCOMM = 'ITWO'.
    ULINE.
    FORMAT COLOR 1.
    WRITE : 'ITEM DETAILS'.
    ULINE.
    FORMAT COLOR 1 OFF.
    FORMAT COLOR 3.
    WRITE : 1 SY-VLINE,
    3 'SALES ORDER NO.',
    40 SY-VLINE,
    42 'SALES ITEM NO.',
    60 SY-VLINE,
    62 'ORDER QUANTITY',
    103 SY-VLINE.
    ULINE.
    ENDIF.
    FORMAT COLOR 3 OFF.
    *END OF PAGE
    END-OF-PAGE.
    ULINE.
    WRITE :'USER :',SY-UNAME,/,'DATE :', SY-DATUM, 85 'END OF PAGE:',
    SY-PAGNO.
    SKIP.
    *& Form SALES_ORD
    *& FIRST SECONDARY LIST FORM
    FORM SALES_ORD .
    SELECT KUNNR VBELN ERDAT ERNAM AUDAT INTO
    (VBAK-KUNNR, VBAK-VBELN, VBAK-ERDAT, VBAK-ERNAM, VBAK-AUDAT)
    FROM VBAK
    WHERE KUNNR = KNA1-KUNNR.
    WRITE:/1 SY-VLINE,
    VBAK-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON,
    16 SY-VLINE,
    VBAK-VBELN UNDER 'SALES ORDER NO.' HOTSPOT ON,
    40 SY-VLINE,
    VBAK-ERDAT UNDER 'DATE',
    60 SY-VLINE,
    VBAK-ERNAM UNDER 'CREATOR',
    85 SY-VLINE,
    VBAK-AUDAT UNDER 'DOC DATE',
    103 SY-VLINE.
    HIDE : VBAK-VBELN.
    ENDSELECT.
    ULINE.
    ENDFORM. " SALES_ORD
    *& Form ITEM_DET
    *& SECOND SECONDARY LIST FORM
    FORM ITEM_DET .
    SELECT VBELN POSNR KWMENG INTO
    (VBAP-VBELN, VBAP-POSNR, VBAP-KWMENG)
    FROM VBAP
    WHERE VBELN = VBAK-VBELN.
    WRITE : /1 SY-VLINE,
    VBAP-VBELN UNDER 'SALES ORDER NO.',
    40 SY-VLINE,
    VBAP-POSNR UNDER 'SALES ITEM NO.',
    60 SY-VLINE,
    VBAP-KWMENG UNDER 'ORDER QUANTITY',
    103 SY-VLINE.
    ENDSELECT.
    ULINE.
    ENDFORM. " ITEM_DET
    REPORT demo_list_at_pf.
    START-OF-SELECTION.
    WRITE 'Basic List, Press PF5, PF6, PF7, or PF8'.
    AT pf5.
    PERFORM out.
    AT pf6.
    PERFORM out.
    AT pf7.
    PERFORM out.
    AT pf8.
    PERFORM out.
    FORM out.
    WRITE: 'Secondary List by PF-Key Selection',
    / 'SY-LSIND =', sy-lsind,
    / 'SY-UCOMM =', sy-ucomm.
    ENDFORM.
    After executing the program, the system displays the basic list. The user can press the function keys F5 , F6 , F7 , and F8 to create secondary lists. If, for example, the 14th key the user presses is F6 , the output on the displayed secondary list looks as follows:
    Secondary List by PF-Key Selection
    SY-LSIND = 14
    SY-UCOMM = PF06
    Example for AT USER-COMMAND.
    REPORT demo_list_at_user_command NO STANDARD PAGE HEADING.
    START-OF-SELECTION.
    WRITE: 'Basic List',
    / 'SY-LSIND:', sy-lsind.
    TOP-OF-PAGE.
    WRITE 'Top-of-Page'.
    ULINE.
    TOP-OF-PAGE DURING LINE-SELECTION.
    CASE sy-pfkey.
    WHEN 'TEST'.
    WRITE 'Self-defined GUI for Function Codes'.
    ULINE.
    ENDCASE.
    AT LINE-SELECTION.
    SET PF-STATUS 'TEST' EXCLUDING 'PICK'.
    PERFORM out.
    sy-lsind = sy-lsind - 1.
    AT USER-COMMAND.
    CASE sy-ucomm.
    WHEN 'FC1'.
    PERFORM out.
    WRITE / 'Button FUN 1 was pressed'.
    WHEN 'FC2'.
    PERFORM out.
    WRITE / 'Button FUN 2 was pressed'.
    WHEN 'FC3'.
    PERFORM out.
    WRITE / 'Button FUN 3 was pressed'.
    WHEN 'FC4'.
    PERFORM out.
    WRITE / 'Button FUN 4 was pressed'.
    WHEN 'FC5'.
    PERFORM out.
    WRITE / 'Button FUN 5 was pressed'.
    ENDCASE.
    sy-lsind = sy-lsind - 1.
    FORM out.
    WRITE: 'Secondary List',
    / 'SY-LSIND:', sy-lsind,
    / 'SY-PFKEY:', sy-pfkey.
    ENDFORM.
    <b>Vendor performance report</b>
    See this sample code
    *"Table declarations...................................................
    TABLES:
    EKKO, " Purchasing Document Header
    CDHDR, " Change document header
    SSCRFIELDS. " Fields on selection screens
    *"Selection screen elements............................................
    SELECT-OPTIONS:
    S_EBELN FOR EKKO-EBELN, " Purchasing Document Number
    S_LIFNR FOR EKKO-LIFNR, " Vendor's account number
    S_EKGRP FOR EKKO-EKGRP, " Purchasing group
    S_BEDAT FOR EKKO-BEDAT, " Purchasing Document Date
    S_UDATE FOR CDHDR-UDATE. " Creation date of the change
    " document
    *" Data declarations...................................................
    Field String to hold Purchase Document Number *
    DATA:
    BEGIN OF FS_EBELN,
    EBELN(90) TYPE C, " Purchase Document Number
    ERNAM TYPE EKKO-ERNAM, " Name of Person who Created
    " the Object
    LIFNR TYPE EKKO-LIFNR, " Vendor's account number
    EKGRP TYPE EKKO-EKGRP, " Purchasing group
    BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
    END OF FS_EBELN,
    Field String to hold Purchase Document Header *
    BEGIN OF FS_EKKO,
    EBELN TYPE EKKO-EBELN, " Purchasing Document Number
    ERNAM TYPE EKKO-ERNAM, " Name of Person who Created the
    " Object
    LIFNR TYPE EKKO-LIFNR, " Vendor's account number
    EKGRP TYPE EKKO-EKGRP, " Purchasing group
    BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
    END OF FS_EKKO,
    Field String to hold Account Number and name of the Vendor *
    BEGIN OF FS_LFA1,
    LIFNR TYPE LFA1-LIFNR, " Account Number of Vendor
    NAME1 TYPE LFA1-NAME1, " Name1
    END OF FS_LFA1,
    Field String to hold Change date and the name of the user *
    BEGIN OF FS_CDHDR,
    OBJECTCLAS TYPE CDHDR-OBJECTCLAS, " Object Class
    OBJECTID TYPE CDHDR-OBJECTID, " Object value
    CHANGENR TYPE CDHDR-CHANGENR, " Document change number
    USERNAME TYPE CDHDR-USERNAME, " User name
    UDATE TYPE CDHDR-UDATE, " Creation date of the change
    " document
    END OF FS_CDHDR,
    Field String to hold Change document items *
    BEGIN OF FS_CDPOS,
    OBJECTCLAS TYPE CDPOS-OBJECTCLAS," Object class
    OBJECTID(10) TYPE C, " Object Value
    CHANGENR TYPE CDPOS-CHANGENR, " Document change number
    TABNAME TYPE CDPOS-TABNAME, " Table Name
    FNAME TYPE CDPOS-FNAME, " Field Name
    VALUE_NEW TYPE CDPOS-VALUE_NEW, " New contents of changed field
    VALUE_OLD TYPE CDPOS-VALUE_OLD, " Old contents of changed field
    END OF FS_CDPOS,
    Field String to hold Date Element Name *
    BEGIN OF FS_DATAELE,
    TABNAME TYPE DD03L-TABNAME, " Table Name
    FIELDNAME TYPE DD03L-FIELDNAME, " Field Name
    ROLLNAME TYPE DD03L-ROLLNAME, " Data element (semantic domain)
    END OF FS_DATAELE,
    Field String to hold Short Text of the Date Element *
    BEGIN OF FS_TEXT,
    ROLLNAME TYPE DD04T-ROLLNAME, " Data element (semantic domain)
    DDTEXT TYPE DD04T-DDTEXT, " Short Text Describing R/3
    " Repository Objects
    END OF FS_TEXT,
    Field String to hold data to be displayed on the ALV grid *
    BEGIN OF FS_OUTTAB,
    EBELN TYPE EKKO-EBELN, " Purchasing Document Number
    ERNAM TYPE EKKO-ERNAM, " Name of Person who Created the
    " Object
    LIFNR TYPE EKKO-LIFNR, " Vendor's account number
    EKGRP TYPE EKKO-EKGRP, " Purchasing group
    BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
    WERKS TYPE LFA1-WERKS, " Plant
    NAME1 TYPE LFA1-NAME1, " Name1
    USERNAME TYPE CDHDR-USERNAME, " User name
    UDATE TYPE CDHDR-UDATE, " Creation date of the change
    " document
    DDTEXT TYPE DD04T-DDTEXT, " Short Text Describing R/3
    " Repository Objects
    VALUE_NEW TYPE CDPOS-VALUE_NEW, " New contents of changed field
    VALUE_OLD TYPE CDPOS-VALUE_OLD, " Old contents of changed field
    END OF FS_OUTTAB,
    Internal table to hold Purchase Document Number *
    T_EBELN LIKE STANDARD TABLE
    OF FS_EBELN,
    Internal table to hold Purchase Document Header *
    T_EKKO LIKE STANDARD TABLE
    OF FS_EKKO,
    Temp Internal table to hold Purchase Document Header *
    T_EKKO_TEMP LIKE STANDARD TABLE
    OF FS_EKKO,
    Internal table to hold Account number and Name of the Vendor *
    T_LFA1 LIKE STANDARD TABLE
    OF FS_LFA1,
    Internal Table to hold Change date and the name of the user *
    T_CDHDR LIKE STANDARD TABLE
    OF FS_CDHDR,
    Internal Table to hold Change document items *
    T_CDPOS LIKE STANDARD TABLE
    OF FS_CDPOS,
    Temp. Internal Table to hold Change document items *
    T_CDPOS_TEMP LIKE STANDARD TABLE
    OF FS_CDPOS,
    Internal Table to hold Data Element Name *
    T_DATAELE LIKE STANDARD TABLE
    OF FS_DATAELE,
    Temp. Internal Table to hold Data Element Name *
    T_DATAELE_TEMP LIKE STANDARD TABLE
    OF FS_DATAELE,
    Internal Table to hold Short Text of the Date Element *
    T_TEXT LIKE STANDARD TABLE
    OF FS_TEXT,
    Internal Table to hold data to be displayed on the ALV grid *
    T_OUTTAB LIKE STANDARD TABLE
    OF FS_OUTTAB.
    C L A S S D E F I N I T I O N *
    CLASS LCL_EVENT_HANDLER DEFINITION DEFERRED.
    *" Data declarations...................................................
    Work variables *
    DATA:
    W_EBELN TYPE EKKO-EBELN, " Purchasing Document Number
    W_LIFNR TYPE EKKO-LIFNR, " Vendor's account number
    W_EKGRP TYPE EKKO-EKGRP, " Purchasing group
    W_VALUE TYPE EKKO-EBELN, " Reflected Value
    W_SPACE VALUE ' ', " Space
    W_FLAG TYPE I, " Flag Variable
    W_VARIANT TYPE DISVARIANT, " Variant
    *--- ALV Grid
    W_GRID TYPE REF TO CL_GUI_ALV_GRID,
    *--- Event Handler
    W_EVENT_CLICK TYPE REF TO LCL_EVENT_HANDLER,
    *--- Field catalog table
    T_FIELDCAT TYPE LVC_T_FCAT.
    AT SELECTION-SCREEN EVENT *
    AT SELECTION-SCREEN ON S_EBELN.
    Subroutine to validate Purchase Document Number.
    PERFORM VALIDATE_PD_NUM.
    AT SELECTION-SCREEN ON S_LIFNR.
    Subroutine to validate Vendor Number.
    PERFORM VALIDATE_VEN_NUM.
    AT SELECTION-SCREEN ON S_EKGRP.
    Subroutine to validate Purchase Group.
    PERFORM VALIDATE_PUR_GRP.
    START-OF-SELECTION EVENT *
    START-OF-SELECTION.
    Subroutine to select all Purchase orders.
    PERFORM SELECT_PO.
    CHECK W_FLAG EQ 0.
    Subroutine to select Object values.
    PERFORM SELECT_OBJ_ID.
    CHECK W_FLAG EQ 0.
    Subroutine to select Changed values.
    PERFORM SELECT_CHANGED_VALUE.
    CHECK W_FLAG EQ 0.
    Subroutine to Select Purchase Orders.
    PERFORM SELECT_PUR_DOC.
    Subroutine to select Vendor Details.
    PERFORM SELECT_VENDOR.
    Subroutine to select Text for the Changed values.
    PERFORM DESCRIPTION.
    END-OF-SELECTION EVENT *
    END-OF-SELECTION.
    IF NOT T_EKKO IS INITIAL.
    Subroutine to populate the Output Table.
    PERFORM FILL_OUTTAB.
    Subroutine to build Field Catalog.
    PERFORM PREPARE_FIELD_CATALOG CHANGING T_FIELDCAT.
    CALL SCREEN 100.
    ENDIF. " IF NOT T_EKKO...
    CLASS LCL_EVENT_HANDLER DEFINITION
    Defining Class which handles events
    CLASS LCL_EVENT_HANDLER DEFINITION .
    PUBLIC SECTION .
    METHODS:
    HANDLE_HOTSPOT_CLICK
    FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
    IMPORTING E_ROW_ID E_COLUMN_ID.
    ENDCLASS. " LCL_EVENT_HANDLER DEFINITION
    CLASS LCL_EVENT_HANDLER IMPLEMENTATION
    Implementing the Class which can handle events
    CLASS LCL_EVENT_HANDLER IMPLEMENTATION .
    *---Handle Double Click
    METHOD HANDLE_HOTSPOT_CLICK .
    Subroutine to get the HotSpot Cell information.
    PERFORM GET_CELL_INFO.
    SET PARAMETER ID 'BES' FIELD W_VALUE.
    CALL TRANSACTION 'ME23N'.
    ENDMETHOD. " HANDLE_HOTSPOT_CLICK
    ENDCLASS. " LCL_EVENT_HANDLER
    *& Module STATUS_0100 OUTPUT
    PBO Event
    MODULE STATUS_0100 OUTPUT.
    SET PF-STATUS 'OOPS'.
    SET TITLEBAR 'TIT'.
    Subroutine to fill the Variant Structure
    PERFORM FILL_VARIANT.
    IF W_GRID IS INITIAL.
    CREATE OBJECT W_GRID
    EXPORTING
    I_SHELLSTYLE = 0
    I_LIFETIME =
    I_PARENT = CL_GUI_CONTAINER=>SCREEN0
    I_APPL_EVENTS =
    I_PARENTDBG =
    I_APPLOGPARENT =
    I_GRAPHICSPARENT =
    I_NAME =
    I_FCAT_COMPLETE = SPACE
    EXCEPTIONS
    ERROR_CNTL_CREATE = 1
    ERROR_CNTL_INIT = 2
    ERROR_CNTL_LINK = 3
    ERROR_DP_CREATE = 4
    OTHERS = 5.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF. " IF SY-SUBRC <> 0
    CALL METHOD W_GRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
    I_BUFFER_ACTIVE =
    I_BYPASSING_BUFFER =
    I_CONSISTENCY_CHECK =
    I_STRUCTURE_NAME =
    IS_VARIANT = W_VARIANT
    I_SAVE = 'A'
    I_DEFAULT = 'X'
    IS_LAYOUT =
    IS_PRINT =
    IT_SPECIAL_GROUPS =
    IT_TOOLBAR_EXCLUDING =
    IT_HYPERLINK =
    IT_ALV_GRAPHICS =
    IT_EXCEPT_QINFO =
    IR_SALV_ADAPTER =
    CHANGING
    IT_OUTTAB = T_OUTTAB
    IT_FIELDCATALOG = T_FIELDCAT
    IT_SORT =
    IT_FILTER =
    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. " IF SY-SUBRC <> 0.
    ENDIF. " IF W_GRID IS INITIAL
    CREATE OBJECT W_EVENT_CLICK.
    SET HANDLER W_EVENT_CLICK->HANDLE_HOTSPOT_CLICK FOR W_GRID.
    ENDMODULE. " STATUS_0100 OUTPUT
    *& Module USER_COMMAND_0100 INPUT
    PAI Event
    MODULE USER_COMMAND_0100 INPUT.
    CASE SY-UCOMM.
    WHEN 'BACK'.
    LEAVE TO SCREEN 0.
    WHEN 'EXIT'.
    LEAVE PROGRAM.
    WHEN 'CANCEL'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    *& Form PREPARE_FIELD_CATALOG
    Subroutine to build the Field catalog
    <--P_T_FIELDCAT Field Catalog Table
    FORM PREPARE_FIELD_CATALOG CHANGING PT_FIELDCAT TYPE LVC_T_FCAT .
    DATA LS_FCAT TYPE LVC_S_FCAT.
    Purchasing group...
    LS_FCAT-FIELDNAME = 'EKGRP'.
    LS_FCAT-REF_TABLE = 'EKKO'.
    LS_FCAT-INTTYPE = 'C'.
    LS_FCAT-OUTPUTLEN = '10'.
    APPEND LS_FCAT TO PT_FIELDCAT.
    CLEAR LS_FCAT.
    Purchasing Document Number...
    LS_FCAT-FIELDNAME = 'EBELN'.
    LS_FCAT-REF_TABLE = 'EKKO' .
    LS_FCAT-EMPHASIZE = 'C411'.
    LS_FCAT-INTTYPE = 'C'.
    LS_FCAT-OUTPUTLEN = '10'.
    LS_FCAT-HOTSPOT = 'X'.
    APPEND LS_FCAT TO PT_FIELDCAT .
    CLEAR LS_FCAT .
    Name of Person who Created the Object...
    LS_FCAT-FIELDNAME = 'ERNAM'.
    LS_FCAT-REF_TABLE = 'EKKO'.
    LS_FCAT-OUTPUTLEN = '15' .
    APPEND LS_FCAT TO PT_FIELDCAT.
    CLEAR LS_FCAT.
    Purchasing Document Date...
    LS_FCAT-FIELDNAME = 'BEDAT'.
    LS_FCAT-REF_TABLE = 'EKKO'.
    LS_FCAT-INTTYPE = 'C'.
    LS_FCAT-OUTPUTLEN = '10'.
    APPEND LS_FCAT TO PT_FIELDCAT.
    CLEAR LS_FCAT.
    Vendor's account number...
    LS_FCAT-FIELDNAME = 'LIFNR'.
    LS_FCAT-REF_TABLE = 'EKKO'.
    LS_FCAT-INTTYPE = 'C'.
    LS_FCAT-OUTPUTLEN = '10'.
    APPEND LS_FCAT TO PT_FIELDCAT.
    CLEAR LS_FCAT.
    Account Number of Vendor or Creditor...
    LS_FCAT-FIELDNAME = 'NAME1'.
    LS_FCAT-REF_TABLE = 'LFA1'.
    LS_FCAT-INTTYPE = 'C'.
    LS_FCAT-OUTPUTLEN = '10'.
    LS_FCAT-COLTEXT = 'Vendor Name'(001).
    LS_FCAT-SELTEXT = 'Vendor Name'(001).
    APPEND LS_FCAT TO PT_FIELDCAT.
    CLEAR LS_FCAT.
    Creation date of the change document...
    LS_FCAT-FIELDNAME = 'UDATE'.
    LS_FCAT-REF_TABLE = 'CDHDR'.
    LS_FCAT-INTTYPE = 'C'.
    LS_FCAT-OUTPUTLEN = '10'.
    LS_FCAT-COLTEXT = 'Change Date'(002).
    LS_FCAT-SELTEXT = 'Change Date'(002).
    APPEND LS_FCAT TO PT_FIELDCAT.
    CLEAR LS_FCAT.
    User name of the person responsible in change document...
    LS_FCAT-FIELDNAME = 'USERNAME'.
    LS_FCAT-REF_TABLE = 'CDHDR'.
    LS_FCAT-INTTYPE = 'C'.
    LS_FCAT-OUTPUTLEN = '10'.
    LS_FCAT-COLTEXT = 'Modified by'(003).
    LS_FCAT-SELTEXT = 'Modified by'(003).
    APPEND LS_FCAT TO PT_FIELDCAT.
    CLEAR LS_FCAT.
    Short Text Describing R/3 Repository Objects...
    LS_FCAT-FIELDNAME = 'DDTEXT'.
    LS_FCAT-REF_TABLE = 'DD04T'.
    LS_FCAT-INTTYPE = 'C'.
    LS_FCAT-OUTPUTLEN = '15'.
    APPEND LS_FCAT TO PT_FIELDCAT.
    CLEAR LS_FCAT.
    Old contents of changed field...
    LS_FCAT-FIELDNAME = 'VALUE_OLD'.
    LS_FCAT-REF_TABLE = 'CDPOS'.
    LS_FCAT-INTTYPE = 'C'.
    LS_FCAT-OUTPUTLEN = '12'.
    APPEND LS_FCAT TO PT_FIELDCAT.
    CLEAR LS_FCAT.
    New contents of changed field...
    LS_FCAT-FIELDNAME = 'VALUE_NEW'.
    LS_FCAT-REF_TABLE = 'CDPOS'.
    LS_FCAT-INTTYPE = 'C'.
    LS_FCAT-OUTPUTLEN = '12'.
    APPEND LS_FCAT TO PT_FIELDCAT.
    CLEAR LS_FCAT.
    ENDFORM. " PREPARE_FIELD_CATALOG
    *& Form SELECT_PO
    Subroutine to select all the Purchase Orders
    There are no interface parameters to be passed to this subroutine.
    FORM SELECT_PO .
    SELECT EBELN " Purchasing Document Number
    ERNAM " Name of Person who Created
    " the Object
    LIFNR " Vendor's account number
    EKGRP " Purchasing group
    BEDAT " Purchasing Document Date
    FROM EKKO
    PACKAGE SIZE 10000
    APPENDING TABLE T_EBELN
    WHERE EBELN IN S_EBELN
    AND BEDAT IN S_BEDAT.
    ENDSELECT.
    IF SY-SUBRC NE 0.
    W_FLAG = 1.
    MESSAGE S401(M8).
    ENDIF. " IF SY-SUBRC NE 0
    ENDFORM. " SELECT_PO
    *& Form SELECT_OBJ_ID
    Subroutine to select Object ID
    There are no interface parameters to be passed to this subroutine.
    FORM SELECT_OBJ_ID .
    IF NOT T_EBELN IS INITIAL.
    SELECT OBJECTCLAS " Object Class
    OBJECTID " Object value
    CHANGENR " Document change number
    USERNAME " User name
    UDATE " Creation date
    FROM CDHDR
    INTO TABLE T_CDHDR
    FOR ALL ENTRIES IN T_EBELN
    WHERE OBJECTID EQ T_EBELN-EBELN
    AND UDATE IN S_UDATE
    AND TCODE IN ('ME21N','ME22N','ME23N').
    ENDSELECT.
    IF SY-SUBRC NE 0.
    W_FLAG = 1.
    MESSAGE S833(M8) WITH 'Header Not Found'(031).
    ENDIF. " IF SY-SUBRC NE 0.
    ENDIF. " IF NOT T_EBELN IS INITIAL
    ENDFORM. " SELECT_OBJ_ID
    *& Form SELECT_CHANGED_VALUE
    Subroutine to select Changed Values
    There are no interface parameters to be passed to this subroutine.
    FORM SELECT_CHANGED_VALUE .
    IF NOT T_CDHDR IS INITIAL.
    SELECT OBJECTCLAS " Object class
    OBJECTID " Object value
    CHANGENR " Document change number
    TABNAME " Table Name
    FNAME " Field Name
    VALUE_NEW " New contents of changed field
    VALUE_OLD " Old contents of changed field
    FROM CDPOS
    PACKAGE SIZE 10000
    APPENDING TABLE T_CDPOS
    FOR ALL ENTRIES IN T_CDHDR
    WHERE OBJECTCLAS EQ T_CDHDR-OBJECTCLAS
    AND OBJECTID EQ T_CDHDR-OBJECTID
    AND CHANGENR EQ T_CDHDR-CHANGENR.
    ENDSELECT.
    IF SY-SUBRC NE 0.
    W_FLAG = 1.
    MESSAGE S833(M8) WITH 'Item Not Found'(032).
    ENDIF. " IF SY-SUBRC NE 0.
    ENDIF. " IF NOT T_CDHDR IS INITIAL
    T_CDPOS_TEMP[] = T_CDPOS[].
    ENDFORM. " SELECT_CHANGED_VALUE
    *& Form SELECT_PUR_DOC
    Subroutine to select Purchase Order Details
    There are no interface parameters to be passed to this subroutine.
    FORM SELECT_PUR_DOC .
    IF NOT T_CDPOS IS INITIAL.
    SORT T_EBELN BY EBELN.
    LOOP AT T_CDPOS INTO FS_CDPOS.
    READ TABLE T_EBELN INTO FS_EBELN WITH KEY EBELN =
    FS_CDPOS-OBJECTID BINARY SEARCH.
    IF SY-SUBRC NE 0.
    DELETE TABLE T_EBELN FROM FS_EBELN.
    ENDIF. " IF SY-SUBRC NE 0.
    ENDLOOP. " LOOP AT T_CDPOS...
    LOOP AT T_EBELN INTO FS_EBELN.
    MOVE FS_EBELN-EBELN TO FS_EKKO-EBELN.
    MOVE FS_EBELN-ERNAM TO FS_EKKO-ERNAM.
    MOVE FS_EBELN-LIFNR TO FS_EKKO-LIFNR.
    MOVE FS_EBELN-EKGRP TO FS_EKKO-EKGRP.
    MOVE FS_EBELN-BEDAT TO FS_EKKO-BEDAT.
    APPEND FS_EKKO TO T_EKKO.
    ENDLOOP. " LOOP AT T_EBELN...
    T_EKKO_TEMP[] = T_EKKO[].
    ENDIF. " IF NOT T_CDPOS IS INITIAL
    ENDFORM. " SELECT_PUR_DOC
    *& Form SELECT_VENDOR
    Subroutine to select Vendor details
    There are no interface parameters to be passed to this subroutine.
    FORM SELECT_VENDOR .
    IF NOT T_EKKO IS INITIAL.
    SORT T_EKKO_TEMP BY LIFNR.
    DELETE ADJACENT DUPLICATES FROM T_EKKO_TEMP COMPARING LIFNR.
    SELECT LIFNR " Account Number of Vendor or
    " Creditor
    NAME1 " Name 1
    FROM LFA1
    INTO TABLE T_LFA1
    FOR ALL ENTRIES IN T_EKKO_TEMP
    WHERE LIFNR EQ T_EKKO_TEMP-LIFNR.
    IF SY-SUBRC NE 0.
    MESSAGE S002(M8) WITH 'Master Details'(033).
    ENDIF. " IF SY-SUBRC NE 0.
    ENDIF. " IF NOT T_EKKO IS INITIAL
    ENDFORM. " SELECT_VENDOR
    *& Form DESCRIPTION
    Subroutine to get the description
    There are no interface parameters to be passed to this subroutine.
    FORM DESCRIPTION .
    IF NOT T_CDPOS IS INITIAL.
    SORT T_CDPOS_TEMP BY TABNAME FNAME.
    DELETE ADJACENT DUPLICATES FROM T_CDPOS_TEMP COMPARING TABNAME FNAME
    SELECT TABNAME " Table Name
    FIELDNAME " Field Name
    ROLLNAME " Data element
    FROM DD03L
    INTO TABLE T_DATAELE
    FOR ALL ENTRIES IN T_CDPOS_TEMP
    WHERE TABNAME EQ T_CDPOS_TEMP-TABNAME
    AND FIELDNAME EQ T_CDPOS_TEMP-FNAME.
    IF NOT T_DATAELE IS INITIAL.
    T_DATAELE_TEMP[] = T_DATAELE[].
    SORT T_DATAELE_TEMP BY ROLLNAME.
    DELETE ADJACENT DUPLICATES FROM T_DATAELE_TEMP COMPARING ROLLNAME.
    SELECT ROLLNAME " Data element
    DDTEXT " Short Text Describing R/3
    " Repository Objects
    FROM DD04T
    INTO TABLE T_TEXT
    FOR ALL ENTRIES IN T_DATAELE_TEMP
    WHERE ROLLNAME EQ T_DATAELE_TEMP-ROLLNAME
    AND DDLANGUAGE EQ SY-LANGU.
    IF SY-SUBRC NE 0.
    EXIT.
    ENDIF. " IF SY-SUBRC NE 0.
    ENDIF. " IF NOT T_DATAELE IS INITIAL.
    ENDIF. " IF NOT T_CDPOS IS INITIAL.
    ENDFORM. " DESCRIPTION
    *& Form FILL_OUTTAB
    Subroutine to populate the Outtab
    There are no interface parameters to be passed to this subroutine.
    FORM FILL_OUTTAB .
    SORT T_CDHDR BY OBJECTCLAS OBJECTID CHANGENR.
    SORT T_EKKO BY EBELN.
    SORT T_LFA1 BY LIFNR.
    SORT T_DATAELE BY TABNAME FIELDNAME.
    SORT T_TEXT BY ROLLNAME.
    LOOP AT T_CDPOS INTO FS_CDPOS.
    READ TABLE T_CDHDR INTO FS_CDHDR WITH KEY
    OBJECTCLAS = FS_CDPOS-OBJECTCLAS
    OBJECTID = FS_CDPOS-OBJECTID
    CHANGENR = FS_CDPOS-CHANGENR
    BINARY SEARCH.
    IF SY-SUBRC EQ 0.
    MOVE FS_CDHDR-USERNAME TO FS_OUTTAB-USERNAME.
    MOVE FS_CDHDR-UDATE TO FS_OUTTAB-UDATE.
    READ TABLE T_EKKO INTO FS_EKKO WITH KEY
    EBELN = FS_CDHDR-OBJECTID
    BINARY SEARCH.
    IF SY-SUBRC EQ 0.
    MOVE FS_EKKO-EBELN TO FS_OUTTAB-EBELN.
    MOVE FS_EKKO-ERNAM TO FS_OUTTAB-ERNAM.
    MOVE FS_EKKO-LIFNR TO FS_OUTTAB-LIFNR.
    MOVE FS_EKKO-EKGRP TO FS_OUTTAB-EKGRP.
    MOVE FS_EKKO-BEDAT TO FS_OUTTAB-BEDAT.
    READ TABLE T_LFA1 INTO FS_LFA1 WITH KEY
    LIFNR = FS_EKKO-LIFNR
    BINARY SEARCH.
    IF SY-SUBRC EQ 0.
    MOVE FS_LFA1-NAME1 TO FS_OUTTAB-NAME1.
    ENDIF. " IF SY-SUBRC EQ 0.
    ENDIF. " IF SY-SUBRC EQ 0.
    ENDIF. " IF SY-SUBRC EQ 0.
    MOVE FS_CDPOS-VALUE_NEW TO FS_OUTTAB-VALUE_NEW.
    MOVE FS_CDPOS-VALUE_OLD TO FS_OUTTAB-VALUE_OLD.
    READ TABLE T_DATAELE INTO FS_DATAELE WITH KEY
    TABNAME = FS_CDPOS-TABNAME
    FIELDNAME = FS_CDPOS-FNAME
    BINARY SEARCH.
    IF SY-SUBRC EQ 0.
    READ TABLE T_TEXT INTO FS_TEXT WITH KEY
    ROLLNAME = FS_DATAELE-ROLLNAME
    BINARY SEARCH.
    IF SY-SUBRC EQ 0.
    MOVE FS_TEXT-DDTEXT TO FS_OUTTAB-DDTEXT.
    ENDIF. " IF SY-SUBRC EQ 0.
    ENDIF. " IF SY-SUBRC EQ 0.
    APPEND FS_OUTTAB TO T_OUTTAB.
    CLEAR FS_OUTTAB.
    ENDLOOP.
    ENDFORM. " FILL_OUTTAB
    *& Form GET_CELL_INFO
    Subroutine to get the Cell Information
    --> W_VALUE Holds the value of Hotspot clicked
    FORM GET_CELL_INFO .
    CALL METHOD W_GRID->GET_CURRENT_CELL
    IMPORTING
    E_ROW =
    E_VALUE = W_VALUE
    E_COL =
    ES_ROW_ID =
    ES_COL_ID =
    ES_ROW_NO =
    ENDFORM. " GET_CELL_INFO
    *& Form VALIDATE_PD_NUM
    Subroutine to validate Purchase Document Number
    There are no interface parameters to be passed to this subroutine.
    FORM VALIDATE_PD_NUM .
    IF NOT S_EBELN[] IS INITIAL.
    SELECT EBELN " Purchase Document Number
    FROM EKKO
    INTO W_EBELN
    UP TO 1 ROWS
    WHERE EBELN IN S_EBELN.
    ENDSELECT.
    IF SY-SUBRC NE 0.
    CLEAR SSCRFIELDS-UCOMM.
    MESSAGE E717(M8).
    ENDIF. " IF SY-SUBRC NE 0
    ENDIF. " IF NOT S_EBELN[]...
    ENDFORM. " VALIDATE_PD_NUM
    *& Form VALIDATE_VEN_NUM
    Subroutine to validate Vendor Number
    There are no interface parameters to be passed to this subroutine.
    FORM VALIDATE_VEN_NUM .
    IF NOT S_LIFNR[] IS INITIAL.
    SELECT LIFNR " Vendor Number
    FROM LFA1
    INTO W_LIFNR
    UP TO 1 ROWS
    WHERE LIFNR IN S_LIFNR.
    ENDSELECT.
    IF SY-SUBRC NE 0.
    CLEAR SSCRFIELDS-UCOMM.
    MESSAGE E002(M8) WITH W_SPACE.
    ENDIF. " IF SY-SUBRC NE 0
    ENDIF. " IF NOT S_LIFNR[]...
    ENDFORM. " VALIDATE_VEN_NUM
    *& Form VALIDATE_PUR_GRP
    Subroutine to validate the Purchase Group
    There are no interface parameters to be passed to this subroutine.
    FORM VALIDATE_PUR_GRP .
    IF NOT S_EKGRP[] IS INITIAL.
    SELECT EKGRP " Purchase Group
    FROM T024
    INTO W_EKGRP
    UP TO 1 ROWS
    WHERE EKGRP IN S_EKGRP.
    ENDSELECT.
    IF SY-SUBRC NE 0.
    CLEAR SSCRFIELDS-UCOMM.
    MESSAGE E622(M8) WITH W_SPACE.
    ENDIF. " IF SY-SUBRC NE 0
    ENDIF. " IF NOT S_EKFRP[]...
    ENDFORM. " VALIDATE_PUR_GRP
    *& Form FILL_VARIANT
    Subroutine to fill the Variant Structure
    There are no interface parameters to be passed to this subroutine
    FORM FILL_VARIANT .
    Filling the Variant structure
    W_VARIANT-REPORT = SY-REPID.
    W_VARIANT-USERNAME = SY-UNAME.
    ENDFORM. " FILL_VARIANT
    <b>Reward if usefull</b>

  • Interactive report code plz

    need an  interactive report to list the purchase orders details for a vendor that has interactive drill down options to give the detail of vendor from vendor master.

    Check this sample code
    TYPE-POOLS: SLIS.
    *type declaration for values from ekko
    TYPES: BEGIN OF I_EKKO,
    EBELN LIKE EKKO-EBELN,
    AEDAT LIKE EKKO-AEDAT,
    BUKRS LIKE EKKO-BUKRS,
    BSART LIKE EKKO-BSART,
    LIFNR LIKE EKKO-LIFNR,
    END OF I_EKKO.
    DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
    WA_EKKO TYPE I_EKKO.
    *type declaration for values from ekpo
    TYPES: BEGIN OF I_EKPO,
    EBELN LIKE EKPO-EBELN,
    EBELP LIKE EKPO-EBELP,
    MATNR LIKE EKPO-MATNR,
    MENGE LIKE EKPO-MENGE,
    MEINS LIKE EKPO-MEINS,
    NETPR LIKE EKPO-NETPR,
    END OF I_EKPO.
    DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
    WA_EKPO TYPE I_EKPO .
    *variable for Report ID
    DATA: V_REPID LIKE SY-REPID .
    *declaration for fieldcatalog
    DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
    WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
    declaration for events table where user comand or set PF status will
    be defined
    DATA: V_EVENTS TYPE SLIS_T_EVENT,
    WA_EVENT TYPE SLIS_ALV_EVENT.
    declartion for layout
    DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
    declaration for variant(type of display we want)
    DATA: I_VARIANT TYPE DISVARIANT,
    I_VARIANT1 TYPE DISVARIANT,
    I_SAVE(1) TYPE C.
    *PARAMETERS : p_var TYPE disvariant-variant.
    *Title displayed when the alv list is displayed
    DATA: I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
    DATA: I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
    INITIALIZATION.
    V_REPID = SY-REPID.
    PERFORM BUILD_FIELDCATLOG.
    PERFORM EVENT_CALL.
    PERFORM POPULATE_EVENT.
    START-OF-SELECTION.
    PERFORM DATA_RETRIEVAL.
    PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
    PERFORM DISPLAY_ALV_REPORT.
    *& Form BUILD_FIELDCATLOG
    Fieldcatalog has all the field details from ekko
    FORM BUILD_FIELDCATLOG.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'EBELN'.
    WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'AEDAT'.
    WA_FIELDCAT-SELTEXT_M = 'DATE.'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'BUKRS'.
    WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'BUKRS'.
    WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'LIFNR'.
    WA_FIELDCAT-NO_OUT = 'X'.
    WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    ENDFORM. "BUILD_FIELDCATLOG
    *& Form EVENT_CALL
    we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    I_LIST_TYPE = 0
    IMPORTING
    ET_EVENTS = V_EVENTS
    EXCEPTIONS
    LIST_TYPE_WRONG = 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.
    ENDFORM. "EVENT_CALL
    *& Form POPULATE_EVENT
    Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT.
    READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
    IF SY-SUBRC EQ 0.
    WA_EVENT-FORM = 'TOP_OF_PAGE'.
    MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
    ENDIF.
    READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
    IF SY-SUBRC EQ 0.
    WA_EVENT-FORM = 'USER_COMMAND'.
    MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-NAME.
    ENDIF.
    ENDFORM. "POPULATE_EVENT
    *& Form data_retrieval
    retreiving values from the database table ekko
    FORM DATA_RETRIEVAL.
    SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
    ENDFORM. "data_retrieval
    *& Form bUild_listheader
    text
    -->I_LISTHEADEtext
    FORM BUILD_LISTHEADER USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
    DATA HLINE TYPE SLIS_LISTHEADER.
    HLINE-INFO = 'this is my first alv pgm'.
    HLINE-TYP = 'H'.
    ENDFORM. "build_listheader
    *& Form display_alv_report
    text
    FORM DISPLAY_ALV_REPORT.
    V_REPID = SY-REPID.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = V_REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
    I_GRID_TITLE = I_TITLE_EKKO
    I_GRID_SETTINGS =
    IS_LAYOUT = ALV_LAYOUT
    IT_FIELDCAT = I_FIELDCAT[]
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    i_default = 'ZLAY1'
    I_SAVE = 'A'
    is_variant = i_variant
    IT_EVENTS = V_EVENTS
    TABLES
    T_OUTTAB = IT_EKKO
    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.
    ENDFORM. "display_alv_report
    *& Form TOP_OF_PAGE
    text
    FORM TOP_OF_PAGE.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = IT_LISTHEADER
    i_logo =
    I_END_OF_LIST_GRID =
    ENDFORM. "TOP_OF_PAGE
    *& Form USER_COMMAND
    text
    -->R_UCOMM text
    -->, text
    -->RS_SLEFIELDtext
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
    CASE R_UCOMM.
    WHEN '&IC1'.
    READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
    PERFORM BUILD_FIELDCATLOG_EKPO.
    PERFORM EVENT_CALL_EKPO.
    PERFORM POPULATE_EVENT_EKPO.
    PERFORM DATA_RETRIEVAL_EKPO.
    PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
    PERFORM DISPLAY_ALV_EKPO.
    ENDCASE.
    ENDFORM. "user_command
    *& Form BUILD_FIELDCATLOG_EKPO
    text
    FORM BUILD_FIELDCATLOG_EKPO.
    WA_FIELDCAT-TABNAME = 'IT_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'EBELN'.
    WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'EBELP'.
    WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'MATNR'.
    WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'MENGE'.
    WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'MEINS'.
    WA_FIELDCAT-SELTEXT_M = 'UOM'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'NETPR'.
    WA_FIELDCAT-SELTEXT_M = 'PRICE'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    ENDFORM. "BUILD_FIELDCATLOG_EKPO
    *& Form event_call_ekpo
    we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL_EKPO.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    I_LIST_TYPE = 0
    IMPORTING
    ET_EVENTS = V_EVENTS
    EXCEPTIONS
    LIST_TYPE_WRONG = 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.
    ENDFORM. "event_call_ekpo
    *& Form POPULATE_EVENT
    Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT_EKPO.
    READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
    IF SY-SUBRC EQ 0.
    WA_EVENT-FORM = 'TOP_OF_PAGE'.
    MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
    ENDIF.
    ENDFORM. "POPULATE_EVENT
    *& Form TOP_OF_PAGE
    text
    FORM F_TOP_OF_PAGE.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = IT_LISTHEADER
    i_logo =
    I_END_OF_LIST_GRID =
    ENDFORM. "TOP_OF_PAGE
    *& Form USER_COMMAND
    text
    -->R_UCOMM text
    -->, text
    -->RS_SLEFIELDtext
    *retreiving values from the database table ekko
    FORM DATA_RETRIEVAL_EKPO.
    SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.
    ENDFORM.
    FORM BUILD_LISTHEADER_EKPO USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
    DATA: HLINE1 TYPE SLIS_LISTHEADER.
    HLINE1-TYP = 'H'.
    HLINE1-INFO = 'CHECKING PGM'.
    ENDFORM.
    FORM DISPLAY_ALV_EKPO.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER = ' '
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = V_REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = 'F_USER_COMMAND'
    I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
    I_CALLBACK_HTML_TOP_OF_PAGE = ' '
    I_CALLBACK_HTML_END_OF_LIST = ' '
    I_STRUCTURE_NAME =
    I_BACKGROUND_ID = ' '
    I_GRID_TITLE = I_TITLE_EKPO
    I_GRID_SETTINGS =
    IS_LAYOUT =
    IT_FIELDCAT = I_FIELDCAT[]
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT =
    I_SAVE = 'A'
    IS_VARIANT =
    IT_EVENTS = V_EVENTS
    TABLES
    T_OUTTAB = IT_EKPO
    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.
    ENDFORM.
    Reward points if useful.

  • Interactive report(need example)

    I want complete example of interactive report using all the events in proper sequence. Any one could help me out. Plz use three to four tables.
    Thanks & regards......

    REPORT ZZ_22038_22098_002 NO STANDARD PAGE HEADING LINE-SIZE 650
    MESSAGE-ID ZZ_9838 .
    TYPE-POOLS: SLIS.
    *type declaration for values from ekko
    TYPES: BEGIN OF I_EKKO,
    EBELN LIKE EKKO-EBELN,
    AEDAT LIKE EKKO-AEDAT,
    BUKRS LIKE EKKO-BUKRS,
    BSART LIKE EKKO-BSART,
    LIFNR LIKE EKKO-LIFNR,
    END OF I_EKKO.
    DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
    WA_EKKO TYPE I_EKKO.
    *type declaration for values from ekpo
    TYPES: BEGIN OF I_EKPO,
    EBELN LIKE EKPO-EBELN,
    EBELP LIKE EKPO-EBELP,
    MATNR LIKE EKPO-MATNR,
    MENGE LIKE EKPO-MENGE,
    MEINS LIKE EKPO-MEINS,
    NETPR LIKE EKPO-NETPR,
    END OF I_EKPO.
    DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
    WA_EKPO TYPE I_EKPO .
    *variable for Report ID
    DATA: V_REPID LIKE SY-REPID .
    *declaration for fieldcatalog
    DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
    WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
    declaration for events table where user comand or set PF status will
    be defined
    DATA: V_EVENTS TYPE SLIS_T_EVENT,
    WA_EVENT TYPE SLIS_ALV_EVENT.
    declartion for layout
    DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
    declaration for variant(type of display we want)
    DATA: I_VARIANT TYPE DISVARIANT,
    I_VARIANT1 TYPE DISVARIANT,
    I_SAVE(1) TYPE C.
    *PARAMETERS : p_var TYPE disvariant-variant.
    *Title displayed when the alv list is displayed
    DATA: I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
    DATA: I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
    INITIALIZATION.
    V_REPID = SY-REPID.
    PERFORM BUILD_FIELDCATLOG.
    PERFORM EVENT_CALL.
    PERFORM POPULATE_EVENT.
    START-OF-SELECTION.
    PERFORM DATA_RETRIEVAL.
    PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
    PERFORM DISPLAY_ALV_REPORT.
    *& Form BUILD_FIELDCATLOG
    Fieldcatalog has all the field details from ekko
    FORM BUILD_FIELDCATLOG.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'EBELN'.
    WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'AEDAT'.
    WA_FIELDCAT-SELTEXT_M = 'DATE.'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'BUKRS'.
    WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'BUKRS'.
    WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'LIFNR'.
    WA_FIELDCAT-NO_OUT = 'X'.
    WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    ENDFORM. "BUILD_FIELDCATLOG
    *& Form EVENT_CALL
    we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    I_LIST_TYPE = 0
    IMPORTING
    ET_EVENTS = V_EVENTS
    EXCEPTIONS
    LIST_TYPE_WRONG = 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.
    ENDFORM. "EVENT_CALL
    *& Form POPULATE_EVENT
    Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT.
    READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
    IF SY-SUBRC EQ 0.
    WA_EVENT-FORM = 'TOP_OF_PAGE'.
    MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
    ENDIF.
    READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
    IF SY-SUBRC EQ 0.
    WA_EVENT-FORM = 'USER_COMMAND'.
    MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-NAME.
    ENDIF.
    ENDFORM. "POPULATE_EVENT
    *& Form data_retrieval
    retreiving values from the database table ekko
    FORM DATA_RETRIEVAL.
    SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
    ENDFORM. "data_retrieval
    *& Form bUild_listheader
    text
    -->I_LISTHEADEtext
    FORM BUILD_LISTHEADER USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
    DATA HLINE TYPE SLIS_LISTHEADER.
    HLINE-INFO = 'this is my first alv pgm'.
    HLINE-TYP = 'H'.
    ENDFORM. "build_listheader
    *& Form display_alv_report
    text
    FORM DISPLAY_ALV_REPORT.
    V_REPID = SY-REPID.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = V_REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
    I_GRID_TITLE = I_TITLE_EKKO
    I_GRID_SETTINGS =
    IS_LAYOUT = ALV_LAYOUT
    IT_FIELDCAT = I_FIELDCAT[]
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    i_default = 'ZLAY1'
    I_SAVE = 'A'
    is_variant = i_variant
    IT_EVENTS = V_EVENTS
    TABLES
    T_OUTTAB = IT_EKKO
    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.
    ENDFORM. "display_alv_report
    *& Form TOP_OF_PAGE
    text
    FORM TOP_OF_PAGE.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = IT_LISTHEADER
    i_logo =
    I_END_OF_LIST_GRID =
    ENDFORM. "TOP_OF_PAGE
    *& Form USER_COMMAND
    text
    -->R_UCOMM text
    -->, text
    -->RS_SLEFIELDtext
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
    CASE R_UCOMM.
    WHEN '&IC1'.
    READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
    PERFORM BUILD_FIELDCATLOG_EKPO.
    PERFORM EVENT_CALL_EKPO.
    PERFORM POPULATE_EVENT_EKPO.
    PERFORM DATA_RETRIEVAL_EKPO.
    PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
    PERFORM DISPLAY_ALV_EKPO.
    ENDCASE.
    ENDFORM. "user_command
    *& Form BUILD_FIELDCATLOG_EKPO
    text
    FORM BUILD_FIELDCATLOG_EKPO.
    WA_FIELDCAT-TABNAME = 'IT_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'EBELN'.
    WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'EBELP'.
    WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'MATNR'.
    WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'MENGE'.
    WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'MEINS'.
    WA_FIELDCAT-SELTEXT_M = 'UOM'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'NETPR'.
    WA_FIELDCAT-SELTEXT_M = 'PRICE'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    ENDFORM. "BUILD_FIELDCATLOG_EKPO
    *& Form event_call_ekpo
    we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL_EKPO.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    I_LIST_TYPE = 0
    IMPORTING
    ET_EVENTS = V_EVENTS
    EXCEPTIONS
    LIST_TYPE_WRONG = 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.
    ENDFORM. "event_call_ekpo
    *& Form POPULATE_EVENT
    Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT_EKPO.
    READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
    IF SY-SUBRC EQ 0.
    WA_EVENT-FORM = 'TOP_OF_PAGE'.
    MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
    ENDIF.
    ENDFORM. "POPULATE_EVENT
    *& Form TOP_OF_PAGE
    text
    FORM F_TOP_OF_PAGE.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = IT_LISTHEADER
    i_logo =
    I_END_OF_LIST_GRID =
    ENDFORM. "TOP_OF_PAGE
    *& Form USER_COMMAND
    text
    -->R_UCOMM text
    -->, text
    -->RS_SLEFIELDtext
    *retreiving values from the database table ekko
    FORM DATA_RETRIEVAL_EKPO.
    SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.
    ENDFORM.
    FORM BUILD_LISTHEADER_EKPO USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
    DATA: HLINE1 TYPE SLIS_LISTHEADER.
    HLINE1-TYP = 'H'.
    HLINE1-INFO = 'CHECKING PGM'.
    ENDFORM.
    FORM DISPLAY_ALV_EKPO.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER = ' '
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = V_REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = 'F_USER_COMMAND'
    I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
    I_CALLBACK_HTML_TOP_OF_PAGE = ' '
    I_CALLBACK_HTML_END_OF_LIST = ' '
    I_STRUCTURE_NAME =
    I_BACKGROUND_ID = ' '
    I_GRID_TITLE = I_TITLE_EKPO
    I_GRID_SETTINGS =
    IS_LAYOUT =
    IT_FIELDCAT = I_FIELDCAT[]
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT =
    I_SAVE = 'A'
    IS_VARIANT =
    IT_EVENTS = V_EVENTS
    TABLES
    T_OUTTAB = IT_EKPO
    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.
    ENDFORM.
    regards
    aswin

  • Interactive reports

    1)How to move from any list to any list ?
    2)when v r calling a transaction from report in interactive report, will it be counted as a secondary list?

    hI
    BY USEING SY-LSIND WE CAN MOVE FROM ONE LIST TO ANOTHER LIST LIKE THSI
    case sy-lsind.
    when 1.
    when 2.
    when 3.
    when 4.
    when 5.
    sy-lsind = 3.
    when others.
    endcase.
    YES WHEN WE ARE CALLING A TRANSACTION AS THE LIST IT WILL ACT LIKE AS A SECONDARY LIST
    EXAMPE
    *& Report  ZTEST_ALV_LOGO
    REPORT  ztest_alv_logo.
    TYPE-POOLS : slis.
    *ALV Formatting tables /structures
    DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: gt_events   TYPE slis_t_event.
    DATA: gs_layout   TYPE slis_layout_alv.
    DATA: gt_page     TYPE slis_t_listheader.
    DATA: gs_page     TYPE slis_listheader.
    DATA: v_repid     LIKE sy-repid.
    *ALV Formatting work area
    DATA: w_fieldcat TYPE slis_fieldcat_alv.
    DATA: w_events   TYPE slis_alv_event.
    DATA: gt_bsid TYPE TABLE OF bsid WITH HEADER LINE.
    INITIALIZATION.
      PERFORM build_events.
      PERFORM build_page_header.
    START-OF-SELECTION.
    *perform build_comment.     "top_of_page - in initialization at present
      SELECT * FROM bsid INTO TABLE gt_bsid UP TO 10 ROWS.
    *perform populate_for_fm using '1' '3' 'BUKRS' '8' 'GT_BSID' 'Whee'.
    *USING = Row, Column, Field name, display length, table name, heading
    *OR
      PERFORM build_fieldcat.
      gs_layout-zebra = 'X'.
    *top of page event does not work without I_callback_program
      v_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program                = v_repid
          i_structure_name                  = 'BSID'
       i_background_id                   = 'ALV_BACKGROUND'
          i_grid_title                      = 'This is the grid title'
      I_GRID_SETTINGS                   =
          is_layout                         = gs_layout
          it_fieldcat                       = gt_fieldcat[]
          it_events                         = gt_events[]
        TABLES
          t_outtab                          = gt_bsid.
    Form..............:  populate_for_fm
    Description.......:  Populates fields for function module used in ALV
    FORM populate_for_fm USING p_row
                               p_col
                               p_fieldname
                               p_len
                               p_table
                               p_desc.
      w_fieldcat-row_pos      = p_row.          "Row Position
      w_fieldcat-col_pos      = p_col.          "Column Position
      w_fieldcat-fieldname    = p_fieldname.    "Field name
      w_fieldcat-outputlen    = p_len.          "Column Lenth
      w_fieldcat-tabname      = p_table.        "Table name
      w_fieldcat-reptext_ddic = p_desc.         "Field Description
      w_fieldcat-input        = '1'.
      APPEND w_fieldcat TO gt_fieldcat.
      CLEAR w_fieldcat.
    ENDFORM.                    " populate_for_fm
    *&      Form  build_events
    FORM build_events.
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = gt_events.
      READ TABLE gt_events
                 WITH KEY name =  slis_ev_user_command
                 INTO ls_event.
      IF sy-subrc = 0.
        MOVE slis_ev_user_command TO ls_event-form.
        APPEND ls_event TO gt_events.
      ENDIF.
      READ TABLE gt_events
                 WITH KEY name =  slis_ev_top_of_page
                 INTO ls_event.
      IF sy-subrc = 0.
        MOVE slis_ev_top_of_page TO ls_event-form.
        APPEND ls_event TO gt_events.
      ENDIF.
    ENDFORM.                    " build_events
    *&      Form  USER_COMMAND
    When user command is called it uses 2 parameters. The itab
    passed to the ALV is in whatever order it currently is on screen.
    Therefore, you can read table itab index rs_selfield-tabindex to get
    all data from the table. You can also check r_ucomm and code
    accordingly.
    FORM user_command USING  r_ucomm     LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
      READ TABLE gt_bsid INDEX rs_selfield-tabindex.
    error checking etc.
      SET PARAMETER ID 'KUN' FIELD gt_bsid-kunnr.
      CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
    ENDFORM.                    "user_command
    *&      Form  top_of_page
    Your own company logo can go here if it has been saved (OAOR)
    If the logo is larger than the size of the headings in gt_page,
    the window will not show full logo and will have a scroll bar. Thus,
    it is a good idea to have a standard ALV header if you are going to
    use logos in your top of page.
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = gt_page
          i_logo             = 'ENJOYSAP_LOGO'.
    ENDFORM.                    "top_of_page
    *&      Form  build_fieldcat
    *Many and varied fields are available here. Have a look at documentation
    *for FM REUSE_ALV_LIST_DISPLAY and REUSE_ALV_FIELDCATALOG_MERGE
    FORM build_fieldcat.
      w_fieldcat-fieldname  = 'BUDAT'.
      w_fieldcat-seltext_m  = 'Dte pst'.
      w_fieldcat-ddictxt(1) = 'M'.
      w_fieldcat-edit = 'x'.
    Can change the position of fields if you do not want them in order
    of the DDIC or itab
    w_fieldcat-row_pos = '1'.
    w_fieldcat-col_pos = '10'.
      APPEND w_fieldcat TO gt_fieldcat.
      CLEAR w_fieldcat.
    ENDFORM.                    " build_fieldcat
    *&      Form  build_page_header
          gt_page is used in top of page (ALV subroutine - NOT event)
          *H = Header, S = Selection, A = Action
    FORM build_page_header.
    For Headers, Key is not printed and is irrelevant. Will not cause
    a syntax error, but is not used.
      gs_page-typ  = 'H'.
      gs_page-info = 'Header 1'.
      APPEND gs_page TO gt_page.
      gs_page-typ  = 'H'.
      gs_page-info = 'Header 2'.
      APPEND gs_page TO gt_page.
    For Selections, the Key is printed (bold). It can be anything up to 20
    bytes. It gets printed in order of code here, not by key value.
      gs_page-typ  = 'S'.
      gs_page-key  = 'And the winner is:'.
      gs_page-info = 'Selection 1'.
      APPEND gs_page TO gt_page.
      gs_page-typ  = 'S'.
      gs_page-key  = 'Runner up:'.
      gs_page-info = 'Selection 2'.
      APPEND gs_page TO gt_page.
    For Action, Key is also irrelevant.
      gs_page-typ  = 'A'.
      gs_page-info = 'Action goes here'.
      APPEND gs_page TO gt_page.
    ENDFORM.                    " build_page_header

  • Interactive Reports - SQL Source Question

    Background
    Apex 3.1 is installed on Oracle 10g instance on local machine but all data is stored on a remote machine on Oracle 9 & 10 instances.
    This data is also used by another piece of software, which directly manipulates the data.
    The Apex Application that I am developing is to be used as a Quick Find/KPI Reporting tool and is setup to utilise DBLinks and Synonyms.
    Within the remote data, we have a mapping table that contains user specific alias' for field names, which the users set using the other piece of software. There can be up to 5 mappings per table field each defined as LNG01, LNG02,etc.
    In order to provide the same field Alias' in the Apex application, I have created a PL/SQL function to return the field alias and return a string value containing the final SQL.
    Problem
    In standard reports, this would work correctly as you could return a SQL statement in a string and it handled it with no problems.
    However, due to Interactive Reports not supporting this, I have tried to find code to pass in the string SQL Statement to return a TABLE or PIPELINED datasource.
    The string SQL statement will vary for each time it is used so the string SQL statement is effectively built as dynamic SQL
    This causes as problem as I will never be able to define the ROWTYPE for a type TABLE variable as the field names will not be constant.
    Can you tell me if there is any way to create a SQL source that could be used for the Interactive Report based on dynamic SQL?
    Alternatively, if you can provide any alternatives to finding a solution I would be most grateful.
    Apologies if this question has been posted before.
    Thanks in advance.
    Stuart

    Stuart,
    You could:
    1) Create page items, one for each dynamic column header (e.g. P1_OBJECT_NAME_HEADER, etc).
    2) Create a page process, to run when the page is loaded, that populates each item with the appropriate text. This can pull the column header text from your remote source.
    3) Use a static query as your interactive report source:
        select objname,
               objuniqueid,
               objtypecode,
               objsitearea,
               objdesc,
               objdesc2,
               objlocationid,
               objcommission
          from cdoweb_om4) Edit the interactive report attributes -- use APEX substitution string syntax to reference the item values (e.g. "&P1_OBJECT_NAME_HEADER." without the quotes) instead of static column headers.
    For more information on using substitution strings:
    http://download.oracle.com/docs/cd/E10513_01/doc/appdev.310/e10499/concept.htm#BEIFGFJF
    - Marco

  • HOW TO DEVELOP AN INTERACTIVE REPORT

    HI,
         How to Develop  an interactive report to display sales orders for particular customer, items for particular order.

    Hi,
    Look at the below sample Program for the Interactive ALV report.
    *& Report  Z_INTERACTIVE_ALV3                                          *
    report  z_interactive_alv4    no standard page heading line-size 650
    message-id zz_9838                      .
    type-pools: slis.
    *type declaration for values from ekko
    types: begin of i_ekko,
           ebeln like ekko-ebeln,
           aedat like ekko-aedat,
           bukrs like ekko-bukrs,
           bsart like ekko-bsart,
           lifnr like ekko-lifnr,
           end of i_ekko.
    data: it_ekko type standard table of i_ekko initial size 0,
          wa_ekko type i_ekko.
    *type declaration for values from ekpo
    types: begin of i_ekpo,
           ebeln like ekpo-ebeln,
           ebelp like ekpo-ebelp,
           matnr like ekpo-matnr,
           menge like ekpo-menge,
           meins like ekpo-meins,
           netpr like ekpo-netpr,
           end of i_ekpo.
    data: it_ekpo type standard table of i_ekpo initial size 0,
          wa_ekpo type i_ekpo .
    *variable for Report ID
    data: v_repid like sy-repid .
    *declaration for fieldcatalog
    data: i_fieldcat type slis_t_fieldcat_alv,
          wa_fieldcat type slis_fieldcat_alv.
    data: it_listheader type slis_t_listheader.
    declaration for events table where user comand or set PF status will
    be defined
    data: v_events type slis_t_event,
          wa_event type slis_alv_event.
    declartion for layout
    data: alv_layout type slis_layout_alv.
    declaration for variant(type of display we want)
    data: i_variant type disvariant,
          i_variant1 type disvariant,
          i_save(1) type c.
    *PARAMETERS : p_var TYPE disvariant-variant.
    *Title displayed when the alv list is displayed
    data:  i_title_ekko type lvc_title value 'FIRST LIST DISPLAYED'.
    data:  i_title_ekpo type lvc_title value 'SECONDRY LIST DISPLAYED'.
    initialization.
      v_repid = sy-repid.
      perform build_fieldcatlog.
      perform event_call.
      perform populate_event.
    start-of-selection.
      perform data_retrieval.
      perform build_listheader using it_listheader.
      perform display_alv_report.
    *&      Form  BUILD_FIELDCATLOG
          Fieldcatalog has all the field details from ekko
    form build_fieldcatlog.
      wa_fieldcat-tabname = 'IT_EKKO'.
      wa_fieldcat-fieldname = 'EBELN'.
      wa_fieldcat-seltext_m = 'PO NO.'.
      append wa_fieldcat to i_fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-tabname = 'IT_EKKO'.
      wa_fieldcat-fieldname = 'AEDAT'.
      wa_fieldcat-seltext_m = 'DATE.'.
      append wa_fieldcat to i_fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-tabname = 'IT_EKKO'.
      wa_fieldcat-fieldname = 'BUKRS'.
      wa_fieldcat-seltext_m = 'COMPANY CODE'.
      append wa_fieldcat to i_fieldcat.
      clear wa_fieldcat.
    wa_fieldcat-tabname = 'IT_EKKO'.
      wa_fieldcat-fieldname = 'BUKRS'.
      wa_fieldcat-seltext_m = 'DOCMENT TYPE'.
      append wa_fieldcat to i_fieldcat.
      clear wa_fieldcat.
    wa_fieldcat-tabname = 'IT_EKKO'.
      wa_fieldcat-fieldname = 'LIFNR'.
      wa_fieldcat-no_out    = 'X'.
      wa_fieldcat-seltext_m = 'VENDOR CODE'.
      append wa_fieldcat to i_fieldcat.
      clear wa_fieldcat.
    endform.                    "BUILD_FIELDCATLOG
    *&      Form  EVENT_CALL
      we get all events - TOP OF PAGE or USER COMMAND in table v_events
    form event_call.
      call function 'REUSE_ALV_EVENTS_GET'
       exporting
         i_list_type           = 0
       importing
         et_events             = v_events
    EXCEPTIONS
       LIST_TYPE_WRONG       = 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.
    endform.                    "EVENT_CALL
    *&      Form  POPULATE_EVENT
         Events populated for TOP OF PAGE & USER COMAND
    form populate_event.
      read table v_events into wa_event with key name = 'TOP_OF_PAGE'.
      if sy-subrc eq 0.
        wa_event-form = 'TOP_OF_PAGE'.
        modify v_events from wa_event transporting form where name =
    wa_event-form.
      endif.
      read table v_events into wa_event with key name = 'USER_COMMAND'.
      if sy-subrc eq 0.
        wa_event-form = 'USER_COMMAND'.
        modify v_events from wa_event transporting form where name =
    wa_event-name.
      endif.
    endform.                    "POPULATE_EVENT
    *&      Form  data_retrieval
      retreiving values from the database table ekko
    form data_retrieval.
      select ebeln aedat bukrs bsart lifnr from ekko into table it_ekko.
    endform.                    "data_retrieval
    *&      Form  bUild_listheader
          text
         -->I_LISTHEADEtext
    form build_listheader using i_listheader type slis_t_listheader.
      data hline type slis_listheader.
      hline-info = 'this is my first alv pgm'.
      hline-typ = 'H'.
    endform.                    "build_listheader
    *&      Form  display_alv_report
          text
    form display_alv_report.
      v_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
         i_callback_program                = v_repid
      I_CALLBACK_PF_STATUS_SET          = ' '
         i_callback_user_command           = 'USER_COMMAND'
         i_callback_top_of_page            = 'TOP_OF_PAGE'
         i_grid_title                      = i_title_ekko
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         = ALV_LAYOUT
         it_fieldcat                       = i_fieldcat[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
        i_default                         = 'ZLAY1'
         i_save                            = 'A'
        is_variant                        = i_variant
         it_events                         = v_events
        tables
          t_outtab                          = it_ekko
    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.
    endform.                    "display_alv_report
    *&      Form  TOP_OF_PAGE
          text
    form top_of_page.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
        exporting
          it_list_commentary       = it_listheader
       i_logo                   =
       I_END_OF_LIST_GRID       =
    endform.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    form user_command using r_ucomm like sy-ucomm
    rs_selfield type slis_selfield.
      case r_ucomm.
        when '&IC1'.
          read table it_ekko into wa_ekko index rs_selfield-tabindex.
          perform build_fieldcatlog_ekpo.
          perform event_call_ekpo.
          perform populate_event_ekpo.
          perform data_retrieval_ekpo.
          perform build_listheader_ekpo using it_listheader.
          perform display_alv_ekpo.
      endcase.
    endform.                    "user_command
    *&      Form  BUILD_FIELDCATLOG_EKPO
          text
    form build_fieldcatlog_ekpo.
      wa_fieldcat-tabname = 'IT_EKPO'.
      wa_fieldcat-fieldname = 'EBELN'.
      wa_fieldcat-seltext_m = 'PO NO.'.
      append wa_fieldcat to i_fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-tabname = 'IT_EKPO'.
      wa_fieldcat-fieldname = 'EBELP'.
      wa_fieldcat-seltext_m = 'LINE NO'.
      append wa_fieldcat to i_fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-tabname = 'I_EKPO'.
      wa_fieldcat-fieldname = 'MATNR'.
      wa_fieldcat-seltext_m = 'MATERIAL NO.'.
      append wa_fieldcat to i_fieldcat.
      clear wa_fieldcat.
    wa_fieldcat-tabname = 'I_EKPO'.
      wa_fieldcat-fieldname = 'MENGE'.
      wa_fieldcat-seltext_m = 'QUANTITY'.
      append wa_fieldcat to i_fieldcat.
      clear wa_fieldcat.
    wa_fieldcat-tabname = 'I_EKPO'.
      wa_fieldcat-fieldname = 'MEINS'.
      wa_fieldcat-seltext_m = 'UOM'.
      append wa_fieldcat to i_fieldcat.
      clear wa_fieldcat.
    wa_fieldcat-tabname = 'I_EKPO'.
      wa_fieldcat-fieldname = 'NETPR'.
      wa_fieldcat-seltext_m = 'PRICE'.
      append wa_fieldcat to i_fieldcat.
      clear wa_fieldcat.
    endform.                    "BUILD_FIELDCATLOG_EKPO
    *&      Form  event_call_ekpo
      we get all events - TOP OF PAGE or USER COMMAND in table v_events
    form event_call_ekpo.
      call function 'REUSE_ALV_EVENTS_GET'
       exporting
         i_list_type           = 0
       importing
         et_events             = v_events
    EXCEPTIONS
      LIST_TYPE_WRONG       = 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.
    endform.                    "event_call_ekpo
    *&      Form  POPULATE_EVENT
           Events populated for TOP OF PAGE & USER COMAND
    form populate_event_ekpo.
      read table v_events into wa_event with key name = 'TOP_OF_PAGE'.
      if sy-subrc eq 0.
        wa_event-form = 'TOP_OF_PAGE'.
        modify v_events from wa_event transporting form where name =
    wa_event-form.
      endif.
      endform.                    "POPULATE_EVENT
    *&      Form  TOP_OF_PAGE
          text
    form f_top_of_page.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
        exporting
          it_list_commentary       = it_listheader
       i_logo                   =
       I_END_OF_LIST_GRID       =
    endform.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    *retreiving values from the database table ekko
    form data_retrieval_ekpo.
    select ebeln ebelp matnr menge meins netpr from ekpo into table it_ekpo.
    endform.
    form build_listheader_ekpo using i_listheader type slis_t_listheader.
    data: hline1 type slis_listheader.
    hline1-typ = 'H'.
    hline1-info = 'CHECKING PGM'.
    endform.
    form display_alv_ekpo.
    call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       i_callback_program                = v_repid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = 'F_USER_COMMAND'
       i_callback_top_of_page            = 'TOP_OF_PAGE'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
       i_grid_title                      = i_title_ekpo
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
       it_fieldcat                       = i_fieldcat[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         =
       i_save                            = 'A'
      IS_VARIANT                        =
       it_events                         = v_events
      tables
        t_outtab                          = it_ekpo
    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.
    endform.
    Regards,
    Ram
    Reward points if helpful

  • Difference between class report and interactive report

    please give me the differences between  classical report and interactive report

    Hi,read the following :
    In ABAP, there are a total of 7 types of reports. They are:
    Classical Reports
    Interactive Reports
    Logical Database Reports
    ABAP query
    ALV Reports (ALV stands for ABAP List Viewer)
    Report Writer/Report Painter
    Views (There are different types of views also)
    Classical Reports
    These are the most simple reports. It is just an output of data using the Write statement inside a loop.
    Classical reports are normal reports. These reports are not having any sub reports. IT IS HAVING ONLY ONE SCREEN/LIST FOR OUTPUT
    Interactive Reports
    As the name suggests, the user can Interact with the report. We can have a drill down into the report data. For example, Column one of the report displays the material numbers, and the user feels that he needs some more specific data about the vendor for that material, he can HIDE that data under those material numbers.
    And when the user clicks the material number, another report (actually sub report/secondary list) which displays the vendor details will be displayed.
    We can have a basic list (number starts from 0) and 20 secondary lists (1 to 21).
    Logical Database Reports
    Logical database is another tool for ABAP reports. Using LDB we can provide extra features for ABAP reports.
    While using LDB there is no need for us to declare Parameters.
    Selection-screen as they will be generated automatically.
    We have to use the statement NODES in ABAP report.
    ABAP Query Reports
    ABAP query is another tool for ABAP. It provides efficency for ABAP reports. These reports are very accurate.
    Transaction Code : SQ01
    Report Writer / Report painter
    Super users and end users can use Report Painter/Report Writer tools to write their own reports.
    Giving them the ability to report on additional fields at their discretion shifts the report maintenance burden to them, saving SAP support groups time and effort normally spent creating and maintaining the reports.
    ALV reports
    Sap provides a set of ALV (ABAP LIST VIEWER) function modules which can be put into use to embellish the output of a report. This set of ALV functions is used to enhance the readability and functionality of any report output. Cases arise in sap when the output of a report contains columns extending more than 255 characters in length.
    In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output.
    The report output can contain up to 90 columns in the display with the wide array of display options.
    There is no difference between drill down and interactive report, they are the same.
    With drilldown reporting, SAP provides you with an interactive information system to let you evaluate the data collected in your application. This information system is capable of analyzing all the data according to any of the characteristics that describe the data. You can also use any key figures you wish to categorize your data. You can display a number of objects for a given key figure, or a number of key figures for a given object. In addition, the system lets you carry out any number of variance analyses (such as plan/actual comparisons, fiscal year comparisons, comparisons of different objects, and so on).
    *More on Classical Vs Interactive*
    Classical Reports
    These are the most simple reports. Programmers learn this one first. It is just an output of data using the Write statement inside a loop.
    Classical reports are normal reports. These reports are not having any sub reports. IT IS HAVING ONLY ONE SCREEN/LIST FOR OUTPUT.
    Events In Classical Reports.
    INTIALIZATION: This event triggers before selection screen display.
    AT-SELECTION-SCREEN: This event triggers after proccesing user input still selection screen is in active mode.
    START OF SELECTION: Start of selection screen triggers after proceesing selection screen.
    END-OF-SELECTION : It is for Logical Database Reporting.
    Interactive Reports
    As the name suggests, the user can Interact with the report. We can have a drill down into the report data. For example, Column one of the report displays the material numbers, and the user feels that he needs some more specific data about the vendor for that material, he can HIDE that data under those material numbers.
    And when the user clicks the material number, another report (actually sub report/secondary list) which displays the vendor details will be displayed.
    We can have a basic list (number starts from 0) and 20 secondary lists (1 to 21).
    Events associated with Interactive Reports are:
    1. AT LINE-SELECTION
    2. AT USER-COMMAND
    3. AT PF<key>
    4. TOP-OF-PAGE DURING LINE-SELECTION.
    HIDE statement holds the data to be displayed in the secondary list.
    sy-lisel : contains data of the selected line.
    sy-lsind : contains the level of report (from 0 to 21)
    Interactive Report Events:
    AT LINE-SELECTION : This Event triggers when we double click a line on the list, when the event is triggered a new sublist is going to be generated. Under this event what ever the statements that are been return will be displayed on newly generated sublist.
    AT PFn: For predefined function keys...
    AT USER-COMMAND : It provides user functions keys.
    TOP-OF-PAGE DURING LINE-SELECTION :top of page event for secondary list.
    Reward if found helpful

  • Interactive Reports using Collections

    I need to prepare queries dynamically using PLSQL on apex 3.2; Since interactive reports are currently supported only using SQL queries , I am storing the results in a collection and then retrieving the results from the collection. I got this working and my report is returning the expected results, but I am running into a couple of issues.
    1. One of my reasons for switching to interactive report feature is to be able to let the user apply aggregate functions like sum, avg. etc. on numeric columns. But since the datatype for all collection columns are of type string , I can't use the aggregate functions now. Is it possible to change the string datatype to another datatype?
    2. the column headers are C01, C02 .. C50 ; Based on user input values, the actual query that is chosen to run is dynamically determined and the no. and the order of columns returned can vary depending on the query that was run. So I cannot manually change/map the C01, C02 ... headers to the column header names that I want. How do I dynamically generate the column headers?
    Any help is appreciated.
    Thanks.

    Hi Bill,
    Without knowing more about the PL/SQL code, the underlying tables and the select statements used, it is difficult to say.
    I would firstly check that I had indexes on the right column or combination of columns. One minute sounds a lot for a query to me, but that may be ok if the tables are very large and the PL/SQL has to do a fair bit to construct the output. You could also do an Explain Plan for any query to check to see if indexes are being used if they exist - this would also show up any part of a query that takes an inordinate amount of time.
    I assume that the PL/SQL is only run once even if the page is reloaded multiple times? However, once the collection has been created, the report itself should be fairly quick as it should be just a simple select over the collection data. Switching on the debug mode should help identify which part is taking the time.
    Andy

  • Hirarchy of interactive report

    Hi Gurus,
    Please tell me what is the meaning of "Hirarchy of an interactive report"?

    HI
    refer this code.
    *&  Include           Z_TABLE_DISPLAY
    VERSION 2
    Code from François Henrotte (EPONA Solutions)
                                http://www.eponasolutions.com
                                Belgium
    Please keep reference !
    HOW TO
    Display an ALV grid :
    CALL METHOD lcl_table_display=>display_grid( 'tabname' ).
    Display a hierarchical list with header and detail :
    CALL METHOD lcl_table_display=>display_hier( in_header = 'table1'
                                                 in_detail = 'table2' ).
    Display a block list with two tables :
    CALL METHOD lcl_table_display=>set_block_mode( 'X' ).
    CALL METHOD lcl_table_display=>display_grid( 'table1' ).
    CALL METHOD lcl_table_display=>display_grid( 'table2' ).
    CALL METHOD lcl_table_display=>end_block_list( ).
    You never have to deal with field catalog of tables !!
    What if field catalog has to be changed anyway ?
    ob_table = lcl_table_display=>create_table( 'tabname' ).
    CALL METHOD ob_table->set_alv_fieldtext( in_field = field
                                             in_ftext = 'text' ).
    CALL METHOD lcl_table_display=>display_grid( 'tabname' ).
    type-pools: abap, slis.
      LCL_TABLE_DISPLAY DEFINITION
    class lcl_table_display definition.
      public section.
        class-methods: display_list importing in_tabname  type any,
                       display_grid importing in_tabname  type any,
                       display_hier importing in_header   type any
                                              in_detail   type any
                                              in_level    type i optional,
                       set_block_mode importing in_mode type c,
                       set_block_text importing in_text type any,
                       end_block_list importing in_print
                                           type slis_print_alv optional
                                     exceptions display_error,
                       create_table
                         importing
                           in_tabname type tabname
                         returning
                           value(out_table) type ref to lcl_table_display
                         exceptions
                           create_error,
                       get_existing_table
                         importing
                           in_tabname type any optional
                           in_repid   type any optional
                           in_struc   type any optional
                         returning
                           value(out_table) type ref to lcl_table_display
                         exceptions
                           no_parameter
                           not_found,
                       refresh_objects.
        methods: constructor importing in_data type standard table
                             exceptions casting_error
                                        empty_fieldcat.
        methods: get_alv_fieldcat  returning value(out_fieldcat)
                                        type slis_t_fieldcat_alv.
        methods: set_table_name     importing in_tabname  type any,
                 set_alv_title      importing in_title    type any,
                 set_alv_fieldcat   importing in_fieldcat
                                         type slis_t_fieldcat_alv,
                 set_alv_fieldnoout importing in_field    type any
                                              in_noout    type c optional
                                              in_tech     type c optional,
                 set_alv_fieldedit  importing in_field    type any
                                              in_edit     type c optional,
                 set_alv_fieldtext  importing in_field    type any
                                              in_ftext    type any,
                 set_alv_fieldsum   importing in_field    type any
                                              in_dosum    type c optional,
                 set_alv_linebreak  importing in_field    type any,
                 set_alv_settings   importing in_settings type any,
                 set_alv_layout     importing in_layout   type any,
                 set_alv_print      importing in_print    type any,
                 set_alv_sorting    importing in_field    type any
                                              in_desc     type c optional
                                              in_group    type any optional
                                              in_subtot   type c optional,
                 set_alv_keys       importing in_level    type i
                                              in_key      type c optional,
                 set_alv_event      importing in_name     type any
                                              in_form     type any,
                 set_all_events.
      protected section.
        data: g_table_type type slis_list_type.
        data: g_title      type lvc_title,
              gt_fcat      type slis_t_fieldcat_alv,
              gs_sett      type lvc_s_glay,
              gs_layo      type slis_layout_alv,
              gt_sort      type slis_t_sortinfo_alv,
              gt_evnt      type slis_t_event,
              gs_prin      type slis_print_alv.
        class-methods: output_hierarchy exceptions display_error.
        methods: output_table importing mode type c
                             exceptions display_error,
                 output_list,
                 output_grid.
      private section.
        class-data: gt_table_obj   type table of ref to lcl_table_display,
                    g_header_table type ref to lcl_table_display,
                    g_detail_table type ref to lcl_table_display.
        class-data: g_variant_level type i.
        class-data: g_block_mode    type c,
                    g_block_text    type slis_text40.
        types: begin of ty_defin,
                 fieldname     type fieldname,
                 ref_tabname   type tabname,
                 ref_fieldname type fieldname,
               end of ty_defin.
        data: g_repid  type repid,
              g_struc  type tabname,
              g_table  type tabname.
        data: gt_data  type ref to data.
        data: gt_defin type table of ty_defin,
              g_level  type tabname.
        methods: init_block_list,
                 fill_fieldcat importing repid type repid
                                         struc type tabname
                                changing fcat  type slis_t_fieldcat_alv
                              exceptions no_definition,
                 get_definition importing repid type repid
                                          struc type tabname
                                 changing abap  type rsfb_source,
                 recursive_definition importing repid type repid
                                       changing abap  type rsfb_source,
                 map_structure importing source type any
                                changing destin type any,
                 get_default_variant changing out_variant type disvariant.
    endclass.                    "lcl_table_display DEFINITION
      LCL_TABLE_DISPLAY IMPLEMENTATION
    class lcl_table_display implementation.
      Display table in ALV list
      method display_list.
        data: l_object  type ref to lcl_table_display,
              l_tabname type tabname,
              l_found   type c.
        l_tabname = in_tabname.
        loop at gt_table_obj into l_object.
          if l_object->g_table = l_tabname.
            l_found = 'X'.
            exit.
          endif.
        endloop.
        if l_found is initial.
          l_object = lcl_table_display=>create_table( l_tabname ).
          if g_block_mode is initial.
            l_object->g_table_type = 4.
          else.
            l_object->g_table_type = 2.
          endif.
          call method l_object->set_all_events.
        endif.
        call method l_object->output_list.
      endmethod.                    "display_list
      Display table in ALV grid
      method display_grid.
        data: l_object  type ref to lcl_table_display,
              l_tabname type tabname,
              l_found   type c.
        l_tabname = in_tabname.
        loop at gt_table_obj into l_object.
          if l_object->g_table = l_tabname.
            l_found = 'X'.
            exit.
          endif.
        endloop.
        if l_found is initial.
          l_object = lcl_table_display=>create_table( l_tabname ).
          if g_block_mode is initial.
            l_object->g_table_type = 4.
          else.
            l_object->g_table_type = 2.
          endif.
          call method l_object->set_all_events.
        endif.
        if g_block_mode is initial.
          call method l_object->output_grid.
        else.
          call method l_object->output_list.
        endif.
      endmethod.                    "display_grid
      Display tables in ALV hierarchy
      method display_hier.
        data: l_tabnam1 type tabname,
              l_tabnam2 type tabname,
              lt_fcat1  type slis_t_fieldcat_alv,
              lt_fcat2  type slis_t_fieldcat_alv,
              ls_fcat1  type slis_fieldcat_alv,
              ls_fcat2  type slis_fieldcat_alv.
        l_tabnam1 = in_header.
        l_tabnam2 = in_detail.
        call method lcl_table_display=>get_existing_table
          exporting
            in_tabname = l_tabnam1
          receiving
            out_table  = g_header_table
          exceptions
            not_found  = 1.
        if sy-subrc ne 0.
          g_header_table = lcl_table_display=>create_table( l_tabnam1 ).
          if g_block_mode is initial.
            g_header_table->g_table_type = 1.
          else.
            g_header_table->g_table_type = 3.
          endif.
          call method g_header_table->set_all_events.
        endif.
        call method lcl_table_display=>get_existing_table
          exporting
            in_tabname = l_tabnam2
          receiving
            out_table  = g_detail_table
          exceptions
            not_found  = 1.
        if sy-subrc ne 0.
          g_detail_table = lcl_table_display=>create_table( l_tabnam2 ).
        endif.
      Set key fields
        if in_level is initial.
          lt_fcat1 = g_header_table->get_alv_fieldcat( ).
          lt_fcat2 = g_detail_table->get_alv_fieldcat( ).
          loop at lt_fcat1 into ls_fcat1.
            ls_fcat1-key = space.
            loop at lt_fcat2 into ls_fcat2
                            where fieldname = ls_fcat1-fieldname.
              ls_fcat2-key = space.
              ls_fcat2-key_sel = 'X'.
              ls_fcat2-tech = 'X'.
              modify lt_fcat2 from ls_fcat2 transporting key.
            endloop.
            if sy-subrc = 0.
              ls_fcat1-key = 'X'.
            endif.
            modify lt_fcat1 from ls_fcat1 transporting key.
          endloop.
          call method g_header_table->set_alv_fieldcat
            exporting
              in_fieldcat = lt_fcat1.
          call method g_detail_table->set_alv_fieldcat
            exporting
              in_fieldcat = lt_fcat2.
        else.
          call method g_header_table->set_alv_keys
            exporting
              in_level = in_level.
          call method g_detail_table->set_alv_keys
            exporting
              in_level = in_level
              in_key   = space.
        endif.
        call method output_hierarchy.
      endmethod.                    "display_hier
      Set block mode
      method set_block_mode.
        g_block_mode = in_mode.
      endmethod.                    "set_block_mode
      Set block text
      method set_block_text.
        g_block_text = in_text.
      endmethod.                    "set_block_text
      Create new table
      method create_table.
        data: l_object type ref to lcl_table_display.
        field-symbols: set_table_name
          exporting
            in_tabname = in_tabname.
      Default print options
        l_object->gs_prin-no_print_selinfos  = 'X'.
        l_object->gs_prin-no_coverpage       = 'X'.
        l_object->gs_prin-no_print_listinfos = 'X'.
        out_table = l_object.
      endmethod.                    "create_table
      Get existing table
      method get_existing_table.
        data: l_object  type ref to lcl_table_display,
              l_tabname type tabname,
              l_repid   type repid,
              l_struc   type tabname,
              l_found   type c.
        l_tabname = in_tabname.
        l_repid   = in_repid.
        l_struc   = in_struc.
        if l_tabname is initial.
          if l_repid is initial and
             l_struc is initial.
            raise no_parameter.
          else.
          Get last existing table with same definition
            loop at gt_table_obj into l_object.
              if l_object->g_repid = l_repid and
                 l_object->g_struc = l_struc.
                l_found = 'X'.
                exit.
              endif.
            endloop.
          endif.
        else.
        Get last existing table with same name
          loop at gt_table_obj into l_object.
            if l_object->g_table = l_tabname.
              l_found = 'X'.
              exit.
            endif.
          endloop.
        endif.
        if l_found is initial.
          raise not_found.
        else.
          out_table = l_object.
        endif.
      endmethod.                    "get_existing_table
      Create table display
      method constructor.
        data: l_object type ref to lcl_table_display.
        data: ls_data  type ref to data.
        data: ob_desc  type ref to cl_abap_structdescr.
        data: l_found  type c,
              l_absol  type char200,
              l_repid  type repid,
              l_struc  type tabname.
        field-symbols:  type any.
      Get data and store it into attribute
        create data me->gt_data like in_data.
        assign me->gt_data->* to .
    = in_data.
      Get global data definition
        create data ls_data like line of  ).
        endcatch.
        if sy-subrc = 1.
          raise casting_error.
        endif.
      Get program name and main type used to define table
        l_absol = ob_desc->absolute_name.
        split l_absol at 'TYPE=' into l_repid l_struc.
        shift l_repid up to '='.
        shift l_repid.
        check l_struc np '%_*'.
      Set attributes
        me->g_repid = l_repid.
        me->g_struc = l_struc.
        me->g_table = l_struc.
        replace 'TY' with 'WT' into me->g_table.
      Field catalog
        call method lcl_table_display=>get_existing_table
          exporting
            in_repid  = l_repid
            in_struc  = l_struc
          receiving
            out_table = l_object
          exceptions
            not_found = 1.
        if sy-subrc = 0.
          me->gt_fcat = l_object->get_alv_fieldcat( ).
          call method set_table_name
            exporting
              in_tabname = me->g_table.
        else.
          call method fill_fieldcat
            exporting
              repid = l_repid
              struc = l_struc
            changing
              fcat  = me->gt_fcat.
          if me->gt_fcat is initial.
            raise empty_fieldcat.
          endif.
        endif.
      Keep list of tables
        append me to gt_table_obj.
      endmethod.                    "constructor
      Output list
      method output_list.
        call method output_table
          exporting
            mode = 'L'.
      endmethod.                    "output_list
      Output grid
      method output_grid.
        call method output_table
          exporting
            mode = 'G'.
      endmethod.                    "output_grid
      Output table
      method output_table.
        data: l_object type ref to lcl_table_display.
        data: ls_vari  type disvariant.
        field-symbols: type standard table.
    assign me->gt_data->* to .
    if not g_block_mode is initial.
    read table gt_table_obj into l_object index 1.
    if sy-subrc = 0.
    if l_object->g_table = me->
    g_table.
              call method init_block_list.
            endif.
          endif.
        endif.
      Get default user variant
        call method get_default_variant
          changing
            out_variant = ls_vari.
      Display table contents
        if mode = 'G'.
          call function 'REUSE_ALV_GRID_DISPLAY'
            exporting
              i_callback_program = me->g_repid
              i_grid_title       = me->g_title
              i_grid_settings    = me->gs_sett
              is_layout          = me->gs_layo
              it_fieldcat        = me->gt_fcat
              it_sort            = me->gt_sort
              i_save             = 'U'
              is_variant         = ls_vari
              it_events          = me->gt_evnt
              is_print           = me->gs_prin
            tables
              t_outtab           =
    exceptions
    program_error = 1
    others = 2.
    if sy-subrc <> 0.
    raise display_error.
    endif.
    call method refresh_objects.
    else.
    if g_block_mode is initial.
    call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
    i_callback_program = me->g_repid
    is_layout = me->gs_layo
    it_fieldcat = me->gt_fcat
    it_sort = me->gt_sort
    i_save = 'U'
    is_variant = ls_vari
    it_events = me->gt_evnt
    is_print = me->gs_prin
    tables
    t_outtab =
    exceptions
    others = 0.
    if sy-subrc <> 0.
    raise display_error.
    endif.
    call method refresh_objects.
    else.
    call function 'REUSE_ALV_BLOCK_LIST_APPEND'
    exporting
    is_layout = me->gs_layo
    it_fieldcat = me->gt_fcat
    i_tabname = me->g_table
    it_events = me->gt_evnt
    it_sort = me->gt_sort
    i_text = g_block_text
    tables
    t_outtab =
    exceptions
    program_error = 1
    maximum_of_appends_reached = 2
    others = 3.
    if sy-subrc <>
    0.
              raise display_error.
            endif.
          endif.
        endif.
      endmethod.                    "output_table
      Output hierarchy
      method output_hierarchy.
        data: l_object type ref to lcl_table_display.
        data: lt_fcat  type slis_t_fieldcat_alv,
              lt_sort  type slis_t_sortinfo_alv,
              ls_fcat  type slis_fieldcat_alv,
              ls_vari  type disvariant,
              ls_keyi  type slis_keyinfo_alv.
        data: l_index  type numc2,
              l_field  type fieldname.
        field-symbols: .
      Set key fields as common fields between header and detail
        loop at g_header_table->gt_fcat into ls_fcat
                                       where key = 'X'.
          l_index = l_index + 1.
        Create link
          concatenate 'HEADER' l_index into l_field.
          assign component l_field of structure ls_keyi to init_block_list.
            endif.
          endif.
        endif.
      Get default user variant
        call method g_header_table->get_default_variant
          changing
            out_variant = ls_vari.
        if g_block_mode is initial.
          call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
            exporting
              i_callback_program = g_header_table->g_repid
              is_layout          = g_header_table->gs_layo
              it_fieldcat        = lt_fcat
              it_sort            = lt_sort
              i_save             = 'U'
              is_variant         = ls_vari
              it_events          = g_header_table->gt_evnt
              i_tabname_header   = g_header_table->g_table
              i_tabname_item     = g_detail_table->g_table
              is_keyinfo         = ls_keyi
              is_print           = g_header_table->gs_prin
            tables
              t_outtab_header    =  0.
            raise display_error.
          endif.
        endif.
      endmethod.                    "output_hierarchy
      Init block list
      method init_block_list.
        data:  ls_evnt1 type slis_alv_event,
               ls_evnt2 type slis_alv_event.
      Events for whole list display
        concatenate 'F_' slis_ev_pf_status_set '_BLOCK'
               into ls_evnt1-form.
        concatenate 'F_' slis_ev_user_command '_BLOCK'
               into ls_evnt2-form.
      Initialization of block list
        call function 'REUSE_ALV_BLOCK_LIST_INIT'
          exporting
            i_callback_program       = me->g_repid
            i_callback_pf_status_set = ls_evnt1-form
            i_callback_user_command  = ls_evnt2-form.
      endmethod.                    "init_block_list
      End of block list
      method end_block_list.
        data: l_object type ref to lcl_table_display,
              ls_print type slis_print_alv.
        check not g_block_mode is initial.
        if in_print is supplied.
          ls_print = in_print.
        else.
          read table gt_table_obj into l_object index 1.
          ls_print = l_object->gs_prin.
        endif.
        call function 'REUSE_ALV_BLOCK_LIST_DISPLAY'
          exporting
            is_print      = ls_print
          exceptions
            program_error = 1
            others        = 2.
        if sy-subrc <> 0.
          raise display_error.
        endif.
        call method refresh_objects.
      endmethod.                    "end_block_list
      Refresh table of objects
      method refresh_objects.
        free: gt_table_obj.
      endmethod.
      Fill field catalog
      method fill_fieldcat.
        data: lt_abap   type rsfb_source.
        data: ls_defin  type ty_defin.
        data: lt_dfies  type table of dfies,
              ls_dfies  type dfies,
              ls_dd04v  type dd04v,
              ls_dd01v  type dd01v,
              l_flong   type dfies-lfieldname,
              l_dname   type dfies-domname.
        data: ls_fcat   type slis_fieldcat_alv,
              ls_fcat2  type slis_fieldcat_alv.
        data: l_index   type i,
              l_nbfld   type i.
        free: me->gt_defin.
      Process data definition
        call method get_definition
          exporting
            repid = repid
            struc = struc
          changing
            abap  = lt_abap.
      Process sub levels if required
        call method recursive_definition
          exporting
            repid = repid
          changing
            abap  = lt_abap.
        if me->gt_defin is initial.
          raise no_definition.
        endif.
        loop at me->gt_defin into ls_defin.
          clear: ls_fcat.
          move-corresponding ls_defin to ls_fcat.
        Retrieve info about this field
          free: ls_dfies, ls_dd04v, ls_dd01v, l_dname.
          l_flong = ls_fcat-ref_fieldname.
          set locale language 'E'.
          translate: ls_fcat-ref_tabname   to upper case,
                     ls_fcat-ref_fieldname to upper case,
                     l_flong               to upper case.
          if not ls_fcat-ref_tabname is initial.
          Try to get info about field in table
            call function 'DDIF_FIELDINFO_GET'
              exporting
                tabname        = ls_fcat-ref_tabname
                fieldname      = ls_fcat-ref_fieldname
                lfieldname     = l_flong
              importing
                dfies_wa       = ls_dfies
              exceptions
                not_found      = 1
                internal_error = 2
                others         = 3.
            if sy-subrc = 0.
              move-corresponding ls_dfies to ls_fcat.
              ls_fcat-fieldname = ls_defin-fieldname.
              move: ls_dfies-keyflag   to ls_fcat-key,
                    ls_dfies-scrtext_m to ls_fcat-seltext_l,
                    ls_dfies-domname   to l_dname.
            endif.
          else.
          Try to get info about structure
            ls_defin-ref_tabname = ls_defin-ref_fieldname.
            call function 'DDIF_FIELDINFO_GET'
              exporting
                tabname   = ls_defin-ref_tabname
              tables
                dfies_tab = lt_dfies
              exceptions
                others    = 0.
            if not lt_dfies is initial.
            Process fields of this structure
              loop at lt_dfies into ls_dfies.
                clear: ls_fcat.
                move-corresponding ls_dfies to ls_fcat.
                if ls_defin-fieldname ne 'INCLUDE'.
                  concatenate ls_defin-fieldname ls_fcat-fieldname
                         into ls_fcat-fieldname
                    separated by '-'.
                endif.
                move ls_dfies-keyflag to ls_fcat-key.
                move ls_dfies-scrtext_m to ls_fcat-seltext_l.
                ls_fcat-tabname = me->g_table.
                clear: ls_fcat-col_pos,
                       ls_fcat-offset.
                if ls_fcat-ref_tabname is initial.
                  ls_fcat-ddictxt = 'L'.
                endif.
              Display Yes/No fields as checkboxes
                if ls_dfies-domname = 'XFELD'.
                  ls_fcat-checkbox = 'X'.
                endif.
              Add field to field catalog
                append ls_fcat to fcat.
              endloop.
              continue.
            else.
            Try to get info about data element
              call function 'DDIF_DTEL_GET'
                exporting
                  name          = ls_fcat-ref_fieldname
                  langu         = sy-langu
                importing
                  dd04v_wa      = ls_dd04v
                exceptions
                  illegal_input = 1
                  others        = 2.
              if sy-subrc = 0.
                move-corresponding ls_dd04v to ls_fcat.
                move: ls_dd04v-scrtext_m to ls_fcat-seltext_l,
                      ls_dd04v-domname   to l_dname.
              else.
              Finally try to get info about domain
                call function 'DDIF_DOMA_GET'
                  exporting
                    name          = ls_fcat-ref_fieldname
                    langu         = sy-langu
                  importing
                    dd01v_wa      = ls_dd01v
                  exceptions
                    illegal_input = 1
                    others        = 2.
                if sy-subrc = 0.
                  move-corresponding ls_dd01v to ls_fcat.
                  move: ls_dd01v-ddtext  to ls_fcat-seltext_l,
                        ls_dd01v-domname to l_dname.
                endif.
              endif.
            endif.
          endif.
        Table name must be internal table containing data
          ls_fcat-tabname = g_table.
        No offset
          clear: ls_fcat-offset.
        Default text is stored in long text
          if ls_fcat-ref_tabname is initial.
            ls_fcat-ddictxt = 'L'.
          endif.
        Display Yes/No fields as checkboxes
          if l_dname = 'XFELD'.
            ls_fcat-checkbox = 'X'.
          endif.
        Add field to field catalog
          append ls_fcat to fcat.
        endloop.
      Positions
        loop at fcat into ls_fcat.
          ls_fcat-row_pos = 1.
          ls_fcat-col_pos = sy-tabix.
          modify fcat from ls_fcat transporting row_pos col_pos.
        endloop.
      Link between fields
        describe table fcat lines l_nbfld.
        loop at fcat into ls_fcat.
          if sy-tabix ne l_nbfld.
            l_index = sy-tabix + 1.
            read table fcat into ls_fcat2 index l_index.
            if sy-subrc = 0.
              if ls_fcat-datatype = 'CURR'.
              Currency unit
                if ls_fcat2-datatype = 'CUKY'.
                  ls_fcat-cfieldname = ls_fcat2-fieldname.
                  ls_fcat-ctabname   = ls_fcat2-tabname.
                  modify fcat from ls_fcat.
                else.
                  loop at fcat into ls_fcat2
                               from l_index
                              where datatype = 'CUKY'.
                  First currency unit after field
                    ls_fcat-cfieldname = ls_fcat2-fieldname.
                    ls_fcat-ctabname   = ls_fcat2-tabname.
                    modify fcat from ls_fcat.
                    exit.
                  endloop.
                  if sy-subrc ne 0.
                  No currency unit after field, try before
                    read table fcat into ls_fcat2
                                with key datatype = 'CUKY'.
                    if sy-subrc = 0.
                      ls_fcat-cfieldname = ls_fcat2-fieldname.
                      ls_fcat-ctabname   = ls_fcat2-tabname.
                      modify fcat from ls_fcat.
                    else.
                    Default is EURO
                      ls_fcat-currency = 'EUR'.
                    endif.
                  endif.
                endif.
              endif.
              if ls_fcat-datatype = 'QUAN'.
              Quantity unit
                if ls_fcat2-datatype = 'UNIT'.
                  ls_fcat-cfieldname = ls_fcat2-fieldname.
                  ls_fcat-ctabname   = ls_fcat2-tabname.
                  modify fcat from ls_fcat.
                endif.
              endif.
            endif.
          endif.
        endloop.
      endmethod.                    "fill_fieldcat
      Get definition of type from code source
      method get_definition.
        data: l_strng type rssource,
              ls_abap type rssource,
              l_fdpos type i,
              l_first type i,
              l_lastr type i.
        data: lt_incl type table of repid,
              ls_incl type repid.
      Get program code
        read report repid into abap.
        check sy-subrc eq 0.
      Get first line of definition
        concatenate 'BEGIN OF' struc into l_strng
                                separated by space.
        loop at abap into ls_abap.
          if ls_abap cs l_strng.
            l_fdpos = strlen( l_strng ) + sy-fdpos.
            if ls_abap(1) = '*' or ls_abap(sy-fdpos) cs '"'.
              continue.
            endif.
            if ls_abap+l_fdpos(1) ca ',. "'.
              l_first = sy-tabix.
              exit.
            endif.
          endif.
        endloop.
        if l_first is initial.
        Table is defined in an include
          call function 'RS_GET_ALL_INCLUDES'
            exporting
              program    = repid
            tables
              includetab = lt_incl
            exceptions
              others     = 1.
          if sy-subrc = 0.
            loop at lt_incl into ls_incl.
            Try to find definition in this include
              read report ls_incl into abap.
              loop at abap into ls_abap.
                if ls_abap cs l_strng.
                  l_fdpos = strlen( l_strng ) + sy-fdpos.
                  if ls_abap(1) = '*' or ls_abap(sy-fdpos) cs '"'.
                    continue.
                  endif.
                  if ls_abap+l_fdpos(1) ca ',. "'.
                    l_first = sy-tabix.
                    exit.
                  endif.
                endif.
              endloop.
              if not l_first is initial.
                exit.
              endif.
            endloop.
          endif.
        endif.
      Get last line of definition
        concatenate 'END OF' struc into l_strng
                              separated by space.
        loop at abap into ls_abap.
          if ls_abap cs l_strng.
            l_fdpos = strlen( l_strng ) + sy-fdpos.
            if ls_abap(1) = '*' or ls_abap(sy-fdpos) cs '"'.
              continue.
            endif.
            if ls_abap+l_fdpos(1) ca ',. "'.
              l_lastr = sy-tabix - l_first.
              exit.
            endif.
          endif.
        endloop.
      Keep only relevant code lines
        if l_first le 0
        or l_lastr le 0.
          refresh abap.
        else.
          delete abap to l_first.
          delete abap from l_lastr.
        endif.
      endmethod.                    "get_definition
      Get definition of type recursively
      method recursive_definition.
        data: lt_token type table of stokex,
              ls_token type stokex,
              lt_state type table of sstmnt,
              ls_state type sstmnt.
        data: ls_defin type ty_defin,
              l_reffld type fieldname.
        data: lt_recu  type rsfb_source.
      Retrieve tokens
        scan abap-source abap
                  tokens into lt_token
              statements into lt_state.
        loop at lt_state into ls_state.
          clear: ls_defin.
        Field name
          read table lt_token into ls_token
                             index ls_state-from.
          ls_defin-fieldname = ls_token-str.
        Reference type
          read table lt_token into ls_token
                             index ls_state-to.
          l_reffld = ls_token-str.
        Check if this type is defined in program
          free: lt_recu.
          call method get_definition
            exporting
              repid = repid
              struc = l_reffld
            changing
              abap  = lt_recu.
          if lt_recu is initial.
            if not g_level is initial.
              concatenate g_level ls_defin-fieldname
                     into ls_defin-fieldname separated by '-'.
              condense ls_defin-fieldname.
            endif.
            if l_reffld cs '-'.
              split l_reffld at '-'
                           into ls_defin-ref_tabname
                                ls_defin-ref_fieldname.
              if ls_defin-ref_tabname = 'SY'.
                ls_defin-ref_tabname = 'SYST'.
              endif.
            else.
              ls_defin-ref_fieldname = ls_token-str.
            endif.
            append ls_defin to me->gt_defin.
          else.
          Process sub levels
            if me->g_level is initial.
              me->g_level = ls_defin-fieldname.
            else.
              concatenate me->g_level ls_defin-fieldname into me->g_level
                                                 separated by '-'.
            endif.
            call method recursive_definition
              exporting
                repid = repid
              changing
                abap  = lt_recu.
            if me->g_level cs '-'.
              shift me->g_level right up to '-'.
              shift me->g_level right.
              shift me->g_level left deleting leading space.
            else.
              clear: me->g_level.
            endif.
          endif.
        endloop.
      endmethod.                    "recursive_definition
      Get fieldcat
      method get_alv_fieldcat.
        out_fieldcat = me->gt_fcat.
      endmethod.                    "get_alv_fieldcat
      Set table name
      method set_table_name.
        data: l_fcat type slis_fieldcat_alv.
        loop at me->gt_fcat into l_fcat.
          l_fcat-tabname = in_tabname.
          modify me->gt_fcat from l_fcat.
        endloop.
        me->g_table = in_tabname.
      endmethod.                    "set_table_name
      Set title
      method set_alv_title.
        me->g_title = in_title.
      endmethod.                    "set_alv_title
      Set fieldcat
      method set_alv_fieldcat.
        me->gt_fcat = in_fieldcat.
      endmethod.                    "set_alv_fieldcat
      Set field invisible
      method set_alv_fieldnoout.
        data: l_field type fieldname,
              l_noout type c,
              l_tech  type c,
              ls_fcat type slis_fieldcat_alv.
        l_field = in_field.
        if in_noout is supplied.
          l_noout = in_noout.
        else.
          l_noout = 'X'.
        endif.
        if in_tech is supplied.
          l_tech = in_tech.
        endif.
        loop at me->gt_fcat into ls_fcat
                           where fieldname = l_field.
          ls_fcat-no_out = l_noout.
          ls_fcat-tech   = l_tech.
          modify gt_fcat from ls_fcat transporting no_out tech.
        endloop.
      endmethod.                    "set_alv_fieldnoout
      Set field editable
      method set_alv_fieldedit.
        data: l_field type fieldname,
              l_edit  type c,
              ls_fcat type slis_fieldcat_alv.
        l_field = in_field.
        if in_edit is supplied.
          l_edit = in_edit.
        else.
          l_edit = 'X'.
        endif.
        loop at me->gt_fcat into ls_fcat
                           where fieldname = l_field.
          ls_fcat-edit = l_edit.
          modify gt_fcat from ls_fcat transporting edit.
        endloop.
      endmethod.                    "set_alv_fieldedit
      Set field text
      method set_alv_fieldtext.
        data: l_field type fieldname,
              ls_fcat type slis_fieldcat_alv.
        l_field = in_field.
        loop at me->gt_fcat into ls_fcat
                           where fieldname = l_field.
          ls_fcat-seltext_m = in_ftext.
          ls_fcat-ddictxt = 'M'.
          modify gt_fcat from ls_fcat transporting seltext_m ddictxt.
        endloop.
      endmethod.                    "set_alv_fieldtext
      Set field sum
      method set_alv_fieldsum.
        data: l_field type fieldname,
              l_dosum type c,
              ls_fcat type slis_fieldcat_alv.
        l_field = in_field.
        if in_dosum is supplied.
          l_dosum = in_dosum.
        else.
          l_dosum = 'X'.
        endif.
        loop at me->gt_fcat into ls_fcat
                           where fieldname = l_field.
          ls_fcat-do_sum = l_dosum.
          modify gt_fcat from ls_fcat transporting do_sum.
        endloop.
      endmethod.                    "set_alv_fieldsum
      Set line break in field catalog
      method set_alv_linebreak.
        data: l_field type fieldname,
              ls_fcat type slis_fieldcat_alv,
              l_tabix type i.
        l_field = in_field.
        read table me->gt_fcat into ls_fcat
                           with key fieldname = l_field.
        if sy-subrc = 0.
          l_tabix = sy-tabix.
        else.
          exit.
        endif.
        loop at me->gt_fcat into ls_fcat
                            from l_tabix.
          ls_fcat-row_pos = ls_fcat-row_pos + 1.
          modify gt_fcat from ls_fcat transporting row_pos.
        endloop.
      endmethod.                    "set_alv_linebreak
      Set settings
      method set_alv_settings.
        call method map_structure
          exporting
            source = in_settings
          changing
            destin = me->gs_sett.
      endmethod.                    "set_alv_settings
      Set layout
      method set_alv_layout.
        call method map_structure
          exporting
            source = in_layout
          changing
            destin = me->gs_layo.
      endmethod.                    "set_alv_layout
      Set printing options
      method set_alv_print.
        call method map_structure
          exporting
            source = in_print
          changing
            destin = me->gs_prin.
      endmethod.                    "set_alv_print
      Set sortings
      method set_alv_sorting.
        data: l_desc   type alvdynp-sortdown,
              l_group  type alvdynp-grouplevel,
              l_subtot type alvdynp-subtotals.
        data: ls_sort  type slis_sortinfo_alv,
              l_index  type i.
        if in_desc is supplied.
          l_desc = in_desc.
        endif.
        if in_group is supplied.
          l_group = in_group.
        else.
          l_group = '*'.
        endif.
        if in_subtot is supplied.
          l_subtot = in_subtot.
        else.
          l_subtot = 'X'.
        endif.
        describe table me->gt_sort lines l_index.
        l_index = l_index + 1.
        ls_sort-spos = l_index.
        ls_sort-fieldname = in_field.
        ls_sort-tabname = me->g_table.
        if l_desc is initial.
          ls_sort-up = 'X'.
        else.
          ls_sort-down = 'X'.
        endif.
        ls_sort-group = l_group.
        ls_sort-subtot = l_subtot.
        append ls_sort to me->gt_sort.
      endmethod.                    "set_alv_sorting
      Set key fields
      method set_alv_keys.
        data: l_key   type c,
              ls_fcat type slis_fieldcat_alv.
        if in_key is supplied.
          l_key = in_key.
        else.
          l_key = 'X'.
        endif.
        loop at me->gt_fcat into ls_fcat from 1 to in_level.
          ls_fcat-key = l_key.
          modify gt_fcat from ls_fcat transporting key.
        endloop.
      endmethod.                    "set_alv_keys
      Add event
      method set_alv_event.
        data: ls_evnt type slis_alv_event.
        loop at gt_evnt into ls_evnt
                       where name = in_name.
          ls_evnt-form = in_form.
          modify gt_evnt from ls_evnt transporting fo

  • ALV Interactive Report  using oops

    Hi All ,
                   Pls anybody send me the code for ALV interactive report using OOPS  , that reports covers the following things like Header , Logo , Total& subtotals  .....etc  ,
                   with this i can complete my object .
    thanks in Adv
    Rgds
    Rafi .

    Hi
    this code is helpful for u.check it.
    REPORT ZZ_22038_22098_002 NO STANDARD PAGE HEADING LINE-SIZE 650
    MESSAGE-ID ZZ_9838 .
    TYPE-POOLS: SLIS.
    *type declaration for values from ekko
    TYPES: BEGIN OF I_EKKO,
    EBELN LIKE EKKO-EBELN,
    AEDAT LIKE EKKO-AEDAT,
    BUKRS LIKE EKKO-BUKRS,
    BSART LIKE EKKO-BSART,
    LIFNR LIKE EKKO-LIFNR,
    END OF I_EKKO.
    DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
    WA_EKKO TYPE I_EKKO.
    *type declaration for values from ekpo
    TYPES: BEGIN OF I_EKPO,
    EBELN LIKE EKPO-EBELN,
    EBELP LIKE EKPO-EBELP,
    MATNR LIKE EKPO-MATNR,
    MENGE LIKE EKPO-MENGE,
    MEINS LIKE EKPO-MEINS,
    NETPR LIKE EKPO-NETPR,
    END OF I_EKPO.
    DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
    WA_EKPO TYPE I_EKPO .
    *variable for Report ID
    DATA: V_REPID LIKE SY-REPID .
    *declaration for fieldcatalog
    DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
    WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
    declaration for events table where user comand or set PF status will
    be defined
    DATA: V_EVENTS TYPE SLIS_T_EVENT,
    WA_EVENT TYPE SLIS_ALV_EVENT.
    declartion for layout
    DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
    declaration for variant(type of display we want)
    DATA: I_VARIANT TYPE DISVARIANT,
    I_VARIANT1 TYPE DISVARIANT,
    I_SAVE(1) TYPE C.
    *PARAMETERS : p_var TYPE disvariant-variant.
    *Title displayed when the alv list is displayed
    DATA: I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
    DATA: I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
    INITIALIZATION.
    V_REPID = SY-REPID.
    PERFORM BUILD_FIELDCATLOG.
    PERFORM EVENT_CALL.
    PERFORM POPULATE_EVENT.
    START-OF-SELECTION.
    PERFORM DATA_RETRIEVAL.
    PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
    PERFORM DISPLAY_ALV_REPORT.
    *& Form BUILD_FIELDCATLOG
    Fieldcatalog has all the field details from ekko
    FORM BUILD_FIELDCATLOG.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'EBELN'.
    WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'AEDAT'.
    WA_FIELDCAT-SELTEXT_M = 'DATE.'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'BUKRS'.
    WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'BUKRS'.
    WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'LIFNR'.
    WA_FIELDCAT-NO_OUT = 'X'.
    WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    ENDFORM. "BUILD_FIELDCATLOG
    *& Form EVENT_CALL
    we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    I_LIST_TYPE = 0
    IMPORTING
    ET_EVENTS = V_EVENTS
    EXCEPTIONS
    LIST_TYPE_WRONG = 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.
    ENDFORM. "EVENT_CALL
    *& Form POPULATE_EVENT
    Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT.
    READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
    IF SY-SUBRC EQ 0.
    WA_EVENT-FORM = 'TOP_OF_PAGE'.
    MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
    ENDIF.
    READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
    IF SY-SUBRC EQ 0.
    WA_EVENT-FORM = 'USER_COMMAND'.
    MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-NAME.
    ENDIF.
    ENDFORM. "POPULATE_EVENT
    *& Form data_retrieval
    retreiving values from the database table ekko
    FORM DATA_RETRIEVAL.
    SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
    ENDFORM. "data_retrieval
    *& Form bUild_listheader
    text
    -->I_LISTHEADEtext
    FORM BUILD_LISTHEADER USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
    DATA HLINE TYPE SLIS_LISTHEADER.
    HLINE-INFO = 'this is my first alv pgm'.
    HLINE-TYP = 'H'.
    ENDFORM. "build_listheader
    *& Form display_alv_report
    text
    FORM DISPLAY_ALV_REPORT.
    V_REPID = SY-REPID.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = V_REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
    I_GRID_TITLE = I_TITLE_EKKO
    I_GRID_SETTINGS =
    IS_LAYOUT = ALV_LAYOUT
    IT_FIELDCAT = I_FIELDCAT[]
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    i_default = 'ZLAY1'
    I_SAVE = 'A'
    is_variant = i_variant
    IT_EVENTS = V_EVENTS
    TABLES
    T_OUTTAB = IT_EKKO
    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.
    ENDFORM. "display_alv_report
    *& Form TOP_OF_PAGE
    text
    FORM TOP_OF_PAGE.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = IT_LISTHEADER
    i_logo =
    I_END_OF_LIST_GRID =
    ENDFORM. "TOP_OF_PAGE
    *& Form USER_COMMAND
    text
    -->R_UCOMM text
    -->, text
    -->RS_SLEFIELDtext
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
    CASE R_UCOMM.
    WHEN '&IC1'.
    READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
    PERFORM BUILD_FIELDCATLOG_EKPO.
    PERFORM EVENT_CALL_EKPO.
    PERFORM POPULATE_EVENT_EKPO.
    PERFORM DATA_RETRIEVAL_EKPO.
    PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
    PERFORM DISPLAY_ALV_EKPO.
    ENDCASE.
    ENDFORM. "user_command
    *& Form BUILD_FIELDCATLOG_EKPO
    text
    FORM BUILD_FIELDCATLOG_EKPO.
    WA_FIELDCAT-TABNAME = 'IT_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'EBELN'.
    WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'EBELP'.
    WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'MATNR'.
    WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'MENGE'.
    WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'MEINS'.
    WA_FIELDCAT-SELTEXT_M = 'UOM'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'NETPR'.
    WA_FIELDCAT-SELTEXT_M = 'PRICE'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    ENDFORM. "BUILD_FIELDCATLOG_EKPO
    *& Form event_call_ekpo
    we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL_EKPO.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    I_LIST_TYPE = 0
    IMPORTING
    ET_EVENTS = V_EVENTS
    EXCEPTIONS
    LIST_TYPE_WRONG = 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.
    ENDFORM. "event_call_ekpo
    *& Form POPULATE_EVENT
    Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT_EKPO.
    READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
    IF SY-SUBRC EQ 0.
    WA_EVENT-FORM = 'TOP_OF_PAGE'.
    MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
    ENDIF.
    ENDFORM. "POPULATE_EVENT
    *& Form TOP_OF_PAGE
    text
    FORM F_TOP_OF_PAGE.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = IT_LISTHEADER
    i_logo =
    I_END_OF_LIST_GRID =
    ENDFORM. "TOP_OF_PAGE
    *& Form USER_COMMAND
    text
    -->R_UCOMM text
    -->, text
    -->RS_SLEFIELDtext
    *retreiving values from the database table ekko
    FORM DATA_RETRIEVAL_EKPO.
    SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.
    ENDFORM.
    FORM BUILD_LISTHEADER_EKPO USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
    DATA: HLINE1 TYPE SLIS_LISTHEADER.
    HLINE1-TYP = 'H'.
    HLINE1-INFO = 'CHECKING PGM'.
    ENDFORM.
    FORM DISPLAY_ALV_EKPO.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER = ' '
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = V_REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = 'F_USER_COMMAND'
    I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
    I_CALLBACK_HTML_TOP_OF_PAGE = ' '
    I_CALLBACK_HTML_END_OF_LIST = ' '
    I_STRUCTURE_NAME =
    I_BACKGROUND_ID = ' '
    I_GRID_TITLE = I_TITLE_EKPO
    I_GRID_SETTINGS =
    IS_LAYOUT =
    IT_FIELDCAT = I_FIELDCAT[]
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT =
    I_SAVE = 'A'
    IS_VARIANT =
    IT_EVENTS = V_EVENTS
    TABLES
    T_OUTTAB = IT_EKPO
    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.
    ENDFORM.
    Regards,
    Sree

  • Interactive report template

    Hi,
    How can I change the template for interactive reports? Can I use a custom template for an interactive report?
    Regards,
    Eugene

    Hi,
    BTW, if anyone cares, you can still include the sortable column headers into the Row Level templates. Basically just copy the header out of the Column-based Report template and paste it into your custom Row-Level template.
    For example:
    <th#ALIGNMENT# foobar id="#COLUMN_HEADER_NAME#" class="t13ReportHeader">#COLUMN_HEADER#</th>I had a gotcha with mine where the column header section started indented one column to the left, due to something in the region header (I guess?). I couldn't figure out how to fix it without a kludge. So I simply closed the previous table row then started a new one by pasting it into the region header.
    </tr><tr>Inelegant but functional! :-/
    Just trying to pass on little hacks as I learn.
    Your mileage may vary...
    Stew

  • Open document from interactive report

    Application Express version 4.0.2.00.07.
    In apex I am trying to accomplish the following:
    1. create a link to a pdf or Word document stored on local network using the file browse button.
    2. store the link to that file in my table but not store the actual document in the oracle table.
    3. open the document from link in interactive report.
    My dba does not want to store anymore documents into oracle because of performance issues we are experiencing with current applications that do this. Does anyone know the where to find sample code that will accomplish this task or will load the linked document into the oracle table but delete the document from the blob when the document is closed.

    You're probably looking to use the BFILE functionality - a pointer to a LOB on the filesystem.
    Try looking at some of the following sources for guidance
    http://docs.oracle.com/cd/B10501_01/appdev.920/a96591/adl12bfl.htm
    APEX BFILE
    http://monkeyonoracle.blogspot.com.au/2009/10/storing-images-outside-oracle-xe-with.html
    Scott

Maybe you are looking for

  • How can I do a user controlled amount of subvi instances?

    Hello! I'm trying to write a dynamic application where the user can control which sub-vis get selected to run in parallel.  The problem I am having is that each sub-vi has it's own never ending while-loop, and that the execution of the first one prev

  • How do you reset the faders in the mixer panel in PPro CC

    how do you reset the faders in the mixer panel in PPro CC? I want to reset my channel faders and start my mix fresh but can find no way to reset them

  • Help with Lost Files and Previews!

    Hi all! I'm in a bit of a panic. I imported a folder into Lightroom and made standard previews. I have large standard sized previews (and some 1:1 previews) on top of my mini thumbnails. The I did something very very stupid... I accidentally deleted

  • [CS3 Win]It is possible read an ini file when starting InDesing and hide some menus?

    Hi all. My plugin reads a ini file to configurate the main menu. It is possible read this file when starting InDesing and hide some submenus created in Myplugin.fr? I have no problem to hide/show a menu, but I don´t know what is the first event that

  • CardDAV, CalDAV not work after upgraded ML server

    After upgrade my Mac mini to ML server and Macbook Pro Retina to ML, the existing configuration of CardDAV, CalDAV and Notes no longer work anymore, it keep asking password. When I remove the setting and I cannot add back again, the checkbox keep loo