How to get fiscal period based on date and Fiscal year?

Hi Guys,
           Can anybody tell me how to get Fiscal period based on date and Fiscal Year or fiscal year variant?
Thanks,
Gopi.

Hi,
Please refer the code below:
*: Report:  ZFISCALYR                                                  :
*: Date  :  2004                                                       :
*: Description: Demonstrates how to return the corresponding fiscal    :
*:              year and posting period for a company code and posting :
*:              date or posting date and fiscal year variant.          :
REPORT  zfiscalyr NO STANDARD PAGE HEADING.
TABLES: ekko.
PARAMETERS:     p_bukrs TYPE ekko-bukrs,
                p_bedat TYPE ekko-bedat.
DATA: gd_fiscalyr  TYPE bapi0002_4-fiscal_year,
      gd_fiscalp   TYPE bapi0002_4-fiscal_period.
DATA: gd_fiscalyr2 TYPE T009B-BDATJ,
      gd_fiscalp2  TYPE bapi0002_4-fiscal_period.
DATA: gd_periv     TYPE t009-periv.
*START-OF-SELECTION.
START-OF-SELECTION.
* get fiscal year and period - (requires date and company code)
  CALL FUNCTION 'BAPI_COMPANYCODE_GET_PERIOD'
    EXPORTING
      companycodeid = p_bukrs
      posting_date  = p_bedat
    IMPORTING
      fiscal_year   = gd_fiscalyr
      fiscal_period = gd_fiscalp.
* Alternative fiscal year function module
* - (requires date and fiscal year variant code from T009 table)
* gets first entry in fiscal year variant table (will need to choose
* correct one from table rather than just using first entry)
  SELECT SINGLE periv
    FROM t009
    INTO gd_periv.
* get fiscal year and period
  CALL FUNCTION 'DETERMINE_PERIOD'
    EXPORTING
      date                      = p_bedat
*    PERIOD_IN                 = '000'
      version                   = gd_periv
   IMPORTING
      period                    = gd_fiscalp2
      year                      = gd_fiscalyr2
   EXCEPTIONS
      period_in_not_valid       = 1
      period_not_assigned       = 2
      version_undefined         = 3
      OTHERS                    = 4.
*END-OF-SELECTION.
END-OF-SELECTION.
  WRITE:/ 'From function module: BAPI_COMPANYCODE_GET_PERIOD',
        / 'Fiscal year is:', gd_fiscalyr,
        / 'Fiscal period is:', gd_fiscalp.
  SKIP.
  WRITE:/ 'From function module: DETERMINE_PERIOD',
        / 'Fiscal year is:', gd_fiscalyr2,
        / 'Fiscal period is:', gd_fiscalp2.
Thanks,
Sriram Ponna.
Edited by: Sriram Ponna on Apr 17, 2008 8:59 PM

Similar Messages

  • How to get previous values based on date filters

    Hi
    i have two fields gldate and startdate
    gldate values are like 1/31/2011,2/28/2011,3/31/2011,4/30/2011,5/31/2011 ...
    startdate values 1/1/2011,2/1/2011,3/1/2011,4/1/2011,5/1/2011 ...
    i need a condition like gldate<startdate
    if startdate is 11/1/2011 then i get all the values before 11/1/2011 values
    im using filter for date filed
    let us filter values is startdate--11/1/2011 and gldate is 11/30/2011 but that cond falls
    how to get this condition
    plz its urgent to me

    Hi
    i have two fields gldate and startdate
    gldate values are like 1/31/2011,2/28/2011,3/31/2011,4/30/2011,5/31/2011 ...
    startdate values 1/1/2011,2/1/2011,3/1/2011,4/1/2011,5/1/2011 ...
    i need a condition like gldate<startdate
    if startdate is 11/1/2011 then i get all the values before 11/1/2011 values
    im using filter for date filed
    let us filter values is startdate--11/1/2011 and gldate is 11/30/2011 but that cond falls
    how to get this condition
    plz its urgent to me

  • How to get the current month starting date and ending date by default ?

    Hello Creators,
    This is my requirement, kindly do the needful, Please dont gimme any links i've no access for other sites, gimme the right solution.
    My Requirement :
    Creation Date (VBAK-ERDAT) - Select Option. By default, the program should run for the current Month ie between the starting and ending date of the current month when the program is run. Today the date is 18th using sy-datum we can bring the current date by calling it in the initialization event, but the requirement is it should not give me the current date, it should only give me the month starting date and the end date. Kindly help.
    Thanks in advance ...

    DATA: gv_datum LIKE vbak-erdat.
    SELECT-OPTIONS: so_date FOR gv_datum.
    INITIALIZATION.
      CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'
        EXPORTING
          iv_date             = sy-datum
        IMPORTING
          ev_month_begin_date = so_date-low
          ev_month_end_date   = so_date-high.
      so_date-option = 'BT'.
      APPEND so_date.
    START-OF-SELECTION.
    Hope this solves the issue. Don't forget to be generous
    Cheers,
    Sougata.

  • How to get the  of last   Exicution date and time   of a program

    Hi all ,
    Is there any table which stores the last exicution Time And Date of a report.
    plz give me the table which stores above details.

    Check out STAT and STAD transactions or
    try table D010SINF

  • Get Fiscal Period based on Fiscal Year

    Hello Experts,
    I have one query. I wanted to get fiscal period based on fiscal year entered in selection screen.
    I tried to find the FM for it but didn't get it. Can you suggest me any FM which gives in Fiscal period based on fiscal year in FI?
    Regards,
    Neha

    Hi,
    Check the following link:
    How to get fiscal period based on date and Fiscal year?
    http://www.sapdev.co.uk/fmodules/fms_fiscalyr.htm
    Regards,
    Bhaskar

  • To get Fiscal period based on Fiscal Year

    Hi Guys,
               Can anybody tell me how to get Fiscal period based on Fiscal Year?
    Thanks,
    Arpan

    Hi Anshu,
    Have a good day.
    I need to convert fiscal year(2011) to fiscal period(2011001).
    Fiscal year(key field in data source) mapped to the fiscal period(key field in infoprovider).
    But in the transformation when I have mapped these fields, data is not coming propperly into the infoprovider because in the transformation its not converting fiscal year to fiscal period.
    This is the scenario. Please help.
    Thanks,
    Arpan

  • Deriving previous Fiscal Period based on current date

    Hi All,
    I have a requirement wherein I need to derive the previous fiscal period based on the current date. Is there any standard FM to get the same? If not can you let me know if there is any other way of deriving it?
    Thanks
    Sundar

    Hi Srinivas, thanks for your reply. What you have suggested will work fine if I am looking for current fiscal period. I want previous fiscal period. How do I get that?
    Thanks
    Sundar

  • How to get the most current file based on date and time stamp using SSIS?

    Hello,
    Let us assume that files get copied in a specific directory. We need to pick up a file and load data. Can you guys let me know how to get the most current file based on date and time stamp using SSIS?
    Thanks
    thx regards dinesh vv

    hi simon
    i excuted this script it is giving error..
       Microsoft SQL Server Integration Services Script Task
       Write scripts using Microsoft Visual C# 2008.
       The ScriptMain is the entry point class of the script.
    using System;
    using System.Data;
    using Microsoft.SqlServer.Dts.Runtime;
    using System.Windows.Forms;
    namespace ST_9a6d985a04b249c2addd766b58fee890.csproj
        [System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
        public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
            #region VSTA generated code
            enum ScriptResults
                Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
                Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
            #endregion
            The execution engine calls this method when the task executes.
            To access the object model, use the Dts property. Connections, variables, events,
            and logging features are available as members of the Dts property as shown in the following examples.
            To reference a variable, call Dts.Variables["MyCaseSensitiveVariableName"].Value;
            To post a log entry, call Dts.Log("This is my log text", 999, null);
            To fire an event, call Dts.Events.FireInformation(99, "test", "hit the help message", "", 0, true);
            To use the connections collection use something like the following:
            ConnectionManager cm = Dts.Connections.Add("OLEDB");
            cm.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;";
            Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
            To open Help, press F1.
            public void Main()
                string file = Dts.Variables["User::FolderName"].Value.ToString();
                string[] files = System.IO.Directory.GetFiles(Dts.Variables["User::FolderName"].Value.ToString());
                System.IO.FileInfo finf;
                DateTime currentDate = new DateTime();
                string lastFile = string.Empty;
                foreach (string f in files)
                    finf = new System.IO.FileInfo(f);
                    if (finf.CreationTime >= currentDate)
                        currentDate = finf.CreationTime;
                        lastFile = f;
                Dts.Variables["User::LastFile"].Value = lastFile;
                Dts.TaskResult = (int)ScriptResults.Success;
    thx regards dinesh vv

  • Function module to get the posting period based on date

    Hi to all,
    Is there any function module to get the posting period based on date?
    Regards,
    Nagesh

    hi,
    CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
          EXPORTING
            I_GJAHR        = GV_GJHAR
            I_PERIV        = GC_24
            I_POPER        = GV_POPER
          IMPORTING
            E_DATE         = S_FKDAT-LOW
          EXCEPTIONS
            INPUT_FALSE    = 1
            T009_NOTFOUND  = 2
            T009B_NOTFOUND = 3
            OTHERS         = 4.
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
          EXPORTING
            I_GJAHR        = GV_GJHAR
            I_PERIV        = GC_24
            I_POPER        = GV_POPER
          IMPORTING
            E_DATE         = S_FKDAT-HIGH
          EXCEPTIONS
            INPUT_FALSE    = 1
            T009_NOTFOUND  = 2
            T009B_NOTFOUND = 3
            OTHERS         = 4.
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    ags.

  • FM to get open period based on company code

    Could you pls tell me the FM which can get open period based on the company code?
    right answer will be rewared for sure.
    Sujatha

    Hi,
    I m not sure. Just check this out.
    CALL FUNCTION 'BAPI_COMPANYCODE_GET_PERIOD'
        EXPORTING
          companycodeid = p_bukrs
          posting_date  = p_bedat
        IMPORTING
          fiscal_year   = gd_fiscalyr
          fiscal_period = gd_fiscalp.
    CALL FUNCTION 'DETERMINE_PERIOD'
        EXPORTING
          date                      = p_bedat
    *    PERIOD_IN                 = '000'
          version                   = gd_periv
       IMPORTING
          period                    = gd_fiscalp2
          year                      = gd_fiscalyr2
       EXCEPTIONS
          period_in_not_valid       = 1
          period_not_assigned       = 2
          version_undefined         = 3
          OTHERS                    = 4.
    check this link.
    http://www.sapdevelopment.co.uk/fmodules/fmssap.htm
    Regards
    Vadi
    Code Formatted by: Alvaro Tejada Galindo on Jan 4, 2010 5:41 PM

  • How to get maximal value from the data/class for show in Map legend

    I make WAD report that using Map Web Item.
    I devide to four (4) classes for legend (Generate_Breaks).
    I want to change default value for the class by javascript and for this,
    I need to get maximal value from the class.
    How to get maximal value from the data/class.
    please give me solution for my problem.
    Many Thx
    Eddy Utomo

    use this to get the following End_date
    <?following-sibling::../END_DATE?>
    Try this
    <?for-each:/ROOT/ROW?>
    ==================
    Current StartDate <?START_DATE?>
    Current End Date <?END_DATE?>
    Next Start Date <?following-sibling::ROW/END_DATE?>
    Previous End Date <?preceding-sibling::ROW[1]/END_DATE?>
    ================
    <?end for-each?>
    o/p
    ==================
    Current StartDate 01-01-1980
    Current End Date 01-01-1988
    Next Start Date 01-01-1990
    Previous End Date
    ================
    ==================
    Current StartDate 01-01-1988
    Current End Date 01-01-1990
    Next Start Date 01-01-2005
    Previous End Date 01-01-1988
    ================
    ==================
    Current StartDate 01-01-2000
    Current End Date 01-01-2005
    Next Start Date
    Previous End Date 01

  • How to get Item-Code wise stock quantity and value for a previous date

    Dear Sir,
    As per the government legal requirement , we are required to furnish a list for items having stock as on a date ( date is not the current date but it is some past date)  and  in the list we need to provide material wise stock quantity and value .
    We can generate a list  for the current date , but do not know how to get it for a previous date .
    We request you to kindly guide us about such a list .
    With Thanks and Regards
    Sonia Agarwal

    hi,
    might be this reports will be help full for your requirement.
    MMBE
    MB53
    MB52
    MB5M
    MB5B
    MB5T
    MBLB
    MBBS
    MB54
    ME56
    Thanking you

  • How can I get missing contacts, notes, calendar dates and reminders that are just on my old iphone onto the iCloud for transfer to my new iPhone upgrade?

    Dear wise & wondeful people:
    How can I get missing contacts, notes, calendar dates and reminders that are just on my old iphone onto the iCloud for transfer to my new iPhone upgrade? Half of my contacts, notes, ect. were on my iCloud so have happily moved to my new iPhone but the rest are completely resistant. For example, on my iCloud I have 14 missing contacts starting with the letter A alone, however they are happily viewable on my old iPhone 4S and won't budge over into the iCloud.
    There are also 3 notes missing yet still acessible on my onld iPhone 4S, the list goes on.
    Your help would be most appreciated. Thank you so much.
    BCHR

    Hi BCHR,
    If you are having issues transfering your content from your old iPhone onto iCloud so it can be transfered to your new iPhone, you may find the following articles helpful:
    iOS: Transferring information from your current iPhone, iPad, or iPod touch to a new device
    http://support.apple.com/kb/HT2109
    iCloud: Troubleshooting iCloud Contacts
    http://support.apple.com/kb/TS3998
    iCloud: Troubleshooting iCloud Calendar
    http://support.apple.com/kb/TS3999
    iCloud: Notes overview
    http://support.apple.com/kb/PH12081
    Regards,
    - Brenden

  • I-photo:  I used 2 cameras to take pictures on a trip --- i have put the pictures from both cameras into an album --- when i click on view and then sort by date, the pictures do not sort by date --- any ideas on how to get the pics sorted by date?

    I-photo:  I used 2 cameras to take pictures on a trip --- i have put the pictures from both cameras into an album --- when i click on view and then sort by date, the pictures do not sort by date --- any ideas on how to get the pics sorted by date?

    Select all the photos that you need to change, then click the "Photos" menu and choose "Adjust Date and Time".
    If you add a year, it will adjust all the photos that you selected by adding a year (so if you accidentally select one of the photos that already has "2012", that will change to "2013"). 

  • How to get internal table from SAP Data Provider C#

    Hello.
    ABAP:
       DATA: lt_t001 TYPE TABLE OF t001.
       DATA: url(1000) TYPE c.
      SELECT * INTO TABLE lt_t001 FROM t001.
      CALL FUNCTION 'DP_CREATE_URL'
        EXPORTING
          type                 = 'APPLICATION'
          subtype           = 'X-R3TABLE'
        TABLES
          data                 = lt_t001
        CHANGING
          url                    = url
        EXCEPTIONS
          OTHERS           = 4.
    C#:
    using SAPDataProvider;
    using SAPTableFactoryCtrl;
    public void SetDataFromUrl(string url)
                SAPDataProviderClass p = new SAPDataProviderClass();
                p.SetDataFromURL("APPLICATION", "X-R3TABLE", url);
                ISapDPR3Table tbl = p.GetDataAsR3Table("APPLICATION", "X-R3TABLE");
                SAPTableFactoryClass tf = new SAPTableFactoryClass();
                Table tb = (Table)tf.NewTable();
                tb.ISAPrfcITab = tbl.DataTable; // Exception !!!!!!
    How to get internal table from SAP Data Provider ?

    Hi Sergey,
    I'm trying to do the same, have you found a solution to solved it?
    thanks for your help.
    Regards.
    Jonathan

Maybe you are looking for