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

problem with INSERT

Former Member
0 Likes
1,168

REPORT ZDW_LOC_MSTR .

tables : t001l.

data : begin of itab occurs 0.

include structure zloc.

data: end of itab.

field-symbols: <ls_itab> type zloc.

SELECT werks lgort lgobe

FROM T001L

into (t001l-werks , t001l-lgort , t001l-lgobe ).

MOVE: T001L-WERKS TO ITAB-zsite,

T001L-LGORT TO ITAB-zloc,

T001L-LGOBE(8) TO ITAB-zdesc.

append itab.

endselect.

loop at itab assigning <ls_itab>.

<ls_itab>-ztable_name = 'loc'.

endloop.

<b>INSERT zloc_mstr FROM itab .</b>

<b>i tried FROM TABLE itab too.

and i get only 1 record and in debug i see 20 rows why?</b>

11 REPLIES 11
Read only

Former Member
0 Likes
1,141

Hi,

When you say itab, you are referring to the header line which will have only one row. When you say table itab, you are referring to entire table.

In the debug mode, you are looking at the table, which has 20 rows. If you use the FROM TABLE ITAB, you should see 20 rows in the database table.

Regards,

Ravi

Read only

0 Likes
1,141

i wrote that i made it too

and i get 1 row

Read only

0 Likes
1,141

Is that an already existing record in the table?

Put a commit work statement at end.

Regards,

Ravi

Read only

0 Likes
1,141

i add this

INSERT zloc_mstr FROM TABLE itab ACCEPTING DUPLICATE KEYS .

commit work.

and delete all the record and still i get 1 row

Read only

0 Likes
1,141

Can you tell us what are the keys in the table and show us the sample data you are passing, including the duplicates if any?

Regards,

Ravi

Read only

0 Likes
1,141

after using

INSERT zloc_mstr FROM TABLE itab ACCEPTING DUPLICATE KEYS .

statement if only one record is updated in the table (from 25 entries of itab) it means all of them are duplicate records .(same value for key fields)

Regards

Raja

Read only

0 Likes
1,141

the key i mandt only?

the data is mosttly the same always except of site that is change to 800 900 ext....

Read only

0 Likes
1,141

raja hi

if all of them are duplicate ( they not)

so i need to have all the records insert right?

Read only

0 Likes
1,141

That's exactly is the problem, if MANDT is the only key you will NOT be able to enter more than one row. Have a column as a key that will different values. As MANDT will be same across all the rows, it will a duplicate key.

Have a column that will have seq. number.

Regards,

Ravi

Read only

0 Likes
1,141

thanks

i want to give you points but i see that it was answered and i did not mark it?

Read only

0 Likes
1,141

The thread is NOT closed yet, please close the thread and mark all the helpful answers.

Regards,

Ravi