‎2008 Aug 11 10:48 AM
Experts,
I have a single tablecontrole screen to create, modify and edit the entries. When clicking display I need to see the table controle in the display mode. I tried looping the screen for the table controle name as below.
loop at screen .
if screen-name = 'TABLECONTROLE'.
SCREEN-INPUT = 0.
ENDIF.
ENDLOOP.
Even I tried thesame for the sub field names in the table controle I mean the column names in the table controle.
Kindly help me achieve my requirement.
Thanks & Regards,
Rama Murthy.P
‎2008 Aug 11 10:55 AM
Hi..
Put a module in loop of table control and den in that module make each column deactive.
regards
vivek
‎2008 Aug 11 10:51 AM
hiii
use this code just go through.
&----
*& Report ZOCX *
*& *
&----
*& *
*& *
&----
REPORT zocx .
TABLES zskem.
CONTROLS: tabcon TYPE TABLEVIEW USING SCREEN 100.
DATA : itab TYPE STANDARD TABLE OF zskem WITH HEADER LINE,
ok_code LIKE sy-ucomm,
wa LIKE LINE OF itab,
n TYPE i
.
DATA : cust_container TYPE REF TO cl_gui_custom_container,
cust_container1 TYPE REF TO cl_gui_custom_container,
editor1 TYPE REF TO cl_gui_textedit,
editor TYPE REF TO cl_gui_textedit.
CALL SCREEN 100.
INCLUDE zttryy.
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE status_0100 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
SELECT * FROM zskem INTO TABLE itab .
IF cust_container IS INITIAL.
CREATE OBJECT cust_container
EXPORTING
parent = cust_container
container_name = 'MY_CONT'(001)
STYLE =
LIFETIME = lifetime_default
REPID =
DYNNR =
NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
others = 6
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT cust_container1
EXPORTING
parent = cust_container1
container_name = 'MY_CONT1'
STYLE =
LIFETIME = lifetime_default
REPID =
DYNNR =
NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
others = 6
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT editor
EXPORTING
MAX_NUMBER_CHARS =
STYLE = 0
WORDWRAP_MODE = WORDWRAP_AT_WINDOWBORDER
WORDWRAP_POSITION = -1
WORDWRAP_TO_LINEBREAK_MODE = FALSE
FILEDROP_MODE = DROPFILE_EVENT_OFF
parent = cust_container
LIFETIME =
NAME =
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
GUI_TYPE_NOT_SUPPORTED = 5
others = 6
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT editor1
EXPORTING
MAX_NUMBER_CHARS =
STYLE = 0
WORDWRAP_MODE = WORDWRAP_AT_WINDOWBORDER
WORDWRAP_POSITION = -1
WORDWRAP_TO_LINEBREAK_MODE = FALSE
FILEDROP_MODE = DROPFILE_EVENT_OFF
parent = cust_container1
LIFETIME =
NAME =
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
GUI_TYPE_NOT_SUPPORTED = 5
others = 6
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DATA: w_event TYPE LINE OF cntl_simple_events,
t_event TYPE cntl_simple_events.
w_event-eventid = cl_gui_textedit=>EVENT_double_click.
w_event-appl_event = ' '.
APPEND w_event TO t_event.
CALL METHOD editor->set_registered_events
EXPORTING
events = t_event
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
ILLEGAL_EVENT_COMBINATION = 3
others = 4
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->double_click FOR editor.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
&----
*& Module populate_screen OUTPUT
&----
text
----
MODULE populate_screen OUTPUT.
READ TABLE itab INTO zskem .
select * from zskemp into table itab .
loop at itab into wa.
append itab.
endloop.
ENDMODULE. " populate_screen OUTPUT
&----
*& Module display_screen INPUT
&----
text
----
MODULE display_screen INPUT.
ENDMODULE. " display_screen INPUT
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'T1'.
CALL METHOD editor->set_selected_text_as_r3table
EXPORTING
table = itab[]
ENABLE_EDITING_PROTECTED_TEXT = false
EXCEPTIONS
ERROR_DP = 1
ERROR_DP_CREATE = 2
others = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
WHEN 'M1'.
CALL METHOD editor->get_selected_text_as_stream
IMPORTING
selected_text = itab[]
EXCEPTIONS
ERROR_DP = 1
others = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD editor->save_as_local_file
EXPORTING
file_name = 'C:\Users\ABC\Desktop\mann.txt'
EXCEPTIONS
ERROR_CNTL_CALL_METHOD = 1
others = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD editor1->open_local_file
EXPORTING
file_name = 'C:\Users\ABC\Desktop\mann.txt'
EXCEPTIONS
ERROR_CNTL_CALL_METHOD = 1
others = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD editor1->set_selected_text_as_stream
EXPORTING
selected_text = itab[]
ENABLE_EDITING_PROTECTED_TEXT = false
EXCEPTIONS
ERROR_DP = 1
ERROR_DP_CREATE = 2
others = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD editor->get_line_count
IMPORTING
lines = n
EXCEPTIONS
ERROR_CNTL_CALL_METHOD = 1
others = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*
*CALL METHOD EDITOR->GET_LINE_COUNT
IMPORTING
LINES = n
EXCEPTIONS
ERROR_CNTL_CALL_METHOD = 1
others = 2
.
*IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
CALL METHOD editor1->protect_lines
EXPORTING
from_line = 1
protect_mode = 1
to_line = n
enable_editing_protected_text = 0
EXCEPTIONS
ERROR_CNTL_CALL_METHOD = 1
INVALID_PARAMETER = 2
others = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WHEN OTHERS.
CALL METHOD cl_gui_cfw=>dispatch
IMPORTING
RETURN_CODE =
.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
‎2008 Aug 11 10:52 AM
HI,,
U cant hide the table table control by looping the table screen...
one of the way to hid the table is place that table control in in one subscreen and whenever u cilck the display then call this subscreen there or else place an empty subscreen u r problem will get solved..
remember this is one of the way .....
Regards,
Sunil Kumar M
‎2008 Aug 11 10:52 AM
Hi,
try this one.
take the field-string for your table control.
suppose field string name is fs_tab.
in the pbo event.
loop at screen.
if screen-name eq 'fs_tab-1'.
screen-input = '0'.
modify screen.
endif.
endloop.
in this way you have give all the fields in the screen-name and make screen-input as zero.
.
Regards
Manjari.
‎2008 Aug 11 10:52 AM
Hi ,
U should use this .
DATA:cols TYPE cxtab_column.
LOOP AT tc1-cols INTO cols.
IF cols-index = 1 . "this will hide the first columN
cols-invisible = 'X' .
MODIFY tc1-cols FROM cols.
ENDIF.
ENDLOOP.
‎2008 Aug 11 10:55 AM
Hey sorry for my reply..
i thought u want to hide the table control initially.. for that i have suggested..
pplzz go through the remaing friends repliess.....
regards,
Sunil Kumar Mutyala
‎2008 Aug 11 10:55 AM
Hi..
Put a module in loop of table control and den in that module make each column deactive.
regards
vivek
‎2008 Aug 11 10:55 AM
Hi,
assign all the fields in tablecontrol to single group using groupid(gid). Then
loop at screen.
if screen-name = 'TABLECONTROLE'.
if screen-groupid = 'G1'.
screen-input = 0.
modify screen.
endif.
endif.
Rgds.,
subash
‎2008 Aug 22 7:25 AM