SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software SAP ABAP Programming and HANA Database Tutorials
Development resources, articles, tutorials, samples, codes and tools for .Net, SQL Server, Windows, Windows Phone, SAP and ABAP, like SAP UI5, Screen Personas, etc.




Install SAP Free


Remove ALV Buttons on SAP Web Dynpro Component

In this SAP Web Dynpro tutorial I share ABAP codes showing how to remove standard ALV buttons like APPEND, INSERT or DELETE with ABAP programmers. On default view of an Web Dynpro ALV there are a numerous buttons which developers can require to hide or remove from ALV table. Using ALV object Get_Model() method and using the methods from IF_SALV_WD_STD_FUNCTIONS interface ABAP programmers can customize the buttons on an SAP Web Dynpro component.

I'm using SALV_WD_TABLE ALV Component to display an internal table data on a SAP Web Dynpro page. Here is how ALV data is displayed with default settings.

ALV table with default buttons on SAP Web Dynpro component

As you see the following ALV buttons are displayed by default when the Web Dynpro page is displayed. Since I do not want a ALV functionality like Append Row, Insert Row or Delete Row on this SAP Web Dynpro component, I will hide these buttons or remove them using ALV configuration methods.

Web Dynpro ALV table buttons like Append, Insert and Delete Row

Following ABAP code fetches the model for the ALV which I will use for configuration of default buttons. This ABAP code will help me to remove ALV buttons that I do not need here in this case Append, Insert and Delete buttons for example.

*******************************************
*** Configure ALV for default buttons
*******************************************

* Instantiate used component ALV
data LO_CMP_USAGE type ref to IF_WD_COMPONENT_USAGE.
LO_CMP_USAGE = WD_THIS->WD_CPUSE_ALV_OPENITEMS( ).
if LO_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) is initial.
 LO_CMP_USAGE->CREATE_COMPONENT( ).
endif.

* Get ALV configuration settings using used controller method GET_MODEL.
data LO_INTERFACECONTROLLER type ref to IWCI_SALV_WD_TABLE .
LO_INTERFACECONTROLLER = WD_THIS->WD_CPIFC_ALV_OPENITEMS( ).

data LV_VALUE type ref to CL_SALV_WD_CONFIG_TABLE.
LV_VALUE = LO_INTERFACECONTROLLER->GET_MODEL( ).

After this line in ABAP code, ABAP programmers can use one of the below two ABAP code blocks to configure visibility of default ALV buttons on Web Dynpro page.

data: LR_STD type ref to IF_SALV_WD_STD_FUNCTIONS.
LR_STD ?= LV_VALUE.
LR_STD->SET_EXPORT_ALLOWED( ABAP_TRUE ).
LR_STD->SET_EDIT_CHECK_AVAILABLE( ABAP_FALSE ).
LR_STD->SET_EDIT_INSERT_ROW_ALLOWED( ABAP_FALSE ).
LR_STD->SET_EDIT_APPEND_ROW_ALLOWED( ABAP_FALSE ).
LR_STD->SET_EDIT_DELETE_ROW_ALLOWED( ABAP_FALSE ).

Or change the allowed or available attributes by using the ABAP_TRUE or ABAP_FALSE values as follows.

LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_EXPORT_ALLOWED( ABAP_TRUE ).
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_EDIT_CHECK_AVAILABLE( ABAP_FALSE ).
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_EDIT_INSERT_ROW_ALLOWED( ABAP_FALSE ).
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_EDIT_APPEND_ROW_ALLOWED( ABAP_FALSE ).
LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_EDIT_DELETE_ROW_ALLOWED( ABAP_FALSE ).

After ABAP programmers make changes on their codes and activate Web Dynpro component, resultant ALV table will be as follows. As seen in below screenshot Export button is allowed on the other hand Check, Append Row, Insert Row and Delete Row buttons are disabled and removed from the ALV table.

SAP Web Dynpro ALV table with buttons removed






SAP Tutorials

SAP Tutorial

SAP Forums

SAP Tools

SAP Transaction Codes Table






Related Articles and Tutorials(http://www.kodyaz.com/sap-abap/remove-alv-buttons-on-web-dynpro-component.aspx)
SAP Web Dynpro ALV Tutorial
Create CL_GUI_ALV_GRID ALV Grid Column Header using ABAP Data Element
Add Value Help to Web Dynpro Select Options
Multi Color ALV Grid Color Alternate using ALV Layout info_fname Property
ALV Grid Color - Table Row Background Color in ALV List
SAP ABAP Tutorial - ALV Grid Example with cl_gui_alv_grid and Screen Painter
Add Button to ALV Table Header on SAP Web Dynpro
Add Web Dynpro Applications to SAP Favorites Menu
Traffic Lights in SAP Web Dynpro ALV Table
Component Usage ALV Does Not Have an Active Component
Create Search Help in ABAP for Web Dynpro Component
Create Transaction Code for Web Dynpro Application
Display Adobe Form in SAP Web Dynpro
Display Data on Web DynPro Table Element
Display and Download Adobe Form as PDF File in SAP Web Dynpro
Find Web Dynpro Class Name to Search in ABAP Code
How to Clear Web Dynpro Cache
Web DynPro Tutorial - How to create Web Dynpro Application (Web Dynpro Component)
Set Page Title in Web Dynpro Application
Web Dynpro Text Translation using Assistance Class
Trigger ALV Events in Web Dynpro Component
Test Web Dynpro ABAP Component by Creating Web Dynpro Application
Remove ALV Buttons on SAP Web Dynpro Component
Read Checkbox Value in Web Dynpro Editable ALV
SAP Web Dynpro File Upload using GOS cl_fitv_gos Class
Web Dynpro Component Service Syntax Error in Program /1BCWDY/O3EC1AX6A3OVKK9L5FXO==CP
Translate Web Dynpro Header Title displayed on Web Browser
Web DynPro Tutorial - Display Spool Requests using Web DynPro Table
SAP Web Dynpro Service Cannot be Reached Error
SAP - ABAP ALV Grid Sample Code using REUSE_ALV_GRID_DISPLAY


Copyright © 2004 - 2018 Eralper YILMAZ. All rights reserved.
Community Server by Telligent Systems