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

INSERT PERSONAL BUTTON IN ALV

Former Member
0 Likes
2,277

Hy, I want to insert a new personal button in an alv created without abap objects, some like the modify_toolbar method in an alv object.

In the other hand, i need a function for an alv created without aap objects to emulate the get_selectd_rows method in an alv object.

THANX!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,815

Hi,

this is very simple.


FORM PF_STATUS_SET USING    P_EXTAB TYPE SLIS_T_EXTAB.
  SET PF-STATUS 'STANDARD' EXCLUDING P_EXTAB.
ENDFORM.                    "PF_STATUS_SET

click on the status and add your own buttons to the application tool bar.

and handle them in user_command form.

regards

vijay

Hi,

this is very simple.


FORM PF_STATUS_SET USING    P_EXTAB TYPE SLIS_T_EXTAB.
  SET PF-STATUS 'STANDARD' EXCLUDING P_EXTAB.
ENDFORM.                    "PF_STATUS_SET

click on the status and add your own buttons to the application tool bar.

and handle them in user_command form.

regards

vijay

12 REPLIES 12
Read only

Former Member
0 Likes
1,816

Hi,

this is very simple.


FORM PF_STATUS_SET USING    P_EXTAB TYPE SLIS_T_EXTAB.
  SET PF-STATUS 'STANDARD' EXCLUDING P_EXTAB.
ENDFORM.                    "PF_STATUS_SET

click on the status and add your own buttons to the application tool bar.

and handle them in user_command form.

regards

vijay

Read only

Former Member
0 Likes
1,815

Hi fer,

1. want to insert a new personal button

a) thru se80, open function group SALV

b) by right click, copy STANDARD Gui status

to your program as STANDARD_COPY

c) open your program

d) while using FM REUSE_ALV_LIST_DISPLAY

pass this parameters :

i_callback_program = sy-repid i_callback_user_command = 'ITAB_USER_COMMAND' i_callback_pf_status_set = 'SET_PF_STATUS'

e) now write this code for FORM :

FORM set_pf_status USING rt_extab TYPE slis_t_extab.

SET PF-STATUS 'STANDARD_COPY'.

ENDFORM. "SET_PF_STATUS

f) double click standard_coy

to open gui status, ADD your own button with own fcode, and activate

g) write one more FORM for call back

FORM ITAB_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE

slis_selfield.

IF whatcomm = 'MYCODE'.

*------ LOGIC

*----


ENDIF.

ENDFORM. "INCRFG_user_command

regards,

amit m.

Read only

0 Likes
1,815

Hello !

I referred to ur code below. But I am having certain doubts:-

1. I am workin with transaction FB03. I have developed the code for header data using module pool program.

But now I want to display the line items using ALV grid with buttons(Search , Sort and Back).

Please if possible could u explain this code in detail.

Thanks in advance,

Sachin

Read only

Former Member
0 Likes
1,815

Fer,

Activate the MODIFY_TOOLBAR event and then use this code to add the button.

DATA: LS_TB TYPE STB_BUTTON.

LS_TB-BUTN_TYPE = 3.

INSERT LS_TB INTO E_OBJECT->MT_TOOLBAR INDEX 1.

LS_TB-FUNCTION = 'FUNC1'.

LS_TB-ICON = ICON_ALERT.

LS_TB-QUICKINFO = 'Customer Function 1'(001).

LS_TB-BUTN_TYPE = '0'.

INSERT LS_TB INTO E_OBJECT->MT_TOOLBAR INDEX 1.

LS_TB-FUNCTION = 'FUNC2'.

LS_TB-ICON = ICON_BW_RA_SETTING_ACTIVE.

LS_TB-QUICKINFO = 'Customer Function 2'(002).

LS_TB-BUTN_TYPE = '0'.

INSERT LS_TB INTO E_OBJECT->MT_TOOLBAR INDEX 1.

After that in the event USER_COMMAND you can handle the same. This is for OOP.

regards,

Ravi

Read only

Former Member
0 Likes
1,815

Hi, thanx a lot. I use the REUSE_ALV_EVENTS_GET function to get the alv events, but I cant see the modify_toolbar event that you told me, where can I find it?

thanx!

Read only

0 Likes
1,815

modify_toolbar is only in OO alv

not normal alv.

vijay

Read only

0 Likes
1,815

Hi fer,

1. I suppose u are displaying alv

using FM (and not OO alv)

REUSE_ALV_LIST_DISPLAY

2. For that, Events are not required.

3. See my previous reply

( it works fantastic )

regards,

amit m.

Read only

0 Likes
1,815

Fer,

As I specified in my answer it is for OOP.

Regards,

Ravi

Read only

0 Likes
1,815

Hi

You don't need that event, you have to transfert the name of your form to set your bar in parameter I_CALLBACK_PF_STATUS_SET of fm REUSE_ALV_GRID_DISPLAY (or REUSE_ALV_LIST_DISPLAY, i don't know whioch fm you're using) and indicate the name of program where you define this routine (Your program I suppose).

So

GT_REPID = SY-REPID.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORT

I_CALLBACK_PROGRAM = GT_REPID

I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'

This form has to be:

FORM set_pf_status USING rt_extab TYPE slis_t_extab.

set pf-status 'MY_GUI_ALV' excluding rt_extab.

ENDFORM.

Now you have to create this toolbar copying from alv gui STANDARD_FULLSCREEN or STANDARD of program SAPLKKBL.

Max

Read only

Former Member
0 Likes
1,815

Hi Ammit, I want to insert the personal button inside the alv, near to search button, export to excel button... but inside the alv, not the top of the screen.

Thanx!

Read only

0 Likes
1,815

Hi,

Take one sample standard ALV Program and go to se41.

and give the program name, and choose the status which is available. and click the copy status button and give your program and status name. copy the status and save , activate. then see the components in the pf-status .

now add your own buttons in the status which you copied and activate. give the status in PF-status form.

for normal alv's this is the way.

Regards

vijay

Read only

Former Member
0 Likes
1,815

Hi,

You need to create an own toolbar as copy of standard status gui.

- Create your status GUI as copy of std gui STANDARD_FULLSCREEN of program SAPLKKBL;

- Insert your new push button;

- Create a routine to call your bar:

FORM set_pf_status USING rt_extab TYPE slis_t_extab

SET PF-STATUS 'MY_ALV_BAR' EXCLUDING rt_extab.

ENDFORM.

- Create routine to manage your commands:

FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

CASE R_UCOMM.

WHEN 'XXXX'........

ENDCASE.

ENDFORM.

- Transfers these routines to ALV fm:

GT_REPID = SY-REPID.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = GT_REPID

I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'

i_callback_user_command = 'USER_COMMAND'

............

Please give points, if it is helpful for you

Thanks,

Pramod