2008 Jan 12 5:34 AM
Hi,
How do I concatenate two strings in Abap/4?
Thanks in advns,
Govindappa
2008 Jan 12 8:26 AM
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
2008 Jan 12 5:36 AM
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.
2008 Jan 12 5:37 AM
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
2008 Jan 12 6:16 AM
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
2008 Jan 12 6:43 AM
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
2008 Jan 12 8:26 AM
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.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |