09-22-2008 9:04 PM
Hi,
I am trying to move Internal table contents to Z TABLE.
I am having data issue. In debugging I see ITAB enteries say for example 100
all are not getting in to ZTABLE.
I am not filtering anywhere
I have 100 records in itab with fld1 = 'ZBC'.
LOOP AT t_data WHERE fld1= 'ABC'.
ZTAB-FLD1 = t_data-FLD1.
ZTAB-FLD2 = t_data-FLD2.
ZTAB-FLD3 = t_data-FLD3.
ZTAB-FLD4 = t_data-FLD4.
modify ZTAB .
commit work.
endloop.
Anything wrong in my code?
Rgds
Praveen
09-23-2008 3:57 AM
hi,
instead of modify use update statement.
UPDATE TABLE SET COLUMN-UPDATE STATEMENT
or use this
Single-line inserts
LOOP AT INT-TAB
INSERT INTO TABLE VALUES INT-TAB
ENDLOOP
wtih regards
janani
09-22-2008 9:08 PM
For example in ITAB FLD1 is key then before going into loop
make sure sort it and delete adjacent duplicates using the field FLD1
a®
09-22-2008 10:50 PM
As you are using modify statement, while updation it will update the table with the exsistng key fields of the database table.
09-23-2008 2:08 AM
Hi, First try using the INSERT statement and then check sy-subrc. If sy-subrc <> 0, then go for the MODIFY statement.
Eg:
ztable-fld 1 = t_itab-fld1.
ztable-fld 2 = t_itab-fld2.
ztable-fld 3 = t_itab-fld3.
ztable-fld 4 = t_itab-fld4.
insert ztable.
if sy-subrc <> 0.
modify ztable.
endif.
Try this code, it should work.
09-23-2008 3:57 AM
hi,
instead of modify use update statement.
UPDATE TABLE SET COLUMN-UPDATE STATEMENT
or use this
Single-line inserts
LOOP AT INT-TAB
INSERT INTO TABLE VALUES INT-TAB
ENDLOOP
wtih regards
janani