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

Removing leading spaces for type P variable

Former Member
0 Likes
1,659

Hi,

I am declaring the 2 variables as type P. The below code was working fine, But our client, wants to remove the leading spaces for these variables,

v_lower(16) TYPE p DECIMALS 2,

v_upper(16) TYPE p DECIMALS 2.

v_lower = i_plmk-toleranzun.

v_upper = i_plmk-toleranzob.

i_output-toleranzun = v_lower.

i_output-toleranzob = v_upper.

Can any one suggest how can we achieve this. Is there any function module for achieving this.

Thanks In Advance,

Regards,

Ramana Trapatla.

Hi,

I am declaring the 2 variables as type P. The below code was working fine, But our client, wants to remove the leading spaces for these variables,

v_lower(16) TYPE p DECIMALS 2,

v_upper(16) TYPE p DECIMALS 2.

v_lower = i_plmk-toleranzun.

v_upper = i_plmk-toleranzob.

i_output-toleranzun = v_lower.

i_output-toleranzob = v_upper.

Can any one suggest how can we achieve this. Is there any function module for achieving this.

Thanks In Advance,

Regards,

Ramana Trapatla.

6 REPLIES 6
Read only

Former Member
0 Likes
1,046

Hi,

If your question was in the context of displaying data of type p without the leading space, then you can use left-justified addtion to your write statement.


data: val(10) type p decimals 2.
val = '0000000123.43'.
write: val LEFT-JUSTIFIED.

Regards,

Vikranth

Read only

0 Likes
1,046

refer to the following code.

data : var(10) TYPE p DECIMALS 2,

var_char TYPE string.

var = '10.20'.

var_char = var.

condense var_char..

WRITE : / var_char.

Read only

Former Member
0 Likes
1,046

Hi,

Use CONDENSE statement for your variable V_UPPER and V_LOWER.

Asha

Read only

venkat_o
Active Contributor
0 Likes
1,046

Hi, Use below statement to take out leading spaces.


WRITE I_OUTPUT-TOLERANZUN TO V_LOWER LEFT-JUSTIFIED.
WRITE I_OUTPUT-TOLERANZOB TO V_UPPER LEFT-JUSTIFIED.
Thanks Venkat.O

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
1,046

Trylikke this

Syntax

... { {LEFT DELETING LEADING} | {RIGHT DELETING TRAILING} } pattern ... .

DATA text TYPE string VALUE `I know you know`.

SHIFT text RIGHT DELETING TRAILING 'no kw'.

Regards,

Sreeram

Read only

Former Member
0 Likes
1,046

Resolved by Myself