2008 Mar 25 2:38 AM
Hello everyone;
I have to disable input for one column in table control based on some security role. I used loop at screen code but still it did not work! How do I disable just one column in table control programmatically?
Thanks.
Mithun
2008 Mar 25 2:44 AM
It can be done using the loop at screen statements only.
loop at screen.
if screen-name = 'COL_NAME'.
screen-input = 0.
modify screen.
endif.
endloop.plz show us the code to know it better.
Regards
Gopi
Hi,
You have to use step loop to resolve the problem.
Here is the sample code.
in the PBO event write the code.
loop at itab with control tc cursor tc-current_line.
field itab-field1 module disable.
endloop.
module disable output.
if sy-stepl <> 1.
loop at screen.
if screen-name = 'ITAB-FIELD1' or
screen-name = 'ITAB-FIELD2'.
screen-input = 0.
modify screen.
endif.
endloop.
endif.
endmodule.
reward if helpful.
Regards,
Sankar.
2008 Mar 25 2:44 AM
It can be done using the loop at screen statements only.
loop at screen.
if screen-name = 'COL_NAME'.
screen-input = 0.
modify screen.
endif.
endloop.plz show us the code to know it better.
Regards
Gopi
2008 Mar 25 2:55 AM
Thanks Gopi. I tried exactly the same code but it does not disable the column! Any other thoughts?
Thanks
Mithun
2008 Mar 25 3:05 AM
Paste your code here.
Do a debug to see if the correct values are being passed into the screen-name. also make sure the screen-name should be like this screen-name = 'MARA-MATNR' (single quotes and capital letters).
also make sure you use the MODIFY SCREEN statement with in the loop.
Regards
Gopi
2008 Mar 25 3:08 AM
Hi Mithun,
Check this code .
loop at screen.
if screen-name = '<tablename>-<column name>'.
screen-input = 0.
modify screen.
endif.
endloop.you might have given just column name instead of giving table control tablename with column name. try that by giving table as well. debug it .
Regards,
Venkat.O
2008 Mar 25 3:11 AM
My code will look like this
LOOP at SCREEN.
IF ROLE_LEVEL = 3.
IF screen-NAME = 'G_RULE_WA2-APPROVAL'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDIF.
endloop.
When I debug it goes inside my If statement goes through screen-input = 0 and everything but does nothing!
Thanks.
Mithun
2008 Mar 25 3:43 AM
Hi Mithun,
you seem to have written right code only. Can you tell me whether that is new development or any any enhancement ?because when u do enhancement sometimes Screen group has to be assigned to existing screen field groups.
Thanks,
Venkat.O
2008 Mar 25 4:15 AM
Hi Mithun,
May be the code u hv written is not in the proper place. U have to write this code in PBO event.
check the below example code .
loop at g_ztabctrl_itab
into g_ztabctrl_wa
with control ztabctrl
cursor ztabctrl-current_line.
module ztabctrl_get_lines.
module ztabctrl_move.
endloop.
ztabctrl is my table contrl name....
in MODULE ZTABCTRL_MOVE. write your code and try it will work.
<b>reward if useful</b>
Regards,
sunil kairam.
2008 Mar 25 1:37 PM
Sunil,
You are exactly correct! I had code in a wrong place and when I moved my code to the place you mentioned it worked fine! Thank you and thanks everyone for the feedback. I rewarded full points to everyone.
Mithun
2008 Mar 25 4:28 AM
hi mithun
i can tell the way 2 u have complete
controls flights type tableview using screen 100.
data:
cols like line of flights-cols,
lines type i.
write this code in any one of pbo
suppose u want disable 3 field
loop at flights-cols into cols where index =3
cols-screen-input = '0'.
modify flights-cols from cols index sy-tabix.
endloop.
check this code
2008 Mar 25 4:56 AM
Hi
I think There may be several ways to solve this issue.
excatly i dont know your scenario.
but I tried such a case
example 10 fields in table control , you want to display 9 only based on the security role , right,
if it's a condition , you had from the selection screen or from previous screen.
Make use of that condtion ,
and follow the following
1) you can keep a condition [security role] before filling the table controls and loop the screen and make the screen field, want to hide and make screen-active as 0 & clear the contents of the field you dont want to display from the structure you used to populate the table control structure.
ELSE
fill all the fields of the structure & table controls.
i tested a sample program, it works , remaining 9 fields gets populated in my example..
Reward Points if helpful...
2008 Mar 25 5:10 AM
Hi
I think There may be several ways to solve this issue.
excatly i dont know your scenario.
but I tried such a case
example 10 fields in table control ,
you wants to display 9 fields only based on the security role ,
[As sucurity role as some conditon to check]
If it's a condition value, you had from the selection screen or from the previous screen.
Make use of that condtion ,and follow the following
1) keep a condition [security role], before filling the table control lines .
There , Loop the screen .
Assign a screen group & call the screen field both using its name & group ( groups can be assigned to n field if such scenario).
Make the screen field, you want to hide as screen-active as 0
end loop.
& Clear the contents of the field that which you dont want to display from the structure you used to populate the table control structure.
ELSE . ( if not the particular security role)
fill all the fields of the structure & table controls.
i tested a sample program, it works , remaining 9 fields gets populated in my example..
Reward Points if helpful...
2008 Mar 25 5:14 AM
Hi,
You have to use step loop to resolve the problem.
Here is the sample code.
in the PBO event write the code.
loop at itab with control tc cursor tc-current_line.
field itab-field1 module disable.
endloop.
module disable output.
if sy-stepl <> 1.
loop at screen.
if screen-name = 'ITAB-FIELD1' or
screen-name = 'ITAB-FIELD2'.
screen-input = 0.
modify screen.
endif.
endloop.
endif.
endmodule.
reward if helpful.
Regards,
Sankar.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |