Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Table control

abapdeveloper20
Contributor
0 Likes
353

Dear Gurus,

How to make one table control as editable and non-editable (simple display) via push button...?

i.e initally the data in table control should be non-editable(grey color) if i press a button called change.... then the data which is displaying as grey will change into editable mode...

Any inputs on this will be highly rewarded.

Regards,

Lakshmiraj

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
334

Hi,

What you can do is assign a modif ID to every column in your table control. When you double click on the column, in the attributes, there are four GROUP fields for entry. In the first one (SCREEN-GROUP1) enter e.g. 'HID'. This becomes modif id for the field/column.

Now, say the pushbutton generates code 'PUSH', then in PBO module wihtin LOOP and ENDLOOP of table control put following code:

IF OKCODE EQ 'PUSH'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 EQ 'HID' AND V_EDIT EQ 'X'.

SCREEN-INPUT = '1'.

CLEAR V_EDIT. "This tells system columns are non-editable

ELSEIF SCREEN-GROUP1 EQ 'HID' AND V_EDIT EQ 'X'.

SCREEN-INPUT = '0'.

V_EDIT = 'X'. "This tells systems the columns are editable

ENDIF.

SCREEN-ACTIVE = '1'.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

Hope this helps.

Note: Declare V_EDIT as single character field.

Regards,

Aditya

2 REPLIES 2
Read only

Former Member
0 Likes
335

Hi,

What you can do is assign a modif ID to every column in your table control. When you double click on the column, in the attributes, there are four GROUP fields for entry. In the first one (SCREEN-GROUP1) enter e.g. 'HID'. This becomes modif id for the field/column.

Now, say the pushbutton generates code 'PUSH', then in PBO module wihtin LOOP and ENDLOOP of table control put following code:

IF OKCODE EQ 'PUSH'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 EQ 'HID' AND V_EDIT EQ 'X'.

SCREEN-INPUT = '1'.

CLEAR V_EDIT. "This tells system columns are non-editable

ELSEIF SCREEN-GROUP1 EQ 'HID' AND V_EDIT EQ 'X'.

SCREEN-INPUT = '0'.

V_EDIT = 'X'. "This tells systems the columns are editable

ENDIF.

SCREEN-ACTIVE = '1'.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

Hope this helps.

Note: Declare V_EDIT as single character field.

Regards,

Aditya

Read only

Former Member
0 Likes
334

Hi,

i think this may help you-

First assign screen group1 to ‘GP1’ to all fields of screen painter’s table control.

At se38 program declare a variable v_flag type c.

And wa_tablecontrolcols type <tablecontrol-cols>.

Here table control have 3 attributes 1. screen, 2. selected, 3. index.

Then at PAI:-

Module user-command input.

Case sy-ucom.

When ‘CHAN’.

V_flag = ‘X’.

Endcase.

At screen flow logic:-

Loop at itab with control <tablecontrol_name> into wa_itab.

Module assign_valuesto_tablecontrol.

Endloop.

Module modify_screen.

At se38:-

Module assign_valuesto_tablecontrol output.

Move-corresponding wa_itab to <screen fields ie tablecontrol fields>.

Endmodule.

Or

Module modify_screen output.

If v_flag = ‘X’.

Loop at screen.

If screen-group1 = ‘GP1’.

screen-input = ‘1’.

Endif.

Modify screen.

Endloop.

Else.

Loop at screen.

If screen-group1 = ‘GP1’.

screen-input = ‘1’.

Endif.

Modify screen.

Endloop.

Endmodule.

Or

Module modify_screen output.

If v_flag = ‘X’.

Loop at tablecontrol-cols into wa_tablecontrolcols.

If wa_tablecontrolcols-screen-group1 = ‘GP1’.

wa_tablecontrolcols-screen-input = ‘1’.

Endif.

Modify tablecontrol-cols from wa_tablecontrolcols index sy-loopc.

Endloop.

Else.

Loop at tablecontrol-cols into wa_tablecontrolcols.

If wa_tablecontrolcols-screen-group1 = ‘GP1’.

wa_tablecontrolcols-screen-input = ‘0’.

Endif.

Modify tablecontrol-cols from wa_tablecontrolcols index sy-loopc.

Endloop.

Endmodule.