‎2007 Feb 21 8:57 AM
Hi Experts,
i have a table control, i want to toggle one of the row in a particular columns in my table control from input to output and vice versa. is it possible?
Thank you.
‎2007 Feb 21 9:03 AM
Hi John,
i've done that already but nothing happened. maybe because i am trying to alter a Table Control and not one of the screen elements.
thanks
‎2007 Feb 21 8:59 AM
Hi Jesus,
Yes you can, in PBO loop over the SCREEN table and switch the relevant field from in- to output.
Regards,
John.
‎2007 Feb 21 9:00 AM
Refer this link:
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dbab6f35c111d1829f0000e829fbfe/content.htm
Regards,
Ravi
‎2007 Feb 21 9:03 AM
Hi
Ye it is!
U have to change the attribute INPUT into loop of table control of PBO and drive the process by a pushbutton (in the user-commad of PAI)
PROCESS PBO
LOOP AT
MODULE CHANGE_SCREEN.
ENDLOOP.
PROCESS PAI.
MODULE USER_COMMAND.
MODULE CHANGE_SCREEN.
LOOP AT SCREEN.
IF SCREEN-NAME = <Colunm name>.
SCREEN-INPUT = _INPUT.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDMODULE.
MODULE USER_COMMAND.
CASE OK_CODE.
WHEN 'MODI'. _INPUT = 1.
WHEN 'DISP'. _INPUT = 0.
ENDCASE.
ENDMODULE.Max
‎2007 Feb 21 9:03 AM
Hi John,
i've done that already but nothing happened. maybe because i am trying to alter a Table Control and not one of the screen elements.
thanks
‎2007 Feb 21 9:04 AM
‎2007 Feb 21 9:06 AM
Hi
See my answer, because u don't need to alter the Table Control, but only the INPUT attribute of the field.
U should change the attribute of table control only if you need to hide a colunm.
Max
‎2007 Feb 21 9:27 AM
‎2007 Feb 21 9:31 AM
Hi
Give me your code...because it's impossible, I've used that trick many many times and it always worked fine:
PROCESS PBO
LOOP AT
MODULE CHANGE_SCREEN.
ENDLOOP.
PROCESS PAI.
LOOP AT
ENDLOOP
MODULE USER_COMMAND.
MODULE CHANGE_SCREEN.
CHECK ITAB-MARK = 'X'.
LOOP AT SCREEN.
IF SCREEN-NAME = 'IT_TC200-MENGE'.
SCREEN-INPUT = _INPUT.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDMODULE.
MODULE USER_COMMAND.
CASE OK_CODE.
WHEN 'F_EDIT'.
IF _INPUT = 1.
_INPUT = 0.
ELSE
_INPUT = 1.
ENDIF.
ENDCASE.
ENDMODULE.Max
‎2007 Feb 21 9:36 AM
Really?
wow that's estranged, anyway here's my code.
MODULE init_screen_200 OUTPUT.
LOOP AT SCREEN.
IF screen-name EQ 'IT_TC200-MENGE'.
screen-input = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDMODULE.
where 'IT_TC200-MENGE' is the field in my TC that i want to change.
thanks a lot.
‎2007 Feb 21 9:37 AM
‎2007 Feb 21 9:41 AM
Hi
In this way you're always setting as editable the colunm IT_TC200-MENGE for every row, because you're only transfering 1 to SCREEN-INPUT.
The first thing you should do is to check the INPUT attribute by screen painter: it doesn't has to be ONLY OUTPUT: it can't change this value at run time, set it as INPUT/OUTPUT.
So you can use a module like this
MODULE CHANGE_SCREEN.
LOOP AT SCREEN.
IF SCREEN-NAME = 'IT_TC200-MENGE'.
SCREEN-INPUT = _INPUT.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDMODULE.
The variable _INPUT is setted in the USER-COMMAD:
MODULE USER_COMMAND.
CASE OK_CODE.
WHEN 'F_EDIT'.
IF _INPUT = 1.
_INPUT = 0.
ELSE.
_INPUT = 1.
ENDIF.
ENDCASE.
ENDMODULE.
If you need to change only a certain row, that depends on how you manange the SELECTION, if you have a MARK colunm:
MODULE CHANGE_SCREEN.
CHECK IT_TC200-MARK = 'X'.
LOOP AT SCREEN.
IF SCREEN-NAME = 'IT_TC200-MENGE'.
SCREEN-INPUT = _INPUT.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDMODULE.
Else you can use a module to get the line with the cursor:
PROCESS PAI.
LOOP
MODULE GET_CURSOR.
ENDLOOP.
MODULE GET_CURSOR.
GET CURSOR LINE VN_LINE
ENDMODULE.
and so
MODULE CHANGE_SCREEN.
CHECK SY-STEPL = VN_LINE.
LOOP AT SCREEN.
IF SCREEN-NAME = 'IT_TC200-MENGE'.
SCREEN-INPUT = _INPUT.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDMODULE
Max
‎2007 Feb 21 9:46 AM
got it max,
i just missed this one.
LOOP AT
MODULE CHANGE_SCREEN.
ENDLOOP.
thanks a lot max, it is really a big help.
‎2007 Feb 21 9:08 AM
Ravi,
here's my code.
CONTROLS tc200 TYPE TABLEVIEW USING SCREEN 200.
DATA: cols LIKE LINE OF tc200-cols,
v_input TYPE i.
WHEN 'F_EDIT'.
IF v_input EQ 0.
v_input = 1.
ELSE.
v_input = 0.
ENDIF.
LOOP AT tc200-cols INTO cols.
IF cols-screen-name EQ 'IT_TC200-MENGE'.
cols-screen-input = v_input.
MODIFY tc200-cols FROM cols INDEX sy-tabix.
ENDIF.
ENDLOOP.
this one works, but all of the rows on the column 'IT_TC200-MENGE' is changed
from output to input. what i want is to change just one row or whatever the user selected in my Table Control.
Thanks Ravi.
‎2007 Feb 21 9:28 AM
Hi Jesus
See my answer, there's a possible solution.
Just as I said you don't need to change the table control attribute, but the field attribute just as I explained before.
PROCESS PBO
LOOP AT
MODULE CHANGE_SCREEN.
ENDLOOP.
MODULE CHANGE_SCREEN.
* If it needs to change only the selected rows
IF ITAB-MARK = 'X'.
LOOP AT SCREEN.
SCREEN-INPUT = _INPUT.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
ENDMODULE.
If you change the attributes of tc you'll change them for all rows.
Max