2008 Jun 04 8:40 AM
hi i have a problem with the table control
i have made a table control where all the records are displayed in disable mode.
what i want is whichever line i select and when i press edit only that row shud become enable.
How can i acheieve that. please send the coding if possible.
points will be rewarded.
Regards.
note by moderator:
Kindly use meaningful subject line
Edited by: Durairaj Athavan Raja on Jun 4, 2008 10:40 AM
2008 Jun 04 5:03 PM
Hi,
All fields of the current screen are stored in the system table SCREEN with their attributes.
The LOOP AT SCREEN statement places this information in the header line of the system table.
If you want to change the attributes, you must put back the changed header line with MODIFY SCREEN. However, you can only do this in the PBO module of a screen.
If you use this statement for step loop processing, the information (and any changes) apply only to the current steploop line. Outside step loop processing, the information for a step loop field applies to the complete column.
You can also modify fields in the loop processing of a table control using this loop statement. Unlike a step loop, modifications before the loop have no effect, since the system gets the initial values for the columns from the column table of the table view.
for Example.
LOOP AT SCREEN.
IF NOT I_USSEED IS INITIAL AND
I_USSEED-PROCESSED_FLAG = 'X'.
IF SCREEN-NAME EQ 'I_USSEED-CHANGE'.
SCREEN-INPUT = 1.
MODIFY SCREEN.
ELSE.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
When Change option is clicked &
record not exist in Frgt trigger table
Replacing check of trig_check with list_flag
and change from 2 If statements to a nested If/Else.
IF I_USSEED-CHANGE_CHECK EQ 'X'. " AND
if i_usseed-list_flag = 'S'. " short
replacing check on screen-name with check on group
if screen-group2 = '001'.
SCREEN-INPUT = 1.
else.
SCREEN-INPUT = 0.
endif.
MODIFY SCREEN.
*-- When Change option is clicked &
*-- record exist in Frgt trigger table
else.
*replacing check on screen-name with check on group
if screen-group3 = '001'.
SCREEN-INPUT = 1.
else.
SCREEN-INPUT = 0.
endif.
MODIFY SCREEN.
endif. " checking list_flag 04/23/07
ENDIF. " chking change_check
ELSE. " chking usseed not init
processed_flag = X
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF. " chking usseed not init and processed_flag = X
ENDLOOP.
2008 Jun 04 5:03 PM
Hi,
All fields of the current screen are stored in the system table SCREEN with their attributes.
The LOOP AT SCREEN statement places this information in the header line of the system table.
If you want to change the attributes, you must put back the changed header line with MODIFY SCREEN. However, you can only do this in the PBO module of a screen.
If you use this statement for step loop processing, the information (and any changes) apply only to the current steploop line. Outside step loop processing, the information for a step loop field applies to the complete column.
You can also modify fields in the loop processing of a table control using this loop statement. Unlike a step loop, modifications before the loop have no effect, since the system gets the initial values for the columns from the column table of the table view.
for Example.
LOOP AT SCREEN.
IF NOT I_USSEED IS INITIAL AND
I_USSEED-PROCESSED_FLAG = 'X'.
IF SCREEN-NAME EQ 'I_USSEED-CHANGE'.
SCREEN-INPUT = 1.
MODIFY SCREEN.
ELSE.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
When Change option is clicked &
record not exist in Frgt trigger table
Replacing check of trig_check with list_flag
and change from 2 If statements to a nested If/Else.
IF I_USSEED-CHANGE_CHECK EQ 'X'. " AND
if i_usseed-list_flag = 'S'. " short
replacing check on screen-name with check on group
if screen-group2 = '001'.
SCREEN-INPUT = 1.
else.
SCREEN-INPUT = 0.
endif.
MODIFY SCREEN.
*-- When Change option is clicked &
*-- record exist in Frgt trigger table
else.
*replacing check on screen-name with check on group
if screen-group3 = '001'.
SCREEN-INPUT = 1.
else.
SCREEN-INPUT = 0.
endif.
MODIFY SCREEN.
endif. " checking list_flag 04/23/07
ENDIF. " chking change_check
ELSE. " chking usseed not init
processed_flag = X
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF. " chking usseed not init and processed_flag = X
ENDLOOP.
2008 Jun 05 11:49 AM
Hi,
Please try the following code.
TYPES : BEGIN OF t_0001 ,
box TYPE c,
pernr TYPE pa0001-pernr,
endda TYPE pa0001-endda,
begda TYPE pa0001-begda,
END OF t_0001,
tt_0001 TYPE STANDARD TABLE OF t_0001.
DATA : it_0001 TYPE tt_0001.
DATA : ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm,
lines TYPE i,
g_tabctrl_lines TYPE i.
DATA : wa_0001 TYPE t_0001.
DATA : p_mark(3) TYPE c VALUE 'BOX'.
CONTROLS : tabctrl TYPE TABLEVIEW USING SCREEN 100.
MODULE get_init_data OUTPUT.
IF it_0001[] IS INITIAL.
SELECT pernr
endda
begda
FROM pa0001
INTO CORRESPONDING FIELDS OF TABLE it_0001
UP TO 10 ROWS
WHERE endda GE sy-datum
AND begda LE sy-datum.
ENDIF.
ENDMODULE. " get_init_data OUTPUT
MODULE status_0100 OUTPUT.
SET PF-STATUS 'ZSTAT0100'.
SET TITLEBAR 'ZTITEL'.
DESCRIBE TABLE it_0001 LINES lines.
tabctrl-lines = lines.
ENDMODULE. " STATUS_0100 OUTPUT
MODULE modiy_pbo_screen OUTPUT.
LOOP AT SCREEN.
IF screen-group1 = 'MOD'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
IF save_ok = 'CHG'.
IF wa_0001-box IS NOT INITIAL
AND screen-group2 = 'CHG'.
screen-input = 1.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.
ENDMODULE. " modiy_pbo_screen OUTPUT
MODULE tc_lines OUTPUT.
g_tabctrl_lines = sy-loopc.
ENDMODULE. " tc_lines OUTPUT
MODULE exit INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " exit INPUT
MODULE modify_tc_table INPUT.
MODIFY it_0001 FROM wa_0001 INDEX tabctrl-current_line.
ENDMODULE. " modify_tc_table INPUT
MODULE user_command_0100 INPUT.
PERFORM user_ok_tc USING 'TABCTRL'
'IT_0001'
p_mark
CHANGING ok_code.
ENDMODULE. " user_command_0100 INPUT
FORM user_ok_tc USING p_tc_name TYPE dynfnam
p_table_name
p_mark_name
CHANGING p_ok TYPE sy-ucomm.
save_ok = p_ok.
CASE save_ok.
WHEN 'CHG'.
CLEAR p_ok.
ENDCASE.
ENDFORM.
*-------Flow logic of the screen.
PROCESS BEFORE OUTPUT.
MODULE get_init_data.
MODULE status_0100.
LOOP AT it_0001 INTO wa_0001 WITH CONTROL tabctrl CURSOR
tabctrl-current_line.
MODULE modiy_pbo_screen.
MODULE tc_lines.
ENDLOOP.
PROCESS AFTER INPUT.
MODULE exit AT EXIT-COMMAND.
LOOP AT it_0001.
MODULE modify_tc_table.
ENDLOOP.
MODULE user_command_0100.
2020 Feb 19 6:56 PM
You can do it using statement LOOP AT spfli_tab INTO spfli WITH CONTROL flight_tab.
example:
PROCESS BEFORE OUTPUT.
MODULE prepare_tab.
LOOP AT spfli_tab INTO spfli WITH CONTROL flight_tab.
module disable_row. " you can write your logic inside module disable_row with statements loop at screen and screen-input = 0.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT spfli_tab.
MODULE modify_tab.
ENDLOOP.
documentation:
https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/dynploop.htm#!ABAP_VARIANT_1@1@