Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function module

Former Member
0 Likes
597

Hi gays,

Can you tell me any function module. In that i could pass fiscal year -2007, and period i.e 01. so it could return the month. for that period of fiscal yea.

Thanks in Advance.

Mukesh

5 REPLIES 5
Read only

Former Member
0 Likes
547

BAPI_COMPANYCODE_GET_PERIOD.

Retrieve fiscal year and period:

The below code shows how to use function modules BAPI_COMPANYCODE_GET_PERIOD and

DETERMINE_PERIOD to retrieve fiscal year and fiscal period for a specific date.

*.......................................................................

*: Report: ZFISCALYR :

*: :

*: Author: :

*: :

*: Date : 2007 :

*: :

*: 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.

Pls reward all helpful points.

Read only

Former Member
0 Likes
547

Hello Mukesh,

The requirement is not clear.....Could you explain lit bit more,.....

Suppose i am passing fiscal year as 2007 and period as 01 .....which month you need to display.

Because every month has period called 01 ,02 etc....

Thanks and Best Regards,

Vinoth

Read only

0 Likes
547

there is a fiscal year change onword 2009 jan to dec but in previous year fiscal year 2008 .Aug to july. i dont want to heard code value so i need FM so i could pass fiscal year and period and it could return month(july or 07).

Read only

Former Member
0 Likes
547

Hi Dubey,

Period concept is different for each company,For example some companies defined period 01 means January or some companies define April is period '01'.

based on how many periods and which period is pertaing to month you have to calculate.

Regards,

Ameer Baba.

Read only

0 Likes
547

There is 12 fiscal period.