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

handling database tables

Former Member
0 Likes
538

how can we do insert, update or delete in a database table using module pool i.e. push buttons on a screen

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
510

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

3 REPLIES 3
Read only

Former Member
0 Likes
510

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

Read only

Former Member
0 Likes
510

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.

Read only

Former Member
0 Likes
511

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