on 07-18-2014 6:50 AM
Hi Experts,
I have 0EC_PCA_3 datasource and a DSO with key field(0calday, 0plant, 0material). In PSA we have data for some days but not every day. Our customer wants to see an amount for every day for each (material, plant). If no data for a day, we must use amount for the day after. Where do we write the code in transformation, start routine or end routine. For the delta record, we also change the target as follows. Is it possible?
SOURCE (PSA)0plant | ||||
0material | 0calday | zamount | ||
1001 | 1X1 | 01.01.2014 | 10 | |
1001 | 1X1 | 04.01.2014 | 20 | |
TARGET (DSO) | ||||
0plant | 0material | 0calday | zamount | zactiv |
1001 | 1X1 | 01.01.2014 | 10 | 1 |
1001 | 1X1 | 02.01.2014 | 20 | 0 |
1001 | 1X1 | 03.01.2014 | 20 | 0 |
1001 | 1X1 | 04.01.2014 | 20 | 1 |
DELTA | ||||
0plant | 0material | 0calday | zamount | |
1001 | 1X1 | 02.01.2014 | 30 | |
1001 | 1X1 | 04.01.2014 | 30 | |
TARGET(DSO) | ||||
0plant | 0material | 0calday | zamount | zactiv |
1001 | 1X1 | 01.01.2014 | 10 | 1 |
1001 | 1X1 | 02.01.2014 | 30 | 1 |
1001 | 1X1 | 03.01.2014 | 20 | 0 |
1001 | 1X1 | 04.01.2014 | 50 | 1 |
Hi,
It is possible if we follow the below approach.
1. First load the 2 records mentioned as per PSA and activate the DSO.
2. Write a FM tag it to DS by getting missing dates in first internal table (IT1) and pass the dates of IT1 to DSO table (using IT2) and identify the nearest record. Once identified appened the records to PSA of new DS. Also, populate a new flag in DSO saying its created as part of new DS.
3. As you have keys set on DSO, the next delta records will come and update the existing entries uploaded using DS. Please make sure you reset the new flag if the entry is already available.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The customer changed his CR, so the subject is not necessary any more to implement. Thanks a lot.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mohammed,
As Rambabu said follow the 2 step load process ..
Maintan 0plant , 0material , 0calday as DSO keys .
1. DS-> DSO : Maintain key key figure property as addition and update the records directly with a flag.
2. DSO to DSO : Maintain a self transformation and do a FULL load only new records and add/generate additional missing days records and update the records with next day key figure value.
In regular load delta comes it will add the new key figure value to the existing value .
Hope it Helps ..
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Muhammed,
Yes this can be possible,But i'll suggest you to create a model in such a way that it should sustain the worst conditions too(it should be ok for full loads if anything happens and delta loads)Instead of writing code in end routine i suggest you to create a recursive transformation.The logic should be like below
Lets talk about full load:
DS to DSO-> in the end routine result_package pass the material,plant,Date to active table of DSO for any entries if no entries place the records as it is and Zactive =1 and another flag zactive_rec = 0.
For Delta Load
If entries were there there are two cases
1. Zactive =0 and zactive_rec = 1.Then replace amount with the new value.
2. Zactive =1 and zactive_rec = 0.Then add the amount with the existing val.
For Missing Dates:
DSO->DSO
then create another transformation and dso as source and target.
Pass Material and plant to DSO get the no of records in ITAB.Now in the loop at result_package read ITAB by passing Plant,Material and date sy-subrc = 0 and zactive should be 1 and zactive_rec = 0.if yes condition true.do nothing and copy the amount to a variable and Index_var to 1.next add 1 to date check the condition if no place the record in Result package with zactive = 0 and zactive_rec = 1 and new amount = above var.continue the process for all the records in the internal table ITAB till Index exactly equals to no of records in ITAB.
But this effect the loading performance very badly. Think about it before creating and even it worse if you are dealing with material,plant and dates are ranging from 2000 to till date.logic will calculate records for each and every date.Better convince the customer that the calculations to performed for one year etc.
Regards,
Rambabu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Do it at the end routine. Write a lookup onto the target DSO active table and see if the record already exists. *in thiscase record with calday 2.1.2014, if it exists , create a negation record (in this case -20)
and append to the result_package. for the original record zactiv should be 1 and the negation record zactiv should be 0.
hope it helps
Regards,
Rathy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.