05-11-2009 12:05 PM
Hi,
I have a Ztable in which i have 4 diff fields....1 2 3 4
and an internal table in whch i have same number of fields...
Internal table :
1 2 3 4
a w x 9
a w x 10
a w x 11
a w x 13
a w x 12
When I am using Modify it only appends last record into ztable as below:
Ztable : 1 2 3 4
a w x 12
Internal table has 6 records and z table should be appended with 6 records too...
if varid-report = 'ZFINRR1001' and
varid-VARIANT = 'CITI - ZBA' or
varid-VARIANT = 'WACHOVIA - ZBA'.
Modify ZV12_SWEEP from t_data_new.
endif.
Any suggestions will be aprreciated!
Regards,
Kittu
05-11-2009 12:11 PM
jus check if ur passing the values to the same set of primary keys.
if a w x are primary keys and it has a value already, then it would not append any value instead it will modify or overwrite the existing record with the value from the internal table. jus check this.if not, make the 4th field as primary key and the records will get appended.
05-11-2009 12:09 PM
Hi,
u need to use code for modify as below
Modify ZV12_SWEEP from table t_data_new.
05-11-2009 12:09 PM
05-11-2009 12:11 PM
jus check if ur passing the values to the same set of primary keys.
if a w x are primary keys and it has a value already, then it would not append any value instead it will modify or overwrite the existing record with the value from the internal table. jus check this.if not, make the 4th field as primary key and the records will get appended.
05-11-2009 12:42 PM
Hi,
Thank you for your quick response!
Thats correct ....1 2 3 are primary key fields...
I cannot change the 4 th fields a primary key field...as it is a table maintenance table and 4 th field will be currency field...
Any other way I can append the records into ztable ...?
Any suggestions will be apprecaiated!
Regards,
Kittu
Edited by: Kittu on May 11, 2009 1:42 PM
05-11-2009 12:48 PM
try to make this 4th field as a primary key or another way is to add an additional filed and make it as primary key such that the values will be appended to the table instead of overwriting.If a w x are primary keys, this new additional field which is also a primary key will hve some different value and the values will get appended.
05-11-2009 12:46 PM
Hello,
Use the statement "APPEND LINES OF itab1 [FROM idx1] [TO idx2] TO itab2. "
Here you can specify the index from which index you have to pick the entries from itab1 and then append to itab2.
If no index is specified, it will append all the lines of itab1 to itab2.
Thanks,
Sowmya
05-11-2009 1:32 PM
hi,
Delete all records of ur ZTABLE matching the primary keys like below
DELETE FROM ZV12_SWEEP WHERE filed = <wa-field>.
IF sy-subrc = 0.
INSERT ZV12_SWEEP FROM TABLE t_data_new ACCEPTING DUPLICATE KEYS.
IF sy-subrc EQ 0.
MESSAGE 'Modified' TYPE 'S'..
ELSE.
MESSAGE 'not updated' TYPE 'E'.
ENDIF.
ENDIF.
Thanks & REgards
04-11-2023 11:21 AM
05-11-2009 2:27 PM
>
> When I am using Modify it only appends last record into ztable
>
> Modify ZV12_SWEEP from t_data_new.
Hi,
You only get last record appended because your MODIFY statement uses t_data_new as a working area and not as a table.
To append the content of your internal table, use the FROM TABLE option as below :
MODIFY zv12_sweep FROM TABLE t_data_new.
Regards.
Nicolas
05-11-2009 2:33 PM
Put the code in the loop.
Ex:
loop at itab into wa.
modify ztab from wa.
endloop.
Regards,
Ajay
05-19-2009 8:29 AM
Hello,
Thank you for your quick response!
My issue is fixed!
I apprecaite the help/suggestions!
Regards,
Kittu