[ABAP]ABAP SQL中补齐前导零语法

ABAP中怎么在一个SQL语句中做到补齐前导零,在做表链接时是遇到这个问题,发现用SQL中预留的函数可以实现,实现方法如下。

SELECT A.RCLNT,
         A.RBUKRS,
         B.gjahr,
         B.belnr,
         B.buzei,
         A.poper,
         A.fiscyearper,
         A.budat,
         B.augdt,
         A.zuonr,
         A.lifnr,
         A.racct,
         lpad( ltrim( A.zuonr,' ' ), 10, '0' ) AS LIFNR_L,
         substring( A.zuonr,1,10 )           AS EBELN_L,
         A.EBELP,
         A.HSL
    FROM ACDOCA AS A 
    INNER JOIN BSIS AS B
      ON A.RBUKRS = B.BUKRS  AND A.gjahr  = B.gjahr
     AND A.belnr  = B.belnr  AND A.buzei  = B.buzei
     AND A.RCLNT  = B.MANDT
   WHERE AND A.RACCT LIKE 1006%' 
上一篇:ABAP 日期时间函数


下一篇:Java的字节码和ABAP load的比较