Aquí les dejo una función para convertir números a letras, utilizando PeopleCode. La función recibe la cantidad en número y devuelve en string la conversión.
Espero les sea de utilidad.
Function monto_en_letra(&monto) Returns string;
For &i = 1 To Len(&monto)
&caracter = Substring(&monto, &i, 1);
Evaluate &caracter
When "0"
&nombre = "";
Break;
When "1"
&nombre = "UNO";
Break;
When "2"
&nombre = "DOS";
Break;
When "3"
&nombre = "TRES";
Break;
When "4"
&nombre = "CUATRO";
Break;
When "5"
&nombre = "CINCO";
Break;
When "6"
&nombre = "SEIS";
Break;
When "7"
&nombre = "SIETE";
Break;
When "8"
&nombre = "OCHO";
Break;
When "9"
&nombre = "NUEVE";
Break;
End-Evaluate;
&posicion = Len(&monto) + 1 - &i;
Evaluate &posicion
When 7
&caracter_sigm = Substring(&monto, 1, 1);
Evaluate &caracter
When "1"
&valor = "UN MILLÓN ";
Break;
When-Other
&valor = &nombre | " MILLONES ";
Break;
End-Evaluate;
Break;
When 6
Evaluate &caracter
When "0"
&valor = &valor | "";
Break;
When "1"
&caracter_sig = Substring(&monto, 2, 2);
If &caracter_sig = "00" Then
&valor = &valor | "CIEN ";
Else
&valor = &valor | "CIENTO ";
End-If;
Break;
When "5"
&valor = &valor | "QUINIENTOS ";
Break;
When "7"
&valor = &valor | "SETECIENTOS ";
Break;
When "9"
&valor = &valor | "NOVECIENTOS ";
Break;
When-Other
If &caracter_sigm <> 0 Then
&valor = &valor | &nombre | "CIENTOS ";
End-If;
Break;
End-Evaluate;
Break;
When 5
&sig = 0;
Evaluate &caracter
When "0"
&valor = &valor | "";
Break;
When "1"
&caracter_sig = Substring(&monto, &i + 1, 1);
&sig = 1;
Evaluate &caracter_sig
When "0"
&valor = &valor | "DIEZ ";
Break;
When "1"
&valor = &valor | "ONCE ";
Break;
When "2"
&valor = &valor | "DOCE ";
Break;
When "3"
&valor = &valor | "TRECE ";
Break;
When "4"
&valor = &valor | "CATORCE ";
Break;
When "5"
&valor = &valor | "QUINCE ";
Break;
When-Other
&valor = &valor | "DIECI";
Break;
End-Evaluate;
Break;
When "2"
&caracter_sig = Substring(&monto, &i + 1, 1);
If &caracter_sig = "0" Then
&valor = &valor | "VEINTE ";
Else
&valor = &valor | "VEINTI";
End-If;
Break;
When "3"
&caracter_sig = Substring(&monto, &i + 1, 1);
If &caracter_sig = "0" Then
&valor = &valor | "TREINTA ";
Else
&valor = &valor | "TREINTA Y ";
End-If;
Break;
When "4"
&caracter_sig = Substring(&monto, &i + 1, 1);
If &caracter_sig = "0" Then
&valor = &valor | "CUARENTA ";
Else
&valor = &valor | "CUARENTA Y ";
End-If;
Break;
When "5"
&caracter_sig = Substring(&monto, &i + 1, 1);
If &caracter_sig = "0" Then
&valor = &valor | "CINCUENTA ";
Else
&valor = &valor | "CINCUENTA Y ";
End-If;
Break;
When "6"
&caracter_sig = Substring(&monto, &i + 1, 1);
If &caracter_sig = "0" Then
&valor = &valor | "SESENTA ";
Else
&valor = &valor | "SESENTA Y ";
End-If;
Break;
When "7"
&caracter_sig = Substring(&monto, &i + 1, 1);
If &caracter_sig = "0" Then
&valor = &valor | "SETENTA ";
Else
&valor = &valor | "SETENTA Y ";
End-If;
Break;
When "8"
&caracter_sig = Substring(&monto, &i + 1, 1);
If &caracter_sig = "0" Then
&valor = &valor | "OCHENTA ";
Else
&valor = &valor | "OCHENTA Y ";
End-If;
Break;
When "9"
&caracter_sig = Substring(&monto, &i + 1, 1);
If &caracter_sig = "0" Then
&valor = &valor | "NOVENTA ";
Else
&valor = &valor | "NOVENTA Y ";
End-If;
Break;
End-Evaluate;
Break;
When 4
If &sig = 1 Then
If Find(&caracter, "6789") > 0 Then
&valor = &valor | &nombre | " ";
Else
&valor = &valor | "";
End-If;
Else
Evaluate &caracter
When "0"
&valor = &valor | "";
Break;
When "1"
If Len(&monto) = 4 Then
&valor = &valor | "";
Else
&valor = &valor | "UN ";
End-If;
Break;
When-Other
&valor = &valor | &nombre | " ";
Break;
End-Evaluate;
End-If;
&valor = &valor | "MIL ";
Break;
When 3
Evaluate &caracter
When "0"
&valor = &valor | "";
Break;
When "1"
If &caracter_sig = "00" Then
&valor = &valor | "CIEN ";
Else
&valor = &valor | "CIENTO ";
End-If;
Break;
When "5"
&valor = &valor | "QUINIENTOS ";
Break;
When "7"
&valor = &valor | "SETECIENTOS ";
Break;
When "9"
&valor = &valor | "NOVECIENTOS ";
Break;
When-Other
&valor = &valor | &nombre | "CIENTOS ";
Break;
End-Evaluate;
Break;
When 2
&sig = 0;
Evaluate &caracter
When "0"
&valor = &valor | "";
Break;
When "1"
&caracter_sig = Substring(&monto, &i + 1, 1);
&sig = 1;
Evaluate &caracter_sig
When "0"
&valor = &valor | "DIEZ ";
Break;
When "1"
&valor = &valor | "ONCE ";
Break;
When "2"
&valor = &valor | "DOCE ";
Break;
When "3"
&valor = &valor | "TRECE ";
Break;
When "4"
&valor = &valor | "CATORCE ";
Break;
When "5"
&valor = &valor | "QUINCE ";
Break;
When-Other
&valor = &valor | "DIECI";
Break;
End-Evaluate;
Break;
When "2"
&caracter_sig = Substring(&monto, &i + 1, 1);
If &caracter_sig = "0" Then
&valor = &valor | "VEINTE ";
Else
&valor = &valor | "VEINTI";
End-If;
Break;
When "3"
&caracter_sig = Substring(&monto, &i + 1, 1);
If &caracter_sig = "0" Then
&valor = &valor | "TREINTA ";
Else
&valor = &valor | "TREINTA Y ";
End-If;
Break;
When "4"
&caracter_sig = Substring(&monto, &i + 1, 1);
If &caracter_sig = "0" Then
&valor = &valor | "CUARENTA ";
Else
&valor = &valor | "CUARENTA Y ";
End-If;
Break;
When "5"
&caracter_sig = Substring(&monto, &i + 1, 1);
If &caracter_sig = "0" Then
&valor = &valor | "CINCUENTA ";
Else
&valor = &valor | "CINCUENTA Y ";
End-If;
Break;
When "6"
&caracter_sig = Substring(&monto, &i + 1, 1);
If &caracter_sig = "0" Then
&valor = &valor | "SESENTA ";
Else
&valor = &valor | "SESENTA Y ";
End-If;
Break;
When "7"
&caracter_sig = Substring(&monto, &i + 1, 1);
If &caracter_sig = "0" Then
&valor = &valor | "SETENTA ";
Else
&valor = &valor | "SETENTA Y ";
End-If;
Break;
When "8"
&caracter_sig = Substring(&monto, &i + 1, 1);
If &caracter_sig = "0" Then
&valor = &valor | "OCHENTA ";
Else
&valor = &valor | "OCHENTA Y ";
End-If;
Break;
When "9"
&caracter_sig = Substring(&monto, &i + 1, 1);
If &caracter_sig = "0" Then
&valor = &valor | "NOVENTA ";
Else
&valor = &valor | "NOVENTA Y ";
End-If;
Break;
End-Evaluate;
Break;
When 1
If &sig = 1 Then
If Find(&caracter, "6789") > 0 Then
&valor = &valor | &nombre | " ";
Else
&valor = &valor | "";
End-If;
Else
Evaluate &caracter
When "0"
&valor = &valor | "";
Break;
When "1"
&valor = &valor | "UN ";
Break;
When-Other
&valor = &valor | &nombre;
Break;
End-Evaluate;
End-If;
Break;
End-Evaluate;
End-For;
If &valor = "UN" Then
&valor = &valor | " PESO ";
Else
&valor = &valor | " PESOS ";
End-If;
Return &valor;
End-Function;