How to make output of ABAp query interactive(drill down)..?

Hi All,
I have developed one ABAP query which shows the output in which there is a coloumm 'order number'.
I want to make this coloumn interactive ,that means after double clicking on any row of this colomn ,it should go to transaction KO02.
Where do i have to write the code  in ABAP query ?
I am very new to ABAP query..this is the first query i have deloped till now.
points will be rewarded.
Thnks in advance.
Regards,
Sanjay.

<b>The below sample code is one such example of Drill down reporting...
Make the necessary modifications, change the statement CALL TRANSACTION to whatever you want to CALL. Proceed further.</b>
*"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
Regards,
Pavan

Similar Messages

  • How to remove the sort function on the drill down and then save

    how to remove the sort function on the drill down and then save in the  change local view of the Query
    Is it possible to change the porperties of any characteristic in the local view and then save?
    If so please post the answer.

    I do not think that option is possible.
    Regards,
    Venkata Boga.

  • How do i create a report that has drill-down with class?

    How do I create a report that has drill-down levels so that I can have summary information at the top level but then view specific records at a more detailed level?

    can i know ur email address.
    this is my other one coding
    but problem is very very slow when i 1 see my output
    TABLES: proj, coep.
    *&            TYPES DECLARATION                                        *
    *TYPES: BEGIN OF tb_coep,
             wtgbtr TYPE coep-wtgbtr,
          END OF tb_coep.
    DATA : int_proj TYPE proj OCCURS 0 WITH HEADER LINE.
    DATA : int_coep TYPE coep OCCURS 0 WITH HEADER LINE.
    DATA : gd_date(10). " FIELD TO STORE OUTPUT DATE
    TYPES : BEGIN OF t_date,
              year(4)  TYPE n,
              month(2) TYPE n,
              day(2)   TYPE n,
           END OF t_date.
    *&            SELECTION-SCREEN                                         *
    SELECTION-SCREEN BEGIN OF BLOCK b01 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: so_pspnr FOR proj-pspnr OBLIGATORY.
    SELECTION-SCREEN ULINE.
    SELECTION-SCREEN END OF BLOCK b01.
    *&            TOP-OF-PAGE                                              *
    *&            fetch the data for the list                              *
    SELECT * INTO int_proj FROM proj where
             pspnr in so_pspnr.
    append int_proj.
    CLEAR int_proj.
    ENDSELECT.
    SELECT * into int_coep FROM coep WHERE
             wtgbtr in so_pspnr.
    append int_coep.
    CLEAR int_coep.
    ENDSELECT.
    LOOP at int_proj.
      write : / int_proj-pspnr, int_proj-post1.
    ENDLOOP.
    LOOP at int_coep.
      write : int_coep-wtgbtr.
    ENDLOOP.
    Edited by: Dickson on Jul 10, 2009 10:53 AM

  • How to go to a particular object in drill down detail pdf report?

    In drill down html reports I could directly go to a particular object in the detail report from the summary report by using hyperlink destination property in the detail report and hyperlink property in the summary report.
    How can I do the same thing in drill down pdf reports? The summary pdf report is opened first and then clicking on any of the object in summary pdf report should direct me to the same object in detail report.
    Thanks for your help.
    -Jayshree

    Unfortunately PDF doesn't support this concept. You could ensure that the detail report has bookmarks, then the user can easily see the different sections of the report.
    Hope this helps,
    Danny

  • How to make changes in infose query in SQ01

    Dear experts,
    I hv question abt infoset query.
    I m not very familiar with infoset query and now i hv to make some changes in already existing query.
    I hv found the infoset in use.
    from this infoset i can find the query.
    Now the question is I just hv to insert one field in selection screen and and same in output list. This field has to come from a table which is already in use in joins. I just have to tick the checkbox to appear the field in selection screen and in outputlist.
    But I m not sure, if i make any changes in query, what will be the effects because the query is in production system and i hv to make changes in the production system only.
    and before sq01 i hv to drag and drop that field in infoset sq02..
    Can any one pls guide me , how i should make changes in query.
    Thanks in advance
    Jaspal Kumar
    Edited by: jaspalkumar on Feb 25, 2011 10:43 AM

    Thank you very much for ur reply.
    Actually, there are tjhree table joined in sq02.  One is KNVV. i hv to add customer group into selection screen and output list also.
    SO i will hv to make changes both in sq02 and then sq01.
    how i supposed to do it.   I m very sory asking again and its like spoon feeding,
    but to be very true report is in production and i m very scared of ripple effects of changes as i hv less idea abt the infoset.
    Pl;s guide,
    With best regards,
    Jaspal Kumar

  • How to get count(*) in ABAP Query...

    Hi All,
    Can someone of you tell me, how to do the following in the ABAP Query. I want to get the count of records retreived during the query execution and display it in the output.
    example:::   Select count(*) from VBRK.
    Thanks a lot.
    Thanks!
    Puneet.

    From help doc:
    Note
    The SELECT COUNT( * ) FROM ... statement returns a result table containing a single line with the result 0 if there are no records in the database table that meet the selection criteria. In an exception to the above rule, SY-SUBRC is set to 4 in this case, and SY-DBCNT to zero.
    You can just run SELECT COUNT (*) FROM TABLE
    Number of rows is returned in SY-DBCNT
    Edited by: Kevin Lin on Jul 2, 2008 10:55 PM

  • How to make a clip art (diagram )interactive report?

    Hello ABAPers,
                           I want help from you. I have a requirement like ..when i am excuteing a report i should get a clip art and the clipart which i got i have to double click on it there by i should get the details of that clip art. I have succeed till getting the clip art and from here i am not getting the idea how to make the clipart(diagram) active so tht when i am doubleing it i should get the details.
    The code that i am using to get the clip art just copy and execute you will get the output till clipart.
    *& Report  ZCLIPART_IR                                                 *
    REPORT  ZCLIPART_IR.
    START OF DO NOT CHANGE***********************************
    DATA: docking TYPE REF TO cl_gui_docking_container,
          picture_control_1 TYPE REF TO cl_gui_picture,
          url(256) TYPE c .
    DATA: query_table LIKE w3query OCCURS 1 WITH HEADER LINE,
          html_table LIKE w3html OCCURS 1,
          return_code LIKE  w3param-ret_code,
          content_type LIKE  w3param-cont_type,
          content_length LIKE  w3param-cont_len,
          pic_data LIKE w3mime OCCURS 0,
          pic_size TYPE i.
    END OF DO NOT CHANGE***********************
    DATA : sum(4) , num1(4) , num2(4).
    PARAMETERS: p_dummy(4) DEFAULT '4' .
    PARAMETERS: p_dummy1(4) DEFAULT '5' .
    AT SELECTION-SCREEN OUTPUT.
      PERFORM show_pic.
      START-OF-SELECTION.
    *& Form show_pic
    FORM show_pic.
       DATA: repid LIKE sy-repid.
             repid = sy-repid.
      CREATE OBJECT picture_control_1 EXPORTING parent = docking.
      CHECK sy-subrc = 0.
      CALL METHOD picture_control_1->set_3d_border
        EXPORTING
          border = 5.
      CALL METHOD picture_control_1->set_display_mode
        EXPORTING
          display_mode = cl_gui_picture=>display_mode_stretch.
      CALL METHOD picture_control_1->set_position
        EXPORTING
          height = 50
          left   = 40
          top    = 30
          width  = 190.
    CHANGE POSITION AND SIZE ABOVE****************
    IF url IS INITIAL.
    REFRESH query_table.
        query_table-name  = '_OBJECT_ID'.
    CHANGE IMAGE NAME BELOW UPLOADED IN SWO0*****************
        query_table-value = 'ENJOYSAP_LOGO'.
        APPEND query_table.
        CALL FUNCTION 'WWW_GET_MIME_OBJECT'
          TABLES
            query_string        = query_table
            html                = html_table
            mime                = pic_data
          CHANGING
            return_code         = return_code
            content_type        = content_type
            content_length      = content_length
          EXCEPTIONS
            object_not_found    = 1
            parameter_not_found = 2
            OTHERS              = 3.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        CALL FUNCTION 'DP_CREATE_URL'
          EXPORTING
            type     = 'image'
            subtype  = cndp_sap_tab_unknown
            size     = pic_size
            lifetime = cndp_lifetime_transaction
          TABLES
            data     = pic_data
          CHANGING
            url      = url
          EXCEPTIONS
            OTHERS   = 1.
            ENDIF.
            CALL METHOD picture_control_1->load_picture_from_url
        EXPORTING
          url = url.
    ENDFORM.
    Thks and waiting for your replies.

    Hi ataran,
    in case, your version of iMovie is able to import the footage, have a read here:
    http://www.apple.com/ilife/tutorials/imovie/

  • How to do coding in abap-query

    Hi friends,
      Please help me how to write the coding in abap-query.
    Regards,
    Bhavani

    hI
    There are certain exit points available in the query, these can be accessed in SQ02 - Infoset editor. Click 'Extras', then the 'Coding' tab. There is a drop down to access different coding sections, e.g. DATA, GET, etc.
    It is not always clear where and when they execute so you may need to experiment with some 'break-point' statements to start with, run the query to find out where the breaks are then go back to SQ02 to enter some code at that section.
    http://www.thespot4sap.com/Articles/SAP_ABAP_Queries_FunctionalAreas_LogicalDB.asp

  • How to use output of a Query as an input to another Query

    Dear BI experts,
    We have a unique requirement. We are multinational company and employees moving from Country to another.
    I have created a Bex query to give me the list of countries that employees have been since they joined the company. The columns in the report are PERNR, date_from  and country.
    When I run the query for all employees it gives us the list of countries that each employee was present.
    Now the requirement is to show only the employees who have been at least once in UK. This list should contain all the countries they were living in addition to UK.
    I cannot put a condition in the u2018Countryu2019 column for u2018UKu2019 since it will give me only UK and will not list other countries.
    Could you please provide me with a solution.
    I thought of running 2 queries to get the desired result. First run a report with a condition that Country = UK. This will give the list of employees who have been in UK at least once. Run the second query by using the list of employees from he first query without any restrictions. But the question is how to make the list of employees in the first query as an input to the second query, other than manually adding it in the selection screen.
    Hope I was able to explain the requirements clearly.\
    Thanks in advance to your suggestions.
    Regards,
    Sai

    Hi Sainath,
    This can be acheived by RRI i.e report to Report Interface !!!!!!
    T Code -RSBBS.
    Report A-Jump to report B.
    Report B-Is Employee Based
    Assume u want call report B from Report A
    1)GOTO RSBBS
    2)Create New
    3)Sender Query Give the First Query Report A
    4)Below sender Query there is Receiver Query  give the RRI query report B (The query which u want to call).Report type should be BEX ,and Target system--Assign the System(Local) and in the report give the Report B.
    5)In the Report A check whether in the GOTO -u get the Receiver Query ,i.e Report B.
    In the Assignments in RSBBS set the Emp Infoobject as Delete instead of Generic and create a Input Variable for Employee in Report A.
    Come bak if u have any issues
    Rgds
    SVU123

  • How to use wildcards in ABAP query where condition?

    Hi,
    Please tell me how to use wildcards in ABAP qurey where condition.
    e.g. select * from mara where matnr = * (wildcard we need to use.
    Thanks & Regards,
    Gaurav T

    Do you want to query asterix * ?
    select * from mara where matnr = '*'.  "then just put it in apstrophes
    or you want certain part of string be used as * ?
    select * from mara where matnr like '%*'  "then use % sign before it
    or maybe you want something like this
    select * from mara where matnr like '%1' . "then it will look for all materials having '1' inside it
    Regards
    Marcin

  • How to use output of one query as an input for another

    Hi Gurus,
    can you give me any links on how to use an output of one query as an input for another (preferably if this can be done in a dynamic/on the fly way)?
    thanks

    You can use Replacement Path Variable for this purpose. See this detailed documentation.
    http://help.sap.com/saphelp_nw04s/helpdata/en/bd/589b3c494d8e15e10000000a114084/content.htm
    Abhijit
    Edited by: ABHIJIT TEMBHEKAR on Nov 19, 2008 9:48 AM

  • How to make a ADOBE FORM as interactive??

    Hi experts,
                       Please anybody share how to make a ADOBE FORM interactive ? It means the content of the form ( text field etc.,) can be varied ( selected dynamically ) and also the form should be freeze later , so that it cannot be edited again ,.
                    Thanks in advance!!

    Hi shukla,
    Thanks for u r response.
    Here my problem is i created webdynpro component view with interactive element .And i set the all required properties also like checking enable checkbox ,pdfsourcr,formname allthe requird things i did and i developed one adobeform using sfp tcode. In that form they are some input fields are their. and i activated every thing sucessfully.
       while executing webdynpro app i am getting pdf also.But in that pdf i cant able to fill the input fields..i checked with javascript code , and different layouts also but still it will be not editable in pdf..
    I need the solution for this........ Pls help me, I stucked with thispoint ,and its urgent...
    Regards,
    Venkat.

  • HELP! How to make RRI from BEX query into Workbook with one report???

    How to make RRI from query into Workbook???

    Hi Alex,
    A workbook is a set format of queries, so when you try to jump to another query , you will definitely open another session and hence another excel file. This is the same for web templates also though you have an option of opening the new result in the same window.
    You would have to use some macros and open the query on the same page. A RRI is a query jump and not a drill down . A drill down would be getting more of the dimensions into the query.
    Regards
    CSM Reddy

  • Execute query with drill down using abap

    Hello together,
    I need to execute a query using abap and I need the result of the drill down on one characteristic in the query.
    I try to use RRX_GRID_CMD_PROCESS to execute query, but I don't understand how to do the drill down.
    I thought I have to specify somehow the name of the object on which I need to make the drill down. I tried to send this as a parameter to e_t_drill... but this is not working. I have also seen that
    e_t_drill[] = g_sx_buffer-r_request->n_sx_request-drill, but this is empty.
    Could you, please explain how to do this?
    Thank you,
    Iuliana

    Our RKF def is as follows:
    Keyfigure: 0deb_cre_lc
    Chars:
    Posting Keys: 01,02,11,12
    Year start date: Restricting it with a variable created on it. Variable is of type Customer exit.This variable
    gets value from key date which is entered by user dynamically.
    Specified the offsets of Yr start date as 0 to 365.
    Regards,
    smitha.

  • Realize Counter in Query without drill-down

    Hello to everybody,
    I have got a query which is displaying POS data for different subsidiaries. In the rows is the subsidiary-number and the sales slip number. In the columns I have a counter as key figure, which shall count the number of existing sales slips. This works well, when I drill-down to the sales slip number and the correct number of sales slips is displayed as result at the last row of the key figure.
    But I do not want every sales slip to be displayed, so I remove it from the drill-down, with the effect that the counter always shows "1" as result.
    How can I make the counter work without having the sales slip in the drill-down?
    Thank you very much!
    PS: Sorry in advantage, if my English is bad, but I am from Germany.

    I think I do now know the problem: the counter I use is a calculated key figure. There is a restricted key figure which counts the number of positions on each sales slip. This key figure is used to realize a calculated key figure which counts the number of sale slips by division of the number of positions by itself, which results in "1" for each sales slip. But of course for the result row it also shows "1", because at the result row there must be used a summation and not a division.
    Example:
    position...........sales slip
    counter............counter (position counter / position counter)
    4....................1
    6....................1
    3....................1
    7....................1
    =============
    20..................1 (because it calculates 20/20 and not 111+1)
    Any idea how to solve this? Thanks!

Maybe you are looking for

  • Pages 5.0 (2013 Mavericks) Table of Contents loses page links when exported to PDF

    I'm using the new Pages 5.0 in Mavericks.  I have a TOC with page numbers that link to the sections in my document.  The links work fine in Pages.  When I export the document to PDF, the page numbers are no longer links. I tried the same in Pages '09

  • Modifying in photoshop cc 2014 doesn't work

    i ve just install lightroom 6 and two things don't work well now . First when i right click on a picture and choose modify in photoshop cc 2014, it opens cc 2014 without displaying the image.Why ? second my graphic card is not recognized althought th

  • How to restore iphone 3g?

    i can't restore my iphone 3g error 1015.... need help

  • Downloaded songs from iStore don't work

    I have downloaded an album paying with an itunes card. All songs are on my computer, but won't start. Other songs I have downloaded previously just work fine, but the new songs are being skipped when I click them. Any idea how to get them running? My

  • ColdFusion 9 in the Cloud (AWS)?

    Does anyone have any updates on where ColdFusion 9 in the Cloud stands? In October of 2009, (see link) a private beta program was announced, but I haven't seen anything since. http://www.adobe.com/aboutadobe/pressroom/pressreleases/200910/AdobeColdFu