‎2006 Dec 18 4:12 AM
In my Dialog program I have used a table-control to let the user enter records.But after entering the record and without actually saving if I press the Enter key, the whole entry gets cleared from the table-control, but the entry gets saved in the table. I wish the entry to remain there in the table-control.
How to tackle this please suggest.
Alok
‎2006 Dec 18 4:19 AM
make sure u use the MODIFY statement in the PAI of the table control.
for better understanding teh table control see the programs
demo_dynpro_tabcont_loop
demo_dynpro_tabcont_loop_at.
RSDEMO_TABLE_CONTROL
Regards
- Gopi
‎2006 Dec 18 4:19 AM
‎2006 Dec 18 4:24 AM
‎2006 Dec 18 4:32 AM
hi,
kindly chk this.
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 of 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.
*here if the data is there, it will modify
MODIFY int_factor INDEX tab_control-current_line.
IF sy-subrc NE 0. "data not exixting in table control . ie new data, then append it
APPEND int_factor.
CLEAR int_factor.
ENDIF.
ENDMODULE. " move_data_from_table INPUTfor any clarifiaction pls mail me.
pls reward points, if this helped u.
regards,
Anver