Application Development 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: 

right justify character

Former Member
0 Kudos

hi All,

I am having a requirement. client wants to download a record into a .txt file. now the record is AAAASPACEBBBBBDDDD.

now the problem is DDDD is decimal value and i m converting it to character. however though now the client wants the record such as the field DDDD should be right justfied. now i can right justify if decimal value but since i have converted it to character so that i can use concatenate and write to a file on Pc, i am not able to right justify it.

can someone give me some suggestions,

thanks,

gaurav

1 ACCEPTED SOLUTION

Former Member
0 Kudos

When you write the decimasl to the character field:


WRITE f_d to itab-f_c RIGHT-JUSTIFIED.

Rob

2 REPLIES 2

Former Member
0 Kudos

Hi,

Try with this code.

Data: v_string type string.

Data: v_len type i.

Data: v_int(10) type n.

Data: v_char(10) type c.

CONSTANTS c_six(6) type c value ' '.

v_string = 'Amandeep Sharma1981'.

v_len = strlen( v_string ).

v_len = v_len - 4.

v_int = v_string+v_len(4).

v_char = v_int.

v_char+0(6) = c_six.

Concatenate v_string+0(v_len) v_char into v_string.

I have taken your numerical value as 4 characters. you can modify as and how you want.

Regards,

Aman

Former Member
0 Kudos

When you write the decimasl to the character field:


WRITE f_d to itab-f_c RIGHT-JUSTIFIED.

Rob