Tuesday, June 15, 2010

Convert String to comma separated number value

There is certain time we need to convert a text of number to comma separated figure and concatenate with bracket, there is a function may could help on this

Below is the code snippet. Final output will be (13,000.00).

DATAstrnew(100TYPE C.

PARAMETERS p_betrg LIKE T5G15-AMUNT.

CALL FUNCTION 'HRCM_AMOUNT_TO_STRING_CONVERT'
  EXPORTING
    BETRG p_betrg
*   WAERS = ' '
    NEW_DECIMAL_SEPARATOR '.'
    NEW_THOUSANDS_SEPARATOR ','
    IMPORTING
    STRING strnew
.
CONDENSE strnew.
CONCATENATE '(' strnew ')' INTO strnew.
WRITE:/ p_betrg'After conversion' strnew.

To debug background job

1) SM37
2) Go to the spool
3) Key in jdbg command, press [Enter]