BW data load for previous fiscal year depending upon sy-datum

Hello All,
In SAP BW, while loading data using date, I have requirement to load the datat for previous fiscal year.
Fiscal year run from Oct to Sept.
I have given example of Nov 2012. Becuase I am going to add this info-package in process chain which will run Nov of every year for full data load.
For Ex: I am loading data in calander year/month Nov 2012. Its previous fiscal year is 2011.
So for fiscal year 2011, my dates for data load would be : 10/1/2010 to 9/30/2011.
So my code or functional module should retun me 10/1/2010 to 9/30/2011 this value.
Kindly give your inputs for the same.
Thank You.

Hello All,
I have wriiten below code and it has solved my problem:
REPORT  ZTEST_PK.
data:
month_last type n length 2,
year_last type n length 4,
year type n length 4,
month_first type n length 2,
month type n length 2,
year_first type n length 4,
day_in type sy-datum,
day_out type sy-datum,
v_date type n length 6,
select_period_low(8) type c,
select_period_high(8) type c.
year = sy-datum(4).
month = sy-datum+4(2).
concatenate year month into v_date.
Data: fisyr type n length 4,
fiscper type n length 3.
*Fiscal years run from Oct to Sep
*For Ex: Nov2012 load of the previous FY itu2019s FY 2011, the dates would be Oct 10 (10/1/2010) to Sep 11 (9/30/2011).
CALL FUNCTION 'Z_XCONVERT_CALMONTH_TO_FISCAL'
  EXPORTING
    IV_CALMONTH       = v_date
IMPORTING
   EV_FISCYEAR       = fisyr
   EV_FISCPER3       = fiscper.
year_last = fisyr - 1.
year_first = year_last - 1.
month_first = '10'.
month_last = '09'.
concatenate year_first month_first '01' into select_period_low.
concatenate year_last month_last '01' into day_in.
*calcualte last day of  a given month
CALL FUNCTION 'SN_LAST_DAY_OF_MONTH'
  EXPORTING
    DAY_IN             = day_in
  IMPORTING
    END_OF_MONTH       = day_out.
concatenate day_out(4) day_out4(2) day_out6(2) into select_period_high.
write:/ select_period_low.
write:/ select_period_high.

Similar Messages

  • Amount for previous fiscal years?

    Dear Bwers,
    I have a query with  a KF Amount that is based on a filter on date field ( with a variable to and from date). Now in my query i want to display columns for Amounts from previous three fiscal years (FY(-1), FY(-2), and FY(-3)) based on the date (to and from date) that the user enters in the initial run of the query.How can i do this? Any help would be appreciated.
    Thanks
    Raj

    steps:
    1) Create one structure in column.
    2) Create 1st selection in Column, put fiscal year and your kf from left side to right, and restrict your fiscal year with some variable.
    3) Create 2nd Selection and follow the same process as step1, just when you will restrict ur variable for fiscal year in restrict window, right click on it, and select offset, and assign -1 to it. It will take fiscal year value as Fiscal Year value wihch user will enter in selected variable -1. Like if user enetered 2006, this column will show output for 2005.
    4) Similarly create selectiosn with different offset values, like for 2004 put offset value as -2...and so on.
    Let me know if u need more help?

  • RFKORDES : PRINT SELF-INVOICE FOR SPAIN FOR PREVIOUS FISCAL YEARS

    Hi,
    our accounting department would like to print self-invoice for transaction from 2006/2007/2008 for tax audit. Unfortunately, it doesn't work. I get message :
    "Print report RFKORDES in company code ES11 has not selected any data for SAPE1"
    Message no. FB475
    When implemented few OSS notes for 2010 VAT Package for Spain.
    Does anybody knows how to fix it?
    Thanks
    Anthony

    someone please help me with this ..

  • Purchase order not appearing as commitment for next fiscal year in KOB2

    Hi Experts
    Any help on this is highly appreciated.Our Fiscal year 2008 is ending on 27th september and fiscal year 2009 will start on 28th September.
    We have some purchase orders created with delivery date as 30th september which falls into next fiscal year. Somehow these purchase orders are not appearing as commitments in KOB2 report even with data ranges for next fiscal year.
    However we have many similar Purchase orders with delivery date in fiscal year 2008 with same internal order as account assignment and they are correctly appearing as commitments in KOB2 report.
    Can you please let us know what could be the reason for purchase orders with delivery date as 30th september not appearing in KOB2 report.
    Regards,
    Santosh

    Hi Ashok
    Thanks for your continued support on this. I was going through these notes today.
    One observation I made was cost elements in our system were valid till 27th september only when problematic POs were created.However their validity was subsequently extended after the creation of Purchase orders.This might be the reason for system not recognising these POs as commitments.
    SAP Note 534993 seems to suggest that we need to run report RKANBU01 for all such purchase orders to redetermine commitments.I am in the process of testing this out in our systems.
    Could you please let me know if my understanding is correct. Thanks again.
    Regards,
    Santosh

  • Variable for budget from starting to previous fiscal year?

    Hi experts,
    The requirement i got in my report to calculate Budget upto previous fiscal year.
    For ex: If my project starts on Nov 2004 , then i want to calculate for the year Nov 2004 to Mar 2008.
    I tried for variable Cumulate to last fiscal yeard

    Hi,
    Here I'm giving the code to get Months based on System date, so you change this code to as per your requirement.And if any use input variable is there then you need to use ....
    LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZVARAIBLE'.
    ENDLOOP.
    Note: So by using this variables you need to restrict your Keyfigures with offset values.
    * First Month Of Current Fiscal year comment*
        WHEN 'FMYEAR'.
          CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
                 EXPORTING
                   i_date               = sy-datum
    *         I_MONMIT             = 00
                   i_periv              = 'V3'
                IMPORTING
                  e_buper              =  zbuper
                  e_gjahr              =  zbdatj.
          CLEAR: l_s_range.
          l_s_range-low+4(2) = '04'.
          l_s_range-low+0(4) = zbdatj.
          l_s_range-sign = 'I'.
          l_s_range-opt = 'EQ'.
          APPEND l_s_range TO e_t_range.
    * Last Month of Current Fiscal year*
        WHEN 'LMYEAR'.
          CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
                 EXPORTING
                   i_date               = sy-datum
    *         I_MONMIT             = 00
                   i_periv              = 'V3'
                IMPORTING
                  e_buper              =  zbuper
                  e_gjahr              =  zbdatj.
          CLEAR: l_s_range.
          l_s_range-low+4(2) = '03'.
          l_s_range-low+0(4) = zbdatj + 1.
          l_s_range-sign = 'I'.
          l_s_range-opt = 'EQ'.
          APPEND l_s_range TO e_t_range.
    Thanks
    Reddy

  • ABST2 - How to take the report for the previous fiscal year

    Hi,
    For FI-AA reconciliation, my scenario is this: The current fiscal year is 2009 and the system (server) date is 16-Apr-2009. My fiscal year period is: Mar-Apr. In ABST2, it does not accept Fiscal year. When I take the report, it displays for fiscal year 2009, which I don't want because I want it for the fiscal year 2008 to reconcile between FI and AA. The fiscal year 2008 is not yet closed in both FI and AA, so I want the report for 2008 only. But ABST2 always gives the report for the current fiscl year. Is there any way out to get the report for 2008?.
    Thanks,
    Kannan S

    This report is based on the actual values. In the past this report was used for EURO conversions to see if the values are in line. When not it was not possible to do the euro conversion.
    Normal it is a part from the fiscal year closing

  • Year To Date for Current Fiscal Year

    Hi All,
    I have installed BC variable Year To Date for Current Fiscal Year 0I_CFYTD..
    foloowing error occurs
    Variable 0I_CFYTD could not be replaced..
    Do i need to write any code or Please help.....

    Hi,
    Please check if fiscal year variant is used in the filter. Else the BC variable throws an error. Drag fiscal year variant to the filter area and set a value or variable input for the same.
    Regards,
    Satya

  • How to Run ebs adaptor data load for 1 year using DAC

    Hi,
    iam trying to Run the ebs adaptor data load for 1 year for procurement and spend ,Please let me know the parameter to set in DAC.
    last extract date is set as Custom Format(@DAC_SOURCE_PRUNED_REFRESH_TIMESTAMP
    Thanks

    You need to set $$INITIAL_EXTRACT_DATE to a year ago. The LAST EXTRACT DATE is something used for incremental loads and you do not manually set that.
    if this helps, mark as correct or helpful.

  • Asset value date must be in fiscal year of posting date

    Hi,
    When i try to post settlement of AuC in transaction AIBU with parameters:
    document date: previous fiscal year
    asset value date: previous fiscal year
    posting date: new fiscal year
    I know that:
    The asset value date is the value date for Asset Accounting. It can deviate from the posting and document date and be in posting periods already closed for Financial Accounting. <b>However, the posting year and asset value date year must be the same.</b> (SAP documentation).
    But maybe someone knows the way, how to post such a document??
    Regards
    Gosia

    Thanks for Your replay,
    But the pravious year is opened in FI-AA and closed in FI. We can't open previous year in FI.
    Do You know another way to solve it??
    regards
    gosia

  • Carrying forward the parked documents of previous fiscal year

    Hi Experts,
    My requirement is to carry-forward the parked documents of the previous fiscal year to the new fiscal year automatically with a background job that should run at the end of each fiscal year.
    This job should check all the documents that are still parked and must carry them to the next fiscal year. As per standard SAP, the document should be manually posted with posting date of the new fiscal year. Then the system will create a new Document in the new fiscal year, deleting the old document. I need to automate this process.
    For posting a document we use a Customized Workflow (Z copy of FIPP).
    My question is, how can I go about this requirement? What all needs to be done if I want to trigger the workflow in the background on a particular day?
    Thanks!

    Sheryl,
    If you really want to "remove/cancel" the parked documents, then your solution is to delete them as Prashant previously suggested.  Transaction FBV0 allows you to post or delete a parked document.  Deleting the parked documents does not remove the entire document from the system.  It will remove any line item information, but it will leave the header information.  With the header information, you will still have record of the document numbers for audit purposes.  The status on the header will show "parked document which was deleted".  Deletion is the standard SAP solution to "remove/cancel" parked documents - the only alternative to deleting a parked document is to post it.
    Park a document on your test system then delete it so you can see the results.  You will still be able to pull up the header information in FB03.
    I am not aware of any standard SAP reports for listing parked documents that were deleted.  However, if you require such a report, you could create a simple SQ01 query against table BKPF.  You would want to include the Document status field (BSTAT) in the query selection criteria so you can select documents with a status of 'Z' - parked document which was deleted.
    Regards,
    Shannon

  • How to calulate previous fiscal year from current year and periods as input

    hi all,
    i have a report where i have 2 select options as year and period.
    my period can be a range  like( Ex: 1 to 6).
    i like to know previous fiscal year from the following inputs.
    Tel me a suitable conversion routine to calculate
    depending on periods and fiscal year.
    regards
    sivaram.

    Hi
    U need to check the lower period, if it's 1 the previous fyscal year will be the year before:
    IF PERIOD = '1'.
      PREV_YEAR = YEAR - 1.
    ENDIF.
    U can also use the fm FI_PERIOD_DETERMINE, in this case you need a date, u can get it from lower current period:
    Get the first day of the period
    BUDAT(4)   = YEAR.
    BUDAT+4(2) = PERIDO_LOW.
    BUDAT+6(2) = '01'.
    Now get the last day of the previous month:
    BUDAT = BUDAT - 1.
    Use this date to get its period by fm FI_PERIOD_DETERMINE
    Max

  • Current fiscal year and previous fiscal year restriction in Query  Customer

    Hi ,
    My requirment is disply current year qtrs and previous year qtrs in the report . User will not enter year , date , month or qtr . system should calucualte and disply curremt year qtrs and previous year qtrs .
    I have created ZFISCYEAR reference of a 0FISYEAR year . now I would like to write customer exit for Current fiscal year and previous fiscal year to display current year qtrs and previous year qtrs.
    Could you please provide customer exit code if you have or recomend if you know any other options.
    Appriciate you help
    Thanks

    hi try this
    take into account that I don't know th periv you use could be K4 or one defined by you so I have commented it.
    The coding here is for the current fiscal period for the previous year just to another l_year varibale and populate with offset for instance l_year = l_year - 1.
    so for current year
    WHEN 'CURRPERIOD'.
        current_date = sy-datum.
        CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
          EXPORTING
            i_date  = current_date
        '    i_periv = ''
          IMPORTING
         '   e_buper = l_period.
            e_gjahr = l_year.
        l_s_range-low = l_year.
        l_s_range-sign = 'I'.
        l_s_range-opt = 'EQ'.
        APPEND l_s_range TO e_t_range.
    for previous period
    WHEN 'PREVPERIOD'.
        current_date = sy-datum.
        CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
          EXPORTING
            i_date  = current_date
        '    i_periv = ''
          IMPORTING
         '   e_buper = l_period.
            e_gjahr = l_year.
        l_year = l_year - 1.
        l_s_range-low = l_year.
        l_s_range-sign = 'I'.
        l_s_range-opt = 'EQ'.
        APPEND l_s_range TO e_t_range.
    bye
    Boujema

  • Display data as per the fiscal year

    Hi All,
    Need a suggestion with formula building:
    I have 2 columns, date which is the start of a fiscal year (04/01) and total cost next to it.
    I want to display only that fiscal year and a total cost which falls in current fiscal year. Please let me know how would i create a formula so it reads the system date and displays the fiscal year and cost according.
    Here is a sample of data:
    Date          Cost
    04/01/2010     100$
    04/01/2011     75$
    So ideally my report should display only row 1 and when run  after 04/01/11 ie after 2-3 days it should display row 2
    Thanks!

    Thanks for your response Shastry, but I am having trouble understanding it. Not sure how the above steps will read the current date.
    To be more specific, I want to display only that cost that falls in fiscal year.
    In above example now since it is 03/26/2011 and my fiscal year starts on 04/01 . I want to display cost from row 1 and when the same report will be run after 04/01/2011 it should display cost from  row 2.
    Like wise if the report is run after n number of years , it should display cost as per the fiscal year at that time.
    So i guess the formula should really depend on system date/current date/ print date
    Thanks!

  • New posting period for former fiscal year

    Hello All!
    For a customer we set up a database with posting periods for 2011 and 2012 (monthly periods). The database went live in 2011.
    Now the requirement came up to post the opening balances for 2011 per end of 2010 (to have the postings not in fiscal year 2011).
    My question is: is it a problem to add now a fiscal year 2010 (yearly basis)?
    Thanks and regards
    Peter Ganserer

    Hi Peter,
    Although it is your 2nd posting, I would add welcome message because I had not do so 1st time.
    For your question, it is not possible to add new posting period for former fiscal year. You best solution is to post those OB as the first date of the first period.
    Thanks,
    Gordon

  • Any function module for getting fiscal year week numbers

    can any one provide me function module for getting fiscal year week numbers ? if no function module please let me know work around.
    Thanks!
    Lakshmikandh

    hi,
    Use FM <b>'DATE_GET_WEEK'</b>...
    parameter D1 LIKE SCAL-DATE.
    Data w like scal-week.
    CALL FUNCTION <b>'DATE_GET_WEEK'</b>
    EXPORTING
    date = D1
    IMPORTING
    WEEK = W
    EXCEPTIONS
    DATE_INVALID = 1
    OTHERS = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    write W+4(2).
    Regards,
    Santosh

Maybe you are looking for