01-05-2009 9:30 AM
Hi all,
I am developing a table control for my dialog program , the problem is when the user selects some three rows and scrolls down and again when he scrolls up, the rows which he selected become
un-highlighted ? but i want those rows to be highlighted always unless he de-highlight, because my calculation are based on the rows the user selects ?
thanks,
Siva
01-05-2009 9:37 AM
Hi Siva,
Take the names of the input/output fields as work_area-field_name and select column in table control as work_area-flag.
Also take a flag field of size 1 datatype character as the last field in the internal table and work area while declaration.
What you need to do exactly is read the values from internal table into table control in PBO of the screen after modifying them in PAI.
Use code:-
At Screen Logic:-
PROCESS BEFORE OUTPUT.
MODULE status_8002. "for pf-status
LOOP WITH CONTROL po_tab. "po_tab is name of table control
MODULE pass_data. "to pass data into table control from internal table
ENDLOOP.
PROCESS AFTER INPUT.
MODULE user_command_8002. "to handle other user commands (back and exit)
LOOP WITH CONTROL po_tab. "po_tab is name of table control
MODULE modify_data. "to modify data from table control into internal table
ENDLOOP.
In PBO,
*&---------------------------------------------------------------------*
*& Module PASS_DATA OUTPUT
*&---------------------------------------------------------------------*
MODULE pass_data OUTPUT.
READ TABLE it_ekpo into wa_ekpo INDEX po_tab-current_line.
ENDMODULE. " PASS_DATA OUTPUT
"it_ekpo is internal table and wa_ekpo is the work area
In PAI,
*&---------------------------------------------------------------------*
*& Module MODIFY_DATA INPUT
*&---------------------------------------------------------------------*
MODULE MODIFY_DATA INPUT.
MODIFY IT_EKPO INDEX PO_TAB-CURRENT_LINE FROM WA_EKPO.
"modify records from table control into the internal table
ENDMODULE. " MODIFY_DATA INPUT
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir
01-05-2009 9:37 AM
Hi Siva,
Take the names of the input/output fields as work_area-field_name and select column in table control as work_area-flag.
Also take a flag field of size 1 datatype character as the last field in the internal table and work area while declaration.
What you need to do exactly is read the values from internal table into table control in PBO of the screen after modifying them in PAI.
Use code:-
At Screen Logic:-
PROCESS BEFORE OUTPUT.
MODULE status_8002. "for pf-status
LOOP WITH CONTROL po_tab. "po_tab is name of table control
MODULE pass_data. "to pass data into table control from internal table
ENDLOOP.
PROCESS AFTER INPUT.
MODULE user_command_8002. "to handle other user commands (back and exit)
LOOP WITH CONTROL po_tab. "po_tab is name of table control
MODULE modify_data. "to modify data from table control into internal table
ENDLOOP.
In PBO,
*&---------------------------------------------------------------------*
*& Module PASS_DATA OUTPUT
*&---------------------------------------------------------------------*
MODULE pass_data OUTPUT.
READ TABLE it_ekpo into wa_ekpo INDEX po_tab-current_line.
ENDMODULE. " PASS_DATA OUTPUT
"it_ekpo is internal table and wa_ekpo is the work area
In PAI,
*&---------------------------------------------------------------------*
*& Module MODIFY_DATA INPUT
*&---------------------------------------------------------------------*
MODULE MODIFY_DATA INPUT.
MODIFY IT_EKPO INDEX PO_TAB-CURRENT_LINE FROM WA_EKPO.
"modify records from table control into the internal table
ENDMODULE. " MODIFY_DATA INPUT
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir
01-05-2009 5:55 PM
01-05-2009 7:23 PM
Hi,
In the Properties window of Table Control, have you set COL.SEL as Multiple?
If not, check that as Multiple.It will work.
Regards
Sandeep