Skip to Content
0
Feb 16, 2011 at 12:04 AM

edit mask in editable ALV Grid

1791 Views

I n my program, I create an editable grid to show the IP address.

I build the field catalog using edit mask ' -. -. -. -' and when it display, It display correctly the first time.

For example if the input is

'129082079255' it shows on the screen as '129.082.079.255' and this is correct.

But if I want to change to like '129.082.079.999', so I changed the last 3 digit to 999 and it showed as '129..08.2.0.79.'

Here is how I build the fieldcat structure

DATA ls_fcat TYPE lvc_s_fcat.

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

EXPORTING

i_structure_name = 'Z_IPADDR'

CHANGING

ct_fieldcat = pt_fieldcat.

LOOP AT pt_fieldcat INTO ls_fcat.

CASE ls_fcat-fieldname.

WHEN 'KUNNR'.

ls_fcat-auto_value = 'X'.

MODIFY pt_fieldcat FROM ls_fcat.

WHEN 'IP_END'.

ls_fcat-edit = 'X'.

ls_fcat-edit_mask = '___.___.___.___'.

ls_fcat-outputlen = 20.

MODIFY pt_fieldcat FROM ls_fcat.

ls_fcat-checktable = '!'. "do not check foreign keys

WHEN OTHERS.

ENDCASE.

ENDLOOP.

Can some one explains why it behaves like this?

Here is my PBO logic, it just create the alv_grid , build the field cat by using above routine and then just call

CALL METHOD go_grid_ip->set_table_for_first_display

EXPORTING

it_toolbar_excluding = lt_exclude

is_layout = ls_layout

CHANGING

it_fieldcatalog = p_t_fieldcat

it_outtab = p_t_auth_ip.

CALL METHOD go_grid_ip->set_ready_for_input

EXPORTING

i_ready_for_input = 1.

Thanks,