Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

UDF for Removing Single Space

Hi Experts,

The Source field SourceField1 is mapped to TargetField1 and the length of TargetField1 is of 20 characters only. Lets Suppose If I'm getting one space in the begining then it is causing the problem while generating value in Target.

Lets suppose the value in <SourceField1>00007633574593990389</SourceField1> then the exact value will go in target field, but if there a single space than I may not get the exact value (<SourceField1> 00007633574593990389</SourceField1> then <TargetField1> 0000763357459399038</TargetField1>) . Can anybody provide me UDF wherein I should check if first character is space then it should ignore it and pass correct value.



Former Member

use standard text function trim() to remove leading (in the beginning empty space) and trailing (ending) space. You dont need UDF for this.

Source field --> trim -> target field

If you want udf still same, create simple udf function pass source value as string parameter (ex str) and return value as string


public String trimString(str a){

return str.trim();


0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question