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

hi. inserting data into a table from internal table

Former Member
0 Likes
1,374

Hi,

i am trying to mass update to the database table

from the internal table.

it is giving an error that the internal table is not long enough..

can anyone help.

ADVance Thanks & Regards

Guhapriyan Subrahmanyam

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,338

Hi,

Check with this code......

****************

data ITAB like standard table of TABLE with header line.

After getting all you data into ITAB....

loop at ITAB.

update TABLE from ITAB.

if sy-subrc eq 0.

commit work.

else.

rollback work.

endif.

THANKS

If this helps you reward with points and close the thread.

17 REPLIES 17
Read only

Former Member
0 Likes
1,338

Hi,

Check whether the internal table is been declared as that of the database table,

Hope this helps,

Rgds,

Read only

Former Member
0 Likes
1,338

Hi Subrahmanyam ,

Assign the field symbol to internal table and then update the table .

Ex:

ASSIGN itab TO <F>. 
UPDATE dbtab FROM TABLE <F>.

<i>Reward Points If It Helps YOU.</i>

Regards,

Raghav

Read only

Former Member
0 Likes
1,338

hi.

thank you very much

it is declared same as the database table

but the table has an appended structure

i dont know how to insert data in this table.

thanks & regards

Guhapriyan subrahmannyam

Read only

0 Likes
1,338

hi can you give the code

how you are doing..insert

regards

vijay..

Read only

0 Likes
1,338

if your itab is same structure as the dbtable, youcan simply use

modify <db table> from table <itab> .

Regards

Raja

Read only

0 Likes
1,338

modify ZGLSTPM_DEPLSCHD FROM TABLE i_in_data.

if sy-subrc <> 0.

  • Error in inserting data to table ZGLSTPM_DEPLSCHD

Message i137.

endif.

Read only

0 Likes
1,338

Hi,

Define the line type of the internal table similar to your database table.

For eg.

DATA itab LIKE TABLE OF mara.

REgards,

Abdul

Read only

0 Likes
1,338

Hi

are you using all the fields..

regards

vijay

Read only

0 Likes
1,338

can you give us your declaration for

i_in_data

Regards

Raja

Read only

0 Likes
1,338

hi..

i have used all the fields

and i cannnot use the like statement according to standards

i have declared manually.

Thanks & Regards

Guhapriyan

Read only

0 Likes
1,338

why dont you simply declare as below.

data: itab type standard table of <your dbtable> .

Regards

Raja

Read only

0 Likes
1,338

Hi

Can you paste ur piece of code for itab declaration here?

REgards,

Abdul

Read only

Former Member
0 Likes
1,338

Hi,

Probably you have missed out some fields while declaring your itab.

Check it.

<b>

but the table has an appended structure

i dont know how to insert data in this table</b>.

For this you just insert those fields which are in appending structure to your itab then it should work.

Hope this helps

Reagrds

Amit

Message was edited by: Amit Kumar

Read only

Former Member
0 Likes
1,338

If inserting new entries is what you are trying, try this:

insert <dbtable> from itab.

Also if you want to remove the previous entries do this first:

delete from <dbtable>

Message was edited by: Feroz Buksh

Read only

Former Member
0 Likes
1,338

Hi Subrahmanyam,

First Declare the internal Table like below:

Data: <Internal-table> type standard table of <database-table> with header line.

Then use the below code to modify the Database table based on your conditions.

modify <database-table> from table <internal-table>.

I hope this help's you.

Regards,

Raja

Read only

Former Member
0 Likes
1,339

Hi,

Check with this code......

****************

data ITAB like standard table of TABLE with header line.

After getting all you data into ITAB....

loop at ITAB.

update TABLE from ITAB.

if sy-subrc eq 0.

commit work.

else.

rollback work.

endif.

THANKS

If this helps you reward with points and close the thread.

Read only

Former Member
0 Likes
1,338

thank you all for the valuable suggestions..