ปัญหา: อยากแปลงจำนวนเงินที่เป็นตัวเลข ให้กลายเป็นจำนวนเงินที่เป็นตัวอักษรแบบอ่าน เช่น 999.99 บาท ซึ่งแปลงแล้วจะได้เป็น เก้าร้อยเก้าสิบเก้า บาท เก้าสิบเก้า สตางค์
หลักการ: ให้ใช้ Function SPELL_AMOUNT ในระบบ ซึ่ง ฟังก์ชั่นนี้ ต้องใช้ควบคู่กับ Table T015Z ให้ทำการตรวจสอบ Table T015Z ว่าได้มีข้อมูล ที่ SPRAS เท่ากับ 2 (ซึ่ง 2 ความหมายคือ TH) แล้วดูว่า มีข้อมูลครบ 206 อัน หรือไม่ตามรูป
ข้างล่างคือ ตัวอย่าง Code การเรียกใช้ FUNCTION
DATA: lv_spras type char1, lv_waers type waers,</span> ls_spell type spell,</span> lv_baht type char20,</span> lv_stg type char20,</span> lv_tmp_bath type string,</span> lv_tmp_stg type string, lv_amount type wrbtr, lv_txt_amount type text300. clear: ls_spell. lv_amount = '999.99'. lv_baht = 'บาท'. lv_stg = 'สตางค์'. lv_waers = 'THB'. lv_spras = '2'. call function 'SPELL_AMOUNT' exporting amount = lv_amount currency = lv_waers language = lv_spras importing in_words = ls_spell exceptions not_found = 1 too_large = 2 others = 3. if sy-subrc = 0. if ls_spell-decimal < 1. clear ls_spell-decword. lv_stg = 'ถ้วน'. endif. endif. condense ls_spell-word no-gaps. condense ls_spell-decword no-gaps. concatenate ls_spell-word lv_baht into lv_tmp_bath. concatenate ls_spell-decword lv_stg into lv_tmp_stg. condense lv_tmp_bath no-gaps. condense lv_tmp_stg no-gaps. concatenate lv_tmp_bath lv_tmp_stg into lv_txt_amount.