‎2007 Oct 02 8:11 AM
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?
‎2007 Oct 02 8:16 AM
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
‎2007 Oct 02 8:23 AM
hi
good
Some code samples on table control,
This may be useful
http://www.planetsap.com/Tips_and_Tricks.htm#setattr
reward point if helpful.
thanks
mrutyun^
‎2007 Oct 02 8:25 AM
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
‎2007 Oct 02 8:32 AM
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
‎2007 Oct 02 8:37 AM
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
‎2007 Oct 02 8:37 AM
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
‎2007 Oct 02 1:49 PM
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.
‎2007 Oct 03 2:21 AM
i using the control table. how to declare a internal table that able to store in the control table record?
‎2007 Oct 03 4:53 AM
Hi Gary,
Please refer programs "RSDEMO02" & "RSDEMO_TABLE_CONTROL ".
Best regards,
Prashant