No-rounding while converting data type F to Packed

Hi All,
I want to pass value of a variable of data type F to another variable of dtata type P with decimals 3.
While converting values decimals are getting rounded to next higher value.
Can any one tell me how to retain the actual values,without rounding off.
Ex. variable 1 = 25.1238567890000   (type F).
      when variable 2 is assigned the value of variable 1,then it should consist of the value 25.123(instead of 25.124).
Thanks & Regards
Seshagiri.

Hi seshagiri,
it seems that the value you want to pass to (type F) is smaller than the value that you are using in your code.
Can I ask what is the actual use of the value type P? if there is processing to be done  then I suggest to try to process the needed code using a common data type then until the later parts of the logic to pass it to data type P.
If the value is only to be used for display then just pass it to a variable of data type C or string to retain the decimals.

Similar Messages

  • Problem with converting data types

    Hi Experts,
    I am stuck up with a little problem, i need your help
    i am converting all the data types to CHAR but i am not getting the expected data out.........
    My code is as below...where do i go wrong...
    LOOP AT <T_ITAB> ASSIGNING <FIELD>.
    DO.
       ASSIGN COMPONENT SY-INDEX OF STRUCTURE <FIELD> TO <RECORD>.
       IF SY-SUBRC = 0.
          LV_FIELD = <RECORD>.
          N = STRLEN( LV_FIELD ).
          IF N = '8'.
               IF LV_FIELD IS NOT INITIAL.
                      LV_DATE = LV_FIELD.
                      CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
                              EXPORTING
                              DATE                     = LV_DATE
                             EXCEPTIONS
                                    PLAUSIBILITY_CHECK_FAILED = 1
                                    OTHERS                     = 2.
                             IF SY-SUBRC <> 0.
                                     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                                     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
                             ENDIF.
                         IF SY-SUBRC EQ 0.
                            CONCATENATE LV_FIELD+6(2) LV_FIELD+4(2) LV_FIELD+0(4) INTO LV_FIELD SEPARATED BY '.'.
                        ENDIF.
                ENDIF.
             ENDIF.
                IF LV_RECORD IS INITIAL.
                         LV_RECORD = LV_FIELD.
                ELSE.
                       CONCATENATE LV_RECORD LV_FIELD INTO LV_RECORD SEPARATED BY '  * '.
               ENDIF.
           ELSE.
         EXIT." DO
        ENDIF.
       ENDDO.
      APPEND LV_RECORD TO LT_OUTPUT.
    CLEAR LV_RECORD.
    ENDLOOP.
    THE TABLE LT_OUTPUT     LIKE     THENV(CHAR 255)
    My output looks some thing like this:
    04  36876   15.09.2011  39600   1999
    06  36960   15.09.2011  39600   2632
    07  36874   15.09.2011  39541   9232
    My expected output
    04    36.876  15.09.2011    39.600  1.999
    06    36.960  15.09.2011    39.600  2.632
    07    36.874  15.09.2011    39.541  9.232
    Regards
    sam

    At run time you can see all the data........ like what i have shown...
    but if you clearly see, DATE will be in the internal format..but if you print it, it will be in dd:mm:yyyy
    can you suggest me if i have a dynamic field symbol (table data) ,,,, How can i convert data types dynamically..
    if it is a static internal table i am achieving with WRITE TO statement.....but i have huge data in field symbols...
    Instead of all these , please specify the exact problem your are facing . What is it with date field ? . In SAP while printing the internal format will be converted to external. What is your requirement with this date field?
    My output looks some thing like this:
    04 36876 15.09.2011 39600 1999
    06 36960 15.09.2011 39600 2632
    07 36874 15.09.2011 39541 9232
    My expected output
    04 36.876 15.09.2011 39.600 1.999
    06 36.960 15.09.2011 39.600 2.632
    07 36.874 15.09.2011 39.541 9.232
    I dont see any problems mentioned in your date field. Both your actual and expected outputs reflects the same in date field.
    In SCN you will only get solutions if your question is precise.
    Kesav

  • Error converting data type nvarchar to numeric 'witholding tax' (OWHT)

    Hi Guys.
    After I have upgraded my clients 2007 PL 30 database to 8.81 PL05, and running a repair to fix inconsistincies, I am receiveing some error when opening any sales documents.
    It takes place when I open a sales document, or browse previous docs. When browsing previous docs, it onlly happens on some of them.
    I also receive a different error when viewing sales orders: Error converting data type nvarchar to numeric (CRD2).
    Any ideas how to fix it?
    It does not limit me from processing and using the rest of the functionality. All calculations with queries in the docs are still working.
    Thanks.

    Hi,
    Please check Note No. : 1402855 and see if the same applied to the issue mentioned by you.
    Kind Regards,
    Jitin
    SAP Business One Forum Team

  • Saving result from sp_executesql into a variable and using dynamic column name - getting error "Error converting data type varchar to numeric"

    Im getting an error when running a procedure that includes this code.
    I need to select from a dynamic column name and save the result in a variable, but seem to be having trouble with the values being fed to sp_executesql
    DECLARE @retval AS DECIMAL(12,2)
    DECLARE @MonthVal VARCHAR(20), @SpreadKeyVal INT
    DECLARE @sqlcmd AS NVARCHAR(150)
    DECLARE @paramdef NVARCHAR(150)
    SET @MonthVal = 'Month' + CAST(@MonthNumber AS VARCHAR(2) );
    SET @SpreadKeyVal = @SpreadKey; --CAST(@SpreadKey AS VARCHAR(10) );
    SET @sqlcmd = N' SELECT @retvalout = @MonthVal FROM dbo.CourseSpread WHERE CourseSpreadId = @SpreadKeyVal';
    SET @paramdef = N'@MonthVal VARCHAR(20), @SpreadKeyVal INT, @retvalout DECIMAL(12,2) OUTPUT'
    --default
    SET @retval = 0.0;
    EXECUTE sys.sp_executesql @sqlcmd,@paramdef, @MonthVal = 'Month4',@SpreadKeyVal = 1, @retvalout = @retval OUTPUT;
    SELECT @retval
    DECLARE @return_value DECIMAL(12,2)
    EXEC @return_value = [dbo].[GetSpreadValueByMonthNumber]
    @SpreadKey = 1,
    @MonthNumber = 4
    SELECT 'Return Value' = @return_value
    Msg 8114, Level 16, State 5, Line 1
    Error converting data type varchar to numeric.

    Please follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI/ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying temporal data. We need
    to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. And you need to read and download the PDF for: 
    https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
    >> I need to select from a dynamic column name and save the result in a variable, but seem to be having trouble with the values being fed to sp_executesql <<
    This is so very, very wrong! A column is an attribute of an entity. The idea that you are so screwed up that you have no idea if you want
    the shoe size, the phone number or something else at run time of this entity. 
    In Software Engineering we have a principle called cohesion that says a model should do one and only one task, have one and only one entry point, and one and only one exit point. 
    Hey, on a scale from 1 to 10, what color is your favorite letter of the alphabet? Yes, your mindset is that level of sillyity and absurdity. 
    Do you know that SQL is a declarative language? This family of languages does not use local variables! 
    Now think about “month_val” and what it means. A month is a temporal unit of measurement, so this is as silly as saying “liter_val” in your code. Why did you use “sp_” on a procedure? It has special meaning in T-SQL.  
    Think about how silly this is: 
     SET @month_val = 'Month' + CAST(@month_nbr AS VARCHAR(2));
    We do not do display formatting in a query. This is a violation of at the tiered architecture principle. We have a presentation layer. But more than that, the INTERVAL temporal data type is a {year-month} and never just a month. This is fundamental. 
    We need to see the DDL so we can re-write this mess. Want to fix it or not?
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Crystal Data Conversion Issue (Error converting data type varchar to datetime)

    Hi,
    I can run stored procedure without error in SQL Server using my personal credentials as well as database credentials.
    I can also run Crystal Report after connecting to Stored procedure without error on my desktop using my personal credentials as well as database credentials.
    But when I upload the crystal report in BOBJDEV and when I run using database credentials report fails saying that "Error in File ~tmp1d1480b8e70fd90.rpt: Unable to connect: incorrect log on parameters. Details: [Database Vendor Code: 18456 ]" but I can run the crystal report successfully on BOBJDEV using my personal credentials.
    I googled (Data Conversion Error Message) about this issue & lot of people asked to do "Verify Database" in Crystal Report. So I did that, but when I do it I am getting a error message like this:
    Error converting data type varchar to datetime.
    Where do you think the error might be occurring? Did anyone faced this kind of issue before? If so, how to resolve it?
    (FYI, I am using Crystal Reports 2008, & for stored procedure I have used SSMS 2012 )
    Please help me with this issue.
    Thanks & Regards.
    Naveen.

    hello Naveen,
    since the report works fine in the cr designer / desktop, we need to figure out where you should post this question.
    by bobjdev do you mean businessobjects enterprise or crystal reports server? if so please post this question to the bi platform space.
    -jamie

  • CF9, no hotfix, VendorErrorCode 8114, cfprocresult error converting data type

    Hello, everyone.
    I've got an issue that really has me scratching my head.  Not sure where the issue lies, but I'll explain as best I can.
    Basically, I _think_ I'm being told that one of the fields in the recordset is not being converted.
    On one page, I make the following CFINVOKE:
    <cfinvoke component="components.header" method="content_single" returnvariable="resultset"
         dbdsn="#request.db_dsn#" dbusr="#request.db_username#" dbpwd="#request.db_password#">
         <cfinvokeargument name="table" value="#url.table#">
         <cfif isDefined("url.thisNav") AND len(trim(url.thisNav)) gt 0><cfinvokeargument name="pt" value="#trim(url.thisNav)#"></cfif>
         <cfif isDefined("url.id") AND val(url.id) gt 0><cfinvokeargument name="id" value="#val(url.id)#"></cfif>
         <cfif isDefined("url.section") AND len(trim(url.section)) gt 0><cfinvokeargument name="section" value="#trim(url.section)#"></cfif>
    </cfinvoke>
    Within a CFCOMPONENT in header.cfc, I have the following:
    <cffunction name="content_single" access="public">
             <cfargument name="dbdsn" required="yes">
             <cfargument name="dbusr" required="yes">
             <cfargument name="dbpwd" required="yes">
         <cfargument name="pt" required="no">
         <cfargument name="id" required="no">
         <cfargument name="section" required="no">
         <cfargument name="table" required="yes">
         <cfstoredproc procedure="SRT_sp_#lcase(url.table)#_contents_single" datasource="#dbdsn#"
                 username="#dbusr#" password="#dbpwd#"
                result="query_result">
            <cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" variable="@table" value="#lcase(table)#" maxlength="30">
    <cfif isDefined("pt") AND len(trim(pt)) gt 0><cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" variable="@pt" value="#ucase(pt)#" maxlength="12" null="no"></cfif>
    <cfif isDefined("id") AND val(id) gt 0><cfprocparam type="In" cfsqltype="CF_SQL_INTEGER" variable="@id" value="#val(id)#" maxlength="10" null="no"></cfif>
    <cfif isDefined("section") AND len(trim(section)) gt 0><cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" variable="@section" value="#trim(replace(lcase(section),'_',' ','all'))#" maxlength="20" null="no"></cfif>
                <cfprocresult name="returned_result">
            </cfstoredproc>
              <cfreturn returned_result>
    </cffunction>
    Instead of the results I expect, I get the following error:
    Error  Executing Database Query.
    [Macromedia][SQLServer JDBC  Driver][SQLServer]Error converting data type varchar to int.
    The  error occurred in E:\xxxxxxxx\xxxxxxx\xxxx\components\header.cfc: line  17
    Called from E:\xxxxxxxx\xxxxxxx\xxxx\content_view.cfm:  line 24
    Called from E:\xxxxxxxx\xxxxxxx\xxxx\components\header.cfc: line 17
    Called  from E:\xxxxxxxx\xxxxxxx\xxxx\content_view.cfm: line  24
    15 :     <cfif isDefined("id") AND val(id) gt 0><cfprocparam type="In" cfsqltype="CF_SQL_INTEGER" variable="@id" value="#val(id)#" maxlength="10" null="no"></cfif>
    16 :     <cfif isDefined("section") AND len(trim(section)) gt 0><cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" variable="@section" value="#trim(replace(lcase(section),'_',' ','all'))#" maxlength="20" null="no"></cfif>
    17 :             <cfprocresult name="returned_result">
    18 :         </cfstoredproc>
    19 :           <cfreturn returned_result>

    DBVARNAME is obsolete: don't use it.  You must pass-in the parameters positionally, not by name.  And, accordingly, you need to pass all of them in (with null values, if necessary).
    http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7d 52.html:
    {quote}
    Changed the dbvarname attribute behavior: it is now ignored for all drivers
    {quote}
    Adam

  • How to convert data type while using @variable function

    Hi Gurus,
    I have a query.
    i have created a Derived Table and the statement is given below.
    select 1 as SENSITIVITY_LEVEL,1 as SUBSENSITIVITY,@variable('US_T') as NITEMS, ...........
    here  in @variable('US_T') "US_T" is hard coded value. I want to change to data type of hard coded value as numeric or integer
    i am using sap BI 4.0 universe design tool.
    Thanks in Advance.
    Regards,
    Jeet

    Hi Jeet,
    Since it is text you can't convert into number.
    Can you please let mw know the exact requriement of yours?
    why you need this
    Thanks,
    Swapnil

  • Error While Creating Date type condition query

    Hi All,
    I am getting following error while creating a multiple condition query.
    ERROR:java.lang.IllegalArgumentException: Unexpected field type for D: java.lang.String
    I am pasting the scrap of the code for review below.
    pls note after removing the condition cond6; it works fine, and cond6 is for date type field.
    for(int j=1;j<7;j++){                          
    fd[j] =trd.getFieldDescriptor(arrayHeaderFieldNames[j]);
    BasisFieldType bft1 =  fd[j].getFieldType();
    if (bft1 == BasisFieldType.C) {
      filterOperator[j] = RelationalOperatorType.CONTAINS;       }
    else{
      filterOperator[j] = RelationalOperatorType.EQUALS;
    order[j] =queryFactory.createSortOrder(fd[j],true);
    cond1 =queryFactory.createCondition(fd[1], filterOperator[1], values[0]);
    cond2 =queryFactory.createCondition(fd[2], filterOperator[2], values[1]);
    cond3 =queryFactory.createCondition(fd[3], filterOperator[3], values[2]);
    cond4 =queryFactory.createCondition(fd[4], filterOperator[4], values[3]);
    cond5 =queryFactory.createCondition(fd[5], filterOperator[5], values[4]);
    cond6 =queryFactory.createCondition(fd[6], filterOperator[6], values[5]);
    Condition cond = queryFactory.createCondition(new Condition[]{cond1,cond2,cond3,cond4,cond5,cond6},LogicalOperatorType.AND);
    Please Help!
    Thanks n regards,
    Kapoorchand.

    Hi,
    well that problem is a long time back -. I only have in mind that the date I had to transfer to the quesry was in a "strange" format. Have a lock into the documentation for the date field - your date field is not recognised as a date field from the quesry engine and so this fails - but unfortunately I have no idea at the moment how I fixed it last time - how I converted my date field......
    Sorry, thast I can not give you the real point - but I will have a lock into the old code - hopefully I find it soon.
    Regards,
    Oliver

  • Error While creating Data type from a XSD

    Hi,
    I am trying to import a XSD into my Data type. I have changed the namespace in the XSD to match that of the target namespace. I am getting the following error.
    Global definition Element: http://ls.sbc.com/OMS/ProcessSalesOrderEFE004,   orderRequest in the schema to be edited will be ignored 
    Schema to be edited defines qualified element names (elementFormDefault = 'qualified')
    Could any help me out in this regard. I don't have much knowledge about XML and XSD.
    Regards,
    Ravikanth

    Hi Ravi,
    please check once again your XSD file.
    it should be like this.
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://ls.sbc.com/OMS/ProcessSalesOrderEFE004, " targetNamespace="http://ls.sbc.com/OMS/ProcessSalesOrderEFE004, ">
         <xsd:complexType name="DTO_Data type">
              <xsd:annotation>
                   <xsd:appinfo source="http://sap.com/xi/TextID">
                   725b8b10c99e11dc8ff3001cc43a8a68
                   </xsd:appinfo>
    Please check the name of  data type u mentioned in XSD  while imporitng.
    regards
    mahesh..

  • How to convert Date type

    I have a JSP to read the date value and use it to update the corresponding column in the table. In the JSP, the data type returned from request.getParameter("hiredate") is java.util.Date. Unfortunately, the CachedRowSet requires the java.sql.Date type. How can I convert the java.util.Date type to java.sql.Date type? Please advise,thanks.
    SK

    SK,
    This is how I do it:
    java.util.Date utilDate = new java.util.Date();
    long millis = utilDate.getTime();
    java.sql.Date sqlDate = new java.sql.Date(millis);Good Luck,
    Avi.

  • Convert Data type from Oracle Data time string to SQL Date time data type

    I have a time stamp column pulled from oracle into a SQL server db table varchar datatype column.
    Now i want to change that column to date time.
    Following is the data present in the table:
    01-APR-11 02.15.00.026000 AM -08:00
    01-APR-11 04.15.00.399000 AM -08:00
    01-APR-11 06.15.00.039000 AM -08:00
    I want to convert this data into sql server datetime data type.
    Please advice.
    Thanks,
    Sam.
    I am unable to find the solution in other sites which is why I have posted it in Oracle forum for seeking solution.
    Thanks in Advance.
    Sam.

    Sam,
    How are you actually loading the data into SQL*Server - are you using something like an Oracle gateway, BCP or another Microsoft utility of some sort ?
    If you are using an Oracle problem then we may be able to help but if using a Microsoft utility then you should really follow up with Microsoft to know what format the data should be in to use a Microsoft utility.
    Regards,
    Mike

  • Converting data types

    hi
    How to convert date data type to number data type:
    Using to_char and to_number
    Thanks
    Edited by: josh1612 on Nov 17, 2008 12:37 AM

    Another approach can be ->
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>create table a_a(dt date)
      2  ;
    Table created.
    Elapsed: 00:00:00.01
    satyaki>
    satyaki>
    satyaki>insert into a_a values(sysdate)
      2  ;
    1 row created.
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>commit;
    Commit complete.
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>select * from a_a;
    DT
    17-NOV-08
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>
    satyaki>select cast(to_char(dt,'ddmmyyyy') as number(10)) res
      2     from a_a;
           RES
      17112008
    Elapsed: 00:00:00.00
    satyaki>Regards.
    Satyaki De.

  • Prefix for attribute while defining data type

    Hello can we add any prefix  for attribute of a field while defining any data type .
    will get data "DA". and I need to add "rr" to this becomes "rrDA"
    or do we need to do this while doing message mapping.

    Hi satya ,
    you could also design the XSD for the masse in an external editor (e.g. XMLSPY) and upload into external definitions.
    Regards Mario

  • In ECC 6 , I AM  GETTING ERROR WHILE DECLARING DATA TYPE OF BAPI

    HI,
    IN ECC 6 , i AM  GETTING ERROR" NO READ ACESS RETURN"
    EVENTHOUGH   I DECLARED  DATA TYPE   FOR EXAMPLE
    DATA: RETURN TYPE BAPIRET2.AND USING IN RFC.
    HOW TO CORRECT THE ERROR.
    pLZ HELP ME.
    REGARDS,
    RANI

    Hi Rani,
    Could you please post the piece of coding where the error comes from? Maybe we can help you then.
    Regards,
    John.

  • Error while creating data type

    Hi
    I am creating data type for the scenario from File to IDOC
    Namespace urn:xiworkshop:groupxx:legacy is not defined in the software component version NEWPRODUCT , 100 of sap Object Message Type Vendor | urn:xiworkshop:groupxx:legacy references the inactive object Data Type Vendor | urn:xiworkshop:groupxx:legacy
    Please help me

    Hi;
    First activate your namespace and then create the data type.
    Namespace + default datatypes should be activated together.
    Then your data type
    Mudit

Maybe you are looking for

  • How do I transfer a photo from my Mac to Ipad?

    How do I transfer a photo from my Mac to Ipad?

  • ITV Catchup TV picture too big

    We have two laptops – the first one is an HP and works OK in Firefox for all TV Channels The second one – an Advent Verona produces the following problem ITV and Catchup TV viewed in Firefox - the picture is about 4 times too big BBCi, 4OD and Demand

  • External HD recommendations for a B&W G3

    I use a PowerMac G3 400 MHz running OS 9.2.2 to record and mix audio with Pro Tools LE using a Digi 001 interface. I currently store all of my audio files on a 120GB Glyph X-Project FireWire external HD, which is now nearing capacity. I'd like to add

  • OBN Business Object

    Dear Experts. In this moment I have the following issue in the MSS=>Requisition Monitor. The system display the following message of error: There is no iview is available for system 'SAP_ERP_TalentManagement' I found in the forum http://forums.sdn.sa

  • Switched from CS to just Muse

    I subscribed to Creative Cloud CS for a year. During that year I created a website with Muse. Now I cancelled my subscription to CS and sunscribed to just Muse. The reason was for email purposes.  My question is two fold. First do I need to switch so