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

HANDLING YEAR

Former Member
0 Likes
778

Hi to all

plz tell me in the database i have order creation date in yyyy-mm-dd format.

At selection screen i am giving fiscal year bkpf-gjahr.

I want report according to fiscal year.

How to compare year and date.

plz help me out.

thanks...

Hi to all

plz tell me in the database i have order creation date in yyyy-mm-dd format.

At selection screen i am giving fiscal year bkpf-gjahr.

I want report according to fiscal year.

How to compare year and date.

plz help me out.

thanks...

4 REPLIES 4
Read only

Former Member
0 Likes
754

I am not very sure if the "Order" ( that you are talking about ) is Accounting Doc ( BKPF-BELNR).

If that is so - creation date is BKPF-BLDAT , Fiscal year - u already know it is BKPF-GJAHR and period is BKPF-MONAT.

You can decide the Fiscal Year & Period from a date by using FM -DATE_TO_PERIOD_CONVERT

and

FIRST_DAY_IN_PERIOD_GET

LAST_DAY_IN_PERIOD_GET

for deriving the boundaries of a period.

For any Order , you can have the detials in AUFK ( creation date ERDAT).

Revert in case of problems.

Read only

Former Member
0 Likes
754

Hi,

Use the function modue : RP_BEGDA_ENDDA_PAYROLL_YEAR_TH

Provide abkrs = '01' and year as your input fiscal year. It will provide o/p from Jan 1st to Dec 31st of that year.

Hope this info will help you. Rewards points in Useful.

With Regards,

K K V

Read only

Former Member
0 Likes
754

Hello Anubhav

Please use FM: GET_CURRENT_YEAR passing the company code and date you will get the fiscal year...

Regards,

Arun

Read only

Former Member
0 Likes
754

Hi. If you already have the two dates that you want to compare, then you can just create a couple of temporary date fields to use like this:

Data: fiscal_begda type sy-datum,

fiscal_endda type sy-datum.

fiscal_begda(4) = bkpf-gjahr.

fiscal_begda+4(4) = '0101'.

fiscal_endda = fiscal_begda.

fiscal_endda+4(4) = '1231'.

SELECT * FROM your_table INTO internal_table

WHERE bkpf-gjahr >= fiscal_begda

AND bkpf-gjahr <= fiscal_endda.

ENDSELECT.

I hope this helps.

- April King