How to add Custom button to existing ALV toolbar
Hi,
I want to add custom buttons for varaints in the existing row PRINT VERSION/EXPORT
How do we do that?
Rgds
Vara
I have used the standard component u2018salv_wd_tableu2019 in my application and will be able to give example by adding a button named 'NEW__BUTTON' .
In the WDDOINIT method of the component controller, use the following code to define column name, your own buttons, visible column for the same component usage.
DATA:
lr_salv_wd_table_usage TYPE REF TO if_wd_component_usage,
lr_salv_wd_table TYPE REF TO iwci_salv_wd_table.
*Check ALV component usage
lr_salv_wd_table_usage = wd_this->wd_cpuse_alv( ).
IF lr_salv_wd_table_usage->has_active_component( ) IS INITIAL.
lr_salv_wd_table_usage->create_component( ).
ELSE.
lr_salv_wd_table_usage->delete_component( ).
lr_salv_wd_table_usage->create_component( ).
ENDIF.
*Get ALV component
lr_salv_wd_table = wd_this->wd_cpifc_alv( ).
wd_this->mr_table type ref to CL_SALV_WD_CONFIG_TABLE.
*Get ConfigurationModel from ALV Component
wd_this->mr_table = lr_salv_wd_table->get_model( ).
*Set table settings
DATA:
lr_table_settings TYPE REF TO if_salv_wd_table_settings.
lr_table_settings ?= wd_this->mr_table .
lr_table_settings->set_visible_row_count( '5' ).
lr_table_settings->set_width( '100%' ).
DATA:
lr_header TYPE REF TO cl_salv_wd_header,
l_header_text TYPE string.
lr_header = lr_table_settings->get_header( ).
l_header_text = cl_wd_utilities=>get_otr_text_by_alias( 'NEW__BUTTON' ).
lr_header->set_text( l_header_text ).
lr_header->set_tooltip( l_header_text ).
"lr_table_settings->set_selection_mode( cl_wd_table=>e_selection_mode-multi_no_lead ).
*Set functions
IF wd_this->mb_no_maintain NE abap_true.
DATA:
lr_function TYPE REF TO cl_salv_wd_function,
lr_fe_button TYPE REF TO cl_salv_wd_fe_button,
l_btn_text TYPE string.
*Add the button here for validation on the top of the ALV
*This is where you add the buttons on the same ROW.
lr_function = lr_functions->create_function( 'NEW__BUTTON' ).
CREATE OBJECT lr_fe_button.
l_btn_text = cl_wd_utilities=>get_otr_text_by_alias( 'NEW__BUTTON' ).
lr_fe_button->set_text( l_btn_text ).
lr_fe_button->set_tooltip( l_btn_text ).
lr_function->set_editor( lr_fe_button ).
After defining the buttons 'NEW__BUTTON' , handle the actions for the same using the method u2018LIST_ACTIONu2019 which should have the event as u2018ON_FUNCTIONu2019, controller as u2018interface controlleru2019 and component use as the name you have given say u2018ALVu2019.
In the method u2018LIST_ACTIONu2019, handle the actions as below. This method will have the following importing parameters.
WDEVENT Importing CL_WD_CUSTOM_EVENT
R_PARAM Importing IF_SALV_WD_TABLE_FUNCTION
method list_action .
case r_param->id .
when 'NEW__BUTTON'.
"Do the validation here-"
endcase.
endmethod.
Thanks,
Rajkumar.S
Similar Messages
-
Hello Everyone,
Currently, I'm developing an outlook add-in and would like to setup a custom ribbon button at one of the existing tabs at home screen and at message level too, when
it is opened from home screen.
Following are the helpful screen prints.
Any help would be much appreciated.
Thanks, <b>Ankit Shah</b> <hr> Inkey Solutions, India. <hr> Microsoft Certified Business Management Solutions Professionals <hr> http://ankit.inkeysolutions.comHello Ankit,
All you need is to specify the IdMso value of the built-tab where you want to place your controls. See
How to: Customize a Built-in Tab for more information (TabMail and TabReadMessage).
You can find the list of built-in controls in the following documents:
Office 2010 Help Files: Office Fluent User Interface Control Identifiers
Office 2013 Help Files: Office Fluent User Interface Control Identifiers
The Fluent UI is described in depth in the following series of articles in MSDN:
Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3) -
Add a button choice on alv toolbar in wd4a
Hy everyone i've to add a button choice on alv toolbar. I create a node 'MY_TOOLBAR_FUNCTIONS' where add node and attributes to bind in external mapping in function_elements of alv interface controller.For button_choice I made a node 'CHOICE' and attribute 'WA_VALUE' type string. But the application dumps when create object lr_choice ; the error is WebDynpro Exception: IDs Can Only Contain Characters of Syntactical Character Set .
May you help me? Thanks in advance.
data: ls_choice TYPE ig_componentcontroller=>element_choice,
nd_choice TYPE REF TO if_wd_context_node,
nd_choice = nd_my_functions->get_child_node( name = wd_this->wdctx_choice ).
el_choice = nd_choice->get_element( ).
ls_choice-wa_value = '01'.
APPEND ls_choice TO lt_choice.
nd_choice->bind_table( lt_choice ).
DATA:lr_button_choice TYPE REF TO cl_salv_wd_fe_button_choice.
DATA:lr_choice TYPE REF TO cl_salv_wd_menu_action_item.
lr_function = l_value->if_salv_wd_function_settings~create_function_right( id = 'MYBUTTONCHOICE' ).
CREATE OBJECT lr_button_choice.
EXPORTING
sel_action_item_elementname = 'CHOICE.WA_VALUE'.
lr_button_choice->set_text( value = 'Filter' ).
lr_button_choice->set_tooltip( value = 'Filter').
lr_button_choice->set_sel_action_itm_elementname( 'CHOICE.WA_VALUE' ).
CREATE OBJECT lr_choice
EXPORTING
id = ls_CHOICE-WA_VALUE.
lr_choice->set_text( 'Esito Positivo' ).
lr_choice->set_image_source( value = 'ICON_GREEN_LIGHT').
lr_button_choice->add_choice( lr_choice ).
lr_function->set_editor( lr_button_choice ).in CREATE OBJECT lr_choice the object id have to refer to name of node.
CREATE OBJECT lr_choice
EXPORTING
id = 'CHOICE'. -
Add a button choice on alv toolbar in wda
Hello Experts,
I want add a button choice on alv toolbar. I already insert the choice button indeed I see the button correctly.
Now I want insert the list of action with the following code:
<<
>>
With this code my web-interface retuns this message: "500 SAO INTERNAL SERVER ERROR. ERROR ACCESS via null object reference not possible. (termination rabax_state)". The dump is in "cl_wdr_utilities=>construct_mime_url".
Do you have any ideas? Do you have any examples?
Thanks in advance.
Best Regards,
MarinoHello,
the problem isn't "the line set_image_source". The problem was the order, the correct order is:
<<
CREATE OBJECT lr_button_choice.
lr_button_choice->set_image_source( 'ICON_CHANGE' ). "#EC *
lr_button_choice->set_text( value = 'Modifica' ).
lr_button_choice->set_tooltip( value = 'Modifica Attributi').
CREATE OBJECT lr_menu_action_item
EXPORTING
id = 'MOD_NOTE'." TYPE REF TO cl_salv_wd_menu_action_item.
lr_menu_action_item->set_text( 'Note').
lr_button_choice->add_choice( EXPORTING value = lr_menu_action_item ).
CREATE OBJECT lr_menu_action_item
EXPORTING
id = 'MOD_CONTO'." TYPE REF TO cl_salv_wd_menu_action_item.
lr_menu_action_item->set_text( 'Conto').
lr_button_choice->add_choice( EXPORTING value = lr_menu_action_item ).
lr_function = wd_this->salv_incassi->if_salv_wd_function_settings~create_function( id = 'MOD')."creating the function for alv button
lr_function->set_editor( lr_button_choice ).
>>
Thanks very much.
Best Regards,
Marino -
How to add custom buttons in a workflow email?
We want to add custom buttons in the workflow mail, and we have tried it successfully in workflow notification, but failed in mail,so is there anyone know how to add buttons in workflow mail if it is possible.
The buttons available are all of the different values on the Lookup Type you assign as the Result for the Notificaiton. Add values to this list, or create a new list and point to it.
-
How to add a button on the ALV LIST pop up
Hi ,
Can any one help me to add a button on the ALV list which is a pop up using ABAP Objects.
Thanks in advance.
Regards,
Kavya.HI ,
I want to add a push button on the ALV list out put which is comming as a pop up and I want this using classes and methods.
I have got a method IF_SREL_BROWSER_COMMANDS~ADD_BUTTONS from class cl_gos_attachment_list but still I am unable to get any additional button on the output ALV popup.
Please help.
Regards,
Kavya. -
How to add custom buttons in the tool bar of the crystal reports viewer
Hi,
I'm using Crystal report viewer (Crystal 2008) in my report and I want to add custom buttons and handle them in the tool bar of the viewer. Is there anyway to achieve this?
Please help me in this regard.
Thanks in advance.
Siva.I did this by adding a picturebox to the toolbar, the same size as the buttons, and loading in an image, and putting code into the Click event of the picturebox.
I also put code into the MouseHover event to change the picture's background color and into the MouseLeave event to change it back.
I have a couple of these buttons. They work very nicely and really look like part of the toolbar. -
How to add a button to an alv standar report
Hi all,
I've got a requiremnt to modify the behaviour of the edit button of the ALV in TX vfx3.
When the edit button pressed, the requiered behaviour is to navigate to a Z TX. Is it possible to edit the ALV without creating a new Z alv? Just changing the standard?
Edited by: Iñaki Nolte Usparicha on Dec 29, 2010 12:18 PMHi Iñaki, you have to copy (using transaction SE41) Status-GUI "standard" from program SAPLSALV, with the same name as our program. Delete all unnecessary components and add your custom button.
In the program you have to add:
Form F_SET_PF_STATUS USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'STANDARD'.
Endform.
Form f_user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '%NF'. "NF is the name of the button
PERFORM f_do_something.
ENDCASE.
Endform. -
How to add custom button to Insert tab?
Hello!
I want to add my own button to the Insert tab. This is the
tab where there are buttons like h1, h2, ul, ol etc.
I often need the code tag, but this tag is not avaible in the
Insert tab. So how to add a custom?Any help?
-
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. -
How can we add a button on our ALV Grid
Hello,
I need to add a button on the ALV Grid and write a code on that button to download a file on the desktop of the user's machine.
How can we write a code for the same and what would be the syntax of that code.Hi,
you should copy the 'STANDARD' GUI status from program SAPLKKBL using transaction SE90 >Programming SubObjects> Gui Status.
ENTER SAPLKKBL PROGRAM
STATUS STANDARD.
exexute.
select standard check box. copy to your zprogram and your gui status.
Enter your Z program name and the name you what for this status - you can keep it as 'STANDARD' to be simple.
then go to se 38 double click on pf status .it goes to me41 screen .
there you can add your button along with predefined buttons on application toolbar.
then write code for button using user command event.
Code:
Form Set_pf_status
Notes: Called by FM REUSE_ALV_GRID_DISPLAY
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZSTANDARD'.
ENDFORM. "Set_pf_status
In the above case the GUI status copied was named ZSTANDARD and adjusted accordingly, adding and removing the desired buttons. A button was added called '%DELETE'.
3). Create the following report:
Code:
Form User_command
Notes: Called by FM REUSE_ALV_GRID_DISPLAY
Detects whether the icon/button for
'Return Tag Deletion' has been pressed. If it has then
detect whether any rows have been highlighted and then
set the delete flag.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: li_count TYPE I.
IF r_ucomm EQ '%DELETE'.
LOOP AT %g00 WHERE mark EQ 'X'.
ADD 1 TO li_count.
ENDLOOP.
IF li_count GT 0.
gc_delete_flag = 'X'.
r_ucomm = '&F03'. "Back arraow
ELSE.
MESSAGE W000 WITH 'Please highlight the rows to be deleted!'.
ENDIF.
ENDIF.
ENDFORM. "User_command
*reward points if usefull -
How to add push buttons in out put screen of ALV
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 .
kiranHi 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. -
How to add push button in alv display with out class or method
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 .
kiranYou should post your question in the ABAP forum.
ABAP Development -
How to add the double headings in Alv Report.
Hi All,
Plz suggest me how to add the double headings in ALv Report.
RamHi,
Try out this program....
REPORT ypm_historycard_rep.
TYPE-POOLS : slis.
DATA : it_cbm TYPE STANDARD TABLE OF mara.
DATA : it_layout TYPE STANDARD TABLE OF slis_layout_alv WITH HEADER LINE,
wa_fcat TYPE slis_fieldcat_alv,
it_fcat TYPE slis_t_fieldcat_alv.
START-OF-SELECTION.
SELECT *
FROM mara
INTO CORRESPONDING FIELDS OF TABLE it_cbm
where matnr = 'D80K7'.
END-OF-SELECTION.
it_layout-zebra = 'X'.
it_layout-colwidth_optimize = 'X'.
it_layout-f2code = '&ETA'.
APPEND it_layout.
DEFINE macro4fcat.
wa_fcat-col_pos = &1.
wa_fcat-fieldname = &2.
wa_fcat-tabname = &3.
wa_fcat-seltext_l = &4.
append wa_fcat to it_fcat.
clear wa_fcat.
END-OF-DEFINITION.
macro4fcat '1' 'MATNR' 'IT_CBM' 'MATERIAL NO' .
DESCRIBE TABLE it_cbm.
IF sy-ucomm = '&F03'.
MESSAGE 'hi hello good morning "press enter button" this is quiz' TYPE 'S'.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
is_layout = it_layout
it_fieldcat = it_fcat
i_save = 'A'
TABLES
t_outtab = it_cbm
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 html_top_of_page
* text
* -->TOP text
FORM html_top_of_page USING top TYPE REF TO cl_dd_document.
DATA: l_text(255) TYPE c.
DATA: text1(255) TYPE c.
DATA: t_header TYPE REF TO cl_dd_table_element ,
wa_header TYPE REF TO cl_dd_table_area.
CALL METHOD top->add_gap
EXPORTING
width = 10.
CALL METHOD top->add_text
EXPORTING
text = 'hello'
sap_style = 'HEADING'
CALL METHOD top->add_gap
EXPORTING
width = 20.
CALL METHOD top->add_text
EXPORTING
text = 'HOW ARE YOU'
sap_style = 'HEADING'.
CALL METHOD TOP->new_line
* EXPORTING
* repeat =
CALL METHOD top->add_gap
EXPORTING
width = 50.
CALL METHOD top->add_text
EXPORTING
text = '____________________________________________________________'
sap_style = 'HEADING'.
CALL METHOD TOP->new_line
* EXPORTING
* repeat =
CALL METHOD top->add_gap
EXPORTING
width = 90.
CALL METHOD top->add_text
EXPORTING
text = 'YOU CAN TRY LIKE THIS'
sap_style = 'HEADING'.
ENDFORM. "html_top_of_page
Regards
Debarshi -
How to add a button in Sales Order screen?
Hi,
Basically I want to add a new button "Show My lookup" in sales order screen and when clicking the button I want to show a form.
Please anyone tell me how to do this?.
thanks in advance
MinaHere is a sample ItemEvent that adds a custom button to Sales Order Entry, and loads a form from XML when it is clicked. Make sure you give the forms unique identifiers when you create them - the sample just uses a hardcoded value.
Hope it helps,
John
Private Sub sboApp_ItemEvent(ByVal FormUID As String, pVal As SAPbouiCOM.IItemEvent, BubbleEvent As Boolean)
On Error GoTo ErrorHandler
Dim sboForm As SAPbouiCOM.Form
Dim sboItem As SAPbouiCOM.Item
Dim sboBtn As SAPbouiCOM.Button
Dim objXMLDoc As MSXML2.DOMDocument
Dim objXMLErr As IXMLDOMParseError
Dim objXMLElem As MSXML2.IXMLDOMElement
Dim strIdentifier As String
If pVal.EventType = et_FORM_LOAD And pVal.Before_Action = False And pVal.FormType = 139 Then
'Add Custom Button
Set sboForm = sboApp.Forms(FormUID)
Set sboItem = sboForm.Items.Add("AZU_BTN", it_BUTTON)
sboItem.Top = sboForm.Items("1").Top
sboItem.Width = "80"
sboItem.Left = sboForm.Width - 105
Set sboBtn = sboItem.Specific
sboBtn.Caption = "Custom Button"
End If
If pVal.EventType = et_ITEM_PRESSED And pVal.Before_Action = False And pVal.ItemUID = "AZU_BTN" And pVal.FormType = 139 Then
strIdentifier = "AZU_XXX" 'You should set this to a unique value each time
Set objXMLDoc = New MSXML2.DOMDocument
objXMLDoc.async = False
objXMLDoc.validateOnParse = True
objXMLDoc.Load (App.Path & "\Config\AZU_CUSTOM.srf")
Set objXMLErr = objXMLDoc.parseError
If (objXMLErr <> 0) Then
MsgBox "Failed to load XML screen definition."
Exit Sub
Else
For Each objXMLElem In objXMLDoc.getElementsByTagName("form")
objXMLElem.setAttribute "uid", strIdentifier
Next
sboApp.LoadBatchActions objXMLDoc.xml
End If
End If
Exit Sub
ErrorHandler:
MsgBox Err.Number & " " & Err.Description
End Sub
Maybe you are looking for
-
Unable to add image.
-
I can not copy and paste from My E-Bay adds. Please help
I need to copy and paste add's from and to E-Bay. Firefox wont let me and says I need to go into profile directory. then user.js. ect ect. I can not figure out how to gt to Profile directory, much less user.js Please help me do this. Diana
-
[SOLVED] Virtual Box Kernel Bug?
I'm using virtualbox_bin 3.2.8-5 from the AUR & kernel26 2.6.35.6-1. I boot the machine clean. It starts the bare essentials. I open a terminal, /etc/rc.d/vboxdrv setup && modprobe vboxdrv. It is not vboxdrv that is the issue, but I'll recompile it a
-
On success of form save I want to go to another for with a detail where clause
I have the follow code snippet which is intented to go to a form on a successfull save. I query some data based on the save then build a url to navigate to a new form. I want the form to show only data that is lacking in one column not being populate
-
ACS / NAC phase 2 / posture validation with symantec AV
Hi, We encounter problem to implement NAC phase 2 with symantec. ACS is an appliance one, version 4.0 We?ve installed the Symantec AV pair on the ACS : that?OK. The following softwares are installed on the client PC: - Cisco CTA : ctasetup-win-2.0.1.