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

Need to insert table control row into database table..

Former Member
0 Likes
1,516

Hi experts,

I have created Table control. There are 4 push button Display, Delete, Exit, Insert.

Now all push buttons are working but Insert button is not working. When I click display button I get records from database table in

my table control. What I need is when I put record in my table control and click Insert push button I want table record to be inserted in

my database table.

Regards,

Sandeep.

1 ACCEPTED SOLUTION
Read only

yogendra_bhaskar
Contributor
0 Likes
1,462

Hi sandeep ,

Are you getting the records in table control or not ?

Plz. check it

and then

add COMMIT WORK. after the insert statement

Regards ,

Yogendra Bhaskar

11 REPLIES 11
Read only

anubhab
Active Participant
0 Likes
1,462

Hi Sandeep,

     I guess you want to update the selected records in table control, to database. For this:

1. Assign a function code for INSERT button.

2. Write a logic within CASE-ENDCASE for that function.

WHEN 'INSERT'.

     LOOP AT i_tc INTO w_tc WHERE sel = 'X'.

          MODIFY/INSERT/UPDATE dbtab FROM w_tc.

          CLEAR: w_tc.

     ENDLOOP.

NOTE: considered SEL as the column name for selecting entries in table control, i_tc is your internal table and w_tc is work area for the same.

Regards,

Anubhab

Read only

Former Member
0 Likes
1,462

Hi anubhab,

I have already tried this logic. It inserts blank row in DB table.

Read only

anubhab
Active Participant
0 Likes
1,462

Hi Sandeep,

     Did you check in debugger if you are getting desired values in PAI while looping at the internal table?

     And also if you are directly updating the DB table from work area, are both of them compatible with each other?

     Did you check the sy-subrc value after INSERT/MODIFY/UPDATE statement?

Regards,

Anubhab

Read only

former_member196651
Contributor
0 Likes
1,462

Hi Sandeep,

First you insert rows into the internal table behind your table control. Then you update your database table with the newly inserted rows in the internal table.

Regards,

Abijith

Read only

yogendra_bhaskar
Contributor
0 Likes
1,463

Hi sandeep ,

Are you getting the records in table control or not ?

Plz. check it

and then

add COMMIT WORK. after the insert statement

Regards ,

Yogendra Bhaskar

Read only

0 Likes
1,462

In pbo I have written MOVE-CORRESPONDING INT_TAB TO DB TABLE.

While inserting record in table control internal table shows blank..

Read only

0 Likes
1,462

Hi Sandeep ,

You have to code in PAI

Does this code include in your PAI :

*&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TC'

   LOOP AT INT_TAB.

     CHAIN.

       FIELD INT_TAB-FIELD1.

       FIELD INT_TAB-FIELD2.

       FIELD INT_TAB-FIELD3.

       FIELD INT_TAB-FIELD4.

       MODULE TC_MODIFY ON CHAIN-REQUEST.

     endchain.

   ENDLOOP.



Regards


Yogendra Bhaskar

Read only

0 Likes
1,462

I do not understand where I am doing wrong.. Tried this logic also, still not working..

Read only

0 Likes
1,462

Hi Sandeep,

please post your code as a attachment .

Read only

0 Likes
1,462

Hi Sandeep ,

Could you paste the code used in PAI with modules ?

Regards,

Yogendra

Read only

Former Member
0 Likes
1,462

Done .. Tnx all..