Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

inserting data into table control

Former Member
0 Likes
2,491

hello gurus ,

can I insert the data in to table control directly and insert in to database table through table control , can it possible , if .........

plz help me .

Thanks in advance .

Joy .

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,118

Hi,

REPORT xyz.

CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.

DATA: ok_code TYPE sy-ucomm,

save_ok TYPE sy-ucomm.

DATA: itab TYPE TABLE OF demo_conn,

fill TYPE i.

TABLES demo_conn.

DATA: lines TYPE i,

limit TYPE i.

SELECT * FROM spfli INTO TABLE itab.

CALL SCREEN 100.

MODULE status_0100 OUTPUT.

SET PF-STATUS 'SCREEN_100'.

DESCRIBE TABLE itab LINES fill.

flights-lines = fill.

ENDMODULE.

MODULE fill_table_control OUTPUT.

READ TABLE itab INTO demo_conn INDEX flights-current_line.

ENDMODULE.

MODULE cancel INPUT.

LEAVE PROGRAM.

ENDMODULE.

MODULE read_table_control INPUT.

lines = sy-loopc.

MODIFY itab FROM demo_conn INDEX flights-current_line.

ENDMODULE.

MODULE user_command_0100 INPUT.

save_ok = ok_code.

CLEAR ok_code.

CASE save_ok.

WHEN 'SAVE'.

INSERT <DataBASEtable> FROM TABLE itab ACCEPTING DUPLICATE KEYS.

(or)

Modify <DataBASEtable> from table itab.

ENDCASE.

ENDMODULE.

Note:- here u can insert data into table control, then u can copying the data in table control into itab, then modify or insert database table from this itab.

And also u can insert or modify database table for selected entries in table control by adding a field(FLAG) of type character and length 1 and according to if this fields value(FLAG) = 'X' then insert into database table .... also.....

Best Regards,

Vijay Mekala

Edited by: Vijay Mekala on Feb 2, 2008 4:50 PM

2 REPLIES 2
Read only

Former Member
0 Likes
1,120

Hi,

REPORT xyz.

CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.

DATA: ok_code TYPE sy-ucomm,

save_ok TYPE sy-ucomm.

DATA: itab TYPE TABLE OF demo_conn,

fill TYPE i.

TABLES demo_conn.

DATA: lines TYPE i,

limit TYPE i.

SELECT * FROM spfli INTO TABLE itab.

CALL SCREEN 100.

MODULE status_0100 OUTPUT.

SET PF-STATUS 'SCREEN_100'.

DESCRIBE TABLE itab LINES fill.

flights-lines = fill.

ENDMODULE.

MODULE fill_table_control OUTPUT.

READ TABLE itab INTO demo_conn INDEX flights-current_line.

ENDMODULE.

MODULE cancel INPUT.

LEAVE PROGRAM.

ENDMODULE.

MODULE read_table_control INPUT.

lines = sy-loopc.

MODIFY itab FROM demo_conn INDEX flights-current_line.

ENDMODULE.

MODULE user_command_0100 INPUT.

save_ok = ok_code.

CLEAR ok_code.

CASE save_ok.

WHEN 'SAVE'.

INSERT <DataBASEtable> FROM TABLE itab ACCEPTING DUPLICATE KEYS.

(or)

Modify <DataBASEtable> from table itab.

ENDCASE.

ENDMODULE.

Note:- here u can insert data into table control, then u can copying the data in table control into itab, then modify or insert database table from this itab.

And also u can insert or modify database table for selected entries in table control by adding a field(FLAG) of type character and length 1 and according to if this fields value(FLAG) = 'X' then insert into database table .... also.....

Best Regards,

Vijay Mekala

Edited by: Vijay Mekala on Feb 2, 2008 4:50 PM

Read only

Former Member
0 Likes
1,118

Hi,

Refer this Demo prgm,

DEMO_DYNPRO_TABCONT_LOOP

refer this links

[url]

http://sap.niraj.tripod.com/id29.html

/people/ravishankar.rajan/blog/2007/02/23/an-easier-way-of-displaying-and-editing-data-using-table-control

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/code%2bto%2bhandle%2bmultiple%2brecords%...

[url]