Add Button with ALV Standard Toolbar.
Hi,
Can any one tell me how to add user-defined button with ALV
Standard toolbar? When I add Pf-status for alv output , standard alv toolbar is not displayed.
Plz do needful.
On the toolbar event of your alv grid, all the button as shown in the code below.
FORM handle_toolbar USING i_object TYPE REF TO cl_alv_event_toolbar_set .
DATA: ls_toolbar TYPE stb_button.
CLEAR ls_toolbar.
MOVE 'EXCH' TO ls_toolbar-function. "#EC NOTEXT
MOVE 2 TO ls_toolbar-butn_type.
MOVE icon_calculation TO ls_toolbar-icon.
MOVE 'Payment in Other Currencies'(202) TO ls_toolbar-quickinfo.
MOVE ' ' TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled. "#EC NOTEXT
APPEND ls_toolbar TO i_object->mt_toolbar.
ENDFORM
CLASS lcl_event_handler DEFINITION .
PUBLIC SECTION .
METHODS:
*To add new functional buttons to the ALV toolbar
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive ,
ENDCLASS.
CLASS lcl_event_handler IMPLEMENTATION .
*Handle Toolbar
METHOD handle_toolbar.
PERFORM handle_toolbar USING e_object e_interactive .
ENDMETHOD .
ENDCLASS.
DATA gr_event_handler TYPE REF TO lcl_event_handler .
*--Creating an instance for the event handler
CREATE OBJECT gr_event_handler .
*--Registering handler methods to handle ALV Grid events
SET HANDLER gr_event_handler->handle_toolbar FOR gr_alvgrid .
Hope this helps.
Thanks,
Balaji
Similar Messages
-
How to add a button to the Standard Toolbar in ALV ?
Hi All,
If i add a button it should be displayed along with
the standard icons of the toolbar.
Plz guide me.
Thx in advance.Hi Albert.
You need to do a few things for that :
- Create your own GUI status by copying STANDARD_FULLSCREEN from function group SLVC_FULLSCREEN.
- Set your own PF-Status using the Exclude table because otherwise your exclude table would become meaningless.
- define a subroutine to handle the user commands.
Sample implementation :
FORM pf_status USING extab TYPE slis_t_extab.
extab = pf_exclude.
SET PF-STATUS 'STANDARD' EXCLUDING extab.
ENDFORM. "PF_STATUS
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repid
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'PF_STATUS'
is_layout = layout
it_fieldcat = fieldcat
it_excluding = pf_exclude
TABLES
t_outtab = itab
EXCEPTIONS
OTHERS = 0.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
ENDFORM.
Please reward points if found helpful. -
Add buttons to an standard status ALV
Hi experts,
I want to add new buttons to an standard status of ALV list.
I created the ALV with the function REUSE_ALV_HIERSEQ_LIST_DISPLAY.
Can anyone help me???
Thanks!Hi LydiaMM,
Copy the standard Status and add the required functionality in the code for the new buttons and
pass the status to the import parameter I_CALLBACK_PF_STATUS_SETfor the FM REUSE_ALV_HIERSEQ_LIST_DISPLAY.
Copy the status 'STANDARD' of the program SAPLKKBL and you can add the new buttons in the status.
Hope this might help you.
Regards,
Phani. -
How can we make the save button active in standard toolbar in outout of alv
Hi experts ,
I am using factory method to print alv with oops .
Cancel , Exit and Back button are active by default in Standard tool bar in output of Report , But Save button is not active , How can i make that save button active .
Also Pls tell me how i can make editable to the cell in output ,
My Code is like this :
cl_salv_table=>factory( IMPORTING r_salv_table = gr_table CHANGING t_table = ispfli ).
gr_functions = gr_table->get_functions( ).
gr_functions->set_all( abap_true ).
gr_display = gr_table->get_display_settings( ).
gr_display->set_striped_pattern( cl_salv_display_settings=>true ).
gr_display->set_list_header( 'This is the heading' ).
gr_columns = gr_table->get_columns( ).
gr_column ?= gr_columns->get_column( 'CITYTO' ).
gr_column->set_long_text( 'This is long text' ).
gr_column->set_medium_text( 'This is med text' ).
gr_column->set_short_text( 'This is sh' ).
gr_column ?= gr_columns->get_column( 'CITYFROM' ).
color-col = '6'.
color-int = '1'.
color-inv = '0'.
gr_column->set_color( color ).
gr_sorts = gr_table->get_sorts( ).
*gr_sorts->add_sort( 'CITYTO' ).
gr_sorts->add_sort( columnname = 'CITYTO' subtotal = abap_true ).
gr_agg = gr_table->get_aggregations( ).
gr_agg->add_aggregation( 'DISTANCE' ).
gr_filter = gr_table->get_filters( ).
gr_filter->add_filter( columnname = 'CARRID' low = 'DL' ).
gr_layout = gr_table->get_layout( ).
gr_layout->set_key( key ).
key-report = sy-repid.
gr_layout->set_save_restriction( cl_salv_layout=>restrict_none ).
gr_table->display( ).
Rgds,
PremrajHi,
1)you need to give the function code to that save in the Function Keys of that screen from the GUI Status.
2) while filling the field catalog of that field you need to put the
wa_fieldcat_edit-edit = c_x.
i.e use the edit and append to that field catalog internal table.
for more infomation you can refer to below links:
problem with alv edit and save
*Edit* and *Save* for the selected records in ALV
solves your problem
Thanks!! -
Add buttons in ALV Report output
Dear Friends,
I am developing one ALV report in PP moule for calculating Shelf Life. The output is coming properly in ALV.
But my additional requirement is ADD coustomise buttons in ALV Reports.
Please give me an idea how can I insert buttons in my alv report?
Thanks & Regards
VasuHi vasu,
consider the code given below.
FORM F4200_PF_STATUS_SET *
FORM f4200_pf_status_set USING i_extab TYPE slis_t_extab.
REFRESH i_extab.
PERFORM f4210_exclude_fcodes CHANGING i_extab.
The PF status is an exact copy of the PF status 'STANDARD' of program
SAPLSALV but with command 'CHNG' added to it.
SET PF-STATUS 'ZSOM_STANDARD' EXCLUDING i_extab.
ENDFORM.
*& Form f4210_exclude_fcodes
FORM f4210_exclude_fcodes USING i_extab TYPE slis_t_extab.
DATA: ws_fcode TYPE slis_extab.
CLEAR ws_fcode.
ws_fcode = '&EB9'. " Call up Report.
APPEND ws_fcode TO i_extab.
ws_fcode = '&ABC'. " ABC Analysis.
APPEND ws_fcode TO i_extab.
ws_fcode = '&NFO'. " Info Select.
APPEND ws_fcode TO i_extab.
ws_fcode = '&LFO'. " Information.
APPEND ws_fcode TO i_extab.
ENDFORM. " f4210_exclude_fcodes
*& Form f4300_user_command
FORM f4300_user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
CASE ucomm.
WHEN '&IC1'. "Double Click line Item
READ TABLE i_data INDEX selfield-tabindex.
IF i_data-qmnum NE space.
SET PARAMETER ID 'IQM' FIELD i_data-qmnum.
CALL TRANSACTION 'IW52' AND SKIP FIRST SCREEN.
CLEAR ucomm.
ENDIF.
WHEN 'CHNG'. " Change Notification Icon
READ TABLE i_data INDEX selfield-tabindex.
IF i_data-qmnum NE space.
SET PARAMETER ID 'IQM' FIELD i_data-qmnum.
CALL TRANSACTION 'IW52' AND SKIP FIRST SCREEN.
CLEAR ucomm.
ENDIF.
ENDCASE.
CLEAR ucomm.
ENDFORM. " f4300_user_command
EXPLANATION
In this program, first we created a PF status (ZSOM_STANDARD), which was an exact copy of STANDARD of program SAPLSALV through transaction SE41 (Menu Painter). Then we added another button to it,with a new fcode called CHNG. After this this we set this PF status instead of STANADRD.
We initialize a third event USER_COMMAND and associate a form with it. In this form we can capture the function codes and write any functionality under it. If we write functionality for an existing fcode, then this gets precedence over the default functionality that might be associated with it.
In this example, we capture a standard fcode &IC1 that is nothing but double clicking a line of the report. We are capturing the notification number of that line and calling transaction IW52 with it. We are also doing the same when a user clicks on the new Change Notification button.
When the user clicks the Back button in IW52, it comes back to the report.
Please reward for the same.
Message was edited by: Prakhar Saxena -
Creating push button on ALV application toolbar
Hi Abapers,
I have created one ALV in HR module using function module 'display_basic_list'. now my requirement is to create a push button on ALV application tool bar so that when user clicks on this push button another list has to appear..
kindly gimme valid inputs which would help me.. Also provide me sample code...
Thanks in Advance,
Radhika.Hi,
GO to SE41 copy the status STANDARD from the program SAPLKKBL..And give the status name and your program name...
Add your buttons..
In the parameter I_CALLBACK_PF_STATUS_SET give the form name 'PF_STATUS_SET'.
In the subroutine.
FORM PF_STATUS_SET.
SET PF-STATUS 'STATUS NAME THAT YOU GAVE IN SE41'.
ENDFORM.
For user command pass the parameter I_CALLBACK_USER_COMMAND with the user command subroutine name..
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
IF R_UCOMM = ''.
ENDIF.
ENDFORM.
Example
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = lv_repid
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS_SET'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
Thanks,
Naren -
How to add button in ALV report (Class method )?
Hello experts,
I have developed one ALV report using classes.
I want to add one more button on the report like already is there named DISPLQUA
How ca i do that here?
Following the code of CLASS definition & implimentation
CLASS lcl_handle_events DEFINITION.
PUBLIC SECTION.
METHODS:
handle_on_user_command FOR EVENT added_function OF cl_salv_events
IMPORTING e_salv_function.
ENDCLASS. "lcl_handle_events DEFINITION
CLASS lcl_handle_events IMPLEMENTATION
CLASS lcl_handle_events IMPLEMENTATION.
METHOD handle_on_user_command.
CASE e_salv_function.
WHEN 'DISPLQUA'.
PERFORM show_quant_record.
WHEN 'DISPQM03'. " Here i want to add button
PERFORM display_quality_notification.
WHEN OTHERS.
ENDCASE.
ENDMETHOD. "handle_on_user_command
ENDCLASS. "lcl_handle_events IMPLEMENTATIONHI Ronny.
Code snippet for reference.
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION.
METHODS :
*--Toolbar control
HANDLE_TOOLBAR FOR EVENT TOOLBAR
OF CL_GUI_ALV_GRID IMPORTING E_OBJECT
E_INTERACTIVE,
ENDCLASS
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
*--handle toolbar
METHOD HANDLE_TOOLBAR.
* append a separator to normal toolbar
CLEAR G_TOOLBAR.
G_TOOLBAR-BUTN_TYPE = 3.
APPEND G_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
CLEAR G_TOOLBAR.
G_TOOLBAR-FUNCTION = 'SAVE'.
G_TOOLBAR-ICON = ICON_SYSTEM_SAVE.
G_TOOLBAR-BUTN_TYPE = 0.
G_TOOLBAR-QUICKINFO = 'Save the Customer'(203).
APPEND G_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
ENDMETHOD. "HANDLE_TOOLBAR
Hope this helps.
Gary.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Apr 7, 2008 5:41 PM -
Buttons on ALV Application Toolbar
Hi,
I have added buttons on the Application Toolbar of the ALV (in the GUI status).
There are a lot of buttons and due to lack of space some of the buttons go out of the screen.
Need to know if there is a way to make these buttons scrolable or in a dorp down.
Thanks for the help.
KarenHi Karen,
I also faced the same issue but solved it using alternative solution.
1) Go to PF-STATUS and create a MENU BAR.
2) Give Appropriate NAME and inside it write FUNCTION CODE given for buttons under "Code"
3) Appropriate description under "Text"
4) Save and activate.
Now, execute the report and even if the buttons are going out of screen, you have option to select the button from MENU BAR.
This is the best solution for this problem as far as i know.
Also, if you re-size your window ; the you will get tabs with drop down.
I hope this will help you in solving your issue.
Regards,
Rahul Mahajan -
Anything other than buttons on ALV Grid toolbar?
Does anyone know if anything other than buttons can be placed on a ALV Grid toolbar, eg. a piece of text or an input field? The filter button for data selection may be too cumbersome/slow for a call centre operator; I want to have a display field with a dropdown identifying a data field and an input field to accept a value on which to select.
may be you can do some thing like this..instead of having a input field on the toolbar. have an input field above the ALV grid(this is applicable only when you are using Object Oriented ALV).
| input field : ________________ |
|__________________________________|
| ALV GRID OUTPUT |
|__________________________________|
you can have a button along with input field also. enter the value in it, and press enter . in the enter handling fetch all the data. and display in the ALV grid.
in the screen fiest create input field, and button, then place the custom control. on the custom control you place the grid. -
hi all,
can we add button to std sap without add screen exit through badi?
ThanksHI, Yes you can add.. for that you have to find out the proper BADI.
Thanks,
Prasanna -
Is it possible to add the exit command to a button in ALV OO toolbar
Hi ABAP folks,
is there are a way to add the exit command to a button of an ALV toolbar (like in the GUI status)?
I want to prevent the field validations of a dynpro field at PAI.
Thanks and regards,
MartinManage the event [TOOLBAR|http://help.sap.com/saphelp_erp2004/helpdata/en/ee/c8e07dd52611d2b468006094192fe3/frameset.htm] of CL_GUI_ALV_GRID.
This event is triggered by the ALV each time the toolbar of the control needs to be regenerated. To add self-defined functions to the toolbar, you trigger the event using method set_toolbar_interactive and write an event handler method ( see also: Defining GUI Elements in the Toolbar).
Look at demo BCALV_GRID_05.
Regards,
Raymond -
Add button with specifics features in toolbar .
Hi Everybody,
I would like to add a button on toolbar with the same features than
the "HTML" and "Plain text" buttons. These buttons don't have
descriptive text when the window is large enough to see them. When the
window is to small to see same buttons, the button ">>" has to be clicked
and only then may we see the descriptive text.
When the window is in full display, the buttons display descriptive text
and make mandatory to widen the window in an exagerate way. Would it be
possible to display the descriptive text ONLY when the button ">>" is
clicked?
Best Regards,
PierreTrying second solution:Getting image in menu bar but mouse click is not working on that menu
Code changed:
//created constructor
OptionCompo()
try
img = javax.imageio.ImageIO.read(new java.net.URL(getClass().getResource("zoom.gif"), "zoom.gif"));
catch(Exception e){}
//changed code of paintComponent()
protected void paintComponent(Graphics g)
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
int h = getHeight();
Font font = UIManager.getFont("Menu.font");
g2.setFont(font);
FontRenderContext frc = g2.getFontRenderContext();
//Rectangle2D r = font.getStringBounds(text, frc);
float sx = 5f;
//float sy = (float)((h + r.getHeight())/2) -
// font.getLineMetrics(text, frc).getDescent();
//g2.drawString(text, sx, sy);
if(img != null) g.drawImage(img,0,0,this);
double x = sx +/* r.getWidth() +*/ sx;
//in main
OptionCompo test = new OptionCompo();
What I need to do? -
How to add excel download button to ALV grid toolbar?
Hi,
Im generating ALV output through the method "SET_TABLE_FOR_FIRST_DISPLAY".But in the output,I cant see a direct excel download button,just like how it used to come when we use FM "REUSE_ALV_GRID_DISPLAY". Here, the excel download option comes as part of a drop down on top.But is there any way that I can have a separate excel download button which will be more user friendly for the customer?
Thanks,
MaheshCreate your own GUI status and add a push button there. In PAI write code for Excel download for that button.
Regards,
Amit -
I made my first attempt to use OO programing in ABAP and created an ALV Grid using CL_GUI_ALV_GRID. I have excluded toolbar buttons without a problem, but now I would like to add a button and code my own reaction to its ok_code. Can anyone tell me how to do this? Please keep in mind I am very new to ABAP Objects.
Hi Jason,
Have you had a look at the example program BCALV_GRID_05 ?
The program demonstrates exactly what you are intending to do.
Please get back with any specific doubts you may encounter.
Regards,
Anand MAndalika. -
Add button to RF Standard transaction
Hello,
Is it possible to add a push button to an RF Standard transaction? and How?
ThxHi,
SAP has provided Dummy screens to each RF screen for you to enhance it. They usually named as 'SAPLXLRF' and screen number would be 9XXX . 'XXX' being the original screen number. Then you need to activate the corresponding user exit that starts with MWMRF* for the corresponding screen. Also in the RF Screen Management you need to add an entry with Variant '1'.
Hope that helps.
Thanks
Vinod.
Maybe you are looking for
-
New iMac on the way, how to save itunes LIB from XP HD w/o resync iPod
I have 2 iPods, my PC had massive brain ****, saved the hard drive, stuffed it in an external enclosure, waiting... for an iMac to land on my door step... using another pc to try and keep iPod's charged, and Itunes wants to erase and re-sync the devi
-
Adobe Photoshop CS5 and activations
Hi everyone...... I have Adobe Photoshop CS5 installed on on Windows XP computer. As I understand, I am allowed 2 activations. If I first deactivate and then uninstall CS5 on my current computer Will I then get both of my activations back? I intend
-
Printing image to size of my painting
I am using cs5. I am making a painting with a 6" head. I would like to print a 6" head so I can get the proportions right. I tape the print to the painting and use it for measurements and reference. I don't know anything about pixels, except I want
-
I had created a form on table with report. When the user clicks on the link image on the report, it query up the data on the form. It does all of the DML on the form behind the scenes. Now I have to do the same thing, but the form needs to be based o
-
I have no other details.