cancel
Showing results for 
Search instead for 
Did you mean: 

I want to make only certain rows editable in table control.

kavmp
Participant
0 Kudos
421

I have a table control in my custom abap program where I have 7 columns. I want to achieve the below layout for input/output disabled/enabled where green is input allowed and red is input disabled. I have searched google and sap community for solutions and tried out many but nothing seems to be working.

Based on column 7, I am trying to make the row editable/disabled. If it is true, then input disabled. If it is false then input enabled. And by default, a new row will have column 7 as false. I tried to put my code inside a module within the Loop itab with table control in my PBO, but that doesn't seem to be working. 

kavmp_0-1726048394765.png

Please help with this. It is quite urgent.

Thanks in advance!!

 

Sandra_Rossi
Active Contributor

People never answer more quickly if you say it's urgent, they answer when they can.

kavmp
Participant
0 Kudos
Yes, But I was just hoping someone would. When they can. Thanks.
kavmp
Participant
0 Kudos
Hi,

Accepted Solutions (1)

Accepted Solutions (1)

kavmp
Participant

Hi, Thanks for the replies. I have found a solution for this. What worked it looping at the screen for each condition separately and modifying screen. So essentially, instead of using a single 'loop at screen' and modifying all my required columns in that, I used three different 'loop at screen' blocks and gave an if inside each of those for each of my columns. 

 

Sandra_Rossi
Active Contributor

Basics to make the Table Control cells with input enabled or disabled varying according to each line. Adapt to your needs.

Flow logic:

PROCESS BEFORE OUTPUT.
  LOOP AT itab INTO line WITH CONTROL yourcontrol.
    MODULE pbo_one_line.
  ENDLOOP.

ABAP code:

MODULE pbo_one_line OUTPUT.
  LOOP AT SCREEN INTO DATA(screen_field).
    CASE screen_field-name.
      WHEN 'COL3'. 
        IF line-col7 = 'TRUE'. 
          screen_field-input = '0'. "input disabled. 
        ELSE. 
          screen_field-input = '1'. "input enabled. 
        ENDIF. 
    ENDCASE. 
    MODIFY SCREEN.
  ENDLOOP.
ENDMODULE.

 

Answers (2)

Answers (2)

ulrich_mhrke
Explorer
0 Kudos

Paste your whole PBO and the whole code of the module with "loop at screen".

raymond_giuseppi
Active Contributor
0 Kudos

 

What exactly have you coded in the PBO logic?

  • Paste your relevant code, it should be some LOOP AT SCREEN / MODIFY SCREEN within a LOOP WITH CONTROL in PROCESS BEFORE OUTPUT logic.
kavmp
Participant
0 Kudos

FIELD-SYMBOLS: <lfs_cntrl> TYPE scxtab_column.

  LOOP AT sch_chain-cols ASSIGNING <lfs_cntrl>.
    IF <lfs_cntrl>-screen-name EQ 'GW_CHAIN_JOB-JOBNAME' OR <lfs_cntrl>-screen-name EQ 'GW_CHAIN_JOB-START_TIME' OR
      gw_chain_job-scheduled EQ gc_schedule .
      <lfs_cntrl>-screen-input 1.
    ELSEIF gw_chain_job-scheduled EQ gc_scheduled.
      <lfs_cntrl>-screen-input 0.
      ENDIF.
  ENDLOOP.

sch_chain is my table control and scheduled is my column 7 flag

The above code is within my PBO loop with table control 

raymond_giuseppi
Active Contributor
0 Kudos
Try to replace LOOP AT sch_chain-cols with a direct LOOP AT SCREEN
kavmp
Participant
0 Kudos
i tried loop at screen as well. But it is changing the input/output for all the rows no matter what the flag is