The ABAP function STRLEN returns the length of a string up to the last character that is not a space.
help.sap.com