Application Development 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: 

How to add push buttons in out put screen of ALV

Former Member
0 Kudos

Hai,

How to add push buttons in out put screen of ALV (tool bar) with out using classes or methods .I want to know using normal ALV .

Thanks in advance .

kiran

1 ACCEPTED SOLUTION

Vinod_Chandran
Active Contributor
0 Kudos

Hi Kiran,

Use the parameter i_callback_pf_status_set in the function module REUSE_ALV_GRID_DISPLAY.

E.g.

i_callback_program = gd_repid

i_callback_pf_status_set = 'SET_PF_STATUS'

And create a subroutine as follows

form set_pf_status using rt_extab type slis_t_extab.

set pf-status 'NEWALVSTATUS'.

endform.

You have to copy the standard ALV pf stauts to 'NEWALVSTATUS' and add your button.

Thanks

Vinod

16 REPLIES 16

Vinod_Chandran
Active Contributor
0 Kudos

Hi Kiran,

Use the parameter i_callback_pf_status_set in the function module REUSE_ALV_GRID_DISPLAY.

E.g.

i_callback_program = gd_repid

i_callback_pf_status_set = 'SET_PF_STATUS'

And create a subroutine as follows

form set_pf_status using rt_extab type slis_t_extab.

set pf-status 'NEWALVSTATUS'.

endform.

You have to copy the standard ALV pf stauts to 'NEWALVSTATUS' and add your button.

Thanks

Vinod

0 Kudos

Hai Vinod,

Thank you.How and where to declare the pushbutton to get in a specific position.

regards

kiran

0 Kudos

You have to copy the standard pf status to a new one.

For this go to the ALV screen and take the menu System -> Status. (I do not access to the system now) then look for the standard pf status. Copy this to Z range and then add your new button.

0 Kudos

Hai Vinod,

Thanks the problem of adding push buttons is solved.

Regards,

kiran.

Vinod_Chandran
Active Contributor
0 Kudos

You have to do the following to process the new button click.

i_callback_user_command = 'USER_COMMAND'

form user_command using i_ucomm like sy-ucomm

is_selfield type slis_selfield.

case i_ucomm.

when 'XXXX'. "XXXX is the function code for new button

endcase.

endform.

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Create a GUI status.

Go to GUI Status->Application toolbar.

THen add the button by giving

Function text

Icon name

Icon text

Info. text

Fastpath

Then in PBO of the screen,

Just give in a module

set pf_status 'ZSTATUS'.

Kindly reward points if it helps,otherwise get back.

0 Kudos

hai jayanthi,

This is a report not a module pool . so how can i customise the screen.

kiran

0 Kudos

Kiran,

You do not have to enter this in the PBO because you can't edit the screen of PBO if you are using the function module. Instead call the new pf status in the subroutine I have mentioned earlier.

Do you know how to copy the standard pf status?

0 Kudos

hai vinod,

Its ok.But iam not doing module pool program.This is a REPORT.So how can i write PBO for this.Also tell me how to copy pfstatus and its user command (functionality of buttons).

thanks

kiran

0 Kudos

Kiran,

You do not have to write PBO for this. You just have to use the new pf status in your report program.

Please refer the following

http://www.sap-basis-abap.com/abap/add-button-to-alv-toolbar-with-reuse-alv-list-display.htm

Thanks

Vinod

0 Kudos

Hi Kiran,

Here is the sample code.If you are using reuse_alv_grid_display, no need to write code in PBO.

Just double click the 'TEST' which is written in code.Then create a GUI Status.In Application toolbar,type the name of the button you want(say BUTTON).Then double click that name.Then enter the ICON name and function text.Activate it.This itself will work.If you want all the functionalities,then try to do as Vinod told.

TYPE-POOLS: slis.

DATA: i_qmel LIKE qmel OCCURS 0.

data v_repid type repid.

SELECT * FROM qmel INTO TABLE i_qmel.

v_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = v_repid

I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

i_structure_name = 'QMEL'

TABLES

t_outtab = i_qmel

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.

form set_pf_status using rt_extab type slis_t_extab.

set pf-status '<b>TEST</b>'.

endform.

FORM user_command USING ucomm LIKE sy-ucomm

selfield TYPE slis_selfield.

data lv_ucomm type sy-ucomm.

lv_ucomm

= sy-ucomm.

CASE lv_ucomm.

WHEN 'BUTTON'. "Double Click line Item

call transaction 'MM01'.

endcase.

endform.

0 Kudos

Hai Jayanthi,

In that PFSTATUS .i have to mention standard ALV tool bar buttons along with my push buttons or only the push buttons that i have to add.

0 Kudos

Hi,

If use want all the standard functionality,then you have to give all the functionality.In that case it is better the copy from standard program.If you want just ,save,back,cancel,exit.,then add the same in Functions Key-Standard Toolbar in GUI status.Write your coding in USER Command for the same.

when 'BACK'.

.....

When 'CANCEL'.

...

0 Kudos

Hi,

To copy from standard status,

Go to SE41.Give program name as SAPLSALV and click status radio button.Then in the icon above , choose copy status icon(ctrl+f6).Then give your (to)program name and your GUI status in the popup appearing.Then in that status, add the button as I already explained.

<b>Still If you face problems,get back.Otherwise,close the thread by clicking the blue star [problem solved] against any reply which solved your problem.Otherwise, if you solved it on your own,you can select the blue star against your question.</b>

Message was edited by: Jayanthi Jayaraman

0 Kudos

Hi Vinod,

The second link you had sent was too gud. thanks a lot.

Tushar

Former Member
0 Kudos

Hi,

Its very simple,

MODULE status_9001 OUTPUT.

IF o_dockingcontainer IS INITIAL.

SET PF-STATUS 'ZSTATUS'.

SET TITLEBAR 'ZTITLE'.

  • Creating Object

PERFORM f9000_objects_create.

  • Building the field catalog

endif.

In the ZSTATUS, when u double click a screen will open in that in the application toolbar u can specify as eg:MATNR give description, save and activate this.

Then in PAI u can do

as

MODULE user_command_9001 INPUT.

CASE sy-ucomm.

WHEN 'MATNR'

perform ....

ENDCASE.

Hope this helps.

If u want some sample code get back to me.