Application Development 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: 

How to update a dbtab via table contols in module pool programs ?

former_member196299
Active Contributor
0 Kudos

HI All ,

I am creating a transaction with 2 screens.the 2nd screen displays the list of a dbtable according to some of the selections made on the 1st screen. In my 2nd screen I want to provide the option to the user to update the db table with a new row. Can anyone guide me in solving the problem?

Thanks in Advance ...

Ranjita

6 REPLIES 6

Former Member
0 Kudos

Provide the option to insert a new row in the table control and append this row to the corresponding internal table in the PAI of the screen. When the Save button is clicked. modify the database table from the internal table using the MODIFY statement.

Regards,

Manoj

0 Kudos

Thanks Manoj,

I have already provided the options to create an empty row in the tab con. As I am new to the table control operations can I get some sample codes on what you explained ...esp the appending part ...

0 Kudos

Thanks Manoj,

I have already provided the options to create an empty row in the tab con. As I am new to the table control operations can I get some sample codes on what you explained ...esp the appending part ...

0 Kudos

You can use the following code in the PAI of the screen.

LOOP AT itab.

MODULE modify_from_screen.

ENDLOOP.

MODULE modify_from_screen INPUT.

MODIFY itab FROM wa INDEX tctrl-current_line.

IF sy-subrc NE 0.

APPEND wa TO itab.

ENDIF.

ENDMODULE.

itab - The Internal table.

wa - The name of the structure on the screen

tctrl - Name of the table control

Use this itab to save to your database table using the statement:

MODIFY dbtab FROM TABLE itab.

Regards,

Manoj

Former Member
0 Kudos

Hi ,

Try this link . u will get the clear idea .

Regards ,

Senthil

former_member196299
Active Contributor
0 Kudos

Thanks for the helpful suggestions !