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

space issue

Former Member
0 Likes
702

hi,

how we can define more spaces between two variables in output .

for ex: i neeed output as

Var1 Var2 but it is coming as

Var1 Var2 ,

how we can pls

THX

6 REPLIES 6
Read only

Former Member
0 Likes
680

you can use

write: 10 var1 ,40 var2

plz reward if useful

vivek

Read only

Former Member
0 Likes
680

Hi,

If you want the space in output then use offset to get space between fields see below code...

WRITE: / wa-matnr, 20 wa-maktx, 66 wa-werks.......

Rgds,

Bujji

Read only

0 Likes
680

but i need to use space while concatenating two variables

How ?

Read only

0 Likes
680

hi Chaaya,

in SAP ABAP if you wish to concatenate 2 or 3 strings together then you can use the following function module.

STRING_CONCATENATE_3

The above mentioned function module excepts 3 strings and concatenates them into 1. Please see the example given below.

REPORT ZEX_STRINGCON .

parameters: p_str1(100),

p_str2(100),

p_str3(100).

Data: d_str(500).

CALL FUNCTION 'STRING_CONCATENATE_3'

EXPORTING

STRING1 = p_str1

STRING2 = p_str2

STRING3 = p_str3

IMPORTING

STRING = d_str

EXCEPTIONS

TOO_SMALL = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Write: d_str.

If the input is as follows.

p_str1 = 'This'

p_str2 = 'Is'

p_str3 = 'ABAP'

The output would be as follows.

String Concatenate

THISISABAP

i hope this helps...

do reward if helpful or get back with further queries.

Read only

0 Likes
680

hi

u can declare a variable tab = ' '.

data tab(5) type c.

concatenate str1 str2 into <var> separated by tab.

Read only

Former Member
0 Likes
680

Hi,

Take a new variable or constant with length what you need for your concatenate statement and fill with space like in the below said way. Then make spaces with in the single quotes with ALT+0160 (Press alt key in you key board and clik on 0160 in your key board which equals to one space).

Rgds,

Bujji