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

table control save

Former Member
0 Likes
1,848

Hi all.

i enter some records in the table control. i want to save the records to my database. How can i write it to my database as i'm using table control?

Any code to reference?

9 REPLIES 9
Read only

Former Member
0 Likes
1,252

Hi

In the loop..endloop of the table control table

read the database table with the key fields of the table control and compare the records that are there in Table or not,

if there no update or if not there Update the record into the database table with that record.

Regards

Anji

Read only

Former Member
0 Likes
1,252

Hello Gary,

In table control once we entered the records in PAI we can transfer the records to the database on clicking the custom 'SAVE'(PF status) or other buttons.

For instance consider the foillowing code ::::::::>>>

PROCESS AFTER INPUT.

LOOP WITH CONTROL FLIGHTS.

module read_table_control.

"updating internal table from the tablecontrol

ENDLOOP.

*at this point we have the updated table control records

module user_command_0100.

in this PAI after the loop...endloop of table control

write code to capture the sy-ucomm(user action) and update the table

eg:

Case Sy-ucomm.

when 'SAVE'.

read the data stored from the table control in the internal table

and update the required table or loop at the internal table and save

Please always note that the key fields are different if it is a new record insertion

endcase.

Pls check,revert and rewards if useful

Regards

Byju

Read only

0 Likes
1,252

Hi Thank for yr reply.

Do u have any sample coding? i can modify the code easily as i stil new to table control. Thk advance

Read only

0 Likes
1,252

Hello Gary,

Please go to se38 and see the program DEMO_DYNPRO_TABCONT_LOOP

to understand the flow of data.. after that in the screen for table control in PAI write a module to capture the Sy-ucomm and update or insert or modify the required table...if you still need clarification pls revert and reward all useful answers

Regards

Byju

Read only

gopi_narendra
Active Contributor
0 Likes
1,252

Hi Gary,

Should there be a button on the screen to tell it to SAVE the records in the table control right?

Ok now in the module user_command of the screen write a module to save the records of the table control when SAVE button is clicked

Case sy-ucomm
when 'SAVE'.
MODIFY dbtab FROM TABLE itab. " itab is the internal table that holds the data on the screen.
endcase.

In order to know of how to handle the table control, just check this simple example under ABAPDOCU

demo_dynpro_tabcont_loop

demo_dynpro_tabcont_loop_at

Regards

Gopi

Read only

Former Member
0 Likes
1,252

hi,

u have surely created save button in ur status, so in PAI's User_command_1000 module write like this.

<b>MODULE user_command_1000 INPUT.</b>

CASE ok_code.(Or sy-ucomm).

WHEN 'SAVE' .(Fcode for Save Button)

itab_mast-clnt = sy-mandt.

itab_mast-srno = srn.

itab_mast-comp_code = zform_track_mast-comp_code.

itab_mast-form_type = ifmtp-form_type.

itab_mast-form_series = form_series.

itab_mast-form_no = form_no.

itab_mast-form_date = zform_track_mast-form_date.

itab_mast-rcvd_issu = 'R'.

itab_mast-form_amt = fm_amt.

INSERT INTO zform_track_mast VALUES itab_mast.

ENDCASE.

<b>ENDMODULE. " USER_COMMAND_1000 INPUT</b>

Here <b>itab_mast</b> is my internal table and right end side values are screen fields.And <b>zform_track_mast</b> is my Ztable.

Hope it will b useful.

reward if useful.

Read only

0 Likes
1,252

i using the control table. how to declare a internal table that able to store in the control table record?

Read only

Former Member
0 Likes
1,252

Hi Gary,

Please refer programs "RSDEMO02" & "RSDEMO_TABLE_CONTROL ".

Best regards,

Prashant