在做中东的项目的时候,需要将1,2,3...这样的数字,转换为对应的阿拉伯文字:١ ٢٣。
转换的程序如下:
set language 'A'.
if text-001isnot initialandtext-002isnot initialandtext-003isnot initial
and text-004isnot initialandtext-005isnot initialandtext-006isnot initial
and text-007isnot initialandtext-008isnot initialandtext-009isnot initial
and text-010isnot initial.
replace all occurrencesof'1' incv_input with text-001.
replace all occurrencesof'2' incv_input with text-002.
replace all occurrencesof'3' incv_input with text-003.
replace all occurrencesof'4' incv_input with text-004.
replace all occurrencesof'5' incv_input with text-005.
replace all occurrencesof'6' incv_input with text-006.
replace all occurrencesof'7' incv_input with text-007.
replace all occurrencesof'8' incv_input with text-008.
replace all occurrencesof'9' incv_input with text-009.
replace all occurrencesof'0' incv_input with text-010.
endif.
其中,text-001、text-002 、text-003 的设置如下图所示,即是1,2,3,4,而不是阿拉伯语的数字。
为什么可以这样做呢?因为set language 'A' 的作用。set language 'A'可以实现语言的转换。
但是,这个转换还需要下面的设置。
在这个代码所在的程序中,点击 菜单 goto ->translation ,在弹出的对话框中选择目标语言 AR
然后,进行如下的设置:其中蓝色部分是我们在text symbols中书写的内容,是源内容。
红色部分是我们要转换成的内容。
参考资料:
http://help.sap.com/saphelp_bw/helpdata/en/e3/960a1aeb0711d194d100a0c94260a5/content.htm
当然,并不是每个人都有访问菜单 goto ->translation 的权利。
这个时候,可以直接用下面一条语句直接代替上面的种种。
TRANSLATE cv_input USING '1١2٢3٣4٤5٥6٦7٧8٨9٩0٠'.