Skip to Content
0
Former Member
May 28, 2008 at 05:06 AM

How to Validate Columns when using cl_gui_alv_grid class?

216 Views

Hi All,

I am using the Class cl_gui_alv_grid to create a ALVGRID. The following code explains it all;

***Code to create the ALVGRID

CALL METHOD grid1->set_table_for_first_display

EXPORTING

i_save = 'A'

i_default = 'X'

is_layout = gs_layout

it_toolbar_excluding = itab_excl_func

CHANGING

it_outtab = gt_grid1

it_fieldcatalog = gt_fieldcatalog1

it_sort = gt_sort_grid[]

***Code to define the Field Catalog

CLEAR ls_fieldcatalog.

ls_fieldcatalog-fieldname = 'MOD_QTY'.

ls_fieldcatalog-datatype = 'QUAN'.

ls_fieldcatalog-reptext = 'Modify Qty'.

ls_fieldcatalog-coltext = 'Modify Qty'.

ls_fieldcatalog-seltext = 'Modify Qty'.

ls_fieldcatalog-edit = 'X'.

ls_fieldcatalog-outputlen = 18.

APPEND ls_fieldcatalog TO lt_fieldcatalog.

CLEAR ls_fieldcatalog.

ls_fieldcatalog-fieldname = 'TOT_QTY'.

ls_fieldcatalog-datatype = 'QUAN'.

ls_fieldcatalog-reptext = 'Total Qty'.

ls_fieldcatalog-coltext = 'Total Qty'.

ls_fieldcatalog-seltext = 'Total Qty'.

ls_fieldcatalog-outputlen = 18.

APPEND ls_fieldcatalog TO lt_fieldcatalog.

===============================================

As you could see the FieldName 'MOD_QTY' can be edited in the ALVGRID. I need to have a code where it would allow only Numeric Figures to be entered in the Editable Field. Please give me all possible methods and I shall Reward you all.

Thanks All,

Sri