I want to store all the change records of ECC table as a separate line item in HANA table

220 Views Asked by At

I want to replicate VBAP table, now let's assume net order value was $1000 on Jan,17. In Feb it was $600 against same document number. So if I see the data in HANA view I can see the latest data, I.e $600. Is there any way to get the previous record in HANA?

2

There are 2 best solutions below

0
On

Check out transaction SCDO. Many SAP objects have a change document that is managed along side. The Change document for SD Documents is VERKBELEG.

You can read the CDHDR and CDPOS tables directly all call functions to access the data.

Inside the SD document the environment menu option "Changes". It will run a report to show the changes. You can pick that apart to suit your requirement.

0
On

SAP HANA versioned tables functionality implements exactly what you need. They store archived records in a separate table with valid_from and valid_to timestamps and actual records in the main table. So anytime you can fetch any former records you want.

To use this functionality you should create (or alter existing) table with clause:

create column table my_table
(
...
)
with system versioning history table my_table_history;

They are supported since HANA 2.0 SPS03 release.