ALV Print event in Custom Button
Hi,
I have requirement to call ALV print event in Custom Button after some condition. Can anyone give me the solution or link to achieve this requirement.
Thank in advance.
Hi Mani,
On that ALV button event, write the following code.
DATA lo_component TYPE REF TO if_wd_component.
DATA lo_appl TYPE REF TO if_wd_application.
lo_component = wd_comp_controller->wd_get_api( ).
lo_appl = lo_component->get_application( ).
lo_appl->print_page( ).
DATA lo_app_info TYPE REF TO if_wd_rr_application .
lo_app_info = lo_appl->get_application_info( ).
DATA lv_app_name TYPE string .
lv_app_name = lo_app_info->get_name( ).
It helps you to print the table contents. Hope this helps you.
Thanks
KH
Similar Messages
-
Add customer button on header level for BUS2201(PO) - SRM 7.0
Hi,
I want to define a customer button (with action) within PO on header level.
Web Dynpro FPM_OIF_COMPONENT
Configuration /SAPSRM/WDCC_FPM_OIF_PO_PURCH
Task:
Add a customer button besides standard Export button.
I assume-afterwards I have to enhance the method onactionbutton_pressed to create my event when customer button is pressed, right?
Could anyone please guide me how to solve this issue?
Thanks and best reagrds
AndreasHi,
Here are the steps to add the button, I wrote it in other thread. In my case for PO is not displayed, try to follow the steps and if you are able to show the button tell me how please.
Add custom button in PO
And yes ,you need to create an enhancement point in the view CNR_VIEW of the component FPM_OIF_COMPONENT, you need to create a post-exit in the method BUTTON_PRESSED, here you have a sample code:
DATA: lv_id TYPE string,
lv_event_id TYPE fpm_event_id.
DATA: lo_nd_oif_application TYPE REF TO if_wd_context_node,
lo_nd_variant TYPE REF TO if_wd_context_node,
lo_nd_toolbar TYPE REF TO if_wd_context_node,
lo_nd_button TYPE REF TO if_wd_context_node,
lo_el_button TYPE REF TO if_wd_context_element,
lo_nd_other_functions TYPE REF TO if_wd_context_node.
DATA: lv_substring TYPE string,
lv_substring_i TYPE i,
lv_node_name TYPE string,
lv_position TYPE string,
lv_length TYPE i,
lv_seq TYPE i.
DATA:lt_keys TYPE STANDARD TABLE OF string,
lv_key LIKE LINE OF lt_keys.
TYPES:BEGIN OF y_parameters,
name TYPE string,
value TYPE string,
END OF y_parameters.
DATA: lt_parameters TYPE STANDARD TABLE OF y_parameters,
ls_parameter LIKE LINE OF lt_parameters.
DATA: lv_boid TYPE bbp_guid,
lv_botype TYPE string,
lv_objkey TYPE swo_typeid,
lv_objtype TYPE swo_objtyp,
lv_object_id TYPE crmt_object_id_db,
lv_process_type TYPE crmt_process_type_db,
lv_object_type TYPE crmt_subobject_category_db,
lv_rfc TYPE zgrs_co_logsys-rfc,
DATA: lo_fpm TYPE REF TO if_fpm.
lo_fpm = cl_fpm_factory=>get_instance( ).
lo_fpm->raise_event_by_id( lv_event_id ).
lt_keys = lo_fpm->mo_app_parameter->get_keys( ).
LOOP AT lt_keys INTO lv_key.
ls_parameter-name = lv_key.
lo_fpm->mo_app_parameter->get_value(
EXPORTING iv_key = lv_key
IMPORTING ev_value = ls_parameter-value ).
INSERT ls_parameter INTO TABLE lt_parameters.
ENDLOOP.
lv_id = wdevent->get_string( 'ID' ).
lo_nd_oif_application = wd_context->get_child_node( name = wd_this->wdctx_oif_application ).
lo_nd_variant = lo_nd_oif_application->get_child_node( name = wd_this->wdctx_variant ).
lo_nd_toolbar = lo_nd_variant->get_child_node( name = wd_this->wdctx_toolbar ).
lo_nd_other_functions = lo_nd_toolbar->get_child_node( name = wd_this->wdctx_other_functions ).
lv_substring = lv_id.
lv_length = STRLEN( lv_id ).
lv_seq = lv_length - 3.
IF lv_id+lv_seq = '_CP'.
lv_substring = lv_substring(lv_seq).
lv_id = lv_substring.
ENDIF.
WHILE lv_substring CS '_'.
lv_position = sy-fdpos + 1.
lv_substring = lv_substring+lv_position.
ENDWHILE.
IF lv_substring CO '1234567890'.
lv_substring_i = lv_substring.
ENDIF.
* Item level action;
IF lv_id CS '_item'.
* Or header level action;
ELSE.
IF lv_id CA '0123456789'.
lv_position = sy-fdpos - 1.
lv_node_name = lv_id(lv_position).
IF lv_id CS 'OTHER_FUNCTIONS'.
lo_nd_button = lo_nd_other_functions->get_child_node( name = wd_this->wdctx_button ).
lo_nd_button->set_lead_selection_index( index = lv_substring_i ).
lo_el_button = lo_nd_button->get_element( ).
TRY.
lo_el_button->get_attribute(
EXPORTING
name = `EVENT_ID`
IMPORTING
value = lv_event_id ).
CATCH cx_wd_context.
ENDTRY.
READ TABLE lt_parameters INTO ls_parameter WITH KEY name = 'SAPSRM_BOTYPE'.
lv_botype = ls_parameter-value.
READ TABLE lt_parameters INTO ls_parameter WITH KEY name = 'SAPSRM_BOID'.
lv_boid = ls_parameter-value.
* Obtain the object_id;
SELECT SINGLE object_id INTO lv_object_id
FROM crmd_orderadm_h
WHERE guid EQ lv_boid.
* If not Z button, exits;
IF lv_event_id(1) NE 'Z'. EXIT. ENDIF.
* Actions;
CASE lv_event_id.
WHEN 'ZBUTTON'.
WHEN 'ZBUTTON2'.
ENDCASE.
ENDIF.
ENDIF.
ENDIF. -
Custom button in alv and disabling all buttons in application tool bar
Experts,
Could you please help me for the below requirements.
1). How to disable all the buttons (like sorting, print, find, set filter...etc.) in tool bar using oops?
2). Where can I add my custom download button in alv report using oops?
Thanks in advance...
Sridhar..Step1:
Create on local class
Class <LCL_EVENT_RECEIVER> Definition
Define the below public methods.
Method Name HANDLE_TOOLBAR
Event Name TOOLBAR
Event Class CL_GUI_ALV_GRID
Importing E_OBJECT, E_INTERACTIVE
Method Name HANDLE_USER_COMMAND
Event Name USER_COMMAND
Event Class CL_GUI_ALV_GRID
Importing E_UCOMM
Class <LCL_EVENT_RECEIVER> Implementation
. Method HANDLE_TOOLBAR
Declare the structure <LS_TOOLBAR> of structure type STB_BUTTON
Append the button information as given below into table E_OBJECT->MT_TOOLBAR to display the custom button on ALV grid.
LS_TOOLBAR-FUNCTION = u2018DOWNu2019
LS_TOOLBAR-QUICKINFO = u2018downloadu2019
LS_TOOLBAR-TEXT = u2018downloadu2019
Method HANDLE_USER_COMMAND
In this method if E_UCOMM = u2018DOWNu2019 write your logic.
Step2:
1. To excluding the ALV grid buttons, fill the <LT_EXC> with function code CL_GUI_ALV_GRID=>MC_FC_EXCL_ALL
2. To generate the ALV Grid, call the method SET_TABLE_FOR_FIRST_DISPLAY
Class CL_GUI_ALV_GRID
Method Name SET_TABLE_FOR_FIRST_DISPLAY
Exporting
I_STRUCTURE_NAME ZDS_CM_EXT_SEL
LS_LAYOUT <LS_LAYOUT>
IT_TOOLBAR_EXCLUDING <LT_EXC>
Changing
IT_OUTTAB <GT_EXT_SEL>
Create the Instance for class <LCL_EVENT_RECEIVER>
Class <LCL_EVENT_RECEIVER>
Instance Name <LO_EVENT_FNAME>
Now set handler <HANDLE_USER_COMMAND> and <HANDLE_TOOLBAR_FNAME> events using instance <LO_EVENT_FNAME>
Call method 'SET_TOOLBAR_INTERACTIVE' to raise event TOOLBAR
Class CL_GUI_ALV_GRID
Instance Name <GO_GRID>
Method Name SET_TOOLBAR_INTERACTIVE -
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
VaraI 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 -
Cant use Export to Excel functionality for ALV if I add a custom button
Hi,
I have added a custom button the the ALV toolbar by creating a GUI status and using the USER_COMMAND event. However. Now I dont the get the standard ALV toolbar with all the options for sorting, exporting to excel etc.
Can someone show me how I can do both, add my own button to the toolbar as well as use ALV Grid toolbar. Currently the ALV grid standard toolbar has disappeared
Thanks for readingHello,
I am not sure how you are creating your ALV report. If you are using FM REUSE_ALV_GRID_DISPLAY there is a parameter callled I_CALLBACK_PF_STATUS . Read the documentation for this field from the doc for the FM. It tells you to copy a standard PF status from fucn group SLVC_FULLSCREEN and then add your new button to that staus.
If you are using class CL_SALV_MODEL_BASE there is a method called set_screen_status that lets you do a similar thing - copy an existing PF status and add your button.
Hope that helps
Regards
Greg Kern -
Hi Experts,
I have a ALV grid. I have added some custom buttons to it.
I want to change dynamically enable of disable some of the buttons in the ALV.
Please help me through.
I tried free, clear refresh for the grid object, control object and the event handler objects also.
still I get the old buttons when i execute the program.
Thanks.Hi,
class lcl_event_receiver implementation.
method handle_toolbar.
IF OK_CODE EQ 'XYZ'.
* append an icon to show booking table
clear ls_toolbar.
move 'BOOKINGS' to ls_toolbar-function.
move 'Show Bookings'(111) to ls_toolbar-quickinfo.
move 'Detail'(112) to ls_toolbar-text.
move ' ' to ls_toolbar-disabled. " Enable
append ls_toolbar to e_object->mt_toolbar.
clear ls_toolbar.
move 'FILGHT' to ls_toolbar-function.
move 'Show Flight'(113) to ls_toolbar-quickinfo.
move 'FlightDetail'(114) to ls_toolbar-text.
move 'X' to ls_toolbar-disabled. " Disable
append ls_toolbar to e_object->mt_toolbar.
ELSE.
* append an icon to show booking table
clear ls_toolbar.
move 'BOOKINGS' to ls_toolbar-function.
move 'Show Bookings'(111) to ls_toolbar-quickinfo.
move 'Detail'(112) to ls_toolbar-text.
move 'X' to ls_toolbar-disabled.
append ls_toolbar to e_object->mt_toolbar.
* append an icon to show booking table
clear ls_toolbar.
move 'FILGHT' to ls_toolbar-function.
move 'Show Flight'(113) to ls_toolbar-quickinfo.
move 'FlightDetail'(114) to ls_toolbar-text.
move ' ' to ls_toolbar-disabled.
append ls_toolbar to e_object->mt_toolbar.
ENDIF.
endmethod.
Endclass.
call method grid1->set_table_for_first_display
exporting i_structure_name = 'SFLIGHT'
is_layout = gs_layout
changing it_outtab = gt_sflight.
create object event_receiver.
set handler event_receiver->handle_user_command for grid1.
set handler event_receiver->handle_toolbar for grid1.
call method grid1->set_toolbar_interactive.
call method sender->refresh_table_display.
set handler event_receiver->handle_toolbar for grid1.
call method grid1->set_toolbar_interactive -
Error when Calling a BAPI in ALV custom button "could not ascertain code"
Hi,
I am getting the error "Could not ascertain code page" when i try to call my BAPI (to export to excel sheet) on click of a custom button in ALV.
I have done the creation and event handling etc for the custom button.
Kindly help if anybody knows this error.
Thanks
RoshanI am creating a custom export button(after disabling the standard export button) to download the data into an excel sheet in my own format. I have created the new button. The code is given here.
data lr_buttonui2 type ref to cl_salv_wd_fe_button.
data input2 type ref to cl_salv_wd_function.
data: lr_column_settings type ref to if_salv_wd_column_settings,
lr_input_field type ref to cl_salv_wd_uie_input_field.
create object lr_buttonui2.
call method lr_buttonui2->set_text
exporting
value = 'Export'
input2 = lo_value->if_salv_wd_function_settings~create_function( id = 'EXPORT' ).
input2->set_editor( lr_buttonui2 ).
data lr_ref3 type ref to cl_salv_wd_fe.
call method input2->get_editor
receiving
value = lr_ref3
I have also created the event handler for my button and written the below code thr. I am caling a BAPI to download the data into my excel format. The problem is coming here only.
data: lt_return type table of bapiret2.
data lo_nd_methcode type ref to if_wd_context_node.
data lo_el_methcode type ref to if_wd_context_element.
data ls_methcode type wd_this->element_methcode.
data lv_methcode like ls_methcode-methcode.
navigate from <CONTEXT> to <METHCODE> via lead selection
lo_nd_methcode = wd_context->get_child_node( name = wd_this->wdctx_methcode ).
get element via lead selection
lo_el_methcode = lo_nd_methcode->get_element( ).
get single attribute
lo_el_methcode->get_attribute(
exporting
name = `METHCODE`
importing
value = lv_methcode ).
call function 'ZBAPI_EXCEL_DLOAD_METHODOLOGY'
exporting
i_methcode = lv_methcode
tables
et_return = lt_return
Plz give me a solution -
Adding custom button in standard toolbar in ALV
Hello All,
I need to add a customized button called "Copy" on ALV. The following code is giving me few standard buttons like "Append" "Delete" "Insert" etc. So, how can I add "Copy" button besides one of these standard buttons.
data: l_value type ref to cl_salv_wd_config_table.
data: lr_table_settings type ref to if_salv_wd_table_settings.
lr_table_settings ?= l_value.
lr_table_settings->set_read_only( abap_false ).
Appreciate help.
Thks & Rgds,
HemalCreate One method
And inside that method write the below code
(Here i am creating delete button you can create any name button you want just replace the name
DATA lV_EDITBTN TYPE REF TO cl_salv_wd_fe_button.
DATA lr_buttonui TYPE REF TO cl_salv_wd_fe_button.
CREATE OBJECT lr_buttonui.
lr_buttonui->set_text( 'Details' ).
lr_buttonui->set_tooltip(
'Shows Detail Screen as per the View selected' ).
Generating Function Object for Button.*
DATA btn_button TYPE REF TO cl_salv_wd_function.
btn_button = lo_value->if_salv_wd_function_settings~create_function(
id = 'DETAILS' ).
btn_button->set_editor( lr_buttonui ).
DATA lr_buttonui1 TYPE REF TO cl_salv_wd_fe_button.
After that create another method and make it as a event ( it means now it become event )
select event ON FUNCTION FROM THE LIST
Inside that event write
CASE LV_FCODE.
WHEN 'DETAILS'.
wd_this->fire_OP_TODEATILS_plg( ).
endcase.
May be it may help -
Custom buttons in hierarchical alv through OO prog
Hi, i have created an hierarchical alv through factory method. I display the gr_table of type cl_salv_hierseq_table.
I wish to add custom buttons at the top.
I searched a lot and mostly found solutions for adding custom buttons in grid of type cl_gui_alv_grid.
There the event 'toolbar' of class cl_gui_alv_grid is used.
In cl_salv_hierseq_table , i could not find any events,
Could anyone please help me in adding custom buttons in the hieerarchical alv.Looking at the details in cl_salv_functions - enable_functions, it looks like adding your own function is only supported in a grid and tree view.
method enable_function .
data: l_name type string.
data: l_msgtext type string.
data: ls_message type scx_t100key.
data: lr_controller type ref to if_salv_controller_model.
data: text type string.
lr_controller ?= me->r_controller.
if lr_controller->r_model->get_display_object( )
ne IF_SALV_C_TABLE_OBJECTS=>GRID
and lr_controller->r_model->get_display_object( )
ne IF_SALV_C_TABLE_OBJECTS=>TREE.
text = text-001.
l_name = name.
raise exception type CX_SALV_METHOD_NOT_SUPPORTED
exporting class = 'CL_SALV_FUNCTIONS'
method = 'ENABLE_FUNCTION'
object = l_name
key = text.
endif. -
Custom Button in ALV Grid standard toolbar
Hello Experts,
I am working on the program in which i have to add custom button to standard toolbar in ALV. I have created the button using the method as below
data: lr_functions type ref to cl_salv_functions_list.
lr_functions = gr_table->get_functions( ).
lr_functions->set_default( abap_true ).
data: l_text type string,
l_icon type string.
* l_text = text-b01.
l_icon = icon_complete.
try.
lr_functions->add_function(
name = 'Update Equipment Cost'
icon = l_icon
text = l_text
tooltip = 'Update Equipment Cost'
position = if_salv_c_function_position=>right_of_salv_functions ).
catch cx_salv_existing cx_salv_wrong_call.
endtry.
I don't understand how to add functionality to this button. I want to design the functionality as when user press button then corresponding values on the screen will be automatically get updated in the table.
Thanks,
AvadhutHi Avadhut,
When you want to add a custom button on ALV - better copy the GUI Status of the standard ALV to your program. So all the function codes are copied , now you can go to the GUI_STATUS which is copied and you can mention your own function code or you can let the standard function codes as it is. You can copy the GUI of standard ALV from SE80 transaction. Let me know if you need any assistance in doing it.
Now, if you want to write the code for any of the button on ALV - then you need to handle it is the class.
I used CL_SALV_TABLE - if you are using same then the below code gives you an idea of it.
1. Create a local class in your program
* CLASS lcl_alv_events DEFINITION
CLASS lcl_alv_events DEFINITION FINAL.
PUBLIC SECTION.
METHODS: on_user_command FOR EVENT added_function OF cl_salv_events
IMPORTING e_salv_function.
ENDCLASS. "lcl_alv_events DEFINITION
DATA: gv_event_handler TYPE REF TO lcl_alv_events.
CREATE OBJECT gv_event_handler.
* Header object
CREATE OBJECT gr_header.
2. Class Implementation
CLASS lcl_alv_events IMPLEMENTATION.
METHOD on_user_command.
CASE e_salv_function.
**When PROCESS Button is selected
WHEN '&PROC'. ***> In my program I added Process button and fcode for it - &PROC
***********Write your code here ******************
ENDCASE.
ENDMETHOD.
ENDCLASS. "lcl_alv_events IMPLEMENTATION
3. Calling events
data: gr_events TYPE REF TO cl_salv_events_table,
gr_alv TYPE REF TO cl_salv_table.
TRY.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = gr_alv
CHANGING
t_table = p_in_tab[]. ***This is my internal table data.
gr_events = gr_alv->get_event( ).
SET HANDLER gv_event_handler->on_user_command FOR gr_events.
CATCH cx_salv_msg INTO lv_msg. "#EC NO_HANDLER
CATCH cx_salv_not_found INTO lv_excep. "#EC NO_HANDLER
CATCH cx_salv_data_error. "#EC NO_HANDLER
ENDTRY.
Regards,
Rafi -
Custom button on a editable alv grid
Hi experts,
I'm using an editable alv like this:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = gd_repid
i_callback_user_command = 'USER_COMMAND'
* I_STRUCTURE_NAME = 'ZPEDAUTOMTAB'
is_layout_lvc = gd_layout
it_fieldcat_lvc = it_fieldcat
i_save = 'X'
TABLES
t_outtab = gt_zpedautomtab
EXCEPTIONS
program_error = 1
OTHERS = 2.
Does anybody know if i can add a custom button to the header or anywhere else to program a custom action?
If it is not; i can use another type of editable alv that lets me do that; if that exists.
Tank-you.Hi
Check the following template code and adjust accordingly:
Call the ALV
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
i_callback_pf_status_set = 'PF_STATUS_SET'
i_callback_user_command = 'LINE_CLICK'
i_callback_top_of_page = 'TOP_ROUTINE'
i_callback_html_end_of_list = 'EOL_LOG'
i_grid_title = text-ttl
is_layout = my_layout
it_fieldcat = it_fieldcatalog
it_sort = it_sort
i_save = g_save
i_grid_settings = lc_glay
is_variant = w_variant
is_print = my_print
TABLES
t_outtab = i_out
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 top_routine
FORM top_routine.
{ Local
DATA:
w_page(5) TYPE c,
l_line TYPE slis_entry,
lh_top TYPE slis_listheader,
lt_top TYPE slis_t_listheader.
DEFINE top_line.
clear lh_top.
lh_top-typ = &1.
lh_top-key = &2.
lh_top-info = &3.
append lh_top to lt_top.
END-OF-DEFINITION.
WRITE sy-datum TO l_line.
top_line 'S' text-t01 l_line.
WRITE sy-uname TO l_line.
top_line 'S' text-t02 l_line.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = lt_top.
ENDFORM. "top_routine
*& Form pf_status_set
FORM pf_status_set USING extab TYPE slis_t_extab.
data: wa_extab like LINE OF extab.
wa_extab-fcode = '&REFRESH'.
append wa_extab to extab.
wa_extab-fcode = 'MODE'.
append wa_extab to extab.
SET PF-STATUS 'ZSD_DA01' EXCLUDING extab.
ENDFORM. "pf_status_set
*& Form line_click
FORM line_click USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
DATA: wl_ucomm LIKE sy-ucomm.
DATA: es_l TYPE slis_layout_alv,
es_fld TYPE slis_t_fieldcat_alv,
es_sort TYPE slis_t_sortinfo_alv,
es_mark TYPE slis_t_fieldcat_alv.
wl_ucomm = sy-ucomm.
CLEAR sy-ucomm.
CASE wl_ucomm.
Set printing mode
WHEN 'MODE'.
IF w_mode = 'O'.
w_mode = 'T'.
w_mode_txt = text-018.
ELSE.
w_mode = 'O'.
w_mode_txt = text-019.
ENDIF.
SET PF-STATUS 'ZSD_DA01'.
Exit Functions
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
LEAVE TO SCREEN 0.
Show Log
WHEN 'LOG'.
selfield-refresh = 'X'.
PERFORM log_show.
Issue output
WHEN 'ISSUE'.
selfield-refresh = 'X'.
PERFORM print_deliveries.
Select all
WHEN 'SALL'.
selfield-refresh = 'X'.
LOOP AT i_out.
i_out-box = 'X'.
MODIFY i_out.
ENDLOOP.
Deselect all
WHEN 'DSAL'.
selfield-refresh = 'X'.
LOOP AT i_out.
i_out-box = ' '.
MODIFY i_out.
ENDLOOP.
ENDCASE.
Handle User clicks
CASE selfield-fieldname.
Display Vendor Master
WHEN 'KUNNR' OR 'KUNAG'.
IF NOT selfield-value IS INITIAL.
READ TABLE i_out INDEX selfield-tabindex.
IF selfield-fieldname = 'KUNAG'.
SET PARAMETER ID 'KUN' FIELD i_out-kunag.
ELSEIF selfield-fieldname = 'KUNNR'.
SET PARAMETER ID 'KUN' FIELD i_out-kunnr.
ENDIF.
SET PARAMETER ID 'BUK' FIELD i_out-bukrs_vf.
SET PARAMETER ID 'VKO' FIELD i_out-vkorg.
SET PARAMETER ID 'VTW' FIELD i_out-vtweg.
SET PARAMETER ID 'SPA' FIELD i_out-spart.
CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
ENDIF.
Go To VL03N
WHEN 'VBELN'.
READ TABLE i_out INDEX selfield-tabindex.
IF NOT i_out-vbeln IS INITIAL.
SET PARAMETER ID 'VL' FIELD i_out-vbeln.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
ENDIF.
Go To VA03
WHEN 'VGBEL'.
READ TABLE i_out INDEX selfield-tabindex.
IF NOT i_out-vgbel IS INITIAL.
SET PARAMETER ID 'AUN' FIELD i_out-vgbel.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM. "line_click
Please, reward if helpful
Regards,
George -
What Custom button in ALV has been clicked?
Hi Experts,
I have written one WDC where in i have created an ALV with two custom buttons in it. One is to Search the company code with Function code as 'SEARCH', and the other is to export the result in to an excel file, this button function code is 'EXPORT'.
I have created these two buttons in the WDDOINIT method of the view, say MAIN.
I have created a method, say 'function_button' in the MAIN for the event ON_FUNCTION, to handle any events that happens on these custom buttons.
The problem is whatever the customized button i click in the ALV the entire code of the method 'FUNCTION_BUTTON' is being executed.
Now, I want to get the function code of the button clicked in my ALV, so that i can only execute the portion of the code that needs to be executed.
Please let me know the ways to tackle this problem.
Thanks in advance.
Good day!Hi Shashi,
Check the following blog to handle ALV custom function.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/101df93f-4b5c-2910-14aa-9eb0338c2110
Regards,
Karthick S -
Hi Experts,
I have created a custom button 'SELECT' in ALV table toolbar.
lo_function = l_value->if_salv_wd_function_settings~create_function( 'SELECT' ).
Now i am getting position of this custom button next to the Standard buttons ('Print' and 'Export' ). So how do I change the custom button position to first place. I mean the custom button should be in the left most position in the toolbar.
Please help me in resolving this.
Regards,
Sarathy.Thank you Lekha. Set_position is working.
We have to change the positon of custom button and the standard button. So that the position of button gets interchnaged.
Regards,
Sarathy
Edited by: DEVASARATHY PANDI on Jan 26, 2012 12:18 PM -
Add on custom button to ALV toolbar in std tcode ME51N, ME52N and ME53N.
Hi All,
I have the requirement to add on the custom button to ALV toolbar in ITEM OVERVIEW for standard transaction ME51N, ME52N and ME53N. Does anyone know what enhancement point or user exit i should apply and how i can add on the custom button?
Thanks.There are no user exits or badi's for COOIS. You may have to make copy of the PPIO_ENTRY to ZPPIO_ENTRY including all the varians without changing their names like copy SAP&COOIS to SAP&COOIS. Create a T-Code ZCOOIS and replace COOIS in variant SAP&COOIS to ZCOOIS not in the name of the variant but in the field "Check Authorization for".
The PF-Status is found in the include LCOISOUTPUTF16 which is located in the function group COISOUTPUT you may have to copy that too. Finally you need to copy SAPLCOISOUTPUT with its GUI status GENERAL and add your custom button there. -
Custom button on ALV report for Tcode FL10G ?
Hi All,
I want to add custom button in the AVL report for FL10G transaction. And then need to implement logic for that button (calling BAPI to create shipment for the selected records).
For VL10G alv program GUI Status - STANDARD001 I think I can add button in this gui by using access key.
But how to implement logic for this custom button? Where I can put the code for this button logic?
Please let me know if any one has any ideas on this issue.
I appreciate your help and time on this.
Thanks.
MHi Murali,
The standard program it will not allow to copy the GUI Status. Because source and target program should not same.
It will definitely debug will work. Yo can create the GUI Status through SE41. In SE41 Just give Program name :SAPLV50R_VIEW click the button status. here you should not give any gui status. just blindy say create the then it will popup screen appears in the screen. Here you can mention your Z GUI Status. It is not required to create all the menus manually instead of the there is button which is located in the screen next to blue i button. here you can click and select the standard interface. You can get all the menus as similar to standard. Like that you should create Menu Bar, Application Toolbar and Function Keys Menus. Then you can add your custom button in the Application tool bar button.
When you execute the Transaction VL10G and check your cusom menu button will appears. Once you click custom button only exit will trigger. Find the below code for your reference.
CODE
loop at ct_postab assigning <fs>
where selkz = 'X'.
*To Fill the BAPI Header Parameters
str_ordhdr-ship_cond = w_sval-value.
*To Fill the BAPI HeaderX Parameters
str_ordhdrx-updateflag = 'U'.
str_ordhdrx-ship_cond = 'X'.
call function 'BAPI_SALESORDER_CHANGE'
exporting
salesdocument = <fs>-vbelv
order_header_in = str_ordhdr
order_header_inx = str_ordhdrx
tables
return = str_return.
endloop.
read table str_return into w_return index 1.
if sy-subrc eq 0.
if not w_return-type = 'S'.
message w_return-message type 'E'.
leave to current transaction.
endif.
endif.
*Do the BAPI Commit
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.
endif.
endif.
endif.
Let me know if you have anything to discuss on the same.
Maybe you are looking for
-
Copies of texts on my computer?
Can I get copies of my children's texts on my computer?
-
So I don't sync my iPad very often. My dad and I share a computer. And I decided to do it the other day. I am pretty sure I did it all correctly selecting music that I wanted not deleting playlists but it seems to be that they are gone. And music I d
-
My HP LaserJet 400 MFP M425 PCL 6 sends a message that paper is caught up near the cartridge area. I had my IT guy look at it and he says there's a wheel on the inside of the machine that is supposed to engage another wheel on the paper feeder. He sa
-
Cant get printer on network to work
have a canon mp110 connected to my pc running xp via usb, set my macbook to search for printer which it did ok , using netgear router,when i click print on mac, it says that the document has been printed but it never has.Would be grateful for any hel
-
Workflow giving error at execution
Hi all, I am referring Ginger Gatling blog to create simple workflow https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e0bbdb3c-d640-2a10-d3b2-e4d9b90536a6 After activating my workflow (workflow is to display material asking user ac