SAP StackFICOHRMMSDPMPSABAPNetWeaverTablesTcodes ☰MENU

ABAP CONCATENATE strings

CONCATENATE statement in ABAP is used for concatenating two or more strings into a single string.

Syntax:

CONCATENATE <c1>… <cn> INTO <c>

[ SEPARATED BY <s> ]

[IN BYTE MODE|IN CHARACTER MODE]

[RESPECTING BLANKS].

See the details and effects of each additions used with this statement

SEPARATED BY: This addition is used for insert a character (or string) between the strings used for concatenating. See the following example

DATA: NAME(10)   VALUE ‘John’,

COUNTRY(10)    VALUE ‘INDIA’,

CITY(10) VALUE ‘DELHI’,

ADDRESS(50).

CONCATENATE NAME COUNTRY CITY INTO ADDRESS SEPARATED BY SPACE.

 

Now the filed ADDRESS will have the value:  John INDIA DELHI

You can see that all the three strings are combined and inserted a space in between each of these strings and stored as a single string in the field ADDRESS.

 

IN BYTE MODE|IN CHARACTER MODE: This addition is used for specifying whether character string or byte string processing is performed. By default string processing will be performed.

RESPECTING BLANKS: This addition is used for specifying “not to avoid the spaces at end of each string”. Be default the trailing spaces will ignore. You will understand the difference after seeing the following sample program.

DATA: NAME(10)   VALUE ‘John’,

COUNTRY(10)    VALUE ‘INDIA’,

CITY(10) VALUE ‘DELHI’,

ADDRESS(50).

CONCATENATE NAME COUNTRY CITY INTO ADDRESS RESPECTING BLANKS.

Now the field ADDRESS will contains the value

John      INDIA     DELHI

 

Here we have specified the NAME field with length 10, and assigned value John has only 4 characters. In the combined string you can watch the 6 blank spaces at the end of string. In the previous example we can see that the end blank spaces are ignored.

Also Read : View Other ABAP Keywords & Syntax -> ABAP Transaction codes

SAP ALECRMSCMSRMSAP Solutions SAP ReferencesSAP BasicsPP ModuleWMSAP Partners
HomeContact & Privacy PolicyTwitter
All of the product names here are trademarks of their respective companies. The site sapstack.com is not affiliated with SAP AG.
©2024 sapstack.com