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

convert 2 integer quantities in one decimal quantity

Former Member
0 Likes
1,872

Hi all,

In a BW end routine, I have 2 fields A and B, both of type QUANT (length 17, digits 3), but used as integers (no coma nore dot are in it).

I want to create a decimal field which integer's part will be A and decimal's part will be the 3 first numbers of B.

examples :

A = 54247

B = 1

result must be 54247,1

A = 1

B = 54247

result must be 1,542

How can I do that ?

Thanks for your help.

7 REPLIES 7
Read only

Former Member
0 Likes
1,128

hi,

data : lv_a(5) type c,

lv_b(5) type c,

lv_total(6) type c.

concatenate lv_a ',' lv_b+0(3) into lv_total.

Thanks

Mahesh

Read only

Former Member
0 Likes
1,128

Hi,

Use "Concatenate A ',' B+0(3) into the Decimal Variable".

Regards,

Lijo Joseph

Read only

Former Member
0 Likes
1,128

Thanks both of you, I thought about that, but the compiler says that the output variable of concatenate function must be of char type.

sample :

==> CODE

DATA : res TYPE /BI0/OIQUANTITY.

Concatenate QUANTITY ',' UCQUANT+0(3) into res.

==> ERROR

E:"RES" must be a character-type data object (data type C, N, D, T or

STRING). field string)

Read only

Former Member
0 Likes
1,128

Hi Gaudet,

Please use the following code:

DATA : w_a(15) TYPE c,

w_b(15) TYPE c,

w_c TYPE p DECIMALS 3,

w_d(20) TYPE c.

MOVE : 54247 TO w_a ,

1234 TO w_b .

CONDENSE : w_a, w_b.

CONCATENATE w_a '.' w_b(3) INTO w_d.

CONDENSE w_d.

MOVE w_d TO w_c.

Thanks and Best Regards,

Vikas Bittera.

***Points for usefull answers ***

Read only

Former Member
0 Likes
1,128

Hi

First you have to remove the comma's and dots in the fields A and B

and then concatenate the fields A and B.

DATA: C(23) TYPE I,

COMMA TYPE C VALUE ','.

for removing commas and dots

UNPACK A.

UNPACK B.

then concatenate

CONCATENATE A AND B+0(3) INTO C SEPARATED BY COMMA.

try with the above logic with the available A and B values of type CURR.

Jeevi.

Read only

Former Member
0 Likes
1,128

hi

good

Try with this functiion module.

VHUMISC_CONVERT_TO_ALTERN_UNIT

thanks

mrutyun

Read only

Former Member
0 Likes
1,128

Thanks, you answeared my question.

The thing to know is that MOVE manages types conversions, and that's really helpfull.

Regards.