ABAP顾问
分类:
2009-10-08 18:33:58
REPORT Z_BARRY_TEST NO STANDARD PAGE HEADING .
DATA: CHAR(20) TYPE C .
CHAR = 'abc def'.
**方法一
DATA: LEN TYPE I .
LEN = STRLEN( CHAR ).
IF LEN > 0 .
IF CHAR+0(LEN) CA SPACE.
WRITE 'Yes'.
ELSE.
WRITE 'No'.
ENDIF.
* TRANSLATE CHAR+0(LEN) USING ' _'.
ELSE.
WRITE 'Initial'.
ENDIF.
*方法二
DATA: STR TYPE STRING .
STR = CHAR.
IF STR CA SPACE.
WRITE / 'Yes'.
ELSEIF STR IS INITIAL.
WRITE / 'Initial'.
ELSE.
WRITE / 'No'.
ENDIF.