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

Abap general

Former Member
0 Likes
674

Hi,

I have one varible which having 13th in length and type is char. I am using this varible to store amount.Now i am storing this amount in right justifield.Now i have to replace my space before amount with '0'.

Ex.

Input : ________15000,00

output: 000000001500.00

Please help me it's argent.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
646

kya guru bhai...simple hai na

just take it as a text it will get converted man...

no problem ok

5 REPLIES 5
Read only

Simha_
Product and Topic Expert
Product and Topic Expert
0 Likes
646

Hi,

Use 'REPLACE ' statement to replace all the spaces with ZERO.

Cheers,

Simha.

Read only

Former Member
0 Likes
647

kya guru bhai...simple hai na

just take it as a text it will get converted man...

no problem ok

Read only

Former Member
0 Likes
646

Hi

Use the conversion exit CONVERSION_EXIT_ALHPA_INPUT.

it will append the zeroes.

Regards

Preeti

Read only

0 Likes
646

for this take the type as any currency field instead of char and also while outputting with write statement use currency addition.

<b>Rewards points if help full</b>

Read only

Former Member
0 Likes
646

Hi,

Try the follwoing:

use replace statement.

OR do the follwoing

e.g.:


DATA: var1(12) type c,
           var2(2)  type c,
           var3(15) type c,
           amount type netwr.

constants: dot(1) type c value '.'.

Split amount at ',' into var1 var2.

Now use the conversion exit:
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    input         = var1
 IMPORTING
   OUTPUT        =var1.

Now concatenate the variables var1 & var2.

concatenate var1 dot var2 into var3.

Now the var3 will be having the value like 000000015000.00.

Reward points if helpful answer.

Ashvender.