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

enble / disable table control column at runtime.

Former Member
0 Likes
445

hi to all,

i want to make my table control enable & disable at runtime according to some logic.

at first in PBO i was tried to disabled column number 1 with help of this code.

LOOP AT TC_RISK_EX-COLS INTO D_TC_EXC WHERE INDEX = 1.

D_TC_EXC-SCREEN-INPUT = 0.

MODIFY TC_RISK_EX-COLS FROM D_TC_EXC INDEX SY-TABIX.

ENDLOOP.

but after that i was tried to make it enable with help of this code. but it is not working.

LOOP AT TC_RISK_EX-COLS INTO D_TC_EXC WHERE INDEX = 1.

D_TC_EXC-SCREEN-INPUT = 1.

MODIFY TC_RISK_EX-COLS FROM D_TC_EXC INDEX SY-TABIX.

ENDLOOP.

Is there any Solution for these ?

1 ACCEPTED SOLUTION
Read only

valter_oliveira
Active Contributor
0 Likes
366

Hello.

It should work. Are you using both statements in PBO of the screen that contains Table Control?

I have a similar code, for example, to hide columns. As aditional info, use TRANSPORTING statement.

cols_in is a table with the fields to appear, like a variant construction.

PBO


* Retira colunas
  LOOP AT table_control-cols INTO wa_cols.
    READ TABLE cols_in WITH KEY field = wa_cols-screen-name+3.
    CHECK sy-subrc NE 0.
    wa_cols-invisible = '1'.
    MODIFY table_control-cols FROM wa_cols TRANSPORTING invisible.
  ENDLOOP.

* Insere colunas
  LOOP AT table_control-cols INTO wa_cols WHERE invisible EQ '1'.
    READ TABLE cols_in WITH KEY field = wa_cols-screen-name+3.
    CHECK sy-subrc EQ 0.
    wa_cols-invisible = space.
    MODIFY table_control-cols FROM wa_cols TRANSPORTING invisible.
  ENDLOOP.

Can you post all of the PBO module coding?

Best regards.

Valter Oliveira.

hi to all,

i want to make my table control enable & disable at runtime according to some logic.

at first in PBO i was tried to disabled column number 1 with help of this code.

LOOP AT TC_RISK_EX-COLS INTO D_TC_EXC WHERE INDEX = 1.

D_TC_EXC-SCREEN-INPUT = 0.

MODIFY TC_RISK_EX-COLS FROM D_TC_EXC INDEX SY-TABIX.

ENDLOOP.

but after that i was tried to make it enable with help of this code. but it is not working.

LOOP AT TC_RISK_EX-COLS INTO D_TC_EXC WHERE INDEX = 1.

D_TC_EXC-SCREEN-INPUT = 1.

MODIFY TC_RISK_EX-COLS FROM D_TC_EXC INDEX SY-TABIX.

ENDLOOP.

Is there any Solution for these ?

1 REPLY 1
Read only

valter_oliveira
Active Contributor
0 Likes
367

Hello.

It should work. Are you using both statements in PBO of the screen that contains Table Control?

I have a similar code, for example, to hide columns. As aditional info, use TRANSPORTING statement.

cols_in is a table with the fields to appear, like a variant construction.

PBO


* Retira colunas
  LOOP AT table_control-cols INTO wa_cols.
    READ TABLE cols_in WITH KEY field = wa_cols-screen-name+3.
    CHECK sy-subrc NE 0.
    wa_cols-invisible = '1'.
    MODIFY table_control-cols FROM wa_cols TRANSPORTING invisible.
  ENDLOOP.

* Insere colunas
  LOOP AT table_control-cols INTO wa_cols WHERE invisible EQ '1'.
    READ TABLE cols_in WITH KEY field = wa_cols-screen-name+3.
    CHECK sy-subrc EQ 0.
    wa_cols-invisible = space.
    MODIFY table_control-cols FROM wa_cols TRANSPORTING invisible.
  ENDLOOP.

Can you post all of the PBO module coding?

Best regards.

Valter Oliveira.