‎2009 Mar 19 1:13 PM
Hi,
If you select some records in table control,i need those records to populated to one internal table.
Can u plz guide me.
‎2009 Mar 19 1:19 PM
‎2009 Mar 19 1:24 PM
Hi,
In the layout, properties for table control select multiple selection and give name as (wa_itab-sel). sel should be declared in the internal table (it_itab).
After this in PAI event check below code
loop at it_assign.
chain.
field wa_itab-f1
field wa_itab-f2
field wa_itab-sel.
module <module_name> on chain-request.
endchain.
endloop.
module <module_name> input.
modify it_itab
from wa_itab
index <table_ctrl_namel>-current_line.
endmodule
thanks!
Brunda
‎2009 Mar 19 3:10 PM
Hi,
Use this code, its working:-
it_zekpo is my internal table w/o header line,
wa_zekpo is work area.
Name of input/output fields on screen are:-
wa_zekpo-field1,
wa_zekpo-field2, and so on...
Include a field in type for internal table and work area as flag(1) type c.
Also in the attributes of the table control take the name of SELCOL as wa_zekpo-flag
Maintain another internal table and work area of same structure as used for the above internal table ( it_zekpo and wa_zekpo ) as ( it_temp and wa_temp )
At screen flow-logic
PROCESS BEFORE OUTPUT.
* MODULE status_8003.
LOOP WITH CONTROL po_tb.
MODULE read_data. "<-- read data from internal table to table control
ENDLOOP.
PROCESS AFTER INPUT.
* MODULE user_command_8003.
LOOP WITH CONTROL po_tb.
MODULE modify_data. "<-- modify data form table control to internal table
ENDLOOP.
MODULE copy_data. "<-- select some records click COPY button to copy records into another internal table
In PBO
*&---------------------------------------------------------------------*
*& Module READ_DATA OUTPUT
*&---------------------------------------------------------------------*
MODULE read_data OUTPUT.
READ TABLE it_zekpo INTO wa_zekpo INDEX po_tb-current_line. "po_tab is table control name
data : line_count type i.
describe it_zekpo
lines line_count.
po_tb-lines = line_count + 10.
"to increase the number of lines in table control dynamically
ENDMODULE. " READ_DATA OUTPUT
In PAI
*&---------------------------------------------------------------------*
*& Module MODIFY_DATA INPUT
*&---------------------------------------------------------------------*
MODULE MODIFY_DATA INPUT.
MODIFY IT_ZEKPO FROM WA_ZEKPO INDEX po_tb-currentline.
"this will modify the contents of existing line into internal table
ENDMODULE. " MODIFY_DATA INPUT
*&---------------------------------------------------------------------*
*& Module COPY_DATA INPUT
*&---------------------------------------------------------------------*
MODULE COPY_DATA INPUT.
CASE sy-ucomm.
WHEN 'COPY'.
sort it_zekpo by flag ascending.
loop at it_zekpo into wa_zekpo.
if wa_zekpo-flag = 'X'.
wa_temp = wa_zekpo.
append wa_temp to it_temp.
clear wa_temp.
endif.
clear wa_zekpo.
endloop.
ENDCASE.
ENDMODULE. " COPY_DATA INPUT
Now when you click COPY button, all the selected records will be copied into another internal table it_temp.
Hope this solves your problem.
Thanks & Regards,
Tarun
‎2009 Aug 12 11:51 AM