Application Development 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: 

Disable Specific Cell in Table Control

dukejib5
Participant
0 Kudos
1,156

Hi,

EDIT: Thanks all for the code correction. Actual problem was , i was modifying Screen after LOOP AT ITAB in PBO as well. Commenting it out solved the problem.

I am trying to disable a specific cell in one row only of a table control.

I've tried using table-cols and specific cell, but it disables all cells in the field.

Can someone please guide me for the same.

Tried following code:

PBO

 LOOP AT   IT_LINEITEM
       INTO WA_LINEITEM
       WITH CONTROL TCNR
       CURSOR TCNR-CURRENT_LINE.
    MODULE TCNR_GET_LINES.
    MODULE DISABLE_DOCUMENT_QUANTITY.
  ENDLOOP.

MODULE - CORRECTED CODE

MODULE DISABLE_DOCUMENT_QUANTITY OUTPUT. 
* CORRECTED CODE  
IF WA_LINEITEM-DCNUMBER NE ''.
    LOOP AT SCREEN.
      IF SCREEN-NAME = 'WA_LINEITEM-QUANTITY' .
        SCREEN-INPUT = '0'.
        SCREEN-INTENSIFIED = '1'.
        MODIFY-SCREEN.
      ENDIF.
    ENDLOOP.
ENDIF.
ENDMODULE.

Please note that this is a dynamically populated table control.

Only possibility, i think of is dynamically giving a name to specific cell and then disable it.

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
1,082

in your PBO logic code, you must have a LOOP, WITH CONTROL

In this loop call some module

  • If required, not with AT ITAB, read the corresponding internal table record and map values to abap and dynpro fields
  • Then execute a LOOP AT SCREEN for this record, here you can modify attributes of cells of this displayed record
10 REPLIES 10

raymond_giuseppi
Active Contributor
1,083

in your PBO logic code, you must have a LOOP, WITH CONTROL

In this loop call some module

  • If required, not with AT ITAB, read the corresponding internal table record and map values to abap and dynpro fields
  • Then execute a LOOP AT SCREEN for this record, here you can modify attributes of cells of this displayed record

0 Kudos
1,082

LOOP AT SCREEN. MODIFY SCREEN. ENDLOOP outside of LOOP WITH CONTROL modifies the entire column, inside - modifies the cell in the current row.

0 Kudos
1,082

Yes, the code is in PBO, module. but it disables full field , not just one cell.

I've also updated the question with PBO code.

1,082

dukejib5 In SCREEN-NAME, don't indicate the temporary ABAP variable, indicate the field name from your DYNPRO.

Wrong:

IF SCREEN-NAME = WA_LINEITEM-QUANTITY .

Correct:

IF SCREEN-NAME = 'XXXXXXX-XXXXXX' . " <=== must be the SCREEN FIELD NAME

0 Kudos
1,082
sandra.rossi

temporary variable is working fine. however i changed it to your corrected version.

Still, unable to disable the specific cell in row.

as raymond.giuseppi suggested, i tried to add the below code, but it is raising error.

loop at itab
  into wtab
  with tablecontrol.

  loop at screen.
    moduel modify-row.
  endloop.
endloop.

1,082

Replace 'moduel modify-row.' with 'module modify_row.'

xiswanto
Active Participant
0 Kudos
1,082

As stated in the answers, make sure that the 'loop at screen' syntax is called in PBO inside the 'loop ... with table control'.
If you change the screen property outside of the table control loop, it will modify all of the row of specified column / fieldname.

dukejib5
Participant
0 Kudos
1,082
xiswanto

Is this what you are saying?

loop at itab
  into wtab
  with tablecontrol.

  loop at screen.
    moduel modify-row.
  endloop.
endloop.
SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}.L0S31 {
font-style: italic;
color: #808080;
}.L0S52 {
color: #0000FF;
}.L0S55 {
color: #800080;
}.L0S70 {
color: #8080

But this is raising error of "invalid nesting of loop"

xiswanto
Active Participant
1,082

Upon taking a closer look on your original code, the issue is because you wrote the syntax incorrectly hence the TRUE condition will never occur.

should be:

IF SCREEN-NAME = 'WA_LINEITEM-QUANTITY'.

logically speaking, if you use the workarea without quote, it will check the value INSIDE the variable, not the variable name itself.

And, if you only need to disable certain rows instead of all rows, do add some additional logic along with the fieldname check.

Sandra_Rossi
Active Contributor
0 Kudos
1,082

Thanks for the resolution feedback (in the head of your question). You may close your question now (Actions > Close).