Categorias

Conversão de valor numérico em extenso

Informação fornecida por Daniel Martins Doval.

A visão em que se encontram os textos em extenso utilizados nesta função é a V_T015Z.

Utilizar a função standard SPELL_AMOUNT conforme código

Report zteste

Tables spell

Data: valor(8) type p decimals 2.

Data: begin of palavra,

Inteiro like spell-word,

Real(6),

Filler(3),

Decimal like spell-decword,

Centavos(8),

end of palavra.

Data: decimals type p.

Data word like spell.

Valor = 710 / 3.

Call function 'SPELL_AMOUNT'

Exporting

Amount = valor

Currency = 'BRL'

Filler = ' '

Language = sy-langu

Importing

In _words = word

Exceptions

Not_found = 1

Too_large = 2

Others = 3.

describe field valor type type decimals decimals.

palavra-inteiro = word-word.

If valor > 1.

Palavra-real = 'REAIS'.

Else.

Palavra-real = 'REAL'.

Endif.

If word-decword ne ' '.

Palavra-filler = 'E '.

Palavra-decimal = word-decword.

Palavra-centavos = 'CENTAVOS'.

Endif.

Condense palavra.

Write palavra.

Write: / valor.