2006 Feb 14 6:10 AM
hi frnds,
my requirement is like this...
i have 2 variables..
C1(10) type c, C2(10) type c, c3(20) type c.
C1 = 'SAP'.
C2 = 'ABAP'.
concatenate c1 c2 to c3.
now my problem is that the concatenation occurs like 'SAPABAP. but i want it with spaces between sap and abap and the no.of spaces should be 7. ( 10 - no. of characters ). like ' SAP ABAP' . IF i use 'seperated by' it gives just 1 space. more ever the values of C1 and C2 are dynamic..
i tried substrings also. butno use..
any suggestins??
points for each and every reply......
regards,
Madan.
2006 Feb 14 6:19 AM
Hi,
Try this.
data : v1(10) type c value 'SAP',
v2(10) value 'ABAP',
v3(20).
v3+0(10) = v1.
v3+10(9) = v2.
write v3.
hi frnds,
my requirement is like this...
i have 2 variables..
C1(10) type c, C2(10) type c, c3(20) type c.
C1 = 'SAP'.
C2 = 'ABAP'.
concatenate c1 c2 to c3.
now my problem is that the concatenation occurs like 'SAPABAP. but i want it with spaces between sap and abap and the no.of spaces should be 7. ( 10 - no. of characters ). like ' SAP ABAP' . IF i use 'seperated by' it gives just 1 space. more ever the values of C1 and C2 are dynamic..
i tried substrings also. butno use..
any suggestins??
points for each and every reply......
regards,
Madan.
2006 Feb 14 6:12 AM
Madan,
Use like this
CONCATENATE C1 C2 INTO C3 SEPARATED BY SPACE.
REGARDS,
RAVI
2006 Feb 14 6:14 AM
HI ,
use
data : sep(7).
data : dat(3) value 'SAP' , dat1(4) value 'ABAP',dat2(20).
concatenate dat dat1 into dat2 separated by sep.
write : dat2.
this works well
regards
satesh
2006 Feb 14 6:19 AM
Hi,
Try this.
data : v1(10) type c value 'SAP',
v2(10) value 'ABAP',
v3(20).
v3+0(10) = v1.
v3+10(9) = v2.
write v3.
2006 Feb 14 6:26 AM
Tanx a lot ... seems to work now... will get back to u if any issues :)-..
regrds,
Madan..
2006 Feb 14 6:23 AM
Madan this will work out...
If you want a space between both fields:
CONCATENATE STRING1 STRING2 INTO STRING3 SEPARATED BY ' '.
regards
Srikanth
2006 Feb 14 6:30 AM
If you need seven spaces between the words...try this...
STRING1 = 'SAP'.
STRING2 = '///////'.
STRING3 = 'ABAP'.
CONCATENATE STRING1 STRING2 STRING3 INTO STRING4.
WHILE SY-SUBRC EQ 0.
REPLACE '/' WITH SPACE INTO STRING4.
ENDWHILE.
Greetings,
Blag.
2006 Feb 14 7:12 AM
MOVE: ' Find out the string length in a fast way'
TO SY-TITLE.
PARAMETERS: P_STRING(10) DEFAULT 'abitrary string 1 ...... '
LOWER CASE.
PARAMETERS: P_STRNG1(10) DEFAULT 'abitrary string 2 ...... '
LOWER CASE.
PERFORM STRINGLAENGE.
FORM STRINGLAENGE.
IF P_STRING CP '*# '. ENDIF. " SY-FDPOS is set
|||
|||----> ' ' = only blanks up to end of line
||-----> # = character for blanks
|------> * = any character
IF P_STRNG1 CP '*# '. ENDIF. " SY-FDPOS is set
|||
|||----> ' ' = only blanks up to end of line
||-----> # = character for blanks
|------> * = any character
WRITE: /1 p_string ,' ',p_strng1.
ENDFORM.