SAP Function STRING_SPLIT - (Obsolete) Split a string in accordance with a delimiter.

Parameter Reference Type Length Default Optional Text
DELIMITER 0 String which is used as delimiter
STRING 0 Character string to be demounted

Parameter Reference Type Length Text
HEAD 0 Head of STRING in front of DELIMITER
TAIL 0 Tail of STRING after DELIMITER

Exception Text
NOT_FOUND Delimiter string not found
NOT_VALID Invalid delimiter string
TOO_LONG DELIMITER too long (more than 40 characters)
TOO_SMALL Output field HEAD or TAIL too short


Functionality
STRING_SPLIT splits STRING according to the delimiter sequenceDELIMITER into two parts, HEAD and TAIL:
- HEAD contains the initial part of STRING, ending with the lastcharacter before the first occurrence of DELIMITER.
- TAIL contains the end of STRING, beginning with the first characterafter the first occurrence of DELIMITER.
The character string passed on in DELIMITER is interpreted as adelimiter sequence until the first blank (uppercase/lowercasenotation is taken into account). If the blank character is to bepart of the delimiter sequence, it must be preceded by the escapesymbol '#'. If the escape symbol is to be part of the delimitersequence, '##' must be entered.
There are four exceptions:
- NOT_FOUND occurs when DELIMITER does not occur in STRING.
- NOT_VALID occurs when DELIMITER ends with one single escape symbol'#'.
- TOO_LONG occurs when the actually used length of the parameterassigned to DELIMITER is more than 40 characters.
- TOO_SMALL occurs when at least one of the two parameters passed on toHEAD and TAIL is too short.
All exceptions are generated with RAISE and must be handled in thecalling program.
Examples
STRING = ' abc-de fg*#hij '
DELIMITER = 'c-de# fg*##h'
HEAD = ' ab' and TAIL = 'ij '.
Sample call:
DATA: STR(40), DEL(10), H(30), T(30).
MOVE 'abcdefghijklmnopqrstuvwxyz' TO STR.
MOVE 'klmnop' TO DEL.
CALL FUNCTION 'STRING_SPLIT`
EXPORTING STRING = STR
DELIMITER = DEL
IMPORTING HEAD = H
TAIL = T
EXCEPTIONS NOT_FOUND = 1
NOT_VALID = 2
TOO_LONG = 3
TOO_SMALL = 4.
CASE SY-SUBRC.
WHEN '0'.
* Initial part is in H, end in T
WHEN '1'.
* DEL is not included in STR.
WHEN '2'.
* DEL is not valid (single escape symbol '#' at the end)
WHEN '3'.
* DEL is too long (longer than 40 characters)
WHEN '4'.
* The actual parameter H or T is too short.
ENDCASE.
Note
The ABAP/4 language element SPLIT string AT delimiter INTO head tailprovides the same functionality as the function module. Only theexceptions are handled differently. Also refer to the ABAP/4documentation for SPLIT.
The ABAP/4 language element provides better performance than thefunction module call.
The function module has been retained to ensure compatibility withfuture releases.
First part of STRING, ending with the last character in front ofthe first occurrence of DELIMITER.entered.