SAP Smart forms中文字体重叠的解决方法

 前注:英文环境指login language 为 'E'的系统,中文环境指login language 为 '1'。
        如果想在smart forms中显示中文内容,最好在中文环境中编辑,我曾经在英文环境编辑,那些中文描述要英文环境中打印都成了乱码。这个问题具体成因和解决方法我现在还未找出。
       smart forms写好以后,测试时发现,当要在form中显示的业务数据(Filed,语法为&...&)包含中文时,英文环境中打印预览时中文重叠在一起,当字符长度超出所留的空间,打印到纸上中文重叠部分就展开与后面的其它内容交杂在一起。但在中文环境中打印,就不会重叠而且按照预留的空间来自动换行。
       初始以为是SAP的程序bug,就在http://service.sap.com上查找Notes,找到了两个相近的:
       Note 808326 - SCR: Unicode print preview
       Symptom: In the Unicode system, text is formatted incorrectly when you display SAPscript forms in the print preview. In addition, characters can overlap or be displayed too far apart from each other.
       Note 908442 - Overlapping Asian texts in Unicode system
       Symptom:In the print preview, Asian texts overlap in the Unicode system.
       但一对比Corrections Instructions中代码,我的系统ECC6.4已经打过了这两个notes了,所以就想是不是自己的程序写的有问题,开始Debug我的form程序。终于在smart form对应的FM中发现这样的代码(一般在350行以后):
  call function 'SSFRT_SET_LANGUAGES'
       exporting i_control_parameters = control_parameters
                 i_masterlanguage     = '1'
                 i_thrulang           = ' '
                 i_install_lang       = ' '
       importing o_languages          = %languages.
  %header-langu = %languages-langu1.
       其中%header-langu是关键,它决定了要打印form的语言版本。FM 'SSFRT_SET_LANGUAGES'对它的赋值逻辑为:control_parameters is initial ? sy-langu : control_parameters-langu。
       我一看我的FORM routine程序中没有对control_parameters-langu进行赋值,所以打印时%header-langu = sy-langu。E环境打印时,由于我没有E版的smart form,系统就把的中文版本的smart form当E版的来处理,所以就导致了中文数据内容重叠。改一下代码:control_parameters-langu = 1. 并传参到smart form的FM中,这下问题好了。
      其他的发现:多次测试后,又发现另一问题,当取出的数据字符比较长它就压缩在一起了,重上sap notes网站,找到下面这个:
      Note 1007575 - Compressed Asian characters in the print preview
      Symptom:You display an Asian Smart Form in a Unicode system. In this case, one table line contains enough space for you to display the contents. However, the system compresses text that is longer than 31 characters.
      一测试果然是超过31字符时才压缩,于是申请打上了这个note,现在smart form打印预览已经没什么问题了。
      基中%header类型是SSFCTRLOP
     总结:无论是smart form还是SAPscript,打印时限制form的语言版本是很重要的(SAPscript 的FM 'OPEN_FORM'中有language参数)。

出处:http://blog.csdn.net/hkj900/archive/2008/04/21/2312798.aspx

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值