‎2009 Apr 22 11:12 AM
Hi,
I have a table control in a module pool screen.
1. I need to fetch the selected row .
2. The row in the table control should be highlighted when I give the position no.
(just as in transaction MIGO)
3. Swapping the rows in table control.(move the rows up and down on a button click)
Thanks & Regards,
Sandhya.
‎2009 Apr 22 11:26 AM
For 1 and 2,
check the demo example:
DEMO_DYNPRO_TABLE_CONTROL_2
Regards,
Ravi Kanth Talagana
‎2009 Apr 22 11:38 AM
‎2009 Apr 28 12:13 PM
hi
see this example
SE51
process before output.
module status_8000.
loop with control control.
module fill_table_control.
endloop.
process after input.
loop with control control.
module read_table_control.
endloop.
module user_command_8000.
SE38
program ycoe_module29 message-id zmsg.
tables : ysrtmm.
controls : control type tableview using screen 8000.
data : begin of i_ysrtmm occurs 0,
sno type ysrtmm-sno,
sname type ysrtmm-sname,
scity type ysrtmm-scity,
sedu type ysrtmm-sedu,
spercent type ysrtmm-spercent,
select(1),
end of i_ysrtmm.
data : i_ysrtmm1 like i_ysrtmm occurs 0 with header line.
data : i_final like ysrtmm occurs 0 with header line.
data : flag.
&----
module status_8000 output.
set pf-status 'STAT29'.
describe table i_ysrtmm1 lines lines.
control-lines = lines.
endmodule. " STATUS_8000 OUTPUT
----
module user_command_8000 input.
case sy-ucomm.
when 'ADD'.
flag = 'Y'.
when 'INSE'.
loop at i_ysrtmm1.
i_final-mandt = sy-mandt.
i_final-sno = i_ysrtmm1-sno.
i_final-sname = i_ysrtmm1-sname.
i_final-scity = i_ysrtmm1-scity.
i_final-sedu = i_ysrtmm1-sedu.
i_final-spercent = i_ysrtmm1-spercent.
append i_final.
clear : i_final.
endloop.
select sno sname scity sedu spercent
from ysrtmm into table i_check for all
entries in i_final where sno = i_final-sno.
if sy-subrc ne 0.
if i_final[] is not initial.
insert ysrtmm from table i_final.
if sy-subrc eq 0.
commit work.
message i010.
clear : i_ysrtmm,i_ysrtmm1,i_final.
refresh : i_ysrtmm,i_ysrtmm1,i_final.
leave screen.
endif.
else.
message i012.
endif.
clear : i_check.
refresh i_check.
when 'DELE'.
delete i_ysrtmm1 where select = 'X'.
clear i_ysrtmm1.
when 'EXIT'.
leave program.
endcase.
endmodule. " USER_COMMAND_8000 INPUT
----
module read_table_control input.
lines = sy-loopc.
read table i_ysrtmm1 index control-current_line.
if sy-subrc eq 0.
modify i_ysrtmm1 from i_ysrtmm index control-current_line.
else.
move-corresponding i_ysrtmm to i_ysrtmm1.
append i_ysrtmm1.
clear i_ysrtmm.
endif.
endmodule. " READ_TABLE_CONTROL INPUT
module fill_table_control output.
describe table i_ysrtmm1 lines wk_init.
if wk_init is not initial.
read table i_ysrtmm1 into i_ysrtmm index control-current_line.
endif.
if sy-ucomm = 'ADD'.
loop at screen.
if flag is initial.
screen-input = 0.
elseif ( flag eq 'Y' ).
if ( ( screen-name = 'I_YSRTMM-SNO' or
screen-name = 'I_YSRTMM-SNAME' or
screen-name = 'I_YSRTMM-SCITY' or
screen-name = 'I_YSRTMM-SEDU' or
screen-name = 'I_YSRTMM-SPERCENT' )
and control-line_selector eq i_ysrtmm-select
and control-current_line le lines ).
screen-input = 1.
else.
endif.
endif.
modify screen.
endloop.
endif.
endmodule. " FILL_TABLE_CONTROL OUTPUT
Regards
Edited by: Murali M on Apr 28, 2009 4:43 PM