Free SAP Training & Tutorial A Free SAP Functional And Technical Tutorial And Training For ABAP, SAP QUERY, ALV, SMARTFORMS, SD, PP, MM, QM, FICO
17.10.2010 | Author: | Posted in ABAP 

Today I want to share some ABAP code samples that you can use to convert numbers or amount into words using SPELL_AMOUNT function module.

Here’s the ABAP Sample code:

data:
lw_spell LIKE spell,
saywords(150),
lv_text TYPE ltext,
p_amt TYPE eban-preis,
p_amt2(15),
p_waers type eban-waers.

START-OF-SELECTION.

p_amt = ‘123450′.
p_waers = ‘USD’.

SELECT SINGLE ktext INTO lv_text
FROM tcurt
WHERE spras = sy-langu
AND waers = p_waers.

TRANSLATE lv_text to UPPER CASE.

CALL FUNCTION ‘SPELL_AMOUNT’
EXPORTING
amount   = p_amt
currency = p_waers
filler   = ‘ ’
language = sy-langu
IMPORTING
in_words = lw_spell.

DATA: lv_cent TYPE spell.
lw_spell-decimal = lw_spell-decimal / 10.
IF lw_spell-decimal IS NOT INITIAL.
CALL FUNCTION ‘SPELL_AMOUNT’
EXPORTING
amount   = lw_spell-decimal
*        currency = lw_vbak-waerk
filler   = ‘ ’
language = sy-langu
IMPORTING
in_words = lv_cent.
ENDIF.

IF NOT lv_cent-word IS INITIAL.
CONCATENATE lw_spell-word ‘AND’ lv_cent-word ‘CENTS’
lv_text INTO saywords
SEPARATED BY space.
ELSE.
CONCATENATE lw_spell-word  lv_text INTO saywords
SEPARATED BY space.
ENDIF.
WRITE p_amt to p_amt2 CURRENCY p_waers.

WRITE:/ p_amt2, saywords.

“end code

Run the program and you will see the number has been converted into words.

18-0ct-10-01

Run the program

Popularity: 1% [?]

 


 
 

Related Tutorial " ABAP" 

  •  
     
    Recent Tutorials
    Create Table Maintenance Display In SAP Create table display to maintain tables values using SM30
    Create Table Maintenance Generator In SAP Maintaining SAP Transparent table values using maintenance generator
    Table Relationship In SAP Learn How To Find Tables Relationships in SAP
    Convert Number To words Using ABAP Find out how to convert numbers into words Using ABAP
    How To Maintain Long Text Object in SAP Maintain long text object in SAP
    How To Know What TCODE Used In ABAP Program Find TCODE For your ABAP Program Report
    How does CRM Work? Learn how CRM system works to run your business
    Why SAP CRM is the Best Choice? The reasons why CRM application is the best choice
    Difference Between CRM System and CRM Strategy What's the difference between CRM system and its strategy
    CRM for a Better Customer Service Learn how CRM could make your customer service much better
    Costs of Implementing CRM Software Learn the how much cost you need to prepare when implementing CRM
     
    Popular Tutorials
  • (none)
  •  
    Categories
    ABAP   Basis & Configuration  
    ALV SAP BW (Business Warehouse)
    BAPI   SAP Interview Questions
    SAP Tables   SAP Overview
    Transaction Codes FI SAP Query
      MM SAP Script  
      PP SAP Tutorial FI Module
      QM   MM Module
      SD   PM Module
    SAP Functional MM   PP Module
      SD   QM Module
    White Papers     SD Module
    Uncategorized   SmartForms  
      User-Exits  
     
     

     

    Home | About | Contribute | Privacy

    Copyright 2011 freesaptutorial.com.

    Free SAP Tutorial is not associated with SAP AG in Germany or in any other country.

    SAP is a registered trade mark of SAP AG.