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

Storing Screen Inputs

Former Member
0 Likes
1,070

Hi Experts,

As I am new to Module Pool, I need to know, how the input from the screen can be stored in form of Internal Tables ?

E.g. I have one Table control and whenever user will enter data in this Table Control and Press Save, it has to update one database table. How can I achieve this ?

Please help...

Thanks

Chandan

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,041

Use the following read command in save user command.

sy-loopc = sy-curow.

READ TABLE ITAB INDEX sy-loopc into wa.

then assign wa fields to ur internal table fields.

hope it will solve ur problem....

Edited by: mujib tirandaz on May 7, 2009 9:02 AM

10 REPLIES 10
Read only

Former Member
0 Likes
1,041

Follow the below logic

In Module of PAI event.

GET CURSOR LINE lv_table_index.

Read the data from internal table using the index

write code for updating the database table.

Above logic seems to be simple but may be complicated while implementation.

advice

1) add buttons in each rows for updating the row in database.

advantage :- Commond associated with button can be used for identifying update event.

2) Go for ALV ; Simple code via events.

Read only

Former Member
0 Likes
1,042

Use the following read command in save user command.

sy-loopc = sy-curow.

READ TABLE ITAB INDEX sy-loopc into wa.

then assign wa fields to ur internal table fields.

hope it will solve ur problem....

Edited by: mujib tirandaz on May 7, 2009 9:02 AM

Read only

0 Likes
1,041

Nice Reply, seems it will work.

Can you just tell me, how can I use my Internal Tables to Update the database table ?

Read only

0 Likes
1,041

you can make use of INSERT or MODIFY for the same.

Type INSERT and MODIFY on the editer and press F1. You will get the syntax, which will help you out

Read only

Former Member
0 Likes
1,041

simply assign the internal table fields to ur database table or assign directly the wa fields to table fields.

And append for new, modify for existing record.

Edited by: mujib tirandaz on May 7, 2009 9:07 AM

Read only

Former Member
0 Likes
1,041

Try this out:

IN PAI When Use Press SAVE.

Use MOdify <DataBase> From Table ITAB. " New Records will be inserted into database table

Note: Modify --> If records are not present it will insert the records

Regards,

Gurpreet

Read only

0 Likes
1,041

Nice Answer Gurpreet, but are you sure it will be MODIFY, because my database table is a custom one and its empty as of now ???

Waiting for your answer ?

Read only

0 Likes
1,041

Use the following

move itab-field to databasetable-field.

...

...

....

move ...

Hope it will solve ur problem

Read only

0 Likes
1,041

Are you sure MOVE will update the database, No COMMIT statement is needed ???

Read only

0 Likes
1,041

Yes...u have to use insert command for database table after move section.....