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

character to quantity

Former Member
0 Likes
831

Hi friends,

I have two variables one is character variable another one is of type quan with decimals 3. As of now I am using the following statement to fill quantity variable

Charpack x_clabs to itab-clabs.

In above x_clabs is of type c with length 15 and itab-clabs is referring the table field mchb-clab.

The above statement is working for some cases and not working for some cases I mean

If my x_clabs contains 1.325,000 I want itab-clabs as 1325,000 but now after execution of charpack statement the itab-clabs is populating as 1.325 . I have one more example there x_clabs is showing as

20,827.807 after charpack statement the itab-clabs is 20827.807 this is correct. But some cases it is not working please help me how to write the logic to work all the cases.

I want no comma and ‘.’ Before decimal point. Please help me.

Thanks to all.

4 REPLIES 4
Read only

Former Member
0 Likes
745

Hi Bharat,

use this one

replace space in place of '.'

replace '.' with ' ' in x_clabs.

now remove the spaces.

condense x_clabs.

reward points to all helpful answers

kiran.M

Read only

Former Member
0 Likes
745

TRY THIS IT MAY HELP YOU

DATA : TEXT(15) VALUE '1.234,560',

VQTY LIKE MSEG-MENGE.

REPLACE ALL OCCURRENCES OF '.' IN TEXT WITH SPACE.

REPLACE ALL OCCURRENCES OF ',' IN TEXT WITH SPACE.

CONDENSE TEXT.

VQTY = TEXT / 1000.

WRITE : / VQTY.

REGARDS

SHIBA DUTTA

Read only

Former Member
0 Likes
745

try this in test report,

data : qty like mchb-clabs,

qty1 type p decimals 3.

qty = '1325000 '.

qty1 = qty.

write : qty, qty1.

Read only

Former Member
0 Likes
745

I think zeros after decimals are being neglected.

so no need to worry.

in case of 1325,000 :

1325,000 = 1325

but in case of 20,827.807

20,827.807 ne 20827

it is showing 20827.807

Regards

Pradeep