SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

BAPI_COMPANYCODE_GET_PERIOD



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Interfaces | Интерфейсы -> BAPI
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sat May 10, 2008 9:11 pm    Post subject: BAPI_COMPANYCODE_GET_PERIOD Reply with quote

BAPI_COMPANYCODE_GET_PERIOD - returns the corresponding fiscal year and posting period to a company code and posting date.

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.

Code:
*.......................................................................
*: Report:  ZFISCALYR                                                  :
*:                                                                     :
*: Author: SAPdev.co.uk :
*:                                                                     :
*: 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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Interfaces | Интерфейсы -> BAPI All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.