This button is required to gain the access of the underlying Grid object (CL_GUI_ALV_grid). Data: mt_toolbar type ttb_button. Ls_toolbarfunction ls_toolbarquickinfo text063. Ls_toolbarfunction ls_toolbarquickinfo text054. . The method would register the event after_refresh and toolbar (for grid). Check lo_grid IS bound.
The class also host the event handler methods in the local class. This all happens in the method CL_salv_controller_events raise_build_uifunction where only few of the buttons are displayed. This would be done same with using the FOR ALL instance. Toolbar Button append ROW clear ls_toolbar. Toolbar, next is the toolbar. Now, how to capture this event when there is no Grid object. Toolbar Separator clear ls_toolbar. Zeile lschen ls_toolbaricon icon_delete_row. Single Method to Make it Editable. To gain an access to the underlying object and do the magic SET handler FOR ALL instances activation.
Using the addition activation space in the SET handler would do this for. This extra button say Edit would make the salv editable. And the event handler LCL_event_handler *-* * Event handler ALV events *-* class lcl_event_handler definition. Ls_toolbarfunction SEP02. Call this method by passing the ALV object before the display method, and all done. Make grid editable call before display gr_table ). Event after_refresh, event after_refresh gets triggered after system finished rendering ALV Field catalog parsed, Data sent to the DP (data provider) aka Frontend, Layout applied, Toolbar created, and all other ALV related stuff. This has been a salv Editable week. IF lo_grid EQ sender. Loop AT t_salv into lo_salv.
Zeile einfgen ls_toolbaricon icon_insert_row. Yes, as per this Standard SAP Application the solution works great if there is an extra button. SET handler lo_event_h- on_toolbar, fOR ALL instances. Yes, as per this Standard SAP Application. Data: ls_layout type lvc_s_layo. Data: lo_salv type REF TO cl_salv_Y. Paul Hardy had asked if we can remove that extra button and make the salv editable directly, in his comment section of my previous blog, sALV Editable? FOR ALL instances of SET event handler. No more button, the idea was to find an event which gets triggered but before the output is displayed to the user. Data: lo_salv type REF TO cl_salv_table.
Check lo_grid EQ sender. Multiple Grid, only one is editable. Fullscreen ALV triggers TOP_OF_page but not the Grid ALV, as for Grid there is no direct TOP_OF_page. Rckgngig ls_toolbaricon icon_system_undo. Without having the Grid to begin with, cant assign the header, and thus cant get the TOP_OF_page event to work. The edit buttons in the toolbar are displayed without any additional work, but for grid there is some special logic which prevents it from creating the edit buttons in the toolbar. Toolbar Button paste over ROW clear ls_toolbar. Append ls_toolbar TO mt_toolbar. Ls_toolbarbutn_type .
Set editable ls_layoutedit. Toolbar Button copy clear ls_toolbar. I did some research, infect lot of research to find an event that would work in both Grid and FullScreen ALV. Class-methods SET_editable importing!IO_salv type ref to CL_salv_table. For the Grid, You would need to create an object for CL_DD_document, pass it to the Grid object and raise the event TOP_OF_page. Thats very useful in this scenario as the Grid object is not yet instantiated.
signature * Static Public Method * - * IO_salv type REF TO CL_salv_table * /signature method set_editable. Data: lo_event_h type REF TO lcl_event_handler. Deregister the event handler SET handler me- on_after_refresh FOR ALL instances activation space. To gain an access to the underlying object and do the magic, sET handler fOR ALL instances. Toolbar Seperator clear ls_toolbar. Also this method would control the logic for multiple salv objects. Toolbar Button check clear ls_toolbar. Event after_refresh is the trick, I was looking for.
Only for grid, would need to add the toolbar buttons. Kopieren ls_toolbaricon icon_system_copy. The event handler would make the grid editable and add the buttons in the toolbar as well. Ls_toolbaricon icon_system_paste. Ls_toolbardisabled space. Toolbar Button undo clear ls_toolbar. lcl_event_handler definition * class lcl_event_handler implementation.
Ls_toolbarfunction ls_toolbarquickinfo text047. SET handler lo_event_h- on_toolbar FOR ALL instances activation. Also this would bring up a header in the ALV. Eingaben prfen ls_toolbaricon icon_check. Create object type lcl_event_handler. Ls_toolbarfunction ls_toolbarquickinfo text046. . So we will trick the toolbar to add the same missing buttons.