ALV Row Editable
ALV Row Editable
ALV Row Editable
White Paper
By
Vijay Agarwal
Abstract
To make single row editable in alv display based on certain condition using Function
Module Reuse_ALV_GRID_DISPLAY .
In many of the business scenarios User wants Reports in ALV display and in that they
want ALV row editable based on certain criteria.
Abbreviations
Term
ERP
ABAP
Description
Enterprise Resource Planning
Advanced Business Application
Programming
Contents
Introduction...........................................................................................................................................................2
The Deployment Logic...........................................................................................................................................2
Steps involved........................................................................................................................................................2
Output....................................................................................................................................................................5
Conclusion.............................................................................................................................................................6
References..............................................................................................................................................................7
Introduction
This document will cover the basic steps that should be followed to get a editable field at the
output of ALV.
Steps involved
The step that needs to be followed is as below.
1. Go to Se 37 , Create a Function module based on your naming convention .
2. In importing parameter Pass FLAG a mandatory Flag to and mention default value 1 for 167
infotype .
As shown blow.
LOOP AT IT_VBAP INTO LS_OUTTAB WHERE FLAG = 'X'.
V_INDEX = SY-TABIX.
LS_EDIT-FIELDNAME = 'VBELN'.
LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_ENAABLED.
LS_EDIT-STYLE2 = SPACE.
LS_EDIT-STYLE3 = SPACE.
LS_EDIT-STYLE4 = SPACE.
LS_EDIT-MAXLEN = 8.
INSERT LS_EDIT INTO TABLE LT_EDIT.
LS_EDIT-FIELDNAME = 'POSNR'.
LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_ENABLED.
LS_EDIT-STYLE2 = SPACE.
LS_EDIT-STYLE3 = SPACE.
LS_EDIT-STYLE4 = SPACE.
LS_EDIT-MAXLEN = 8.
INSERT LS_EDIT INTO TABLE LT_EDIT.
INSERT LINES OF LT_EDIT INTO TABLE LS_OUTTAB-HANDLE_STYLE.
MODIFY IT_VBAP INDEX V_INDEX FROM LS_OUTTAB
TRANSPORTING
HANDLE_STYLE .
ENDLOOP.
3. Go to Tables Define
While filling fieldcat pass following for the column you want to make as editable.
FIELDCAT-EDIT = 'X'.
Call Fm
= IT_FIELDCAT
TABLES
T_OUTTAB
= IT_VBAP[]
EXCEPTIONS
PROGRAM_ERROR
= 1
OTHERS
= 2.
Output
Conclusion
This code could be used to get a editable row in the ALV outupu screen.
Objective of this white paper is to
Standardize and automate the efforts of Architects in applying this solution
and Developers using the logic to maximum effect so as to reduce the
development cycle.Reusablity of efforts is key to deliver more in short time to
reduce the turn around time in Project management.
References