Método para mover un monto desde pantalla a formato interno Currency.
*&---------------------------------------------------------------------*
*& Form mueve_monto
*&---------------------------------------------------------------------*
FORM mueve_monto USING a waers
CHANGING b.
DATA: input TYPE bapicurr-bapicurr.
DATA: l_dcpfm TYPE usr01-dcpfm.
DATA: output(15) TYPE p DECIMALS 2.
DATA: l_a TYPE string.
l_a = a.
CONDENSE l_a NO-GAPS.
IF NOT l_a IS INITIAL.
SELECT SINGLE dcpfm
INTO l_dcpfm
FROM usr01
WHERE bname = sy-uname.
IF l_dcpfm = 'X'. " Separador decimal es punto
TRANSLATE l_a USING ', ' .
CONDENSE l_a NO-GAPS.
ELSE. " Separador decimal es coma
TRANSLATE l_a USING '. ' .
CONDENSE l_a NO-GAPS.
TRANSLATE l_a USING ',.'.
ENDIF.
input = l_a.
CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_INTERNAL'
EXPORTING
currency = waers
amount_external = input
max_number_of_digits = 20
IMPORTING
amount_internal = output.
MOVE output TO b.
ENDIF.
ENDFORM. "mueve_monto
No hay comentarios:
Publicar un comentario