Dealing with Currency / Amounts...
Rounding off Amounts:
CALL FUNCTION 'J_1I6_ROUND_TO_NEAREST_AMT'
EXPORTING
I_AMOUNT = V_KWERT “ Amount to convert
* I_AMOUNT1 =
* I_AMOUNT2 =
* I_AMOUNT3 =
* I_AMOUNT4 =
* I_AMOUNT5 =
* I_EXADDTAX1_AMOUNT =
* I_EXADDTAX2_AMOUNT =
* I_EXADDTAX3_AMOUNT =
IMPORTING
E_AMOUNT = V_AMOUNT “ Rounded Amount
* E_AMOUNT1 =
* E_AMOUNT2 =
* E_AMOUNT3 =
* E_AMOUNT4 =
* E_AMOUNT5 =
* E_EXADDTAX1_AMOUNT =
* E_EXADDTAX2_AMOUNT =
* E_EXADDTAX3_AMOUNT =
Spell Amount: To spell amount in Indian Currency format
CALL FUNCTION 'HR_IN_CHG_INR_WRDS'
EXPORTING
AMT_IN_NUM = V_STOTAL “ Amount to spell
IMPORTING
AMT_IN_WORDS = V_TOTWORDS “ Amount spelt
EXCEPTIONS
DATA_TYPE_MISMATCH = 1
OTHERS = 2.
************ Another FM for the same purpose ************
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTINGAMOUNT = V_AMOUNT " Amount to be spelt
CURRENCY = PWAERS " Currency
FILLER = SPACE " Space filler
LANGUAGE = 'E' " Language
IMPORTING
IN_WORDS = V_SPELL " Amount Spelt
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 2
OTHERS = 3.
Dealing with Dates...
No of days in a month
/OSP/GET_DAYS_IN_MONTH Pass Date
HR_E_NUM_OF_DAYS_OF_MONTH Pass Month (in words)NUMBER_OF_DAYS_PER_MONTH_GET Pass Year Month
Convert month (number) to name
HR_RU_MONTH_NAME_IN_GENITIVE Pass Month (number)
Get difference between 2 dates
call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
exporting
i_date_from = FROMDATE
i_date_to = TODATE
* I_FLG_SEPARATE = ' '
IMPORTING
E_DAYS = EDAYS
E_MONTHS = EMONTHS
E_YEARS = EYEARS.
WRITE:/ 'Difference in Days ', EDAYS.
WRITE:/ 'Difference in Months ', EMONTHS.
WRITE:/ 'Difference in Years ', EYEARS
Dealing with Unit Conversions...
CALL FUNCTION 'MC_UNIT_CONVERSION'
EXPORTING
nach_meins = p_tunit " Target unit
von_meins = p_sunit " Source unit
IMPORTING
umref = l_factor
EXCEPTIONS
conversion_not_found = 1
material_not_found = 2
nach_meins_missing = 3
overflow = 4
von_meins_missing = 5
OTHERS = 6 .
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
w_target_value = p_svalue * l_factor.
WRITE :
'The value after conversion to the target unit of measure is', w_target_value.ENDIF.
No comments:
Post a Comment