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 col clearance

Former Member
0 Likes
645

Hi friends,

have a problem ,here i am pasting my code for the first condition am hiding two fields for the second condition am hiding four fields,but the problem is for the second condition also the first conditon fields are hiding could you please provide the solution which one have to clear.

If first = 'X'.

CASE Sy-ucomm.

when 'CREATE' .

loop at lv_control-cols into control .

IF control-index = 6 or

control-index = 7 .

control-invisible = 'X'.

MODIFY lv_control-cols FROM control index sy-tabix.

clear control.

ENDIF.

ENDLOOP.

endcase .

elseif second = 'X'.

CASE Sy-ucomm.

when 'CREATE' .

clear control.

loop at lv_control-cols into control .

IF control-index = 4 or

control-index = 8 or

control-index = 10 or

control-index = 13 .

control-invisible = 'X'.

MODIFY lv_control-cols FROM control index sy-tabix.

clear control.

ENDIF.

ENDLOOP.

endcase .

endif..

thanks in advance

Hi friends,

have a problem ,here i am pasting my code for the first condition am hiding two fields for the second condition am hiding four fields,but the problem is for the second condition also the first conditon fields are hiding could you please provide the solution which one have to clear.

If first = 'X'.

CASE Sy-ucomm.

when 'CREATE' .

loop at lv_control-cols into control .

IF control-index = 6 or

control-index = 7 .

control-invisible = 'X'.

MODIFY lv_control-cols FROM control index sy-tabix.

clear control.

ENDIF.

ENDLOOP.

endcase .

elseif second = 'X'.

CASE Sy-ucomm.

when 'CREATE' .

clear control.

loop at lv_control-cols into control .

IF control-index = 4 or

control-index = 8 or

control-index = 10 or

control-index = 13 .

control-invisible = 'X'.

MODIFY lv_control-cols FROM control index sy-tabix.

clear control.

ENDIF.

ENDLOOP.

endcase .

endif..

thanks in advance

4 REPLIES 4
Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
623

Hi Sai,

Use it this way:-

Say on condition1 you want to hide a textbox with group1 ABC and on condition2 you want to hide other four fields all having group1 as DEF.

Now use the code:-


if <condition1>.
  if ( screen-group1 = 'ABC' ).
    loop at screen.
      screen-invisible = 1. "hide one field
      screen-active = 0.
    endloop.
    modify screen.
  else ( screen-group1 = 'DEF' ).
    loop at screen.
      screen-invisible = 0. "display other four fileds
      screen-active = 1.
    endloop.
    modify screen.
  endif.
elseif <codition2>.
  if ( screen-group1 = 'ABC' ).
    loop at screen.
      screen-invisible = 0. "display one field
      screen-active = 1.
    endloop.
    modify screen.
  else ( screen-group1 = 'DEF' ).
    loop at screen.
      screen-invisible = 1. "hide other four fields
      screen-active = 0.
    endloop.
    modify screen.
  endif.
endif.  

Hope this solves your problem.

Thanks & Regards,

Tarun Gambhir

Read only

Former Member
0 Likes
623

Thanks gambhir,

but requirement is to hide the 1,2,3 colums in first condition and in second condition 2,5,6 cloumns like that, in my case maitaining group is not possible .

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
623

Hi Sai,

Then use this alternative:-

Say you take the name of the these six fields as :-

TextBox1 : TXT1

TextBox2 : TXT2

TextBox3 : TXT3

TextBox4 : TXT4

TextBox5 : TXT5

TextBox6 : TXT6


if <condition1>. "on which fields 1, 3 and 5 will hide and 2, 4 and 6 will display
  loop at screen.
    if ( screen-name = 'TXT1' ).
      screen-invisible = 1. "hide field 1
      screen-active = 0.
    elseif ( screen-name = 'TXT2' ).
      screen-invisible = 0. "display field 2
      screen-active = 1.
    elseif ( screen-name = 'TXT3' ).
      screen-invisible = 1. "hide field 3
      screen-active = 0.
    elseif ( screen-name = 'TXT4' ).
      screen-invisible = 0. "display field 4
      screen-active = 1.
    elseif ( screen-name = 'TXT5' ).
      screen-invisible = 1. "hide field 5
      screen-active = 0.
    elseif ( screen-name = 'TXT6' ).
      screen-invisible = 0. "display field 6
      screen-active = 1.
    endif.
    modify screen.
  endloop.
endif.


if <condition2>. "on which fields 2, 4 and 6 will hide and 1, 3 and 5 will display
  loop at screen.
    if ( screen-name = 'TXT1' ).
      screen-invisible = 0. "display field 1
      screen-active = 1.
    elseif ( screen-name = 'TXT2' ).
      screen-invisible = 1. "hide field 2
      screen-active = 0.
    elseif ( screen-name = 'TXT3' ).
      screen-invisible = 0. "display field 3
      screen-active = 1.
    elseif ( screen-name = 'TXT4' ).
      screen-invisible = 1. "hide field 4
      screen-active = 0.
    elseif ( screen-name = 'TXT5' ).
      screen-invisible = 0. "display field 5
      screen-active = 1.
    elseif ( screen-name = 'TXT6' ).
      screen-invisible = 1. "hide field 6
      screen-active = 0.
    endif.
    modify screen.
  endloop.
endif.

Hope this solves your problem.

Thanks & Regards,

Tarun Gambhir

Read only

Former Member
0 Likes
623

hi,

try in this way..

CASE Sy-ucomm.
when 'CREATE' .

If first = 'X'.
loop at lv_control-cols into control .
IF control-index = 6 or
   control-index = 7 .
  control-invisible = 'X'.
MODIFY lv_control-cols FROM control index sy-tabix.
clear control.
ENDIF.
ENDLOOP.
elseif second = 'X'.
loop at lv_control-cols into control .
IF control-index = 4 or
control-index = 8 or
control-index = 10 or
control-index = 13 .
control-invisible = 'X'.
MODIFY lv_control-cols FROM control index sy-tabix.
clear control.
ENDIF.
ENDLOOP.
endif.

endcase .