Skip to Content

I searched high and low for this and found 2 useful solutions.

1 is purely a functional one.

You can Enable Fiscal year Default & Value Date via the IMG.
Path: Financial Accounting (New)-Financial Accounting Global Settings (New)-Document-Default Values-Enable Fiscal Year Default & Default Value Date.

The second is the one that worked for me. The code below calls the function DATE_TO_PERIOD_CONVERT to return the current period from table T009B.

The function module needs value PERIV (Fiscal Year Variant) which is set in your customizing for your company code (table T001). 

Table T009C is a good table as well showing the periods and their language relevant names should you need to show that as well.

  data: lv_poper_l  type poper,
        lv_pgjahr_l type bdatj,
        lv_date     type sydatum,
        lv_periv    type periv.

* Set Posting date
    lv_date = sy-datum.

* Determine Financial Period Variant
  select single periv into lv_periv
    from t001
    where bukrs = pv_bukrs.  “PV_BUKRS is the company code

  if sy-subrc = 0.

*  determine posting period
    call function ‘DATE_TO_PERIOD_CONVERT’
      exporting
        i_date         = lv_date
        i_periv        = lv_periv
      importing
        e_buper        = lv_poper_l     “Contains period
        e_gjahr        = lv_pgjahr_l    “Contains year
      exceptions
        input_false    = 1
        t009_notfound  = 2
        t009b_notfound = 3
        others         = 4.

  endif.

To report this post you need to login first.

6 Comments

You must be Logged on to comment or reply to a post.

    1. Kevin Wilson Post author
      I guess I’m not that good a searcher because I did search SDN and Google and didn’t find the detail I was looking for… hence the post.
      (0) 
  1. Naimesh Patel
    Check the FM FI_PERIOD_DETERMINE, which is more encapsulated than given solution.

    Frankly, I don’t like to see type of content in the BLOG area. They are more suitable for WIKI or Forum.

    Regards,
    Naimesh Patel

    (0) 
    1. Kevin Wilson Post author
      Naimesh,
      thanks for sharing the other FM. Regarding the blog vs. the forums I would say that forums are used to ask questions where people answer them. I am not asking a question, rather giving an answer in case someone has the question…

      Regarding the WIKI that is probably a good suggestion and I will include this in my ABAP Tips and Tricks Database wiki located at http://wiki.sdn.sap.com/wiki/display/ABAP/ABAP+Tips+and+Tricks+Database
      Thanks
      Kevin

      (0) 

Leave a Reply