Process Internal DataByte String and Character String Processing
SPLIT 拆分子串
Process Internal DataByte String and Character String Processing
SPLIT 拆分子串
CONCATENATE 连接字符串 [SEPARATED BY 分割符]
find
SPLIT 拆分子串
------------------------------------------------------
取前八位
data a type c(30).
a = '88888888abcdefg'.
a = a(6). "取前6位
a = a+6(1). "取第7位
a = a+6 . "取第六位后的所有字符
a = a+6(1). "取第7位
a = a+6 . "取第六位后的所有字符
-------------------------------------------------------
拆分
split XXX at into table XXX
SPLIT dobj AT sep INTO
{ {result1 result2 ...} | {TABLE result_tab} }
[IN {BYTE|CHARACTER} MODE].
SPLIT dobj AT sep INTO
{ {result1 result2 ...} | {TABLE result_tab} }
[IN {BYTE|CHARACTER} MODE].
--------------------------------------------------------
拼接
DATA NAME (30).
NAME(10) = ' Dr.',
NAME+10(10) = 'Michael',
NAME+20(10) = 'Hofmann'.
CONDENSE NAME.
WRITE NAME.
NAME(10) = ' Dr.',
NAME+10(10) = 'Michael',
NAME+20(10) = 'Hofmann'.
CONDENSE NAME.
WRITE NAME.
-------------------------------------------------------
去空格
CONDENSE
-------------------------------------------------------
查找
Search for all occurrences of the string "now" in a string literal using a WHILE loop. After every successful search, the search range is redefined to start after the found location. This enables you to find all occurrences of the search string even in releases before 7.0.
DATA: patt TYPE string VALUE `now`,
text TYPE string,
off TYPE i,
moff TYPE i,
mlen TYPE i.
text TYPE string,
off TYPE i,
moff TYPE i,
mlen TYPE i.
off = 0.
WHILE sy-subrc = 0.
FIND patt IN SECTION OFFSET off OF
`Everybody knows this is nowhere`
MATCH OFFSET moff
MATCH LENGTH mlen.
IF sy-subrc = 0.
WRITE / moff.
off = moff + mlen.
ENDIF.
ENDWHILE.
------------------------------------------------------------
WHILE sy-subrc = 0.
FIND patt IN SECTION OFFSET off OF
`Everybody knows this is nowhere`
MATCH OFFSET moff
MATCH LENGTH mlen.
IF sy-subrc = 0.
WRITE / moff.
off = moff + mlen.
ENDIF.
ENDWHILE.
------------------------------------------------------------
补零
数字前补零
用途:
在查语句中,'00006' 和 '6' 是不同的字符,
而SAP会自动将查询条件变量前面的零去掉。导致查询条件不正确,
这时候要用CONVERSION_EXIT_ALPHA_INPUT进行补零。
用途:
在查语句中,'00006' 和 '6' 是不同的字符,
而SAP会自动将查询条件变量前面的零去掉。导致查询条件不正确,
这时候要用CONVERSION_EXIT_ALPHA_INPUT进行补零。
call function 'CONVERSION_EXIT_ALPHA_INTPUT'
exporting
input = &1
importing
output = &1.
注意:变量类型要与数据库字段类型一直,否则补零的位数不正确。
exporting
input = &1
importing
output = &1.
注意:变量类型要与数据库字段类型一直,否则补零的位数不正确。
去零
数字前去零
用途:
在输出的时候,'00006' 和 '6' 是不同的字符,要求把前面的零去掉
这时候要用CONVERSION_EXIT_ALPHA_OUTPUT进行去零。
------------------------------------------------------------
用途:
在输出的时候,'00006' 和 '6' 是不同的字符,要求把前面的零去掉
这时候要用CONVERSION_EXIT_ALPHA_OUTPUT进行去零。
call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
exporting
input = &1
importing
output = &1.
exporting
input = &1
importing
output = &1.
------------------------------------------------------------
字符串长度
strlen( char_var )
------------------------------------------------------------
回车符
A Virtual Characterstic is a normal Characterstic,The Only difference is the data will be Updated at the time of Query Execution.Just Create a Characterstic add this Char to the Cube.You need to write some ABAP Code to Update this Char.
You will find the Doumentation and Example in SMOD for Virtual Characterstics and Keyfigures.
for Documentation and Example.
Goto Tcode SMOD -> Enter Enhancement as RSR00002 ,Select the Radio button Documentation -> Click on Display
You will find the Doumentation and Example in SMOD for Virtual Characterstics and Keyfigures.
for Documentation and Example.
Goto Tcode SMOD -> Enter Enhancement as RSR00002 ,Select the Radio button Documentation -> Click on Display
用sap的类CL_ABAP_CHAR_UTILITIES( TYPE-POOLS: abap.).
CL_ABAP_CHAR_UTILITIES中有字符常量:如:CR_LF,HORIZONTAL_TAB,NEWLINE等等.
CL_ABAP_CHAR_UTILITIES中有字符常量:如:CR_LF,HORIZONTAL_TAB,NEWLINE等等.
-------------------------------------------------
是否全是数字
if aaa CO '01234567888889 '.
---------------------------------------------------
数学函数
ABAP 代码编辑器中 strlen F1。
ABAP - Keyword documentation
ABAP By Theme
Built-in Type, Data Objects, and Functions
Built-in Functions
Mathematical Functions
ABAP By Theme
Built-in Type, Data Objects, and Functions
Built-in Functions
Mathematical Functions
------------------------------------------------------------
Process Internal DataByte String and Character String Processing
CONCATENATE 连接字符串 [SEPARATED BY 分割符]
find
SPLIT 拆分子串
------------------------------------------------------
取前八位
data a type c(30).
a = '88888888abcdefg'.
a = a(6). "取前6位
a = a+6(1). "取第7位
a = a+6 . "取第六位后的所有字符
a = a+6(1). "取第7位
a = a+6 . "取第六位后的所有字符
-------------------------------------------------------
拆分
split XXX at into table XXX
SPLIT dobj AT sep INTO
{ {result1 result2 ...} | {TABLE result_tab} }
[IN {BYTE|CHARACTER} MODE].
SPLIT dobj AT sep INTO
{ {result1 result2 ...} | {TABLE result_tab} }
[IN {BYTE|CHARACTER} MODE].
--------------------------------------------------------
拼接
DATA NAME (30).
NAME(10) = ' Dr.',
NAME+10(10) = 'Michael',
NAME+20(10) = 'Hofmann'.
CONDENSE NAME.
WRITE NAME.
NAME(10) = ' Dr.',
NAME+10(10) = 'Michael',
NAME+20(10) = 'Hofmann'.
CONDENSE NAME.
WRITE NAME.
-------------------------------------------------------
去空格
CONDENSE
-------------------------------------------------------
查找
Search for all occurrences of the string "now" in a string literal using a WHILE loop. After every successful search, the search range is redefined to start after the found location. This enables you to find all occurrences of the search string even in releases before 7.0.
DATA: patt TYPE string VALUE `now`,
text TYPE string,
off TYPE i,
moff TYPE i,
mlen TYPE i.
text TYPE string,
off TYPE i,
moff TYPE i,
mlen TYPE i.
off = 0.
WHILE sy-subrc = 0.
FIND patt IN SECTION OFFSET off OF
`Everybody knows this is nowhere`
MATCH OFFSET moff
MATCH LENGTH mlen.
IF sy-subrc = 0.
WRITE / moff.
off = moff + mlen.
ENDIF.
ENDWHILE.
------------------------------------------------------------
WHILE sy-subrc = 0.
FIND patt IN SECTION OFFSET off OF
`Everybody knows this is nowhere`
MATCH OFFSET moff
MATCH LENGTH mlen.
IF sy-subrc = 0.
WRITE / moff.
off = moff + mlen.
ENDIF.
ENDWHILE.
------------------------------------------------------------
补零
数字前补零
用途:
在查语句中,'00006' 和 '6' 是不同的字符,
而SAP会自动将查询条件变量前面的零去掉。导致查询条件不正确,
这时候要用CONVERSION_EXIT_ALPHA_INPUT进行补零。
注意:变量类型要与数据库字段类型一直,否则补零的位数不正确。
用途:
在查语句中,'00006' 和 '6' 是不同的字符,
而SAP会自动将查询条件变量前面的零去掉。导致查询条件不正确,
这时候要用CONVERSION_EXIT_ALPHA_INPUT进行补零。
注意:变量类型要与数据库字段类型一直,否则补零的位数不正确。
去零
数字前去零
用途:
在输出的时候,'00006' 和 '6' 是不同的字符,要求把前面的零去掉
这时候要用CONVERSION_EXIT_ALPHA_OUTPUT进行去零。
------------------------------------------------------------
用途:
在输出的时候,'00006' 和 '6' 是不同的字符,要求把前面的零去掉
这时候要用CONVERSION_EXIT_ALPHA_OUTPUT进行去零。
------------------------------------------------------------
字符串长度
strlen( char_var )
------------------------------------------------------------
回车符
A Virtual Characterstic is a normal Characterstic,The Only difference is the data will be Updated at the time of Query Execution.Just Create a Characterstic add this Char to the Cube.You need to write some ABAP Code to Update this Char.
You will find the Doumentation and Example in SMOD for Virtual Characterstics and Keyfigures.
for Documentation and Example.
Goto Tcode SMOD -> Enter Enhancement as RSR00002 ,Select the Radio button Documentation -> Click on Display
You will find the Doumentation and Example in SMOD for Virtual Characterstics and Keyfigures.
for Documentation and Example.
Goto Tcode SMOD -> Enter Enhancement as RSR00002 ,Select the Radio button Documentation -> Click on Display
用sap的类CL_ABAP_CHAR_UTILITIES( TYPE-POOLS: abap.).
CL_ABAP_CHAR_UTILITIES中有字符常量:如:CR_LF,HORIZONTAL_TAB,NEWLINE等等.
CL_ABAP_CHAR_UTILITIES中有字符常量:如:CR_LF,HORIZONTAL_TAB,NEWLINE等等.
-------------------------------------------------
是否全是数字
if aaa CO '01234567888889 '.
---------------------------------------------------
数学函数
ABAP 代码编辑器中 strlen F1。
ABAP - Keyword documentation
ABAP By Theme
Built-in Type, Data Objects, and Functions
Built-in Functions
Mathematical Functions
ABAP By Theme
Built-in Type, Data Objects, and Functions
Built-in Functions
Mathematical Functions
------------------------------------------------------------
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/190059/viewspace-476664/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/190059/viewspace-476664/