Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

sample code of Oops ALV Interactive Report

Former Member
0 Likes
5,793

Hi Everybody,

Can anybody give sample code of Oops ALV Interactive Report

Regards,

Satya

4 REPLIES 4
Read only

Former Member
0 Likes
1,950
*"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

with regards,

Read only

Former Member
0 Likes
1,950

Hi,

Please follow the below mentioned links,

http://abapprogramming.blogspot.com/2007/11/alv-list-using-oo-style-sample-code.html

Regards,

Mayank

Read only

Former Member
0 Likes
1,950

hi,

here is the code...

in this i have taken one custom container in screen 100 with name CC_ALV



*&---------------------------------------------------------------------*
*& Report  ZALV_OOP
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  zalv_oop.

*----------------------------------------------------------------------*
*       CLASS lcl_event_handler DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_handler DEFINITION .
  PUBLIC SECTION .
    METHODS:

*--Double-click control
    handle_double_click
    FOR EVENT double_click OF cl_gui_alv_grid
    IMPORTING e_row e_column es_row_no.

  PRIVATE SECTION.
ENDCLASS.                    "lcl_event_handler DEFINITION


*----------------------------------------------------------------------*
*       CLASS lcl_event_handler IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_handler IMPLEMENTATION .


*--Handle Double Click
  METHOD handle_double_click .
    PERFORM handle_double_click USING e_row e_column es_row_no .
  ENDMETHOD .                    "handle_double_click

ENDCLASS .                    "lcl_event_handler IMPLEMENTATION

TABLES : mseg.

DATA : BEGIN OF itab OCCURS 0,
        mblnr LIKE mseg-mblnr,
        matnr LIKE mseg-matnr,
        menge LIKE mseg-menge,
       END OF itab.

DATA : gr_alvgrid TYPE REF TO cl_gui_alv_grid,
       gr_ccontainer TYPE REF TO cl_gui_custom_container,
       gt_fcat TYPE lvc_t_fcat,
       gs_layo TYPE lvc_s_layo.


DATA gr_event_handler TYPE REF TO lcl_event_handler .

DATA : ok_code LIKE sy-ucomm.

DATA : t_mat LIKE mara-matnr.


DATA: variant TYPE disvariant.


SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_mblnr FOR mseg-mblnr.
SELECTION-SCREEN : END OF BLOCK blk1.


START-OF-SELECTION.

  SET SCREEN 100.


  CREATE OBJECT gr_event_handler .
  PERFORM get_data.

  PERFORM dis_data.


*&---------------------------------------------------------------------*
*&      Form  get_data
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM get_data.

  SELECT mblnr matnr menge FROM mseg INTO CORRESPONDING FIELDS OF TABLE itab
   WHERE mblnr IN s_mblnr.

  variant-report = sy-repid.
  variant-username = sy-uname.

ENDFORM.                    "get_data

*&---------------------------------------------------------------------*
*&      Form  dis_data
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM dis_data.

  IF gr_alvgrid IS INITIAL.

    CREATE OBJECT gr_ccontainer
      EXPORTING
        container_name              = 'CC_ALV'
      EXCEPTIONS
        cntl_error                  = 1
        cntl_system_error           = 2
        create_error                = 3
        lifetime_error              = 4
        lifetime_dynpro_dynpro_link = 5
        OTHERS                      = 6.
    IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    CREATE OBJECT gr_alvgrid
      EXPORTING
        i_parent          = gr_ccontainer
      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.

    PERFORM create_fcat CHANGING gt_fcat.

    PERFORM create_layout CHANGING gs_layo.

    CALL METHOD gr_alvgrid->set_table_for_first_display
      EXPORTING
*        I_BUFFER_ACTIVE               =
*        I_BYPASSING_BUFFER            =
*        I_CONSISTENCY_CHECK           =
*        I_STRUCTURE_NAME              =
        is_variant                    = variant
        i_save                        = 'A'
*        I_DEFAULT                     = 'X'
        is_layout                     = gs_layo
*        IS_PRINT                      =
*        IT_SPECIAL_GROUPS             =
*        IT_TOOLBAR_EXCLUDING          =
*        IT_HYPERLINK                  =
*        IT_ALV_GRAPHICS               =
*        IT_EXCEPT_QINFO               =
*        IR_SALV_ADAPTER               =
      CHANGING
        it_outtab                     = itab[]
        it_fieldcatalog               = gt_fcat
*        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.

    SET HANDLER gr_event_handler->handle_double_click FOR gr_alvgrid .

  ENDIF.
ENDFORM.                    "dis_data
*&---------------------------------------------------------------------*
*&      Form  create_fcat
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      <--P_GT_FCAT  text
*----------------------------------------------------------------------*
FORM create_fcat  CHANGING pt_fcat TYPE lvc_t_fcat.

  DATA : ls_fcat TYPE lvc_s_fcat.

  ls_fcat-fieldname = 'MBLNR'.
  ls_fcat-coltext = 'Material Doc.'.
  APPEND ls_fcat TO pt_fcat.

  ls_fcat-fieldname = 'MATNR'.
  ls_fcat-coltext = 'Material'.
  APPEND ls_fcat TO pt_fcat.

  ls_fcat-fieldname = 'MENGE'.
  ls_fcat-coltext = 'Quantity'.
  APPEND ls_fcat TO pt_fcat.

ENDFORM.                    " create_fcat
*&---------------------------------------------------------------------*
*&      Form  create_layout
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      <--P_GS_LAYO  text
*----------------------------------------------------------------------*
FORM create_layout  CHANGING ps_layo TYPE lvc_s_layo.

  ps_layo-zebra = 'X'.
ENDFORM.                    " create_layout
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'ZALV_OOP'.
*  SET TITLEBAR 'xxx'.

ENDMODULE.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.

  ok_code = sy-ucomm.

  CASE ok_code.
    WHEN 'BACK' OR 'UP' OR 'CANC'.
      LEAVE PROGRAM.
  ENDCASE.

ENDMODULE.                 " USER_COMMAND_0100  INPUT


*&---------------------------------------------------------------------*
*&      Form  handle_double_click
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->I_ROW      text
*      -->I_COLUMN   text
*      -->IS_ROW_NO  text
*----------------------------------------------------------------------*
FORM handle_double_click USING i_row TYPE lvc_s_row
                               i_column TYPE lvc_s_col
                               is_row_no TYPE lvc_s_roid.

  READ TABLE itab INDEX is_row_no-row_id .

  IF sy-subrc = 0 .
    IF i_column = 'MATNR'.
      t_mat = itab-matnr.
      SET PARAMETER ID 'MAT' FIELD t_mat.
      CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
      SET PARAMETER ID 'MAT' FIELD space.

    ELSEIF i_column = 'MBLNR'.

      CALL TRANSACTION 'MIGO'.
    ENDIF .
  ENDIF.
ENDFORM .                    "handle_double_click


reward if usefull.....

Read only

Former Member
0 Likes
1,950

hai Sree,

include <color>.

include <icon>.
include <symbol>.

types: begin of g_type_s_master.
include type alv_chck.
types:   expand   type char01,
       end of g_type_s_master,

       begin of g_type_s_slave.
include type alv_t_t2.
types: end   of g_type_s_slave,

        begin of g_type_s_test,
         amount  type i,
         repid   type syrepid,
       end of g_type_s_test.

constants: con_master type lvc_fname value 'ALV_CHCK',
           con_slave  type lvc_fname value 'ALV_T_T2'.

*... §5 Definition is later
class lcl_handle_events definition deferred.

data: gs_test type g_type_s_test.

data: gt_master type standard table of g_type_s_master,
      gt_slave  type standard table of alv_t_t2.

data: gr_hierseq type ref to cl_salv_hierseq_table.

*... §5 object for handling the events of cl_salv_table
data: gr_events type ref to lcl_handle_events.

*---------------------------------------------------------------------*
*       CLASS lcl_handle_events DEFINITION
*---------------------------------------------------------------------*
* §5.1 define a local class for handling events of cl_salv_table
*---------------------------------------------------------------------*
class lcl_handle_events definition.
  public section.
    methods:
      on_user_command for event added_function of cl_salv_events
        importing e_salv_function,

      on_before_salv_function for event before_salv_function of cl_salv_events
        importing e_salv_function,

      on_after_salv_function for event after_salv_function of cl_salv_events
        importing e_salv_function,

      on_double_click for event double_click of cl_salv_events_hierseq
        importing level row column,

      on_link_click for event link_click of cl_salv_events_hierseq
        importing level row column.
endclass.                    "lcl_handle_events DEFINITION

*---------------------------------------------------------------------*
*       CLASS lcl_handle_events IMPLEMENTATION
*---------------------------------------------------------------------*
* §5.2 implement the events for handling the events of cl_salv_table
*---------------------------------------------------------------------*
class lcl_handle_events implementation.
  method on_user_command.
    perform show_function_info using e_salv_function text-i08.
  endmethod.                    "on_user_command

  method on_before_salv_function.
    perform show_function_info using e_salv_function text-i09.
  endmethod.                    "on_before_salv_function

  method on_after_salv_function.
    perform show_function_info using e_salv_function text-i10.
  endmethod.                    "on_after_salv_function

  method on_double_click.
    perform show_cell_info using level row column text-i07.
  endmethod.                    "on_double_click

  method on_link_click.
    perform show_cell_info using level row column text-i06.
  endmethod.                    "on_single_click
endclass.                    "lcl_handle_events IMPLEMENTATION

*----------------------------------------------------------------------*
* SELECTION-SCREEN - for demonstration purposes only                   *
*----------------------------------------------------------------------*
selection-screen begin of block gen with frame.
parameters:
p_amount type i default 30.
selection-screen end of block gen.

*----------------------------------------------------------------------*
* START-OF-SELECTION                                                   *
*----------------------------------------------------------------------*
start-of-selection.
  gs_test-amount = p_amount.
  gs_test-repid = sy-repid.

*... §1 select data into global output table
  perform select_data.

*----------------------------------------------------------------------*
* END-OF-SELECTION                                                     *
*----------------------------------------------------------------------*
end-of-selection.
  perform display_hierseq.

*&---------------------------------------------------------------------*
*&      Form  select_data
*&---------------------------------------------------------------------*
* §1 select data into your global output table
*----------------------------------------------------------------------*
form select_data.

  field-symbols: <ls_master> type g_type_s_master.

  data: lt_slave type standard table of g_type_s_slave.

  select * from (con_master)
    into corresponding fields of table gt_master
    up to gs_test-amount rows.                              "#EC *

  loop at gt_master assigning <ls_master>.
    select * from (con_slave) into corresponding fields
               of table lt_slave
               up to gs_test-amount rows
               where carrid eq <ls_master>-carrid
                 and connid eq <ls_master>-connid.          "#EC *
    append lines of lt_slave to gt_slave.
  endloop.

endform.                    " select_data

*&--------------------------------------------------------------------*
*&      Form  display_hierseq
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form display_hierseq.

  data:
    lt_binding type salv_t_hierseq_binding,
    ls_binding type salv_s_hierseq_binding.

  data:
    lr_functions type ref to cl_salv_functions_list.

  data:
    lr_columns type ref to cl_salv_columns_hierseq,
    lr_column  type ref to cl_salv_column_hierseq.

  data:
    lr_level type ref to cl_salv_hierseq_level.

*... create the binding information between master and slave
  ls_binding-master = 'MANDT'.
  ls_binding-slave  = 'MANDT'.
  append ls_binding to lt_binding.

  ls_binding-master = 'CARRID'.
  ls_binding-slave  = 'CARRID'.
  append ls_binding to lt_binding.

  ls_binding-master = 'CONNID'.
  ls_binding-slave  = 'CONNID'.
  append ls_binding to lt_binding.

*... §2 create an ALV hierseq table
  try.
      cl_salv_hierseq_table=>factory(
        exporting
          t_binding_level1_level2 = lt_binding
        importing
          r_hierseq               = gr_hierseq
        changing
          t_table_level1           = gt_master
          t_table_level2           = gt_slave ).
    catch cx_salv_data_error cx_salv_not_found.
  endtry.

*... §3 Functions
*... §3.2 include own functions by setting own status
  gr_hierseq->set_screen_status(
    pfstatus   =  'SALV_STANDARD'
    report     =  gs_test-repid ).

*... §3.1 activate ALV generic Functions
  lr_functions = gr_hierseq->get_functions( ).
  lr_functions->set_all( abap_true ).

*... *** MASTER Settings ***
  try.
      lr_columns = gr_hierseq->get_columns( 1 ).
    catch cx_salv_not_found.
  endtry.

*... set the columns technical
  try.
      lr_column ?= lr_columns->get_column( 'MANDT' ).
      lr_column->set_technical( if_salv_c_bool_sap=>true ).
    catch cx_salv_not_found.                            "#EC NO_HANDLER
  endtry.

*... set expand column
  try.
      lr_columns->set_expand_column( 'EXPAND' ).
    catch cx_salv_data_error.                           "#EC NO_HANDLER
  endtry.

*... set items expanded
  try.
      lr_level = gr_hierseq->get_level( 1 ).
    catch cx_salv_not_found.
  endtry.
  lr_level->set_items_expanded( ).

*... §4 set hotspot column
  try.
      lr_column ?= lr_columns->get_column( 'CARRID' ).
      lr_column->set_cell_type( if_salv_c_cell_type=>hotspot ).
    catch cx_salv_not_found.                            "#EC NO_HANDLER
  endtry.

*... *** SLAVE Settings ***
  try.
      lr_columns = gr_hierseq->get_columns( 2 ).
    catch cx_salv_not_found.
  endtry.

*... set the columns technical
  perform set_columns_technical using lr_columns.

*... §4 set hotspot column
  try.
      lr_column ?= lr_columns->get_column( 'CARRID' ).
      lr_column->set_cell_type( if_salv_c_cell_type=>hotspot ).
    catch cx_salv_not_found.                            "#EC NO_HANDLER
  endtry.

*... *** GENERAL Settings ***
*... §6 register to the events of cl_salv_hierseq_table
  data: lr_events type ref to cl_salv_events_hierseq.

  lr_events = gr_hierseq->get_event( ).

  create object gr_events.

*... §6.1 register to the event USER_COMMAND
  set handler gr_events->on_user_command for lr_events.
*... §6.2 register to the event BEFORE_SALV_FUNCTION
  set handler gr_events->on_before_salv_function for lr_events.
*... §6.3 register to the event AFTER_SALV_FUNCTION
  set handler gr_events->on_after_salv_function for lr_events.
*... §6.4 register to the event DOUBLE_CLICK
  set handler gr_events->on_double_click for lr_events.
*... §6.5 register to the event LINK_CLICK
  set handler gr_events->on_link_click for lr_events.

*... set list title
  data: lr_display_settings type ref to cl_salv_display_settings,
        l_title type lvc_title.

  l_title = text-t01.
  lr_display_settings = gr_hierseq->get_display_settings( ).
  lr_display_settings->set_list_header( l_title ).

*... §7 display the table
  gr_hierseq->display( ).

endform.                    "display_hierseq

*&---------------------------------------------------------------------*
*&      Form  show_function_info
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
form show_function_info using i_function type salv_de_function
                              i_text     type string.

  data: l_string type string.

  concatenate i_text i_function into l_string separated by space.

  message i000(0k) with l_string.

endform.                    " show_function_info

*&---------------------------------------------------------------------*
*&      Form  set_columns_technical
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
form set_columns_technical using ir_columns type ref to cl_salv_columns_hierseq.

  data: lr_column type ref to cl_salv_column.

  try.
      lr_column = ir_columns->get_column( 'MANDT' ).
      lr_column->set_technical( if_salv_c_bool_sap=>true ).
    catch cx_salv_not_found.                            "#EC NO_HANDLER
  endtry.

  try.
      lr_column = ir_columns->get_column( 'FLOAT_FI' ).
      lr_column->set_technical( if_salv_c_bool_sap=>true ).
    catch cx_salv_not_found.                            "#EC NO_HANDLER
  endtry.

  try.
      lr_column = ir_columns->get_column( 'STRING_F' ).
      lr_column->set_technical( if_salv_c_bool_sap=>true ).
    catch cx_salv_not_found.                            "#EC NO_HANDLER
  endtry.

  try.
      lr_column = ir_columns->get_column( 'XSTRING' ).
      lr_column->set_technical( if_salv_c_bool_sap=>true ).
    catch cx_salv_not_found.                            "#EC NO_HANDLER
  endtry.

  try.
      lr_column = ir_columns->get_column( 'INT_FIEL' ).
      lr_column->set_technical( if_salv_c_bool_sap=>true ).
    catch cx_salv_not_found.                            "#EC NO_HANDLER
  endtry.

  try.
      lr_column = ir_columns->get_column( 'HEX_FIEL' ).
      lr_column->set_technical( if_salv_c_bool_sap=>true ).
    catch cx_salv_not_found.                            "#EC NO_HANDLER
  endtry.

  try.
      lr_column = ir_columns->get_column( 'DROPDOWN' ).
      lr_column->set_technical( if_salv_c_bool_sap=>true ).
    catch cx_salv_not_found.                            "#EC NO_HANDLER
  endtry.

  try.
      lr_column = ir_columns->get_column( 'TAB_INDEX' ).
      lr_column->set_technical( if_salv_c_bool_sap=>true ).
    catch cx_salv_not_found.                            "#EC NO_HANDLER
  endtry.

endform.                    " set_columns_technical(

*&--------------------------------------------------------------------*
*&      Form  show_cell_info
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
form show_cell_info using i_level  type i
                          i_row    type i
                          i_column type lvc_fname
                          i_text   type string.

  data: l_row_string type string,
        l_col_string type string,
        l_row        type char128.

  write i_row to l_row left-justified.

  concatenate text-i02 l_row into l_row_string separated by space.
  concatenate text-i03 i_column into l_col_string separated by space.

  case i_level.
    when 1.
      message i000(0k) with i_text text-i04 l_row_string l_col_string.
    when 2.
      message i000(0k) with i_text text-i05 l_row_string l_col_string.
  endcase.

endform.                    " show_cell_info

Regards.

Eshwar.