Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Concatanate

Former Member
0 Likes
829

Hi,

How do I concatenate two strings in Abap/4?

Thanks in advns,

Govindappa

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
765

Hi,

For all SAP Versions

STR_LENGTH = STRLEN( STRING1 ).

MOVE STRING1 TO STRING3.

WRITE STRING2 TO STRING3+STR_LENGTH.

For SAP Version 3.0 choose:

CONCATENATE STRING1 STRING2 INTO STRING3.

If you want a space between both fields:

CONCATENATE STRING1 STRING2 INTO STRING3 SEPARATED BY ' '.

For SAP Version 2.2 choose Functions:

STRING_CONCATENATE for 2 Strings and

STRING_CONCATENATE_3 for 3 Strings.

Reward points if found helpfull...

Cheers,

Chandra Sekhar.

Hi,

How do I concatenate two strings in Abap/4?

Thanks in advns,

Govindappa

5 REPLIES 5
Read only

Former Member
0 Likes
765

hi

Use concatenate statement..

EX:-

data ph(500).

concatenate

'"' po-source '";'

'"' po-company '";'

'"' po-id '";'

'"' po-linenumber '";'

'"' po-order_date '";'

'"' po-revision_date '";'

'"' po-language '";'

'"' po-company_id '";'

'"' po-supplier '";'

into ph.

Regards

Pragwal K.

Read only

arpit_shah
Contributor
0 Likes
765

hi,

do like this,

use CONCATENATE keyword

CONCATENATE <str1> <str2> 'Any Text' into str3.

or

CONCATENATE <str1> <str2> 'Any Text' into str3 separated by space.

pls give point if it is helpful to u,

Regards,

Arpit

Read only

Former Member
0 Likes
765

Hi

The CONCATENATE statement combines two or more separate strings into one.

CONCATENATE <c1> ... <cn> INTO <c> [SEPARATED BY <s>].

This statement concatenates the character fields <c1> to <cn> and assigns the result to <c>. The system ignores spaces at the end of the individual source strings.

The addition SEPARATED BY <s> allows you to specify a character field <s> which is placed in its defined length between the individual fields.

If the result fits into <c>, SY-SUBRC is set to 0. However, if the result has to be truncated, SY-SUBRC is set to 4.

DATA: C1(10) VALUE 'Sum',

C2(3) VALUE 'mer',

C3(5) VALUE 'holi ',

C4(10) VALUE 'day',

C5(30),

SEP(3) VALUE ' - '.

CONCATENATE C1 C2 C3 C4 INTO C5.

WRITE C5.

CONCATENATE C1 C2 C3 C4 INTO C5 SEPARATED BY SEP.

WRITE / C5.

Output:

Summerholiday

Sum - mer - holi - day

In C1 to C5, the trailing blanks are ignored. The separator SEP retains them.

plzz reward if it is usefull..

plzz dont forget to reward

Read only

rahul2000
Contributor
0 Likes
765

DATA:STRING1 TYPE STRING,

STRING2 TYPE STRING,

STRING3 TYPE STRING.

CODE...

CONCATENATE STRING1 STRING2 INTO STRING3.

OR

CONCATENATE STRING1 STRING2 INTO STRING3 SEPARATED BY SPACE.

C IF THIS HELPS

Read only

Former Member
0 Likes
766

Hi,

For all SAP Versions

STR_LENGTH = STRLEN( STRING1 ).

MOVE STRING1 TO STRING3.

WRITE STRING2 TO STRING3+STR_LENGTH.

For SAP Version 3.0 choose:

CONCATENATE STRING1 STRING2 INTO STRING3.

If you want a space between both fields:

CONCATENATE STRING1 STRING2 INTO STRING3 SEPARATED BY ' '.

For SAP Version 2.2 choose Functions:

STRING_CONCATENATE for 2 Strings and

STRING_CONCATENATE_3 for 3 Strings.

Reward points if found helpfull...

Cheers,

Chandra Sekhar.