How to trim decimal values in a string?

Hi
How do i trim decimal value in a string..
suppose i have 1.00, i want it to be displayed as 1
Is there any Round off functionality in WD ABAP?
Regards,
Puneet

hi,
   Try using the mathematical function abs().
ABS( VAR1 ). Which will return the numeric value only.
Thanks
Yogesh

Similar Messages

  • Can u tell me how to convert int value in to string

    hi to all, can u tell me how to convert int value in to string.

    hi to all, can u tell me how to convert int value in
    to string.Even this way:
    int number = 155;
    String mystring = ""+155;
    [\code]                                                                                                                                                                                                                                                                                               

  • How to delete decimal values zeros

    Hi experts,
    i am using mseg-menge field ( lenth13 and decimals 3) in my alv grid report.
    eg: 2.3456.000
    user wants only  2.3456 no decimals.
    how we can aviod decimals 0 s in report.
    thanks in advance.
    mahahe

    I search this ways in the forums:
    Shift
    SHIFT varb1 RIGHT DELETING TRAILING '0'.
    write: gv_variable decimals 0.
    SHIFT VALUE LEFT DELETING LEADING '0'.
    Shift2
    DATA: T(14) VALUE ' abcdefghij',
    STRING LIKE T,
    STR(6) VALUE 'ghijkl'.
    STRING = T.
    WRITE STRING.
    SHIFT STRING LEFT DELETING LEADING SPACE (or use 0 to detete 0).
    WRITE / STRING.
    STRING = T.
    SHIFT STRING RIGHT DELETING TRAILING STR or 0.
    WRITE / STRING.
    Shift3
    data amt(6) type p decimals 3 value '123.450'.
    data amt1(6) type p decimals 2.
    data amt_c(6) type c.
    unpack amt to amt_c.
    shift amt_c right deleting trailing '0'.
    pack amt_c to amt1.
    write amt1.
    use FM
    FTR_CORR_SWIFT_DELETE_ENDZERO
    this FM will remove all the zeros from decimal values like
    value - 234.8000000
    output - 234.8
    IF
    data: var1 type p decimals 3,
          var2 type p decimals 2,
          var3 type p decimals 1.
    move '12345.100' to var1.
    move var1 to var2.
    move var1 to var3.
    if var2 = var1.
      if var3 = var1.
        write var3.
      else.
        write var2.
      endif.
    else.
      write var1.
    endif.
    I hope that this solve your problem.
    Cordial greetings.

  • How can i store values from my String into Array

    Hi guys
    i wants to store all the values from my string into an array,,,, after converting them into intergers,,,, how i can do this becs i have a peice of code which just give me a value of a character at time,,,,charat(2)...BUT i want to the values from String to store in an Array
    here is my peice of code which i m using for 1 char at time
    int[] ExampleArray2 = new int[24];
    String tempci = "Battle of Midway";
    for(int i=0;i>=tempci.length();i++)
    int ascii = tempci.charAt(i); //Get ascii value for the first character.

    public class d1
         public static final void main( String args[] )
              int[] ExampleArray2 = new int[24];
              String tempci = "Battle of Midway";
              for(int i=0;i<tempci.length();i++)
                   int ascii = tempci.charAt(i);
                   ExampleArray2=ascii;
              for(int i=0;i<ExampleArray2.length;i++)
                   System.out.println(ExampleArray2[i]);

  • How to load decimal values into a file using bcp in SQL Server 2000?

    Hi everyone,
    I'm trying to load data from a database table to a text file using bcp on SQL Server 2000. When I'm loading the decimal values, the values before the decimal are not being loaded into the file. How could I load the values before decimals?
    Here are the DDLs and DMLs of what I'm trying to run:
    CREATE TABLE [dbo].[Product_Sales](
    [Year_of_Sale] [smallint] NOT NULL,
    [Product_Type] [varchar](25) NOT NULL,
    [Product_Group] [varchar](25) NOT NULL,
    [Category_Type] [varchar](25) NOT NULL,
    [Category_Group] [varchar](10) NOT NULL,
    [Product_Count] [bigint] NOT NULL,
    [Product_Amount] [decimal](19, 2) NOT NULL,
    [Category_Count] [bigint] NOT NULL,
    [Category_Amount] [decimal](19, 2) NOT NULL,
    CONSTRAINT [PK_Product_Sales] PRIMARY KEY CLUSTERED
    [Year_of_Sale] ASC,
    [Product_Type] ASC,
    [Product_Group] ASC,
    [Category_Type] ASC,
    [Category_Group] ASC
    ) ON [PRIMARY]
    ) ON [PRIMARY]
    INSERT INTO [Yearly_Sales].[dbo].[Product_Sales]
    VALUES(2010, 'Online', 'Web', 'Cameras', 'Electronics', 547, 0.00, 0, 0.00)
    EXEC [master].[dbo].[xp_cmdshell] 'bcp "SELECT * FROM [Yearly_Sales].[dbo].[Product_Sales]" queryout D:\Yearly_Sales\Product_Sales.dat -c -T -S'
    And the output I see in the file is:
    2010 Online Web Cameras Electronics 547 .00 0 .00
    The values before decimals are being truncated.
    Thanks,
    Bangaaram
    Known is a DROP, Unknown is an OCEAN.

    You can modify the decimal column(s) in the table to varchar type before export. But it does not look good.
    alter table [dbo].[Product_Sales]
    Alter column [Product_Amount] varchar(20)
    alter table [dbo].[Product_Sales]
    Alter column [Category_Amount] varchar(20)
    Does that make any sense?
    Known is a DROP, Unknown is an OCEAN.
    Basically you modify the decimal column to a varchar type before you run the bcp command for export. You can modify your source table or you can modify them on the fly. It is just a workaround.
    Modifying the source wouldn't be a good idea. Never do that if you can't get your desired output.
    Known is a DROP, Unknown is an OCEAN.

  • How to display decimal values (8.00, 8.01, 8.10)

    Can you please tell me anyone how to display the decimal values.
    Ex: amount number(5,2)
    inserted the table value 300.00
    when I am select the value using it has to display as the same 300.00.
    Thanks,
    Ramesh

    I suggest you read oracle documentation about TO_CHAR function and number format models.
    SQL> select to_char(0.00, '99990.99') from dual ;
    TO_CHAR(0
    0.00
    1 row selected.
    SQL> select to_char(99.78, '99990.99') from dual ;
    TO_CHAR(9
    99.78
    1 row selected.
    SQL>

  • How to delcare decimal value in selection screen

    hi all,
    in my selection screen, how to declare parameter  type decimal value of 2 places default value 99.00 %
    points will be rewarded
    thanks in advance

    Hi,
    Create a domain for that variable.
    ex: val type P decimals 2.
    Assign it to data element.
    Then use that data element in u r selection screen.
    Reward if useful.
    Regards,
    Narasimha

  • How to check decimal value in numeric field

    Is there any way to find number of decimal digit is being used.
    999.444
    444.45
    344.23
    33.666666666666
    Query provide rusult after the decimal value.
    thanks.

    user-Keen wrote:
    Query provide rusult after the decimal value.
    thanks.
    your_col - trunc(your_col)Do you have negative numbers?
    For negative values what do you want to display?
    If just the decimal part, you could use ABS(col) - trunc(ABS(col))
    Edited by: jeneesh on Apr 4, 2013 3:29 PM

  • How can i convert values in my string to ascii characters

    Hi guy.
    I am wrinting a code but i m stuck, I have a string with (Battle of Midway) in it, Now i want to convert each character in this string with the asci character,,,
    String temp = {"Battle of Midway"};
    so the ascii will be:
    B=66 a=97 t=116 l=108 e=101 o=111 f=102 M=77 i=105 d=100 w=119 y=121
    i found all these number for all the charachers, but i donno how to covert this string into ascii characerts... ofcurse i can do it one by one...but is there any class or method i can use for this,,,,, Once i convert all the character (from string) to ascii character THEN i have to convert it back from ascii to character,,
    Is anybody has any idea
    Thanks alot in Advance

    You get get the ascii code for those characters by doing something like:
    int ascii = str.charAt(0); //Get ascii value for the first character.
    Kaj

  • How to Copy a value of a String to the RAM memory?

    Hi there,
    I was wondering how to copy a String into the ram memory (consider you're doing right click on THIS word and choose 'Copy'; the String's Value will be to the ram memory for a later Paste).
    In my application, a user has a table and he right click on it and choose Copy. I get the value of the item (Obj) but face dificulties to add it to RAM.
    my code looks like this:
              if (obj!=null)  //inside I have the value (say: 12345 --< Obj.toString)
                   Action copyAction = TransferHandler.getCopyAction();
                   int id = ActionEvent.ACTION_PERFORMED;
                   String name =  (String) copyAction.getValue(Action.NAME);
                   long l = EventQueue.getMostRecentEventTime();
                   copyAction.actionPerformed(new ActionEvent(XXXXXXX, id, name, l ,0));     
                            ///what comes in the XXXXXXX      
              }I tried, instead of the XXXXXXX, to put Obj or Obj.toString but...nothing.
    Anyone?

    Thanks,
    should implement ClipboardOwner
    and do this:
                  StringSelection stringSelection = new StringSelection( obj.toString() );
                  Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
                  clipboard.setContents( stringSelection, this );
    @Override
         public void lostOwnership(Clipboard clipboard, Transferable contents)
              //do nothing!
         }

  • How to search a value in a string

    Greate oracle programmers
    how are u all doing. i am facing a problem in query. actually i wanna search a value in string using query. just read the piece of code below
    DECLARE
    LC_VALUE VARCHAR2(100) := '51,52,53,54';
    CHK NUMBER;
    BEGIN
    SELECT 1 INTO CHK
    FROM DUAL
    WHERE TO_CHAR(51) IN (LC_VALUE);
    MESSAGE(CHK);PAUSE;
    EXCEPTION WHEN OTHERS THEN
    MESSAGE(SQLERRM);PAUSE;
    END;
    I am unable to find my value in string using query. i have tried the instr function also but the problem with this function is that suppose if i wanna search '1' in '51,52,53' then the value is found in string although there is not as such value as but 51. also i dont want to use the dynamic SQL for this pupose
    i m waiting for repsonse please help me out.
    Regards
    Kamran Ahmed
    [email protected]

    you can do something like
    select * from emp
    where
    '1000,2000,3000,4000,5000,6000,7000,8000,9950' like to_char(sal,'FM999999999990')||',%' or
    '1000,2000,3000,4000,5000,6000,7000,8000,9950' like '%,'||to_char(sal,'FM999999999990')||',%' or
    '1000,2000,3000,4000,5000,6000,7000,8000,9950' like '%,'||to_char(sal,'FM999999999990') or
    '1000,2000,3000,4000,5000,6000,7000,8000,9950' = to_char(sal,'FM999999999990');
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20

  • How to trim decimal????????

    I have writen a program which gives a output in double data TYPE.
    EX- 25.525899999
    Is there any method to trim the decimal point to 2 decimal places????????

    PrintWriter, PrintStream and Console all have a printf() method, and String has
    a static format() method.

  • How to restrict decimal values in Project Management JSP pages

    Hi,
    By default, the values of effort % complete, % complete, Earned Value etc show 8 digits after decimal in Progress Update Overview page.
    We want to round off these values to two digits.
    How can this be achieved? Please suggest.

    Hi 977941,
    Please set the following properties for a field and check for decimal point
    Action Type : firePartialAction
    Event : validateInteger
    Create a controller and add the following in Process From Request :
    if ("*validateInteger*".equals(pageContext.getParameter(EVENT_PARAM))) // identifier should be same as what you have set .
    get the value here and check if the decimal exist and throw exception message .
    Thanks
    Sandeep

  • How to take the values from a  String ( CSV   values).

    Hi All,
    I am passing csv String to a procedure as in parameter,but I have to take the values from a csv String one by one.Please let me know Is there any StringTokenizer function in oracle to take values like in java. Here is my javacode.
    import java.util.StringTokenizer;
    public class Sample {
         public static void main(String[] args) {
              String s="one,two,three,four,five";
              StringTokenizer stringTokenizer=new StringTokenizer(s,",");
              System.out.println( stringTokenizer.countTokens());
              System.out.println(stringTokenizer.hasMoreTokens());
              while(stringTokenizer.hasMoreTokens()){
                        System.out.print(stringTokenizer.nextToken());
    o/p: one two three four five

    Something based around one of these two methods should assist...
    select substr( the_string 
                  , decode( level, 1, 1, instr(the_string,',',1,level-1)+1)
                  , decode( instr(the_string,',',1,level), 0, length(the_string), instr(the_string,',',1,level) - decode( level, 1, 0, instr(the_string,',',1,level-1))-1)
                  ) the_value
                  from ( select '10,12,20,30,30,3,12,12,56' the_string
                         from dual
                  connect by level < length(replace(translate(the_string,'01234567890','00000000000'),'0')) + 2
    or
    SQL> select REGEXP_SUBSTR ('a,b,c,d,e', '[^,]+', 1, level) from dual connect by level<=5
      2  /
    REGEXP_SU
    a
    b
    c
    d
    e
    SQL>

  • How to change the value of subtitution string in a page at runtime

    Hi,
    I need to change the value of a substitution string which is mentioned in application attributes at runtime.
    The value will be fetched from a field in database on load of each screen.
    Can anybody help.......
    Help will be appriciated........thanx in advance
    Sunil

    Substitution strings are meant to be static, like global constants.
    If you need some variable stuff, use application level items and set them using Application level computations/processes

Maybe you are looking for

  • How can I save iPhoto Libraries that are in Trash?

    Hello. I have been having troubles with iPhoto which are basically cured at the moment. However during the process I had to drag two iPhoto Libraries to my Trash. My iPhoto is working fine at the moment, but I do not want to delete those two in the T

  • YouTube URL's in interactive PDF (InDesign CC)

    Hey guys, I'm wondering if there's a way yet to insert a youtube video URL in an InDesign document, so when exported as a pdf, will play within the pdf. The PDF will be viewed on desktop and mobile devices (including iOS). Right now, I'm finding issu

  • Hyperlink character options in InDesign

    I am creating hyperlinks in InDesign and do not have any options available under the "character options" box.  It just lists [none] with no options in the drop down menu. My hyperlinks WORK but do not appear in either preview mode or .pdf output with

  • Does anyone know if Dell Computers work with IMACs

    I am trying to make my Dell Printer work...I can't even open the pages on the Dell Site ?

  • JMF; Video watermarking in java?

    Can any one suggest me how to proceed for this problem? Input is quicktime file. A watermark should be added to the video track (this can be a small black square in the upper left hand corner of the screen, or something more elaborate). The watermark