‎2009 Feb 16 6:27 AM
Hi,
i am doing modulepool programming using table controls.
can anybody suggest me how to write insert and dalete statements in my program.
Thanks&Regards,
Raji.
‎2009 Feb 16 6:57 AM
Hi,
simply as use in REPORT.
"for insert
INSERT t352r FROM wa_work1. " t352r is the name of data bse table,wa_work1 is the name of work area of internal table
"for delete
DELETE t352r FROM TABLE it_del.
Thanks
Arun
‎2009 Feb 16 6:57 AM
Hi,
simply as use in REPORT.
"for insert
INSERT t352r FROM wa_work1. " t352r is the name of data bse table,wa_work1 is the name of work area of internal table
"for delete
DELETE t352r FROM TABLE it_del.
Thanks
Arun
‎2009 Feb 16 7:13 AM
hi,
other than this ,shall i write any code.its not working .i alreaady i tried with dis.
Thanks&Regards,
raji
‎2009 Feb 16 7:39 AM
Hi,
You will be displaying data into table control using an internal table so use this internal table to insert/update/delete your ztable from table control.
Use these statements:-
INSERT Y00MOVIES FROM TABLE MOVIE_TAB. "insert new records
UPDATE Y00MOVIES FROM TABLE MOVIE_TAB. "update existing records
MODIFY Y00MOVIES FROM TABLE MOVIE_TAB.
"insert if no record found
"else update
DELETE Y00MOVIES FROM TABLE MOVIE_TAB. "delete existing records
Y00MOVIES is a ztable and MOVIE_TAB is the internal table which is used to display data in table control on module pool screen.
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir
‎2009 Feb 16 10:15 AM
Hi,
Try the code below.
PROCESS BEFORE OUTPUT.
LOOP AT itab WITH CONTROL TC. "table control name
MODULE status_0500.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT itab.
MODULE user_0500.
ENDLOOP.
MODULE user_0500 INPUT.
CASE ok_code.
WHEN 'INSERT'.
insert into tbl values struct. "struct is the work area with reqd values to be inserted
ENDCASE.Hope this helps.
Regards.
‎2009 Feb 16 2:10 PM
hi!
for insert
INSERT<table name> FROM <work area>.
for delete
DELETE <table name> FROM <work area>.
use this in your module where u want to perform this on which ever criteria it will work...
‎2009 Feb 18 3:29 AM
hi raji,
you question is not very much clear where and what you want to insert and delete.
here i am explaining that you are selecting some record in table control and it is going to save in another internal table from where you can insert it into any ztable where you want and that record will delete from your table control.
in internal table take one more field FLAG.
and in table control define this field so that when you will select the perticuler record it will put 'X' in internal tabel.
in PAI.
modify your internal table ITAB1.
In PBO.
copy this selected record into another internal table ITAB2.
and delete that selected records from ITAB1.
insert itab2 into your ztable.
and display itab1 into table control with less records.
i think this will solve your problem.
thanks
abhishek prakash
‎2009 Feb 18 8:26 AM
Hi raji,
you can see SAP provided examples for the same:-
Step 1: Go to transaction SE38 and then in the menu choose --->
Environment > Examples > Controls
Step 2: now, select Table Control and click on Source Code {double click to execute}
Step 3: scroll down to line 92 you will get your answer.
Alternatively, You can dirctly go to the Report Program RSDEMO02 in SE38 then to line 92.
{Also, there is another report called RSDEMO_TABLE_CONTROL which shows how to delete rows from a table control}
Hope this was of some help.
Best regards,
Sagar.