zoukankan      html  css  js  c++  java
  • SHIFT 去掉前导0,SHIFT语法

    SHIFT str LEFT DELETING LEADING '0'.
    如果要在layout显示不出前面的0 格式:
    &字段(zc)&
    如果要在layout显示不出小数点后面的0 格式: &字段(.0)&
    关于shift
    1.Shift a structure by a given number of
    postions
    SHIFT <c> [BY <n> PLACES] [<mode>].
    This
    statement shifts the field <c> by <n> positions. If you omit BY
    <n> PLACES, <n> is
    interpreted as one. If <n> is 0 or
    negative, <c> remains unchanged. If <n> exceeds the
    length
    <c>, <c> is padded with blanks. <n> can be
    variable.
    With the different (<mode>) options, you can shift the field
    <c> in the following ways:
    · LEFT:
    Shift <n> positions to the
    left and pad with <n> blanks on the right (default setting).
    ·
    RIGHT:
    Shift <n> positions to the right and pad with <n> spaces
    on the left.
    · CIRCULAR:
    Shift <n> positions to the left so that
    <n> characters on the left appear on the right.
    2.Shift a structure up
    to a given string
    To shift field contents up to a given string, use the SHIFT
    statement as follows
    Syntax
    SHIFT <c> UP TO <str>
    <mode>.
    ABAP searches the field contents of <c> until it finds
    the string <str> and shifts the field <c> up to
    the field margin.
    The (<mode>) options are the same as described in the section Shifting
    a
    Structure by a Given Number of Positions [Page 201]. <str> can be a
    variable.
    If <str> is not found in <c>, SY-SUBRC is set to 4 and
    <c> is not shifted. Otherwise, SY-SUBRC is set to 0.
    3.Shifting a
    structure according to the first or last character
    You can use the SHIFT
    statement to shift a field to the left or to the right, provided the first or
    last
    character satisfies a certain condition. To do this, use the following

    syntax:
    SHIFT <c> LEFT DELETING LEADING <str>.
    SHIFT
    <c> RIGHT DELETING TRAILING <str>.

    SHIFT dobj [ {[places] [direction]} |deleting]            [IN {BYTE|CHARACTER} MODE].

    1 SHIFT dobj

    向左移动一位(一个汉字、一个数字或者一个字符)

    2 SHIFT dobj BY num PLACES LEFT|RIGHT.

    向左或者向右移动num位,默认值是向左。

    3  SHIFT dobj LEFT DELETING LEADING pattern.从左开始比较并向左移动,

       SHIFT dobj RIGHT DELETING TRAILING pattern. 从左开始比较并向左移动。

    例如: c = '12345678'. shift c RIGHT DELETING TRAILING '768'. 结果 12345

  • 相关阅读:
    mkconfig文件里的"cat << EOF >> config.h"
    (ARM v7)信号量、互斥体代码追踪
    (ARM v7)自旋锁、读写锁、顺序锁代码追踪
    mac 系统上安装navicat
    git2consul配置管理工具使用教程
    Spring Cloud Feign如何上传文件
    spring-cloud feign的多参数传递方案
    Consul下载安装及运行教程
    比SecureCRT更好用的工具MobaXterm下载安装使用教程
    Linux下RocketMQ下载安装教程
  • 原文地址:https://www.cnblogs.com/hanmos/p/3028672.html
Copyright © 2011-2022 走看看