04-09-2008 2:21 AM
Hi all,
I am working on Dialog programming. I am confused as of how I would be able to add a new record to a table which already has few records in it and also when necessary change the contents of the existing record.
Please let me know, thanks so much in advance.
Step by step explanation would be really helpful along with sample code.
Thanks!
04-09-2008 2:40 AM
hi Shekar,
To add a line in a table control which already has some data use following code in your PBO.
describe table <itab> lines l_lines. "itab is the table used to display ur table control)
tcontrol-lines = l_lines + 1.
In PAI of your screen loop at the table control and save it the table you want.
This will help you in both adding and modifying an already existing data.
Thanks,
Arun
04-09-2008 3:01 AM
Thankyou Arun!
Could you tell me how I can add a new record?
Thanks!
04-09-2008 3:08 AM
I hope u have Add button in your GUI_STATUS.
if the button is clicked,
do this in your PBO.
desc table itab lines l_lines.
tccontrol-lines = l_lines + 1.
This code will help you in adding new line to your table control.
When user enters and value and presses save,
do the following in your PAI.
loop at itab.
modify table itab.
endloop.
case okcode.
when okcode = 'SAVE'.
modify dbtab from itab.
endcase.
The modify dbtab will add new records and modify existing records in your database table.
Thanks,
Arun
04-09-2008 6:22 AM