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

Fill variable with blank spaces

Former Member
0 Likes
2,214

Hi,

Im trying to fill a variable type c with blank spaces before the content, but it just wont work.

For example:

var(10) type c.

concatenate ' ' '12345' into var.

And when i run the program in debug mode, after the concatenate it still shows the value '12345' and the blank spaces are gone.

Could anybody tell me how to make this work, please?

Regards,

Roberto.

1 ACCEPTED SOLUTION
Read only

naimesh_patel
Active Contributor
0 Likes
1,208

Try with this:

REPORT ZTEST_NP.

data: var(10) type c.

var = '12345'.

shift var right deleting trailing space.

write: var.

Regards,

Naimesh Patel

Hi,

Im trying to fill a variable type c with blank spaces before the content, but it just wont work.

For example:

var(10) type c.

concatenate ' ' '12345' into var.

And when i run the program in debug mode, after the concatenate it still shows the value '12345' and the blank spaces are gone.

Could anybody tell me how to make this work, please?

Regards,

Roberto.

4 REPLIES 4
Read only

Former Member
0 Likes
1,208

Hi,

do like this

data: var(15) type c.

constatnts: gc_space type c value ' '.

concatenate ' ' '12345' gc_space ' ' '12345' into var.

Reward points if it helps,

Satish

Message was edited by:

Satish Panakala

Read only

naimesh_patel
Active Contributor
0 Likes
1,209

Try with this:

REPORT ZTEST_NP.

data: var(10) type c.

var = '12345'.

shift var right deleting trailing space.

write: var.

Regards,

Naimesh Patel

Read only

Former Member
0 Likes
1,208

Hi,

Please try this.


DATA: VAR(10) TYPE C.
                                                                        
WRITE '12345' TO VAR RIGHT-JUSTIFIED.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
1,208

Thanx for your answers.

"Shift var right deleting trailing space" solved the problem

I'll reward every helpful answer.