Application Development 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: 

Decimal Notation in Check Printing

Former Member
0 Kudos

Hi Gurus,

I am facing a problem in displaying amount value in SAP script. Actually i have written a form routine which returns a amount value to Check print SAP script. For example my form routine return 50000.00 to script, it should display as 50,000.00 where as it's displaying 50000..00.

Please help me. Thanks in Advance.

5 REPLIES 5

Clemenss
Active Contributor
0 Kudos

Hi Smarty,

it's no a bug, it's a feature: Probably the display field is of length 8. The formatted output of 50,000.00 is 9 characters wide. ABAP will try to remove the thousand's separator to fit in the field. If this is not enough it will add a * at the end, try 500000.00.

If this is not the reason then SAPScript formatting may use [Omitting the Separator for u2018Thousandsu2019|http://help.sap.com/saphelp_nw73/helpdata/en/d1/803486454211d189710000e8322d00/frameset.htm].

Or User settings are responsible.

You did not post more information, so this is just guessing.

Regards,

Clemens

Former Member
0 Kudos

HI

You have written routine so that it fetches value from routine to script .

the value returned from routine to script will be in char format , in routine you mite have declared variable as numeric and transfering the value to variable type of char.

solution is you have to explicitly has to format the variable to have have separators. there are lot of funcions available for this.

you can check on sdn.

thanks

former_member200345
Contributor
0 Kudos

Hi,

Check the decimal settings in the 'Conuntry Global Parameters' for the country code being used. check the below path in SPRO.

SAP Customizing Implementation Guide > SAP NetWeaver>General settings>Set Countries>Define Countries in my SAP System.

Thanks & Regards,

Vijaymadhur.

Former Member
0 Kudos

Hi Try this,

In your form routine :

Suppose v_amount is your amount field, then convert it into character format


data : v_char_amount(18) type c.

data :     v_decimal_notation TYPE xudcpfm,"Decimal notation
              v_replace_char TYPE char1,      "Character with which the decimal seperator should be modified
              v_search_char  TYPE char1.      "Character with which the factor should be searched

v_char_amount =  v_amount.

*selecting the settings for the field decimal notation
*from user master table
  SELECT SINGLE dcpfm
                INTO  v_decimal_notation
                FROM usr01
                WHERE bname = sy-uname.
  IF sy-subrc = 0.
    CASE v_decimal_notation.
      WHEN 'X'.
        v_search_char  = '.'.
        v_replace_char = ','.
      WHEN OTHERS.
        v_search_char  = ','.
        v_replace_char = '.'.
    ENDCASE.
  ENDIF.

    IF v_char_amount IS NOT INITIAL.
*     search the variable for the character with which the decimal seperator
*     needs to be replaced
      SEARCH v_char_amount FOR v_search_char.
*     if the decimal separator is not the same as the user settings then replace it
*     as per the user settings
      IF sy-subrc <> 0.
        REPLACE ALL OCCURRENCES OF v_replace_char IN v_char_amount WITH v_search_char.
      ENDIF.
    ENDIF.

* Noe move character field to your original amount field.

Move v_char_amount to  v_amount. 

It will display your amount field based user user settings

Regards,

Mr.A

Former Member
0 Kudos

Thanks All for your unconditional help. My problem is solved. What i did is before returning to script i moved the value to currency type field(NETWR) and used the write statement to move to returning parameter.

With Regard.

AH