cancel
Showing results for 
Search instead for 
Did you mean: 

Modify Date between DSO and infocube

amine_lamkaissi
Active Contributor
0 Kudos

Hi experts,

I have to load data in full mode with a filter on period on DTP between DSO and Infocube.

I am comfortable with it  , but there is a type of data that I have to manage to avoid me big changes on my flow.

To simplify, let’s say data is coming from DSO as following:

Employee

WorkDate

ApprovDate

Hours

A

08/02/2013

10/03/2013

5

And In stvarv, I will create 2 variables as following:

First Date of current period (FDCP): 01/03/2013

Last Date of current period (LDCP): 31/03/2013

So what I have to do, is to control that approvdate is between FDCP and LDCP, and also superior to workdate.

If the 3 conditions are respected, I have to set the value of Approvaldate in Wordate, so my record will be:

Employee

WorkDate

ApprovDate

Hours

A

10/03/2013

10/03/2013

5

So I tought about creating a Start routine in my cube transfo level and do something as following:

LOOP AT SOURCE PACKAGE into structure

If APROVDAT between FDCP and LDCP

And WORKDATE LT APPROVDAT

WORKDAT = APPROVDAT

ENDIF

ENDLOOP

What do you think about it? What could you advice me?

Thanks.

Amine

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Amine,

Your logic looks good. Please go ahead with coding.

Regards,

Sangita

amine_lamkaissi
Active Contributor
0 Kudos

Ok Thanks Sangita,

I will let the thread open for other experts recommandations.

Amine

former_member229708
Active Participant
0 Kudos

Hi Amine,

Your logic looks good.

Thanks & Regards,

Vipin

Answers (2)

Answers (2)

anindya_bose
Active Contributor
0 Kudos

Hi...

You can try this variant..

LOOP AT SOURCE PACKAGE into structure WHERE WORKDAT LT APPROVEDAT

If APROVDAT between FDCP and LDCP

WORKDAT = APPROVDAT

ENDIF


ENDLOOP

This will check Workdat < approve date before copying into work area and improve performance.

regarding FDCP and LDCP , instead of taking them from DTP filter use system date to calculate .

Function Modules are available for it.

FIRST_DAY_IN_PERIOD_GET and LAST_DAY_IN_PERIOD_GET.

From SYSDATE take Year and Month. Concatenate 0 with month.

Pass  YYYY  , Fiscal Year Variant ( Like K4) and Period ( 003) to get first and last dates.

Cheers

Anindya

amine_lamkaissi
Active Contributor
0 Kudos

Hi Anindya,

I like your answer. I have only one question about he functions modules.

At which level do you recommand me to use them?

Thanks.

Amine

anindya_bose
Active Contributor
0 Kudos

Hi Amine

You can use these to FM to assign value to FDCP and LDCP in start routine ( global area).

and use field routine or start routine for other parts.

Cheers

Anindya

amine_lamkaissi
Active Contributor
0 Kudos

Thanks Anindya

Amine

Former Member
0 Kudos

Hi Amine,

What happens if your conditions are not met? Will the record still go to the Cube ?

Guess your code is just for illustration. Otherwise the logic seems fine.

amine_lamkaissi
Active Contributor
0 Kudos

Hi Sujith,

Thanks for you answer.

Even if the conditions aren't met, my record still go to the cube

You mean that i need to forecast an else, right?

And for the record, in the DTP i am flitering only on current period (managed with a TVARV)

Thanks.

Amine

Former Member
0 Kudos

Hi Amine,

As you are going to process each record then I don't think you should do it in start routine. Assign these three/four fields to your ApprovDate field in target. Then write a simple if else statement. No need of an extra loop in start routine.

Regards,

Sujit.

amine_lamkaissi
Active Contributor
0 Kudos

Ok thanks Sujit for the heads up.

But do you confirm me with that method that my DTP is going to load anyways only records of the current period?

Thanks.

Amine

Former Member
0 Kudos

Hi Amine,

I didn't get your last question. Could you explain.

Regarding the two variables in your first post, you can create them and set their value in Start Routine - Global Variables. Then use them in your field assignment routine.

Regards,

Sujit.

amine_lamkaissi
Active Contributor
0 Kudos

Hi Sujit,

If you are refering to:

First Date of current period (FDCP): 01/03/2013

Last Date of current period (LDCP): 31/03/2013

I am going to store them in a tvarv table (T-code STVARV), they will be updated via an abap program.

If i understand you:

I can select/Declare them in the start routine.

And at the field level transformation i will implement that logic, right?

If APROVDAT between FDCP and LDCP 

And WORKDATE LT APPROVDAT

WORKDAT = APPROVDAT

else

WORKDAT = SOURCE-PACKAGE-WORKDATE.

ENDIF

Thanks.

Amine

I