Posts

Showing posts with the label &&

Difference between Chaining operator(&&) and Literal Operator(&)

Image
Recently I talked about the Chaining Operator(&&) and how it simplifies dealing with texts and strings. I wanted to talk about a similar-looking operator with some similar functions to the chaining operator which makes it easy to confuse each other. A literal operator( & ) is used to join two or more literals to produce a single literal. However, there is a hard character length limit of 255. Example of using a literal operator: There are more features and limitations to a literal operator. Below are the points on which it's similar/different to a Chaining operator.     - Similar to the chaining operator, you can use join string templates using & .     - Any trailing blank in text field literals is preserved, unlike chaining operator.     - Can span multiline:      - Calculated at compile-time.     -  Can not have more than 255 c...

ABAP Chaining Operator && and how to use it

I am not particularly fond of the excess of the ABAP statements to achieve simple tasks and really like the new adaption to operators and predefined functions to achieve similar or sometimes better results. In line with that, this post is about my favourite, chaining operator or && . For folks who have never seen this or want to know more about it, What is a Chaining Operator? The chaining operator concatenates two operands in a string expression as a character string. It has the ability to allow string expressions, predefined functions or functional methods, and even method chaining at its operand position.  To Me, It's an upgrade over the good old CONCATENATE statement. Syntax: … operand1  && operand2 … . Below are a few examples of Chaining Operator and its usage. Simple Concatenation:  Adding Separator: Adding Different Separators in a text: Notice how effortlessly different separators can be embe...