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

INSERT dtab FROM TABLE itab Not working

Former Member
0 Likes
2,424

Hi All,

Can anyone tell me why this statement isn't working? When I run it in debug mode everything is fine and it comes back with a return code of 0 but it never posts to the database.

Any help is much appreciated.

 INSERT zwebedi FROM TABLE t_zwebedi.

1 ACCEPTED SOLUTION
Read only

former_member156446
Active Contributor
0 Likes
1,072

Hi Colm as said in the above post check the syntax.. and after that..

you need to write this code as well


Commit work and wait.

this will close the LUW, and then update will be complete

8 REPLIES 8
Read only

Former Member
0 Likes
1,072

here hare some alternatives check them out

loop itab into wa.

INSERT INTO dbtab VALUES wa. or

INSERT INTO (dbtabname) VALUES wa. or

INSERT dbtab FROM wa. or

INSERT (dbtabname) FROM wa.

ENDLOOP.

reward if helpful plz..

keep rockin

vivek

Read only

former_member188829
Active Contributor
0 Likes
1,072

Hi,

The syntax is..

INSERT dbtab FROM wa.

Read only

Former Member
0 Likes
1,072

Hi,

check your internal table Because your syntax is right.

INSERT dbtab FROM TABLE itab. oder

INSERT (dbtabname) FROM TABLE itab.

Extras:

1. ... CLIENT SPECIFIED

2. ... ACCEPTING DUPLICATE KEYS

3. ... CONNECTION con

Effect

Mass insert: All lines of the internal table itab are inserted in one single operation. The lines of itab must fulfill the same conditions as the work area wa in variant 1.

When the command has been executed, the system field SY-DBCNT contains the number of inserted lines.

The Return Code is set as follows:

SY-SUBRC = 0:

All lines successfully inserted. Any other result causes a runtime error.

Note

If the internal table itab is empty, SY-SUBRC and SY-DBCNT are set to 0 after the call.

REGARDS,

GAURAV J.

Read only

former_member156446
Active Contributor
0 Likes
1,073

Hi Colm as said in the above post check the syntax.. and after that..

you need to write this code as well


Commit work and wait.

this will close the LUW, and then update will be complete

Read only

Former Member
0 Likes
1,072

hi Gavin,

Write a commit work statement immediately after the insert statement.

i.e,

.
 INSERT zwebedi FROM TABLE t_zwebedi.
commit work.

Read only

former_member188829
Active Contributor
0 Likes
1,072

Hi,

Check this Example.

TABLES:MARA.

DATA:ITAB LIKE MARA .

START-OF-SELECTION.

ITAB-MATNR = '123ABCD'. .

ITAB-MBRSH = 'C'.

ITAB-MTART = 'FERT' .

ITAB-MEINS = 'KG' .

INSERT MARA FROM ITAB.

MODIFY MARA .

Or..

TABLES:MARA.

DATA:ITAB LIKE MARA OCCURS 0 WITH HEADER LINE.

START-OF-SELECTION.

ITAB-MATNR = '123ABCDA'. .

ITAB-MBRSH = 'C'.

ITAB-MTART = 'FERT' .

ITAB-MEINS = 'KG' .

APPEND ITAB.

ITAB-MATNR = '123ABCDB'. .

ITAB-MBRSH = 'C'.

ITAB-MTART = 'FERT' .

ITAB-MEINS = 'KG' .

APPEND ITAB.

LOOP AT ITAB.

INSERT MARA FROM ITAB.

MODIFY MARA .

ENDLOOP.

Read only

former_member194669
Active Contributor
0 Likes
1,072

simply use


MODIFY zwebedi FROM TABLE t_zwebedi.
commit work.

a®

Read only

Former Member
0 Likes
1,072

HI,

U r syntax is correct. use commit work after that it will work.

Pls reward points if useful.

Regards,

Raghu