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

CONVERSION EXIT to remove thousand separator from quantity field

Former Member
0 Likes
12,475

HI

NEED HELP

do u know any FM or CONVERSION EXIT which remove thousand separator from quantity field.

Eg. 1,234,567.11 SHOULD be displayed as 1234567.11

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
6,790

Hi - maybe you could use WRITE TO NO-GROUPING

HI

NEED HELP

do u know any FM or CONVERSION EXIT which remove thousand separator from quantity field.

Eg. 1,234,567.11 SHOULD be displayed as 1234567.11

9 REPLIES 9
Read only

Former Member
0 Likes
6,791

Hi - maybe you could use WRITE TO NO-GROUPING

Read only

0 Likes
6,790

Hi thanks for your answer ,but its not dat much simple ,

let take another example

1.123.45,12 should be displayed 112345.12

1,123,45.12 should be displayed 112345.12

means i need to remove all commas (thousand separator) and data should be displayed in decimals.

some times decimals may be more than 2 which depends on unit lets say in mm unit i want it more than 2 decimals.

the solution which u had given is fine but i am facing this problem frequently so i need to format every time.

if any fm is available then i can reuse it in proper way.

there is fm available for curreny as "CURRENCY_AMOUNT_SAP_TO_IDOC" and many more but not for quantity.

so if any one find solution for above problem , i will be thankful to him/her.

Thanks

Read only

0 Likes
6,790

Hi Chetanpatil.

Try this:

If your quantity has thousand separator as comma:


translate lv_quantity using ', '.
condense lv_quantity.

If your quantity has thousand separation as dot:


translate lv_quantity using '. '.
translate lv_quantity using ',.'.
condense lv_quantity.

You'll need to check for the user thousand separator configuration in table USR01 field DCPFM or by calling BAPI_USER_GET_DETAIL and act accordingly.

Regards,

Andres.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
6,790

Hello All,

IMHO WRITE ... NO-GROUPING is the most fool-proof solution to handle different decimal separators.

Excerpt from the documentation:

... suppresses the thousands separator in the output of data objects of data types i or p ...

Source: [http://help.sap.com/abapdocu_70/en/ABAPWRITE_INT_OPTIONS.htm#&ABAP_ADDITION_5@5@]

BR,

Suhas

Read only

former_member778137
Discoverer
6,790

hi,

try this.

REPLACE ALL OCCURRENCES OF '.' IN lv_quantity WITH ''.

CONDENSE lv_quantity.

REPLACE ALL OCCURRENCES OF ',' IN lv_quantity WITH '.'.

Thanks ,

K.Kiranmayi

Read only

0 Likes
6,790

>

> hi,

>

> try this.

> REPLACE ALL OCCURRENCES OF '.' IN lv_quantity WITH ''.

> CONDENSE lv_quantity.

> REPLACE ALL OCCURRENCES OF ',' IN lv_quantity WITH '.'.

>

> Thanks ,

> K.Kiranmayi

Won't work with

1.123.45,12 should be displayed 112345.12

1,123,45.12 should be displayed 112345.12

Read only

0 Likes
6,790

Hi Chetan,

Try this:

CLEAR: w_dcpfm, w_thousand_sep.

SELECT SINGLE dcpfm

INTO w_dcpfm

FROM usr01

WHERE bname EQ sy-uname.

IF sy-subrc EQ 0.

IF w_dcpfm EQ 'X'.

w_thousand_sep = ','.

ELSEIF w_dcpfm EQ ' '.

w_thousand_sep = '.'.

ENDIF.

ENDIF.

REPLACE ALL OCCURRENCES OF w_thousand_sep IN l_quantity WITH ' '.

CONDENSE l_quantity NO-GAPS.

Regards,

Nisha Vengal.

Read only

Former Member
0 Likes
6,790

Quantity fields do not contain anything other than 0-9, decimal and possibly sign. The thousands separators are "user-friendly" display characteristics of the value, not the data value!

If it's a true quantity field (or other true-numeric type, e.g., not N), output it to a file and look at the data value.

Read only

Clemenss
Active Contributor
0 Likes
6,790

in your editor, enter WRITE.

Move back cursor. Press F1.

Look at NO-GROUPING.

Regards,

Clemens