Simple currency data type  calculation doubt

Hello All,
net_price2 = '12.10'.
DATA : NET_PRICE2 TYPE  CHAR20,
       NET_PRICE TYPE KBETR,
       NET_PRICE1 TYPE CHAR20,
       C TYPE CHAR20.
C = 1.
LOOP AT ITAB2.
NET_PRICE = ITAB2-KBETR * C.
C = NET_PRICE.
SHIFT C LEFT DELETING LEADING SPACE.
ENDLOOP.
NET_PRICE1 = C * NET_PRICE2.
in this code i have two values for ITAB2-KBETR .those are 5.00 and 2.00
for first record in loop i am getting value of net_price as (5.00* 1 = 5.00)
but for secodn record what the problem i am facing in i am getting net_price as (5.00*2.00 = 1000.00)......though i want it to
come like 10.
so that net_price1 should come like 12.10 * 10 = 121.....
what i shd do..this type of code now working..please help
Abhijeet

Hello All,
i have done like this........its working.....but do let me know your commnets ....
CHECK PREISFINDUNGSART EQ 'B'.
TYPES : BEGIN OF T_KONP ,
        KBETR TYPE KONP-KBETR,
        MATNR TYPE A073-MATNR,
        KNUMH TYPE A073-KNUMH,
        END OF T_KONP.
TYPES : BEGIN OF T_A004,
        KNUMH TYPE A004-KNUMH,
        KBETR TYPE KONP-KBETR,
        KSCHL TYPE A004-KSCHL,
        END OF T_A004.
DATA :  ITAB TYPE STANDARD TABLE OF T_KONP WITH HEADER LINE,
        ITAB1 TYPE STANDARD TABLE OF T_A004 WITH HEADER LINE,
        ITAB2 TYPE STANDARD TABLE OF T_A004 WITH HEADER LINE.
DATA : NET_PRICE2 TYPE kbetr value '12.10',
NET_PRICE TYPE P DECIMALS 6,
NET_PRICE1 TYPE KWERT,
C TYPE  P DECIMALS 4.
NET_PRICE2 = '12.10'.
SELECT KNUMH INTO CORRESPONDING FIELDS OF TABLE ITAB1 FROM A004 WHERE
       MATNR = KOMP-MATNR.
IF SY-SUBRC = '0'.
  SELECT KBETR KSCHL KNUMH INTO CORRESPONDING FIELDS OF TABLE ITAB2 FROM KONP FOR ALL
    ENTRIES IN ITAB1 WHERE KNUMH = ITAB1-KNUMH.
ENDIF.
C = 1.
LOOP AT ITAB2.
NET_PRICE = ITAB2-KBETR * C.
C = NET_PRICE.
ENDLOOP.
NET_PRICE1 = ( C * NET_PRICE2 ) / 10000 .
XKWERT = NET_PRICE1.

Similar Messages

  • Handling Currency Data type in a Web Service

    hello,
    I have created a Java Web Service n i have tested the support for all the data types w.r.t to Java Client n C# Client.
    In case of other data types, they are supported by both the clients. But in case of currency, it is not supported since there is no currency data type in C#.
    For reference:
    public int testInt (int aValue) throws Exception
    mLogger.info("SampleAPI.testInt: Value: " + aValue);
    return aValue;
    I have created this method to test the support for Integer data type n it is working fine for both the clients. I want that same should be achieved for Currency Data type also.
    Problem is: Since Currency does not have a constructor. i cannot set the value at the C# client end n it shows the error "Cannot create the instance of java.util.currency"
    So, i reached this solution of handling the currency data type on the Service end itself by converting the currency value into decimal when the C# client sends a request for currency data type and convert it again into Currency from Decimal when the client sets the value at the Web Service end.
    But it cannot be achieved since currency is not defined in any monetary sense but is using only the currency codes, so it cannot be converted.
    Please tell me how to handle this thing?? Any suggestion will be appreciated.
    Thanks & Regards,
    Kapil

    hello
    i have created a transfer structure which contains the attributes of Currency class such as CurrencyCode, CurrencySymbol and FractionDigits. I can get these three attributes by:
        public CurrencyStructure getCurrency ()
            mLogger.info("SampleAPIImpl.getCurrency: ");
            Currency currency = mBackend.getCurrencyValue();
            CurrencyStructure currencyStructure = new CurrencyStructure();
            // Get the values
            currencyStructure.code = currency.getCurrencyCode();
            currencyStructure.symbol = currency.getSymbol();
            currencyStructure.fractionDigits = currency.getDefaultFractionDigits();
            return currencyStructure;
        }The C# client can get the values by calling mService.getCurrency();
    The C# client can also set/change the value like this on client-end:
      public void testSetCurrency ()
            CurrencyStructure currencyStructure = new CurrencyStructure();
            // Initialize the values
            currencyStructure.code = "EUR";
            currencyStructure.symbol = "e";
            currencyStructure.fractionDigits = 3;
            mService.setCurrency(currencyStructure);
    }Now i want that these values should be set on the Web Service side but i m not able to set since Currency class has no setters.
    I m setting the values at Service end like this, but there is no setCurrencyCode() method available in Currency class.
        public void setCurrency (CurrencyStructure aValue)
            mLogger.info("SampleAPIImpl.setCurrency: " + aValue);
            Currency currency = mBackend.getCurrencyValue();
            // Set the values
            currency.setCurrencyCode(aValue.code);
            currency.setSymbol(aValue.symbol);
            currency.setDefaultFractionDigits(aValue.fractionDigits);
        }How to achieve this??

  • Currency data type

    Hi all
    the currency column in java is mapped to which datatype in oracle?
    regards
    Raj

    Number.
    Currency is not a data type but a format, you would use the to_char function to format a numeric value as a currency.
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/functions189.htm#i79330
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/sql_elements004.htm#i34570

  • Check for Currency Data Type

    Hello All,
    In my Dynamic Internal Table I've certain fields.
    Now I want to check whether those fields are of type Currency or Quantity .
    How to do this ?
    Using Describe Field  syntax I'm getting as TYPE C for both CURRRENCY as well as CHARACTER.
    Any clues ?
    Regards,
    Deepu.K

    Hello Vikram,
    Thanks for ur reply !
    But when I pass my Internal table data Name to ur said FM I'm not getting any data.
    So I tried with one more FM :
    * Get the Layout Fields Content
      call function 'LVC_VARIANT_SELECT'
        exporting
          i_dialog            = ' '
          i_user_specific     = 'A'
          it_default_fieldcat = gt_fcat
        importing
          et_fieldcat         = gt_fcat
        tables
          it_data             = gt_final
        changing
          cs_variant          = ls_variant
        exceptions
          wrong_input         = 1
          fc_not_complete     = 2
          not_found           = 3
          program_error       = 4
          data_missing        = 5
          others              = 6.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    By using the above FM i got my required content.
    In the FIeldcatalog I have all the DATATYPES, INTTYPEs, Decimals etc. and so by reading the values from the field catalog I coud resolve my isssue.
    Regards,
    Deepu.K

  • Currency Data type conversion to send as file.

    Hello, I have a requirement to pull the ID,total_amount field defined as currency from Salesforce and send  it to file as fixed width 10 bytes. Source values: 1  15.02  11.06 Amount 15.0 has to be changed to 2 decimals while sending it to file. I have multiplied 15.0 * 1.0 to make it 15.00 , but for the 11.06 * 1.0 , I am getting result 11.060. I have to get 11.06 as it is.I have coded the logic  this way.lpad(to_char(Total_Amount__c * 1.0) || '', 10, '0'). Any ideas.ThanksVara

    Hi, we are trying to connect to a server from where we have to fetch a fax documet or multiple ones using web services wsdl connection and using a metod call and get the  fax files and write it to salesforce. Below is the error I encounter:] [ERROR] Jul 14, 2015 7:44:47 AM org.ow2.easywsdl.schema.api.abstractElmt.AbstractIncludeImpl retrieveIncludeWARNING: This import is already include : http://ix1faxsvrtst.am.lilly.com:8000/OpenText/ImportingServiceBasic?xsd=xsd4. This probably mean there's a cyclic import Have attached the session log for reference. Connection DetailsConnection Name:CSP_RightFax to SFDC InboundDescription:
    Type:Webservices V2 (Informatica Cloud Labs)Created On:Jul 13, 2015 08:45:57 AMUpdated On:Jul 14, 2015 07:08:10 AMCreated By:
    Updated By:
    Webservices V2 Connection PropertiesRuntime Environment:mohawkWSDL Url:http://ix1faxsvrtst.AM.LILLY.COM:8000/OpenText/ImportingServiceBasic?wsdlHeader CSV Path:C:\CatchallBody CSV Path:C:\CatchallEndpointUrl:http://ix1faxsvrtst.AM.LILLY.COM:9001/OpenText/ImportingServiceBasicAuthentication Type:NoneUser Name:
    Pass Word:
    CertificatePath:
    Auto csv File Creation:Auto Creation of Body/Header csv filesDownload Path for Attachment:
    Upload Path for Attachment:
    Enable Logging:falseAllow Empty Tags:false

  • How to split a value of currency data type...........?

    Hi Abapers,
                       Is there any way by which we can spit values like 1000.11
    i just want the values after decimal like 11 in this case
    Is it possible...?

    The answer is true with a NUMC/decimal field, but is false with a CURR/currency field, not every currency has 2 decimals (most have but not all) so when conversion to character you MUST use a
    WRITE <currfield> CURRENCY <cucyfield> TO <charfield>
    Look at [CURRENCY cur |http://help.sap.com/abapdocu/en/ABAPWRITE_TO_OPTIONS.htm#!ABAP_ADDITION_6@6@] in [WRITE - format_options|http://help.sap.com/abapdocu/en/ABAPWRITE_TO_OPTIONS.htm]
    Regards,
    Raymond

  • Not Able to Load the data type "Non Currency"in Planning accounts dimension

    Dear All,
    We are building Meta data in planning using HAL 9.2 ...while construction of accounts we were able to assign "Currency" Data Type ,but were unable to add the "Non Currency" data types to account members.
    We have mentioned "Non Currency" in the the Data Type Field.
    Thanks in Advance.

    Hi Guys my issue is resolved..... just wanted to let you know that you will need to write "Non-Currency" in the field name in the csv for marking accounts as Non currency data type.

  • Float data types

    I don't really know SSAS but have been a .NET programmer and worked with SQL Server and T-SQL for years.  I am working on a project where there is a database storing sales transactions and a cube that is created nightly so we can get MTD Sales, YTD
    Sales, Profit $, etc.
    I just ran into an issue where I got an error retrieving the Profit $ measure (using an MDX query inside of a SQL stored procedure using OPENQUERY) and found that the profit $ should be 0.07 but is coming back as 6.9999999999993179E-2. After talking
    to our DBA, he said all of the calculations in the cube are double precision floating point and I need to round all results to 2 decimal places (programs like Excel handle the rounding and I should too.)
    Our DBA also claims the measures can't be calculated and returned as currency. He claims that the potential for error is very small and no one has ever complained about a $ value being off.
    I am struggling with this answer because I have always been told never to use floating point for monetary values.  I am having a hard time believing there is no way to have a measure be a currency field that is accurate.  I looked for articles
    online but can't seem to find anything to answer my questions.
    Could someone please point me in the right direction? Thanks so much!

    Your DBA is not completely correct in his claims. All calculations are not floating point below is a link to all of the data types supported by SSAS (Multi-Dimensional)
    https://technet.microsoft.com/en-us/library/gg471558%28v=sql.110%29.aspx?f=255&MSPPError=-2147217396
    SSAS supports a currency data type. It's 4 decimal places not 2, but it is the recommended data type for currency values as it does not suffer from the imprecision of the double data type.
    The other thing measures in a cube have is the concept of a format string, so you can ask the cube to return a pre-formatted value to you. But default an OPENQUERY will just return the raw value, but if you add the following:
    CELL PROPERTIES FORMATTED_VALUE
    to the end of your MDX query that should tell it to return the formatted value (which could be something like "$#,##0.00")
    See here https://msdn.microsoft.com/en-us/library/ms146084.aspx for a list of all the different format masks that can be applied
    http://darren.gosbell.com - please mark correct answers

  • Planning metadata - data type "currency" to "text"

    Hi.
    There is a problem.
    As in Calculation Script the data stored in Oracle Essbase (Planning) as number (property data type = currency or nonCurrency or unspecified) to transfer to an element at which property data type = "text".

    Hi,
    Can you clarify your question?
    Data for Planning apps is stored in Essbase. Text is usually stored in the Planning relational database.
    Im not sure I understand what you re trying to achieve. Are you asking about members tagged with the "Text" data type?
    Seb

  • Local Currency - Translation Date Type

    Hi:
    We are on ECC 6.0 with New GL.
    I wanted to check if we can change the Translation Date Type for 1st local currency (10) from Translation date to document date? There are three options in this field - Posting date, document date and translation date. But when we maintain it (under additional local currencies for a company code), local currency has this grey out and comes default to translation date. Not sure where it is defined that local currency can be translated only based on translation date.
    However for 2nd and 3rd currencies this field is open and allow to choose any date type.
    Please advise.
    Thanks,
    Rahul

    Hello Rahul,
    For the local currency, it is hard-coded in the system to
    choose the translation date as the transalation date (type 3). If you
    change this translation date when you enter a document, the system will
    use this new date. However, if you don't change this, the system will
    always use the posting date as translation date for the local currency.
    hope thic clarifies
    Ray

  • File Adapter NFS: Doubt with th Data Type corresponding to the XML

    Hi All!!
    On my scenario, a file is caught from the server and its information is passed to a proxy.
    My doubt is how must be the XML format and the Data Type to the data be correctly retrieved?
    The XML I have designed is the next:
    Is correct? If yes, How must be defined its Data Type?
    Thanks and regards,
    Manuel Míguez.

    Hi!
    I will try to elaborate my question.
    I have the next XML Data on the Server:
    <?xml version='1.0' encoding='UTF-8'?>
    <DT_File_Req>
    <NumeroDocumento>2/0211/M015010010N</NumeroDocumento>
    <Tipo>ZEP</Tipo>
    <Version>000</Version>
    <Parcial>00</Parcial>
    <Descripciones>
    <Item>
    <Idioma>ES</Idioma>
    <DescripcionCorta>Prueba descripcion corta</DescripcionCorta>
    <DescripcionLarga>Prueba descripcion larga swfiwjeflijwelifjlwejlkfdsjfelsdjflkjdslkfjsjdoifjposdjfojsdkjfslkdjfwehjfjdslfkjsdlfhswfsdfl</DescripcionLarga>
    </Item>
    <Item>
    <Idioma>FR</Idioma>
    <DescripcionCorta>Prueba descripcion corta en frances</DescripcionCorta>
    <DescripcionLarga>Prueba descripcion larga en frances ejlkfdsjfelsdjflkjdslkfjsjdoifjposdjfojsdkjfslkdjfwehjfjdslfkjsdlfhswfsdfl</DescripcionLarga>
    </Item>
    </Descripciones>
    <Caracteristicas>
    <Item>
    <Nombre>Fecha Inicio Plano</Nombre>
    <Valor>12032008</Valor>
    </Item>
    <Item>
    <Nombre>Fecha Fin Plano</Nombre>
    <Valor>20032008</Valor>
    </Item>
    </Caracteristicas>
    </DT_File_Req>
    This XML is polled by XI.
    I have created the next Data Dype corresponding with structure of the XML (I hope will be understable):
    DT_File_Req
    Numero Documento STRING
    Tipo STRING
    Parcial STRING
    Descripciones
    Item 1..n
    Idioma STRING
    DescripcionCorta STRING
    DescripcionLarga STRING
    Caracteristicas
    Item 1..n
    Nombre STRING
    Valor STRING
    My question is if this XML structure and this Data Type are compatible. I get on SXMB_MONI an error on the Mapping and I guess that the error is produced because the XML Format is not correct.
    Thanks and regards,
    Manuel.

  • Dynamic Drop Down creation using simple data types

    Hi all,
    I have got a requirement in which i have to create an iView which is going to have 6 drop down values and with in that 1 value is going to have sub values which needs to get displayed in the similar drop down fashion.
    I have created a simple data type having enumeration of the 6 values and linked the same to iView with drop down by key which is working successfully. And for the purpose of sub values i have created a similar simple data type with two values and linked the same with a value attribute.
    Well, can any one tell me the further process to proceed ?
    Thanks in advance ...
    Vipin

    Vipin,
    There are quite some steps to achieve what you need. Since you have both your DropDownByKey elements defined and bound to context elements, it may make sense to keep the Second DropDownByKey element invisible and make it visible only when user selects a specified key from first DropDownByKey. To achieve this, follow these steps.
    1. Create an action with a parameter "key" of type string.
    2. Bind this action with onSelect event of your First DropDownByKey UI Element.
    3. Do mapping of parameter "key" in your wdDoModifyView with following code.
      if (firstTime)
             final IWDDropDownByKey dk = (IWDDropDownByKey)view.getElement("DropDownByKey1");
               // Replace DropDownByKey1 with id of your DropDownByKey Element.
             dk.mappingOfOnSelect().addSourceMapping("key", "key");
    4. Create a context attribute of type WDVisibility say "DDVisible" and bind to "visible" property of your second DropDownByKey.
    5. Set DDVisible to NONE in wdInit().
    wdContext.currentContextElement().setDDVisible(WDVisibility.NONE); 
    6. In onSelect action write this code to make second visible
    if(key.equalsIgnoreCase("Two")){
         //Replace "Two" with your required value.
             wdContext.currentContextElement().setDDVisible(WDVisibility.VISIBLE);
           else{
                wdContext.currentContextElement().setDDVisible(WDVisibility.NONE); 
    This should give the desired results.
    Hope this helps.
    Vishwas.

  • Data Types for Currency and Percent?

    I am struggling to find data types in the Power BI Designer for Currency ($) and Percent (%). I see these in many preview screenshots from Microsoft, but I cannot figure out how to implement these critical symbols for visualizations. Also, did someone
    forget to include data labels in the charts? I am finding this tool set to be very limited compared to the previous iteration of PowerQuery and Power BI for Office 365.

    Hello,
    The data type of your field is smallmoney or you want to convert a int or varchar value to smallmoney?
    Hugs!
    Bruno Destro
    Dicas de programação em .net, C# e SQL - http://smcode.com.br/blog.aspx

  • APD problem - data type & currency translation

    Hi,
    I am using APD to get hung number of records from mulitprovider. I use a query to as a source of APD.
    In the query, there is an option to select currency translation in variable screen.
    But I encounter the following problems:
    1. key figures in the output file are in floating point. is it possible to change data type in APD?
    2. when I select currency translation in this query, does APD support currency translation?
    Thanks a lot.
    Regards,
    Helen

    Hi Helen,
    You can use an routine ABAP to change the format of your data type & currency transation.
    Regards
    Romain

  • Simple Data Type in CAF of SAP NetWeaver DevStudio 7.1 SP3

    Hallo
    Anybody knows about the use of Enumeration for simple Data Type in CAF of SAP NetWeaver DevStudio 7.1 SP3?
    I've defined an attribute "status" for the Entity "Project" with the following values
    0: NEW;
    1: ACTIVE;
    -1: INACTIVE. 
    As you see the data type is short.
    In the program I want to use the following code:
    Project myProject = new Project();
    myProject.setStatus(Status.NEW)
    But I found it out, it is inpossible to to use Status.NEW.
    On the other side I read the article of https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/085098ea-0c01-0010-12a8-80ac838bec85. This article is again not updated with the version 7.1 SP 3.
    I cannot understand about the whole changes. In the previous release we can define a DDIC type and use it as Simple Data type and in the new Release we just use the XSD-Facet to define an enumeration, but the problem is: we can not reference it in the program. I don't see any advantage.  And I tried to find out how I can define the attibute using DDIC type. I didn't get it.
    Thanks for any Hints!
    Kind Regards!
    Ping

    Hi Oliver,
    Thanks for the reply!
    I have login into the system, using User Id and Password.
    I have tried unsinstalling everything but the result remains the same.
    Previously only one service SAPCE_01 was showing up in the services explorer. But when I tried the
    Instance 00:
    sc create SAPRKT_00 binPath= "C:\usr\sap\RKT\SYS\exe\uc\NTI386\sapstartsrv.exe pf=C:/usr/sap/RKT/SYS/profile/CE1_SCS00_xxxxx" start= auto obj= "NT AUTHORITY\LocalService" password= abcd1234
    Instance 01:
    another service SAPCE1_00 was created. But when I tried to retry the instlattio, the installation again stopped at the point while starting the service and when I tried to retry it terminted with the following error.
    Please guide.
    sapinst.exe - Application Error
    The instruction at "0x00cbf040" referenced memory at "0x0072006d". The memory could not be "read".
    Click on OK to terminate the program
    Click on CANCEL to debug the program
    Selfextractor error
    iaextract.c:888: child has signaled an exec error. Keeping directory C:/DOCUME1/I047488/LOCALS1/Temp/sapinst_exe.1448.1196681060
    OK  
    Manish

Maybe you are looking for

  • Call Transaction "MIGO" in display mode only

    Hi friends, I have changed the standard the SAP standard program MB51 to a Customer Program 'ZMB51' based upon the user requirement.Iam able to get all the values (output) Now my requirement is .... iam trying to call transaction "MIGO" when the user

  • Business Rules and Dates

    I have many Java POJOs imported as facts. In each of these POJOs there is at least 1 date property. How am I to use these dates in my rules. for example: pojo.date > '08/22/06' pojo.date < today println(pojo.date) Although I have imported the java da

  • Fillable object from line segments

    I've created a tree object from line segments and it looks how I want it to look. I made it a compound path. When I fill it, I get weird results. I used live fill and that works fine, but I still dont get the pointed edges that I would like to see on

  • Problem with new IPod Touch - connecting to computer

    Just bought an IPod touch 2nd generation and plugged it into my computer to charge and to set up. I got a "found new hardware-Ipod" message and then the "found new hardware wizard" screen came up asking me for an installation CD or floppy to install

  • Buttons not working when slide is open

    I bought my E65 like .. umm.. a week ago, n now when i open the slide " right button, mute button, c button contacts button and the exit button isnt working, n when i close the slide they works only... it has no warranty on it because i bought a used