check 关键字理解

一、check 关键字

CHECK log_exp.

Effect

If the statement CHECK is executed in a loop and log_exp is incorrect, the statement CHECK immediately terminates the current loop pass and the program continues with the next loop pass. You can specify any logical expression for log_exp.

Notes

IF NOT log_exp. 
  CONTINUE. 
ENDIF.

  1. processing block (see CHECK), however we recommend using CHECK only inside loops.

Example

A loop pass is exited using CHECK if the loop index sy-index is an odd number.

DATA remainder TYPE i. 
DO 20 TIMES. 
  remainder = sy-index MOD 2. 
  CHECK remainder = 0. 
  WRITE / sy-index. 
ENDDO.


以上为帮助文档里的解释:

    简单的来说,check 分为loop内和loop外两种使用方法

当在loop内使用的时候,

loop .....

check log_exp.

.....
endloop.

这里当逻辑表达式为假的时候,则会终止check下面的语句,继续进行下一次的循环。

当逻辑表达式为真的时候,则会继续进行执行check 下面的语句。


  CHECK it_vbeln IS NOT INITIAL.  

 

这句话表示:当it_vbeln为空的时候,则会退出当前处理快,否则继续执行下面的语句

 

二、condense 关键字

CONDENSE text [NO-GAPS].

 

In the variable text, leading and closing blanks are completely removed and any other directly consecutive blanks are all replaced by exactly one space character or - if NO-GAPS is specified - are also removed completely.

The data object text must be character-type. If the data object has a fixed length, any space created by the condense operation is filled with blanks on the right. If the data object is of the type string, its length is adapted to the result of the condense operation.

Note

You can also condense a character string in an operand position using a condensation function which covers the functionality of the CONDENSE statement.

对于text字符串,condense的功能就是将两个字符之间的一连串空格用一个空格代替,如果加上 no-gaps 则表示去除所有的空格

转载于:https://www.cnblogs.com/bailang-LBG/articles/3801106.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值