cancel
Showing results for 
Search instead for 
Did you mean: 

ADD DATA TO DSO FOR EVERY 0CALDAY

m_gokdemir_m
Explorer
0 Kudos

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
0material0caldayzamount
10011X101.01.201410
10011X104.01.201420
TARGET (DSO)
0plant0material0caldayzamountzactiv
10011X101.01.2014101
10011X102.01.2014200
10011X103.01.2014200
10011X104.01.2014201
DELTA
0plant0material0caldayzamount
10011X102.01.201430
10011X104.01.201430
TARGET(DSO)
0plant0material0caldayzamountzactiv
10011X101.01.2014101
10011X102.01.2014301
10011X103.01.2014200
10011X104.01.2014501

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

Answers (4)

Answers (4)

m_gokdemir_m
Explorer
0 Kudos

Hi,

The customer changed his CR, so the subject is not necessary any more to implement. Thanks a lot.

ravishanker_cheedepudi
Active Participant
0 Kudos

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

Former Member
0 Kudos

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

rathy_moorthy2
Active Contributor
0 Kudos

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