cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate last two months data with posting period & fiscal year

Former Member
0 Kudos

Hello,

We've developed a BEx query using Composite provider.  And in the source DSOs, we don't have calender day/date field and we've only fiscal year and posting period for calculating month.

In a requirement, we've to show last two months data.  We've developed a query using Restriction on Posting period and fiscal year as shown below:

The variable ZCURRFY is a customer exit variable where it captures current date and calculate fiscal year accordingly.  Similarly, ZCURFP calculates current posting period from system date.

The problem we're facing is when we are in Posting period 01, we get no data as calculation happens ( current posting period-1 to current posting period)

where we actually need data for posting period 12 of last financial year and posting period 1 of current financial year.

Please help me to handle the requirement to display last two months data with fiscal year & posting period.

Regards,

Antony Jerald.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member194898
Active Contributor
0 Kudos

Hi,

     For some reasons it would be better if you had 0fiscper in that data flow.

Regards, Leszek

swati_gawade
Contributor
0 Kudos

Yes I think you should definately have the 0Fiscper in your dataflow itself.

If it was not included before then maybe you raise this concern and get it added to the dataflow if does not affect too much.

-Swati.

Former Member
0 Kudos

Hi,

Ok.  So I think we've to enhance the model...

Can you give some idea on how can we do this from fiscal year period infoobject when we are at 1st of a month?

Regards,

Antony Jerald.

swati_gawade
Contributor
0 Kudos

Hi Antony,

if you have fiscal year period in the data provider then the offset will take care of the calculation to 012.20XX.

The standard functionality will be able to understand that the previous period of Janruary current year is December last year. so there wont be any issue.

Aslo, if you have the data at Data-provider level itself then your query performance will also improve.

Hope this helps.

-Swati.

swati_gawade
Contributor
0 Kudos

Hi Antony,

You only need to adjust your customer exit code to match your requirement.

In the customer exit for ZCURRFY and ZCURFP check if the period is calculated at '001'

Then have the logic to adjust the year to year - 1 and period = 012.

as your restriction is posting period - 1 it will automatically calculate to 011.20XX - 012.20XX.

For e.g.

in your customer exit code:

Date = sy-datum ( 20140424)

Year = get_Fiscal_ year_from_date (Sy-datum) . (2015)

Period = get_posting_period_from_date (Sy-datum) . (004.2015)


IF period+4(3) = '001' . (period value = 001)

Year = year -1.

clear Period.

concatenate Year '012' into Period.

ENDIF.

Hope this helps.

-swati.

Former Member
0 Kudos

Hi Swati,

Thanks for your reply.

We are using range of variable which is (ZCURFP-1 - ZCURFP) for posting period by using set offset for variable option..

So I think we've to create a new variable for posting period to calculate for last two months data based on the fiscal year variable.

Can you give me some Idea on this whether this can be done or not?

Regards,

Antony Jerald.

former_member194898
Active Contributor
0 Kudos

Hi,

Tell us please, may be you can use 0fiscper in this dataflow. If yes it would be much easier to create a exit code for your need.

Regards, Leszek

swati_gawade
Contributor
0 Kudos

Hi Antony,

if your ZCURFP a single entry variable? if yes can you change it to Multiple single values ? or else can you create a new variable with Multiple single values?

remove the offset from the query and try appending the values in below way.

Case istep = 2.

case  'ZCURFP' .

Data: Period(3) type c.

concatenate '0' sy-datum+4(2) into Period.

CLEAR l_s_range.

l_s_range-low = Period.

l_s_range-sign = 'I'.

l_s_range-sign = 'EQ'.

APPEND l_s_range TO e_t_range.

CLEAR l_s_range.

IF period = '001'

l_s_range-low = '012'.

ELSE.

Period = period -1.

l_s_range-low = Period.

ENDIF.

l_s_range-sign = 'I'.

l_s_range-sign = 'EQ'.

APPEND l_s_range TO e_t_range.


Hope this helps.

-Swati.