Substring in ABAP

 * This function is used to split the string into sub strings.

Code

REPORT zab_rp_substring.

DATA: str1 TYPE string VALUE 'abcdefghi',
      str2 TYPE string.

str2 substringval str1 off len ).
WRITE: 'substring: 'str2 COLOR 1.       " cde

str2 substring_fromval str1 sub 'd' ).
WRITE'substring from: 'str2 COLOR 2.      " defghi

str2 substring_afterval str1 sub 'd' ).
WRITE: 'substring after: 'str2 COLOR 3.      " efghi

str2 substring_beforeval str1 sub 'd' ).
WRITE'substring before: 'str2 COLOR 4.      " abc

str2 substring_toval str1 sub 'd' ).
WRITE: 'substring to: 'str2 COLOR 5.      " abcd


Output



*****************Thank You****************

Comments

Popular posts from this blog

Add custom tab to me51n at item level in ABAP

New syntax for append- VALUE (new syntax 7.4+) in ABAP

Pf status and user command in factory method - OOPS ALV in ABAP