‎2006 Oct 03 9:49 AM
how can we do insert, update or delete in a database table using module pool i.e. push buttons on a screen
‎2006 Oct 03 9:53 AM
Hi Tarka,
Assign FCODE `INSERT`, `DELETE` to the buttons in screen layout.
<b>In flow logic :</b>
PROCESS AFTER INPUT.
MODULE USER_COMMAND_100.
MODULE USER_COMMAND_100.
case okcode.
when `INSERT`.
insert into ztable values watab .
when `DELETE`.
DELETE FROM ZTABLE where matnr = watab-matnr.
endcase.
END MODULE.
Best regards,
Prashant
‎2006 Oct 03 9:51 AM
Hi Tarka,
You can show the table data in table control, allow user to modify the data, and then update your ztable using the contents of your table control.
Regards,
Raj
‎2006 Oct 03 9:53 AM
Hi tarka,
1. push button will trigger some fcode.
2. Inside the code, we have to write the logic
to update the table.
3. suppose your whole data is in ITAB.
4. then we can simply use
5. LOOP AT ITAB.
MODIFY ZDBTABLE FROM ITAB.
ENDLOOP.
5. This MODIFY statement will automatically
take care of insert/update
based upon the primary key found/not found
in the ztable.
regards,
amit m.
‎2006 Oct 03 9:53 AM
Hi Tarka,
Assign FCODE `INSERT`, `DELETE` to the buttons in screen layout.
<b>In flow logic :</b>
PROCESS AFTER INPUT.
MODULE USER_COMMAND_100.
MODULE USER_COMMAND_100.
case okcode.
when `INSERT`.
insert into ztable values watab .
when `DELETE`.
DELETE FROM ZTABLE where matnr = watab-matnr.
endcase.
END MODULE.
Best regards,
Prashant