Hi Chinna,
You can do it in start routine with an algorithm such as
while looping in your datapackage you read the data from DSO where material and document is the same as in your data, you sort the data by date descending, delete duplicates comparing material and document and assign its value to your key figure for previous value.
Hope it gives an idea
Yasemin...