‎2006 Oct 06 7:36 AM
Hi,
I have a Table control.and have 3 columns. 2 are Text fields and one is Input field.
Table control is filled with values from table DEMO_CONN.
User may change the value in the Input fields.
Can anyone help me how to get the Input values from the Table control?
Thanks
Ram
‎2006 Oct 06 7:37 AM
Hi
U have to map the values and remember the names shud b same for the Screen-fields and ABAP fields.
PROCESS AFTER INPUT.
LOOP AT itab.
MODULE modify_internal_table.
ENDLOOP.
&----
*& Module Modify_internal_table INPUT
&----
text
----
MODULE modify_internal_table INPUT.
modify itab index tc_100-current_line.
ENDMODULE. " Modify_internal_table INPUT
Hope this helps u.
Regds,
Seema
‎2006 Oct 06 7:38 AM
Similar examples are here
demo_dynpro_tabcont_loop
demo_dynpro_tabcont_loop_at
Regards
- Gopi
‎2006 Oct 06 7:41 AM
Check this program,
RSDEMO_TABLE_CONTROL
Check this code also similar situation is handled.
PROCESS BEFORE OUTPUT.
MODULE status_9010.
LOOP WITH CONTROL tab_control.
MODULE move_data_to_table.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP WITH CONTROL tab_control.
MODULE move_data_from_table.
ENDLOOP.
****************************
&----
*& Module move_data_to_table OUTPUT
&----
This is to move the data from the internal table to the table control
----
MODULE move_data_to_table OUTPUT.
This is to move the data from the internal table to the table control
zmpets_mode-modecode,zmpets_range-rangeid,zmpets_servfacto-factor are column name if *table control
*
READ TABLE int_factor INDEX tab_control-current_line.
IF sy-subrc = 0.
zmpets_mode-modecode = int_factor-modecode.
zmpets_range-rangeid = int_factor-rangeid.
zmpets_servfacto-factor = int_factor-factor.
ENDIF.
ENDMODULE. " move_data_to_table OUTPUT
**********************
&----
*& Module move_data_from_table INPUT
&----
Date is moved from the table control to the Internal Table
----
MODULE move_data_from_table INPUT.
To move the data from the table control to internal table 'INT_FACTOR.
int_factor-modecode = zmpets_mode-modecode.
int_factor-rangeid = zmpets_range-rangeid.
int_factor-factor = zmpets_servfacto-factor.
MODIFY int_factor INDEX tab_control-current_line.
IF sy-subrc NE 0.
APPEND int_factor.
CLEAR int_factor.
ENDIF.
ENDIF.
ENDMODULE. " move_data_from_table INPUT
Once u move data from table control to internal table u can update in database table.
Regards
‎2006 Oct 06 8:09 AM
Hi ,
Thnaks for reply.
I have created a table control(FLIGHTS) and colums are referring to table DEMO_CONN. I tried to change the value in one of the column. and try this in PAI:
itab-connid = flights-connid.
But getting msg as Flights-connid doesn't exists.
Pls correct me
Thanks
Ram
‎2006 Oct 06 8:11 AM
u might not have the value u entered in table control in the demo_conn table.
first see if the table contains values or not.
Regards
- Gopi
‎2006 Oct 06 9:09 AM
Hi,
yes table control has values and i'm modifying that too in one cell.
All the example program tell only how to display and sort in table control.
Can anyone help me with example of how to get the modified value of table control ?
Pls help
Thanks
Ram
‎2006 Oct 06 9:14 AM
in the PAI of the table control
use the following code
loop at tab_ctrl.
module read_tc.
endloop.
module read_tc.
modify itab from demo_conn index tab_ctrl-current_line.
endmodule.
if this does not work
module read_tc.
move each and every screen field to teh internal table.
then write modify statement.
endmodule.
<b>if u r stil not clear please paste ur code</b>
Regards
- Gopi
‎2006 Oct 06 9:33 AM
Hi,
By using the F.M 'DYNP_VALUES_READ', u can get the all screen fields(DYNPFIELDS). From those fields u can get the table control values based on STEPL. In this way u can get the modified values from the table control.
‎2006 Oct 06 8:15 AM
hi,
chk this sampled pgms.
demo_dynpro_tabcont_loop
demo_dynpro_tabcont_loop_at
rgds
anver