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

How to insert data from screen to database Table..??

Former Member
0 Likes
3,619

This is regarding screen painter area..

I have created a Z-table.

Also created a screen where i am having input box.

After entering text in the input box, i will click "SAVE" push button.

When i click "SAVE" push button, the Text entered in the screen input box should be saved in that z-table.

How to do it...??

Can anybody explain me with ABAP code...???

Thanks

Pavan

1 ACCEPTED SOLUTION
Read only

dani_mn
Active Contributor
0 Likes
1,480

TABLES: ztable.

DATA: ok_code like sy-ucomm.

DATA: screen_field(50).

CASE ok_code.

WHEN 'SAVE'.

ztable-text = screen_field.

INSERT ztable.

ENDCASE.

Regards,

Wasim Ahmed

6 REPLIES 6
Read only

Former Member
0 Likes
1,480

u have to use INSERT / MODIFY / UPDATE Commmands.

Regards

Prabhu

Read only

dani_mn
Active Contributor
0 Likes
1,481

TABLES: ztable.

DATA: ok_code like sy-ucomm.

DATA: screen_field(50).

CASE ok_code.

WHEN 'SAVE'.

ztable-text = screen_field.

INSERT ztable.

ENDCASE.

Regards,

Wasim Ahmed

Read only

Former Member
0 Likes
1,480

I have used the same in my Program.its working fine.I can able tio save

When cicking the save Button,

Give code as "Insert table "

Read only

Former Member
0 Likes
1,480

Hai,

You can use Insert dbtab fro work area, or modify.

It will insert a new record in the database table.

Regards,

Umasankar

Read only

Former Member
0 Likes
1,480

Hi,

You can try follwong logic.

tables : ztable.

data wa_ztable like line of ztable.

Case sy-ucomm.

when 'SAVE'.

clear wa_ztable.

wa_ztable-field1 = screenfield1.

wa_ztable-field2 = screenfield2.

wa_ztable-field3 = screenfield3.

modify ztable from wa_ztable.

endcase.

If it is simple database insertion,

you can always use Table Maintainance provided by SAP.

So that the code will be automatically generated and you dont have to worry.

Regards,

Shashank

Read only

aris_hidalgo
Contributor
0 Likes
1,480

Hi,

you should use modify statement for your requirement. If you want to insert records to a data dictionary table, just use insert command. To know more about these 2 commands, press F1 while it is highlighted.

Regards!

P.S. Please award points for useful answers.