SAP CDS SQL FUNCTIONS CHARACTER V1



Get Example source ABAP code based on a different SAP table
  


• CONCAT ABAP_CDS_FUNCTION_V1
• LPAD ABAP_CDS_FUNCTION_V1
• REPLACE ABAP_CDS_FUNCTION_V1
• SUBSTRING ABAP_CDS_FUNCTION_V1
• LENGTH ABAP_CDS_FUNCTION_V1
• RTRIM ABAP_CDS_FUNCTION_V1
• LTRIM ABAP_CDS_FUNCTION_V1
• RIGHT ABAP_CDS_FUNCTION_V1
• CONCAT_WITH_SPACE ABAP_CDS_FUNCTION_V1
• INSTR ABAP_CDS_FUNCTION_V1
• LEFT ABAP_CDS_FUNCTION_V1
• RPAD ABAP_CDS_FUNCTION_V1
• LOWER ABAP_CDS_FUNCTION_V1
• UPPER ABAP_CDS_FUNCTION_V1

ABAP_CDS_DDL - DDIC-Based View, String Functions
The following table shows the possible SQL functions for character strings in a ABAP_CDS_V1_VIEW , plus the requirements made on the arguments. FunctionResultValid Argument TypesResult Type
CONCAT(arg1, arg2)Concatenates strings in arg1 and arg2. Trailing blanks in arg1, arg2, and in the result are ignored. The maximum length of the result is 1333.See below SSTRING if an argument has the type SSTRING, else CHAR with the length of the result.
CONCAT_WITH_SPACE(arg1, arg2, spaces ) Concatenates strings in arg1 and arg2 as with CONCAT. The number of blanks specified in spaces is inserted between arg1 and arg2. The maximum length of the result is 1333. arg1, arg2: see below lbr lbr spaces: positive numeric literal greater than 0 and less than or equal to 1333SSTRING if an argument has the type SSTRING , else CHAR with the length of the result.
INSTR(arg, sub) Position of the first occurrence of the string from sub in arg (case-sensitive). arg respects leading blanks and ignores trailing blanks. sub respects all blanks. sub must contain at least one character. If no occurrences are found, the result is 0. arg: see below lbr lbr sub : non-empty character literal INT4
LEFT(arg, len) String of the length len with the len left characters of arg (ignoring the trailing blanks). The value of len cannot be greater than the length of arg. arg: see below lbr lbr len: positive numeric literal greater than 0 and less than or equal to 1333 SSTRING if arg has the type SSTRING, else CHAR with length len
LENGTH(arg) Number of characters in arg ignoring trailing blanks See below INT4
LOWER( arg ) String with a length of arg, in which all uppercase letters are transformed to lowercase letters See below, with the exception of NUMC , DATS, and TIMSData type of arg in the length of arg
LPAD(arg, len, src) String of the length len with the right-aligned content of arg without trailing blanks and in which leading blanks produced by the expanded string are replaced by the characters from the argument src (respecting all blanks). Leading blanks from arg are preserved. If more characters are required than exist in src, the content of src is used repeatedly. If len is less than the length of arg, it is truncated on the right. If src is empty and len is greater than the length of arg, arg remains unchanged. arg : see below lbr lbr len: positive numeric literal greater than 0 and less than or equal to 1333 lbr lbr src: Character literal SSTRING if arg has the type SSTRING, else CHAR with length len
LTRIM(arg, char) String with the content of arg in which all trailing blanks and leading characters are removed that match the character in char. A blank in char is significant. arg: see below lbr lbr char : Character literal with length 1 SSTRING if arg has the type SSTRING , else CHAR with the length of arg.
REPLACE(arg1, arg2, arg3) String arg1, in which all instances of arg2 are replaced by the content from arg3. The replacement of letters is case-sensitive. Trailing blanks are ignored in all arguments. The maximum length of the result is 1333 See belowSSTRING if arg1 or arg3 has the type SSTRING , else CHAR with the maximum possible length of the result.
RIGHT(arg,len) String of the length len with the len right characters of arg (ignoring the trailing blanks). The value of len cannot be greater than the length of arg. arg: see below lbr lbr len: positive numeric literal greater than 0 and less than or equal to 1333 SSTRING if arg has the type SSTRING, else CHAR with length len
RPAD(arg, len, src) String of the length len with the left-aligned content of arg without trailing blanks and in which trailing blanks produced by the expanded string are replaced by the characters from the argument src (respecting all blanks). Leading blanks from arg are preserved. If more characters are required than exist in src, the content of src is used repeatedly. If len is less than the length of arg, it is truncated on the right. If src is empty and len is greater than the length of arg, arg remains unchanged. arg : see below lbr lbr len: positive numeric literal greater than 0 and less than or equal to 1333 lbr lbr src: Character literal SSTRING if arg has the type SSTRING, else CHAR with length len
RTRIM(arg, char) String with the content of arg in which all trailing blanks are removed and all trailing characters that match the character in char. A blank in char is significant.arg: see below lbr lbr char : Character literal with length 1 SSTRING if arg has the type SSTRING , else CHAR with the length of arg.
SUBSTRING(arg, pos, len) Substring arg from the position pos with length len . pos and len must be specified so that the substring is within arg. arg: see below lbr lbr pos and len: positive numeric literals not equal to zero SSTRING if arg has the type SSTRING, else CHAR or NUMC with length of at lest len
UPPER( arg ) String with a length of arg, in which all lowercase letters were transformed to uppercase letters See below, with the exception of NUMC , DATS, and TIMSData type of arg in the length of arg