How to used the utility SPLIT statement? Explain with an example. Splitting Character Strings: To split a character string into two or more smaller strings, use the SPLIT statement as follows: SPLIT c AT del INTO c1 ... cn. The system searches the field c for the separator del.
The parts before and after the separator are placed in the target fields
c1 ... cn.
If all target fields are long enough and no fragment has to be truncated, sy-subrc is set to 0. Otherwise it is set to 4. DATA: string(60) TYPE c,
SPLIT string AT del INTO p1 p2 p3 p4.
The output appears as follows: Part 1 *** Part 2 *** Part 3 *** Part 4 *** Part 5
Note that the contents of the fields p1 ...p4 are totally overwritten and that they are filled out with trailing blanks. You can also split a string into the individual lines
of an internal table as follows:
Get help for your ABAP problems
ABAP Books
More ABAP Tips
SAP Basis, ABAP Programming and Other IMG Stuff http://www.erpgreat.com All the site contents are Copyright © www.erpgreat.com
and the content authors. All rights reserved.
|