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

drill down in tree report

Former Member
0 Likes
503

Hi gurus,

This is regarding the drill down in the Tree report.

My scenario is,

i am doing a budget variance report which displays the report in tree format.

i have texts for different nodes in the tree, along with that i have a 10 feilds which i display using fieldcat in output along with nodes.

now i want to have the drill down to the 2 of the fields, where it has to go to some transaction.

i tried with hotspot in fieldcat definition but it is not working.

please can u tell me a solution as how can i do this drill down.

thanks in advance.

u will be rewarded heavily.

Hi gurus,

This is regarding the drill down in the Tree report.

My scenario is,

i am doing a budget variance report which displays the report in tree format.

i have texts for different nodes in the tree, along with that i have a 10 feilds which i display using fieldcat in output along with nodes.

now i want to have the drill down to the 2 of the fields, where it has to go to some transaction.

i tried with hotspot in fieldcat definition but it is not working.

please can u tell me a solution as how can i do this drill down.

thanks in advance.

u will be rewarded heavily.

2 REPLIES 2
Read only

Former Member
0 Likes
435

Hi Vipin,

You can try with following example:

&----


*& Report ZPRG *

*& *

&--


INTERACTIVE ALV REPORT PROGRAM--

*& *

&This program displays order detais for a particular customer----


&----


REPORT zprg .

--


TYPE POOLS--

TYPE-POOLS slis.

--


TABLES--

TABLES : kna1, vbak.

--


DATA TYPES--

TYPES : BEGIN OF ty_vbak,

vbeln TYPE vbak-vbeln,

erdat TYPE vbak-erdat,

netwr TYPE vbak-netwr,

END OF ty_vbak.

TYPES : BEGIN OF ty_vbap,

posnr TYPE vbap-posnr,

arktx TYPE vbap-arktx,

werks TYPE vbap-werks,

END OF ty_vbap.

--


WORK AREAS--

  • FOR FIRST PAGE *

DATA w_fcat TYPE slis_fieldcat_alv. "Used as Header for Field Catalog

DATA w_vbak TYPE ty_vbak. "Used as Header for Data Table

DATA w_events TYPE slis_alv_event. "Used as header for Events Table

DATA w_comments TYPE slis_listheader. "Used as Header for Comments Table

  • SECOND PAGE *

DATA w2_fcat TYPE slis_fieldcat_alv. "Used as Header for Field Catalog

DATA w2_vbap TYPE ty_vbap. "Used as Header for Data Table

DATA w2_events TYPE slis_alv_event. "Used as header for Events Table

DATA w2_comments TYPE slis_listheader."Used as Header for Comments Table

--


INTERNAL TABLES--

  • FOR FIRST PAGE *

DATA t_fcat TYPE slis_t_fieldcat_alv. "Table for Field Catalog

DATA t_vbak TYPE ty_vbak OCCURS 1. "Data Table

DATA t_events TYPE slis_t_event. "Table for events

DATA t_comments TYPE slis_t_listheader. "Comments table

  • SECOND PAGE *

DATA t2_fcat TYPE slis_t_fieldcat_alv. "Table for Field Catalog

DATA t2_vbap TYPE ty_vbap OCCURS 1. "Data Table

DATA t2_events TYPE slis_t_event. "Table for events

DATA t2_comments TYPE slis_t_listheader. "Comments table

*****************VIPIN: START*****************************

DATA: V_REPID LIKE SY-REPID.

V_REPID = SY-REPID.

*****************VIPIN: END*******************************

--


SELECTION SCREEN--

PARAMETERS p_custno TYPE kna1-kunnr.

--


FILLING FIELD CATALOG--

  • FOR FIRST PAGE *

w_fcat-col_pos = 1.

w_fcat-fieldname = 'VBELN'.

w_fcat-seltext_m = 'ORDER NUMBER'.

APPEND w_fcat TO t_fcat.

w_fcat-col_pos = 2.

w_fcat-fieldname = 'ERDAT'.

w_fcat-seltext_m = 'ORDER DATE'.

APPEND w_fcat TO t_fcat.

w_fcat-col_pos = 3.

w_fcat-fieldname = 'NETWR'.

w_fcat-seltext_m = 'ORDER VALUE'.

APPEND w_fcat TO t_fcat.

  • SECOND PAGE *

w2_fcat-col_pos = 1.

w2_fcat-fieldname = 'POSNR'.

w2_fcat-seltext_m = 'ITEM NUMBER'.

APPEND w2_fcat TO t2_fcat.

w2_fcat-col_pos = 2.

w2_fcat-fieldname = 'ARKTX'.

w2_fcat-seltext_m = 'ITEM DESCRIPTION'.

APPEND w2_fcat TO t2_fcat.

w2_fcat-col_pos = 3.

w2_fcat-fieldname = 'WERKS'.

w2_fcat-seltext_m = 'PLANT'.

APPEND w2_fcat TO t2_fcat.

--


FILLING DATA TABLE--

  • FOR FIRST PAGE *

SELECT vbeln

erdat

netwr

FROM vbak

INTO TABLE t_vbak

WHERE kunnr = p_custno.

SORT t_vbak BY vbeln.

  • SECOND PAGE *

  • DATA FOR 2ND PAGE IS FILLED IN THE SUBROUTINE HANDLING USER_COMMAND *

--


FILLING EVENTS TABLE--

w_events-name = 'TOP_OF_PAGE'.

w_events-form = 'SUB1'.

APPEND w_events TO t_events.

w_events-name = 'USER_COMMAND'.

w_events-form = 'SUB2'.

APPEND w_events TO t_events.

--


FILLING COMMENTS TABLE--

w_comments-typ = 'H'.

w_comments-info = 'CUSTOMER ORDER INFORMATION'.

APPEND w_comments TO t_comments.

w_comments-typ = 'S'.

w_comments-key = 'Sold To Party'.

w_comments-info = p_custno.

APPEND w_comments TO t_comments.

-----PASSING FIELD CATALOG AND THE DATA TABLE TO THE FUNCTION-----

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

i_callback_program = V_REPID

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

it_fieldcat = t_fcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

it_events = t_events

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = t_vbak

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

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

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

ENDIF.

&----


  • Subroutine for the Event TOP_OF_PAGE

----


FORM sub1 .

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = t_comments

i_logo = 'COMPANY LOGO'

  • I_END_OF_LIST_GRID =

.

ENDFORM. " sub1

&----


  • Subroutine for the Event USER_COMMAND

  • Here u_comm contains the function code of the selected function

  • and slis_field is a structure containing cursor information

----


FORM sub2 USING u_comm LIKE sy-ucomm rs_field TYPE slis_selfield.

CASE u_comm.

WHEN '&IC1'.

IF rs_field-fieldname = 'VBELN'.

SELECT posnr

arktx

werks

FROM vbap INTO TABLE t2_vbap WHERE vbeln = rs_field-value.

ENDIF.

ENDCASE.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

  • I_CALLBACK_PROGRAM = ' '

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

it_fieldcat = t2_fcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = t2_vbap.

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

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

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

ENDIF.

ENDFORM. "sub2

Read only

former_member191735
Active Contributor
0 Likes
435

I cannot put all my code here but if you search for programs SALV_DEMO_TREE_* there are about 5 programs for events and functions etc.

it is possible with Hotspot and i am using in one of my programs but it is an SALV type. Use on link click event. You should be fine