ABAP将内表数据打印到邮件正文,如何排列的整齐呢?

最近在做通过邮件披露业务员销售业绩。

需要将业务员的业绩直接放在邮件正文BODY,然后发送。 邮件BODY部分目前的技术是放不了什么容器之类的。如果要美观点,就只能在其他方面想想办法。

方法:

1、每个字段必须是C型,长度15比较合适。

2、汉字部分可以给前面加空格达到对齐的目的。

代码如下:

  DATA LT TYPE I.
  DATA LS(6).
    MOVE QTAB113-BEZEE TO ETAB-BEZEE.  "销售人员描述
    LT = STRLEN( ETAB-BEZEE ).   "判断名称长度
    LT = 6 - LT.
    CLEAR LS.
    IF STRLEN( ETAB-BEZEE ) < 6. "假如小于6个字符 少几个循环几次加空格
       DO LT TIMES.
          CONCATENATE ' ' ETAB-BEZEE INTO ETAB-BEZEE.
       ENDDO.

    ENDIF.


CONCATENATE 连接空格是有诀窍的,不管你是用SPACE或者TAB键都不起作用。 这里用输入法全角下的空格,问题迎刃而解。

CONCATENATE    LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3
               LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3
               LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3
               LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 LINE3 CL_ABAP_CHAR_UTILITIES=>CR_LF
               LINE2'销售办事处' LINE2 ' ''销售人员' LINE2 '年度销售目标额' LINE2 '月度销售目标额' LINE2 '当月销售总金额'
               LINE2 '累计销售总金额' LINE2 '当月占月度比[%]' LINE2 '累计占年度比[%]' LINE2 CL_ABAP_CHAR_UTILITIES=>CR_LF
               LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1
               LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1
               LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1
               LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1
    INTO L_STR  .
APPEND L_STR TO I_OBJTXT.

LOOP AT ETAB.
CONCATENATE    LINE2 ETAB-BEZEI LINE2 ETAB-BEZEE  ETAB-YSALE  LINE2 ETAB-MSALE  LINE2 ETAB-ZSALE
               LINE2 ETAB-ZTOTL  LINE2 ETAB-MCALE LINE2 ETAB-YCALE LINE2 CL_ABAP_CHAR_UTILITIES=>CR_LF
               LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1
               LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1
               LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1
               LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1 LINE1
    INTO L_STR  .
  APPEND L_STR TO I_OBJTXT.
ENDLOOP.


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值