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

Adding button in the ALV Grid display

Former Member
0 Likes
16,762

I have developed a Z report and used 'REUSE_ALV_GRID_DISPLAY' function module for displaying the output. But now I have to add one button in the report display for displaying the issue log how to get this?

1 ACCEPTED SOLUTION
Read only

Former Member
7,985

Hi,

Please find the below code

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_BYPASSING_BUFFER = ' '

I_SAVE = 'A'

I_CALLBACK_PROGRAM = 'Report Name'

I_CALLBACK_PF_STATUS_SET = 'F01_ALV_EVENT_PF_STATUS_SET'

I_CALLBACK_USER_COMMAND = 'F01_ALV_EVENT_USER_COMMAND'

IS_LAYOUT = WA_LAYOUT

IT_FIELDCAT = IT_FCAT[]

TABLES

T_OUTTAB = IT_OFIN[].

ENDFORM. " out_disp

----


  • FORM f01_alv_event_pf_status_set

----


*

----


FORM F01_ALV_EVENT_PF_STATUS_SET USING RT_EXTAB TYPE SLIS_T_EXTAB.

SET PF-STATUS 'ICON'.

ENDFORM. "f01_alv_event_pf_status_set

----


  • FORM f01_alv_event_user_command

----


*

----


FORM F01_ALV_EVENT_USER_COMMAND USING PU_UCOMM LIKE SY-UCOMM

PU_SELFIELD TYPE SLIS_SELFIELD.

CASE PU_UCOMM.

WHEN '&IC1'.

CASE PU_SELFIELD-FIELDNAME.

WHEN 'LIFNR'.

W_LIFNR1 = PU_SELFIELD-VALUE.

SET PARAMETER ID 'LIF' FIELD W_LIFNR1.

CALL TRANSACTION 'XK03'.

EXIT.

WHEN 'EBELN'.

W_EBELN1 = PU_SELFIELD-VALUE.

SET PARAMETER ID 'BES' FIELD W_EBELN1.

CALL FUNCTION 'ME_DISPLAY_PURCHASE_DOCUMENT'

EXPORTING

I_EBELN = W_EBELN1

I_ENJOY = 'X'

I_DISPLAY_ONLY = 'X'.

EXIT.

ENDCASE.

I have developed a Z report and used 'REUSE_ALV_GRID_DISPLAY' function module for displaying the output. But now I have to add one button in the report display for displaying the issue log how to get this?

5 REPLIES 5
Read only

Former Member
0 Likes
7,985

go to

SE41 - copy gui status from SAPLSALV Status STANDARD to your program - you status name

then add your buttons, options and the like

In your REUSE_ALV_GRID/LIST fill the parameters

(1) I_CALLBACK_PROGRAM - with your program name

(2) I_CALLBACK_PF_STATUS_SET - with the name of a subroutine of I_CALLBACK_PROGRAM which looks ike "FORM set_pf_status USING rt_extab TYPE slis_t_extab

" and contains instrution "ET PF-STATUS user status EXCLUDING rt_extab"

in rt_extab you can hide function codes (as a rule only change or add your own function codes but you can hide some standard functions)

(3) I_CALLBACK_USER_COMMAND - with the name of a subroutine of I_CALLBACK_PROGRAM, which looks like FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

R_UCOMM contains function code

in RSSELFIELD : tabname/tabindex to read the record selected etc.

Read only

Former Member
0 Likes
7,985

Hi,

you should copy the 'STANDARD' GUI status from program SAPLKKBL using transaction SE90.Then add your own button in that status.Write logic in form 'USER_COMMAND' of 'REUSE_ALV_GRID_DISPLAY'.

Hope this will help.

Thanks & Regards,

Rock.

Read only

Former Member
0 Likes
7,985

HI,

please check in scn. It was solved many times.

for your reference you can check with

user_command and also custom buttons in ALV.

Regards,

Venkatesh

Read only

Former Member
0 Likes
7,985

Hi,

Refer to this link..[How to add a button to the toolbar while using REUSE_ALV_GRID_DISPLAY?|]

Read only

Former Member
7,986

Hi,

Please find the below code

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_BYPASSING_BUFFER = ' '

I_SAVE = 'A'

I_CALLBACK_PROGRAM = 'Report Name'

I_CALLBACK_PF_STATUS_SET = 'F01_ALV_EVENT_PF_STATUS_SET'

I_CALLBACK_USER_COMMAND = 'F01_ALV_EVENT_USER_COMMAND'

IS_LAYOUT = WA_LAYOUT

IT_FIELDCAT = IT_FCAT[]

TABLES

T_OUTTAB = IT_OFIN[].

ENDFORM. " out_disp

----


  • FORM f01_alv_event_pf_status_set

----


*

----


FORM F01_ALV_EVENT_PF_STATUS_SET USING RT_EXTAB TYPE SLIS_T_EXTAB.

SET PF-STATUS 'ICON'.

ENDFORM. "f01_alv_event_pf_status_set

----


  • FORM f01_alv_event_user_command

----


*

----


FORM F01_ALV_EVENT_USER_COMMAND USING PU_UCOMM LIKE SY-UCOMM

PU_SELFIELD TYPE SLIS_SELFIELD.

CASE PU_UCOMM.

WHEN '&IC1'.

CASE PU_SELFIELD-FIELDNAME.

WHEN 'LIFNR'.

W_LIFNR1 = PU_SELFIELD-VALUE.

SET PARAMETER ID 'LIF' FIELD W_LIFNR1.

CALL TRANSACTION 'XK03'.

EXIT.

WHEN 'EBELN'.

W_EBELN1 = PU_SELFIELD-VALUE.

SET PARAMETER ID 'BES' FIELD W_EBELN1.

CALL FUNCTION 'ME_DISPLAY_PURCHASE_DOCUMENT'

EXPORTING

I_EBELN = W_EBELN1

I_ENJOY = 'X'

I_DISPLAY_ONLY = 'X'.

EXIT.

ENDCASE.