Application Development 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: 

Need function modules for the following...

aris_hidalgo
Contributor
0 Kudos

Hello experts,

Is there an function module that I can use for:

1. get the last date for a given year

2. get the exchange rate for a given document number in a span of 5 years -

for example, I need to get the exchange rate of doc. number 0000000123

for the year 2000, 2001, 2002, 2003, 2004 and 2005(maximum of 5 years)

Help would be greatly appreciated.

Again, thank you guys and take care!

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Check the following, this might help,

1.To get last date in a year - LAST_DAY_IN_YEAR_GET & FIRST_AND_LAST_DAY_IN_YEAR_GET

2. To get the exchange rate - CALCULATE_EXCHANGE_RATE_N, to get the history of exchange rates for 5 years, you need to write a custom fm or a report, as the exchange rate would be fluctuating,

Rgds,

5 REPLIES 5

Former Member
0 Kudos

get the last date for a given year---> its always 31-12-'Year' u can hard code.

check <b>BAPI_EXCHANGERATE_GETDETAIL</b>

Regards

prabhu

Message was edited by: Prabhu Peram

0 Kudos

LAST DATE 31-12-

IF U WANT LAST DATE FOR FINACIAL YEAR..USE FM.

HR_E_GET_FISC_YEAR_DATES

or

FIRST_AND_LAST_DAY_IN_YEAR_GET

Former Member
0 Kudos

Hi,

Check the following, this might help,

1.To get last date in a year - LAST_DAY_IN_YEAR_GET & FIRST_AND_LAST_DAY_IN_YEAR_GET

2. To get the exchange rate - CALCULATE_EXCHANGE_RATE_N, to get the history of exchange rates for 5 years, you need to write a custom fm or a report, as the exchange rate would be fluctuating,

Rgds,

0 Kudos

Hi again guys,

do you have any examples on how to use BAPI_EXCHANGERATE_GETDETAIL and

CALCULATE_EXCHANGE_RATE_N?

Thanks a lot!

0 Kudos

Hi,

To use CALCULATE_EXCHANGE_RATE_N, you just have to pass the required parameters like foreign amount/currency and local amount/currency, instead you can query the table TCURR for the same data, remember to convert the 'DATE' to internal format before sending it in to the fm/table, you can refer the following code, this might help,

WRITE V_date TO LV_DATUM USING EDIT MASK '__.__.____'.

CALL FUNCTION 'CONVERSION_EXIT_INVDT_INPUT'

EXPORTING

INPUT = LV_DATUM

IMPORTING

OUTPUT = LV_DATUM.

  • Retrieve the Exchange rate from Custom table for the Exchange

*

select ukurs from tcurr

into tcurr-ukurs

up to 1 rows

where kurst = 'M'

and fcurr = komk-waerk

and tcurr = komk-HWAER

and gdatu >= LV_DATUM.

endselect.

Rgds,