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 report...

Former Member
0 Likes
1,129

HI abapers,

How to create drill down report in alv.

When i double click the particular field, another report has to pop up and display the details of that particular field.

for eg,

When double click the amount spent field other report has to say, For which material the amonut has spend.

Thanking You

arvind

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,085

FORM sub_show_alv .

  • Function Module for Grid display

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

i_callback_user_command = 'AT_USER_COMMAND'

is_layout = wa_fieldlayout

it_fieldcat = it_fieldcat

it_events = events

i_save = 'A'

TABLES

t_outtab = i_final

EXCEPTIONS

program_error = 1

OTHERS = 2.

ENDFORM. " sub_show_alv

*&----


*& Form AT_user_command

*&----


form at_user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

refresh i_sub_out.

IF rs_selfield-fieldname <> 'MATNR' AND

rs_selfield-fieldname <> 'WERKS' AND

rs_selfield-fieldname <> 'DISPO' AND

rs_selfield-fieldname <> 'FEVOR'.

LOOP AT i_sub.

split i_sub-counter AT '-' into counter1 counter2.

shift counter1 left deleting leading space.

IF counter1 = rs_selfield-tabindex AND

counter2 = rs_selfield-fieldname.

shift i_sub-order left deleting leading '0'.

i_sub_out-order = i_sub-order.

i_sub_out-pedtr = i_sub-pedtr.

i_sub_out-quant = i_sub-quant.

i_sub_out-arbpl = i_sub-arbpl.

i_sub_out-doc = i_sub-doc.

i_sub_out-vornr = i_sub-vornr.

APPEND i_sub_out.

ENDIF.

ENDLOOP.

  • SORT i_sub_out BY doc.

perform sub1_popu_fieldcat.

perform sub1_popu_layout.

perform sub1_show_alv.

ELSE.

MESSAGE 'Please select any Quantity for this facility'

TYPE 'I'.

ENDIF.

endform. " at_user_command

9 REPLIES 9
Read only

former_member212005
Active Contributor
0 Likes
1,085

This message was moderated.

Read only

Former Member
0 Likes
1,085

Check this Demo program BCALV_TREE_DEMO

Read only

Former Member
0 Likes
1,085

<<copy&paste_removed_by_moderator>>

If you copy paste once again , all points will be unassigned.

Edited by: Vijay Babu Dudla on May 11, 2009 9:11 AM

Read only

Former Member
Read only

Former Member
0 Likes
1,086

FORM sub_show_alv .

  • Function Module for Grid display

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

i_callback_user_command = 'AT_USER_COMMAND'

is_layout = wa_fieldlayout

it_fieldcat = it_fieldcat

it_events = events

i_save = 'A'

TABLES

t_outtab = i_final

EXCEPTIONS

program_error = 1

OTHERS = 2.

ENDFORM. " sub_show_alv

*&----


*& Form AT_user_command

*&----


form at_user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

refresh i_sub_out.

IF rs_selfield-fieldname <> 'MATNR' AND

rs_selfield-fieldname <> 'WERKS' AND

rs_selfield-fieldname <> 'DISPO' AND

rs_selfield-fieldname <> 'FEVOR'.

LOOP AT i_sub.

split i_sub-counter AT '-' into counter1 counter2.

shift counter1 left deleting leading space.

IF counter1 = rs_selfield-tabindex AND

counter2 = rs_selfield-fieldname.

shift i_sub-order left deleting leading '0'.

i_sub_out-order = i_sub-order.

i_sub_out-pedtr = i_sub-pedtr.

i_sub_out-quant = i_sub-quant.

i_sub_out-arbpl = i_sub-arbpl.

i_sub_out-doc = i_sub-doc.

i_sub_out-vornr = i_sub-vornr.

APPEND i_sub_out.

ENDIF.

ENDLOOP.

  • SORT i_sub_out BY doc.

perform sub1_popu_fieldcat.

perform sub1_popu_layout.

perform sub1_show_alv.

ELSE.

MESSAGE 'Please select any Quantity for this facility'

TYPE 'I'.

ENDIF.

endform. " at_user_command

Read only

Former Member
0 Likes
1,085

HI,

Search the SCN/WIKI..you can find the lot of thread's answered. Do search before you post

Read only

Former Member
0 Likes
1,085

Hi Arvind,

You can try out one thing. Create a hotspot for your amount spent field and capture the sy-ucomm for the hotspot trigger in FORM USER-COMMAND. The ucomm is '&IC1'. And you can call the next report on the basis of this.

Rgds,

Sachin.

Read only

Former Member
0 Likes
1,085

Hi

U can have a look at this.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = V_REPID

I_CALLBACK_PF_STATUS_SET = 'SET_STAT'

I_CALLBACK_USER_COMMAND = 'USR_CMD'

I_GRID_SETTINGS = L_GRID_SETTINGS

IT_FIELDCAT = GT_FIELDCAT[]

IS_LAYOUT = GS_LAYOUT

IT_EVENTS = GT_EVENTS[]

TABLES

T_OUTTAB = I_alv_OUTPUT.

*&----


**& Form SET_STAT

*&----


*To Handle Dril down.

FORM SET_STAT USING RT_EXTAB TYPE SLIS_T_EXTAB.

SET PF-STATUS 'create a pf status as that of a standard screen and add a n additional push button'.

ENDFORM. "SET_STAT

*

&----


*& Form USR_CMD

&----


  • To Handle Push Button in alv

FORM USR_CMD USING UCOMM LIKE SY-UCOMM SELFIELD TYPE SLIS_SELFIELD.

DATA LV_UCOMM TYPE SY-UCOMM.

LV_UCOMM = SY-UCOMM.

CASE LV_UCOMM.

WHEN 'Push BUtton'.

Logic.......

ENDCASE.

ENDFORM.

Read only

Former Member
0 Likes
1,085

hi arv,

for me your scenario is not clear..

you want to drill down the alv .. and show the report in the same program or you want to call another program when u try to hit the alv report..

well for drilling down the same program.. you can use the following method

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = GV_REPID

  • I_CALLBACK_PF_STATUS_SET = ' '

I_CALLBACK_USER_COMMAND = 'TOP1' " drill down

I_CALLBACK_TOP_OF_PAGE = 'TOP2'

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

FORM TOP1 USING UCOMM TYPE SY-UCOMM SELFIELD TYPE SLIS_SELFIELD.

READ TABLE GT_FINAL_TOTAL INTO GS_FINAL INDEX SELFIELD-TABINDEX.

CASE SELFIELD-TABINDEX.

WHEN SELFIELD-TABINDEX.

perfrom itab2_operation. " in this form you will write the code to get the data for drill dispplay

now defing fieldcatalog again : example :

GS_FCAT-COL_POS = 1.

GS_FCAT-FIELDNAME = 'EBELN'.

GS_FCAT-SELTEXT_L = TEXT-001.

GS_FCAT-FIX_COLUMN = 'X'.

GS_FCAT-OUTPUTLEN = 13.

APPEND GS_FCAT TO GT_FCA

and call alv display again :

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = GV_REPID

  • I_CALLBACK_PF_STATUS_SET = ' '

I_CALLBACK_TOP_OF_PAGE = 'TOP2'

  • 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 = GS_LAYOUT

IT_FIELDCAT = GT_FCAT

and if you want to call another progam when u hit..u have to use..submit key work

like SUBMIT ZAFI013R VIA SELECTION-SCREEN AND RETURN.