How to trap Append row fcode from ALV toolbar in OOPS approache
Hi
1. I would like trap the function code for ALV toolbar button like APPEND row and Delete row etc. Please let the procedure for that or may be if somebody can tell me that how do what logic is being followed while appending a line to the grid using "Insert Row" in BCALV_TEST_GRID_EDITABLE program.
2. My is editable ALV grid, if i pressing the delete button from the keyboard then it is deleting the from the ALV.I would like to prevent from not deleting the rows.
Thanks
Suruchi
how did you resolve it?
thank in advance.
Similar Messages
-
How to disable self defined button from ALV Toolbar when ok_code ='BACK'
here is the code
CLASS Z_CL_6_U_EVENT_RECEIVER DEFINITION.
PUBLIC SECTION.
METHODS:
HANDLE_TOOLBAR
FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
IMPORTING E_OBJECT E_INTERACTIVE,
HANDLE_USER_COMMAND
FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
IMPORTING E_UCOMM.
ENDCLASS.
CLASS Z_CL_6_U_EVENT_RECEIVER IMPLEMENTATION.
METHOD HANDLE_TOOLBAR.
DATA: LS_TOOLBAR TYPE STB_BUTTON.
IF G_FLAG = 'X' and ok_code = space.
CLEAR LS_TOOLBAR.
MOVE 0 TO LS_TOOLBAR-BUTN_TYPE.
MOVE 'UPDATE' TO LS_TOOLBAR-FUNCTION.
MOVE ICON_MODIFY TO LS_TOOLBAR-ICON.
MOVE 'Update Records'(111) TO LS_TOOLBAR-QUICKINFO.
MOVE ''(112) TO LS_TOOLBAR-TEXT.
MOVE ' ' TO LS_TOOLBAR-DISABLED.
APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
elseif ok_code = 'BACK'.
CLEAR LS_TOOLBAR.
LS_TOOLBAR-function = 'UPDATE'.
LS_TOOLBAR-butn_type = 0.
LS_TOOLBAR-icon = ICON_MODIFY.
LS_TOOLBAR-quickinfo = 'Update Records'.
LS_TOOLBAR-disabled = 'X'.
append LS_TOOLBAR TO <i><b>E_OBJECT</b></i>->MT_TOOLBAR.
ENDIF.
ENDMETHOD.
<i><b>ERROR COMES when ok_code is 'BACK'.
at this point E_OBJECT has null reference instead of ref to Class cl_ALV_EVENT_TOOLBAR_SET.</b></i>
tell me why this error coming.
pls helpHello Neetu
To give you an example I have copied sample report BCALV_GRID_DEMO, added some code (search for <b>$Comment</b>) and modified the GUI-status <b>MAIN100</b> (replace function code EXIT with <b>BACK</b> for the F3 function).
Run the program and push several times the BACK button: one toolbar function after the other will be inactivated.
PROGRAM test.
DATA: ok_code LIKE sy-ucomm,
gt_sflight TYPE TABLE OF sflight,
g_container TYPE scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1',
grid1 TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container.
<b>----
CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-DATA:
md_cnt TYPE i.
CLASS-METHODS:
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING
e_object
e_interactive
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_toolbar.
DATA:
ls_button TYPE stb_button.
ADD 1 TO md_cnt. " a simple counter
LOOP AT e_object->mt_toolbar INTO ls_button FROM 1 TO md_cnt.
ls_button-disabled = 'X'.
MODIFY e_object->mt_toolbar FROM ls_button.
ENDLOOP.
ENDMETHOD. "handle_toolbar
ENDCLASS. "lcl_eventhandler IMPLEMENTATION</b>
START-OF-SELECTION.
* MAIN *
SELECT * FROM sflight INTO TABLE gt_sflight.
CALL SCREEN 100.
* MODULE PBO OUTPUT *
MODULE pbo OUTPUT.
SET PF-STATUS 'MAIN100'.
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container.
* Instantiate ALV grid control
CREATE OBJECT grid1
EXPORTING i_parent = g_custom_container.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
it_outtab = gt_sflight.
<b>*$Comment: Set event handler for event TOOLBAR
SET HANDLER:
lcl_eventhandler=>handle_toolbar FOR grid1.
ENDIF.</b>
ENDMODULE. "PBO OUTPUT
* MODULE PAI INPUT *
MODULE pai INPUT.
* to react on oi_custom_events:
CALL METHOD cl_gui_cfw=>dispatch.
CASE ok_code.
WHEN 'EXIT'.
PERFORM exit_program.
<b> WHEN 'BACK'.
$Comment: Toolbar can be modified on-the-fly
grid1->set_toolbar_interactive( ).</b>
WHEN OTHERS.
* do nothing
ENDCASE.
CLEAR ok_code.
ENDMODULE. "PAI INPUT
* FORM EXIT_PROGRAM *
FORM exit_program.
* CALL METHOD G_CUSTOM_CONTAINER->FREE.
* CALL METHOD CL_GUI_CFW=>FLUSH.
LEAVE PROGRAM.
ENDFORM. "EXIT_PROGRAM
Regards
Uwe -
How to restrict append row upto 5 in ALV Webdynpro.
how to restrict append row up to 5 in ALV Webdynpro.
how did you resolve it?
thank in advance. -
How to open document to PDF from ALV
Hi ,
how to open document to PDF from ALV on clicking (hot spot)
urgent
thanks,something like this:
line_fieldcat-fieldname = 'vbeln'.
line_fieldcat-ref_tabname = 'I_vbeln'.
line_fieldcat-hotspot = 'X'. " Shows the field as ahotspot.
line_fieldcat-seltext_m = 'Notification '.
APPEND line_fieldcat TO i_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = ws_repid
i_callback_user_command = 'MY_USER_COMMAND'
and rest of parameters,
FORM MY_USER_COMMAND USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
IF ucomm = '(Function code of action, say click, or enter'
CASE selfield-fieldname.
WHEN 'QMNUM'. "Notification
IF i_tab-qmnum NE space.
CALL FUNCTION 'WS_EXECUTE'
EXPORTING
commandline = '/F /IM "ACRORD32.EXE"'
program = 'TASKKILL'.
ENDIF. -
Urgent : how to select the rows in the ALV Grid Control
How to select the rows in the ALV Grid control,
I am facing the situation where i need to select the row/rows in the Grid control and then to lock the entries,
If anyone have the solution please help me out
<b>Its very Urgent</b>Hi Bharath,
Go through this hope u can understand.
SEL_MODE. Selection mode, determines how rows can be selected. Can have the following values:
A Multiple columns, multiple rows with selection buttons.
B Simple selection, listbox, Single row/column
C Multiple rows without buttons
D Multiple rows with buttons and select all ICON
Setting and getting selected rows (Columns) and read line contents
You can read which rows of the grid that has been selected, and dynamic select rows of the grid using methods get_selected_rows and set_selected_rows. There are similar methods for columns.
Note that the grid table always has the rows in the same sequence as displayed in the grid, thus you can use the index of the selected row(s) to read the information in the rows from the table. In the examples below the grid table is named gi_sflight.
Data declaration:
DATA:
Internal table for indexes of selected rows
gi_index_rows TYPE lvc_t_row,
Information about 1 row
g_selected_row LIKE lvc_s_row.
Example 1: Reading index of selected row(s) and using it to read the grid table
CALL METHOD go_grid->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines = 0.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
textline1 = 'You must choose a valid line'.
EXIT.
ENDIF.
LOOP AT gi_index_rows INTO g_selected_row.
READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
ENDIF.
ENDLOOP.
Example 2: Set selected row(s).
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines > 0.
CALL METHOD go_grid->set_selected_rows
exporting
it_index_rows = gi_index_rows.
ENDIF.
Reward points if helpful.
Thanks
Naveen khan -
How to find function code for buttons on toolbar in oops alv
Hi experts,
I want to remove some buttons from toolbar in oops alv, i know the procedure like get function code and pass the value in a table and pass that table to IT_TOOLBAR_EXCLUDING of
method set_table_for_first_display but I WANT TO KNOW HOW TO FIND FUNCTION CODE FOR BUTTONS ON TOOLBAR IN OOPS ALVHi Prakash,
-->First you have to set the pf status in your alv program by,
{FORM pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'FIRST'.
ENDFORM. "PF_STATUS}
-->Pass this Subroutine name in the Function module, Reuse_alv_grid_display's parameters i.e,
i_callback_pf_status_set = 'PF_STATUS'}
*-->Then doble click on that pf status,
From the menu bar, select Extras->Adjust Template->List Viewer,
This will give you the existing statndard gui status of the program*
->Then catch that function codes in the User command Parameter of the Function module Reuse.. i.e,
i_callback_user_command = 'COMM'
And make a subroutine of the name 'COMM'i.e,
FORM comm USING ucomm LIKE sy-ucomm selfield TYPE slis_selfield.
DATA: okcode TYPE sy-ucomm.
okcode = ucomm.
CASE okcode.
WHEN 'REF'.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'MANSI'
txt1 = 'CREATED BY'
txt2 = SY-UNAME
TXT3 = ' '
TXT4 = ' '
endcase.
Hope it helps you
Regrds
Mansi -
How do I delete dashlane icon from Mavericks toolbar
How do I delete dashlane icon from Mavericks toolbar? This app is redundant and not necessary in Mavericks. I have uninstalled but I cannot drag the icon off the toolbar.
I am sorry CT, it is the menu bar and on the right side at the top...
Below is one of the suggestion I have found, but it doesn't work.
OS X Mavericks: What’s in the menu bar?
The right end of the menu bar contains “status menus,” which are represented by icons.
These menus show the status of your Mac or give you quick access to certain features—for example, you can quickly turn on Wi-Fi, turn off Bluetooth, or mute your computer’s volume.
You can add some icons to the right end of the menu bar. For example, you can show a volume slider in the menu bar by selecting a checkbox in the Sound pane of System Preferences. You can also add a status icon for some apps to the menu bar when you install the app.
To rearrange the status menu icons, hold down the Command (⌘) key while dragging the icons. To remove an icon from the menu bar, hold down the Command key and drag the icon out of the menu bar. -
How to preselect all rows before displaying ALV report
I would like to select all rows before sending ALV Grid Display. User then can unselect couple of rows for further processing. How do I do that ?. Im using Method grid1->SET_TABLE_FOR_FIRST_DISPLAY for ALV Report Display. Any help appreciated.
Ok,
I've started the editor and check my code. I made few small mistakes (like with this exporting/importing), here's the sample - correctly working - code:
DATA: it_selected TYPE lvc_t_row,
wa_selected TYPE lvc_s_row,
wa_sflight TYPE sflight,
ltp_layout TYPE lvc_s_layo.
SELECT *
FROM sflight
INTO TABLE gi_sflight.
ltp_layout-stylefname = 'CELLTAB'.
ltp_layout-sel_mode = 'A'.
LOOP AT gi_sflight INTO wa_sflight.
wa_selected-index = sy-tabix.
APPEND wa_selected TO it_selected.
ENDLOOP.
* * Load data into the grid and display them
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_layout = ltp_layout
i_save = 'A'
CHANGING it_outtab = gi_sflight.
CALL METHOD go_grid->set_selected_rows
EXPORTING
it_index_rows = it_selected.
This time it is 100% correct.
Edited by: Marcin Cudo on Apr 11, 2010 2:13 AM -
How to remove a Sort button from ALV List
Hi Experts,
How to remove sort button from ALV List.
I have requirement where I need to remove the sort button from ALV list.
Kindly give me useful clues.
Higher points will be awarded for the useful inputs.
Thanks in Advance,
DharaniHi dharani,
1. UP and Down Sort Button will get removed.
2. Important code is marked in bold
3. Just copy paste.
4.
report abc.
TYPE-POOLS : slis.
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : alvfcwa TYPE slis_fieldcat_alv.
<b>data : excl type SLIS_T_EXTAB.
data : exclwa type SLIS_EXTAB.</b>
data : begin of itab occurs 0.
include structure usr02.
data : end of itab.
START-OF-SELECTION.
select * from usr02
into table itab.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'ITAB'
i_inclname = sy-repid
CHANGING
ct_fieldcat = alvfc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
<b>*----
IMPORTANT
fcodes to remove
Up and Down Sort Button
exclwa-fcode = '&OUP'.
append exclwa to excl.
exclwa-fcode = '&ODN'.
append exclwa to excl.</b>
Display
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
<b>IT_EXCLUDING = excl</b>
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
regards,
amit m. -
How to get selected row no in ALV
Hi....
I am displaying a alv in sub screen...
I want to provide user functionality to delete records from alv..
The problem is i dont have a method to get row ids if user select multiple rows...
I tried using GET_ROW_ID but as its a protected method i cant use it..
please suggest stepwise how to use protected method in my class...and if u coud suggest some public method it will be great
regards
vivekHi,
You can also use the FM "REUSE_ALV_POPUP_TO_SELECT'.
It displays the output along with check boxes, where u can select the rows whatever u want.
Thanks & Regards,
Sudheer -
Appending Rows To Editable ALV Grid
Hi,
I have a requirement to allow users to append rows to ALV grid in order to insert new data. The standard append button works to add the row on the front end, however, when I go to process the row through the DATA_CHANGED event of the CL_GUI_ALV_GRID class the program errors out with a GETWA_NOT_ASSIGNED error.
Any help or examples of programs utilizing the Append button would be much appreciated.
Thanks,
Brian SHi,
check this demo program <b> BCALV_EDIT_04</b>
regards
Vijay -
How to get selected row keys from RichSelectManyCheckbox
Adf Table has getSelectedRowKeys but SelectManyChekcbox does not has anything similar. Can you tell me how to get selected row keys programmatically for RichSelectManyCheckbox?
Hi User,
selectManyCheckbox component's value property holds the selected items values. Bind this property to some bean variable(of type list) so that you can get the selected values by accessing the bean property.
Sireesha -
Hide 'Change Layout' button from alv toolbar
Hello All,
can anyone let me know how can we hide the change layout button or exclude the change layout button from the ALV tool bar using OOPS . what's the fcode for it.
Thank You !
RaviHi Ravi,
Please refer to this [Program|http://www.saptechies.com/disable-some-standard-buttons-from-alv-display/].
Hope this helps.
Regards,
Chandravadan -
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 -
How to trigger New page while using ALV with classes/oops?
Hi All
I am trying to print a report which has to show the data in two pages.
I am using ALV with classes/oops.
Though I am able to print the report but a new page is not coming. Whole of the data is coming in one single page.
Please tell me as to how to trigger a NEW PAGE while using ALV with classes/oops.
Please send some code samples also if available.
Thanks in advance.
Jerryusing sort option you can do it. in case of grid/oo alv class ALV you can view that only in print mode/preview mode.
in case of list you can view that directly.
sort-fieldname = 'FIELDNAME'.
sort-group = '*' "triggers new page
sort-up = 'X'.
append sort to it_sort.
Maybe you are looking for
-
Please help me with the error ASAP
I am trying to write an ABAP statement for the below requirement. Function has two import parameters. 1. key and 2. date. Export parameter: export_rec like TAB. Req: I need to select a record from a table where key = inpu
-
Setting Duration of Photos (still clips) in iMovie '11 Does Not Work
Howdy - I realize there are already similar posts to this one, but so far as I could tell, most of them involve (& focus on) transitions, whereas my issue is strictly with setting the duration for which a photo is held in iMovie. Effectively, I am tr
-
I don't have a status bar!
Somehow Oryte! and Bing got to be my browser and I didn't want that, so I asked Firefox how to get rid of it. Whatever it said to do, I did -- but I lost the Firefox status bar. I just have blank tabs without any place to enter URLs or search, withou
-
Notification with user defined type results in PLS-00306: wrong number..
I created a user defined type TLogMessage: CREATE OR REPLACE TYPE TLogMessage AS OBJECT module VARCHAR2(4000), severity NUMBER, message VARCHAR2(4000) I also created a multi-consumer queue using this type as payload. My callback procedure in the pack
-
Hi What is the significance of pricing procedure in contract document type WK1? Is there any relationship b/w pricing procedure used in sales order(like RVAA01)? Thanks in advance