Variable Conversion

I am a college student, learning Java programming. The program I'm working on now has to do with drawing a graph, given the height and width of the widow and the max and min x-values. For my calculations, I have my variables in doubles, but to plot out the graph, I need to convert them to type int. I have tried a couple different ways, but I keep getting the error 'Wrong number of arguments in method.' One of the other students in my class said he managed to force the conversion, but I didn't get a chance to ask him how. Suggestions would be very much appreciated. Thanks!!
~~dragonesse

>
One ofthe other students in my class said he managed
to force the conversion, but I didn't get a chance to
ask him how. Suggestions would be very much
appreciated. mydouble = 1.3456789;
if(mydouble > 0) myint = (int)(mydouble + 0.5); // + 0.5 = positive rounding
else myint = (int)(mydouble - 0.5); // negatives

Similar Messages

  • How to manage variable conversion factor in UOM to order unit

    Hi,
    We have a material whose base unit is PC unit price is 8 Euro / PC
    Order unit is Box now we do not have a standard conversion factor.
    Means sometimes vendor send 8 pc/ Box ,10 pc /Box and 12 pc /Box
    so when we create Material master and enter order unit as Box in purchasing view system ask for conversion rate
    if we do not enter any the value in PC field its taking 1 Box =1 PC as default.
    Example: Now while creating PO say we order for 10 box.(at this point we do not know exact conversion rate)
    and in the conditions we maintain price against PC .system calculate.
    Now when we receive the material then we actually know how much QTy we receive in SKU (PC) but that field is blur (no input) in 101 mvt type.
    One more thing In MIGO we can enter the Qty in PO Price Unit say we enter 80 PC
    system only creates stock value posting (80 * 8 =640 Euro ) but the stock qty in MMBE is still 10 piece ( from 1:1 conversion with box)
    Please suggest how we can handle this variable conversion rate.
    So that we can enter correct Qty in the time of GR ( MIGO ).
    Thanks in advance.

    Hi,
    Thanks for the valuable  Input.
    For our material base unit is PC order unit is Box.
    Say we main a conversion factor 10 PC =1 Box ( a default value) in MM01
    And we order 10 Box. but when we receive we found that vendor send 12 pc per Box so total 120 pc
    [ Po price unit is in PC in condition details]
    Now in MIGO we cannot modify that Qty ( from 100 to 120 in PC)
    SO you are suggesting here we receive 12 box in MIGO. so that actual qty in PC is correct..
    Thanks again

  • Maintaining variable conversion weight by LOT-wise

    The client is in Textile business where the Cotton is purchased in KGS and stored/issued in BALES.
    Business Need: The conversion factor of a Bale of cotton cannot be fixed, since it is a natural commodity and the wieght may vary from Bale to Bale.
    Item Code:     FV-00001
    Item Desc:     Cotton Fibre
    UOM (Pri):     KGS
    UOM (Sec):     BALES
    Conversion:     Inter-class conversion factor: 1 Bale = 10 KGs
    Deviation:     +/- 10%
    Purchasing UOM:     KGS
    Issuance UOM:     BALES
    Required calculation of Balance on Hand in Pri/Sec UOM:
    + FV-00001     LOT-1 1000kg 100Bales 1000Kg 100B
    + FV-00001     LOT-2 1080kg 100Bales 2080Kg 200B
    - FV-00001     LOT-1 800kg 80Bales 1280Kg 120B
    - FV-00001     LOT-2 756kg 70Bales 524Kg 50B
    - FV-00001     LOT-1 200kg 20Bales 324Kg 30B
    - FV-00001     LOT-2 324kg 30Bales 0Kg 0B
    Whereas the Oracle is calculating as:
    + FV-00001     LOT-1 1000kg 100Bales 1000Kg 100B
    + FV-00001     LOT-2 1080kg 100Bales 2080Kg 200B
    - FV-00001     LOT-1 800kg 80Bales 1280Kg 120B
    - FV-00001     LOT-2 700kg 70Bales 580Kg 50B
    - FV-00001     LOT-1 200kg 20Bales 380Kg 30B
    - FV-00001     LOT-2 300kg 30Bales 80Kg 0B
    At the time of Issuance the system is picking the Standard Conversion rate instead of the Actual conversion factor by Lot.

    Hi,
    I could not try this thing as I do not have any 10g set up at the moment, but hope this works. I am assuming that you are using Oracle DB at the moment.
    1. Create an initialization block that initializes the variable XX_PROD_LINE.
    2. Create another variable that can store the length of this variable.
    3. Create another initialization block that fires a query like
    select length(:XX_PROD_LINE) from dual
    4. Set this initialization block to execute only after the initialization block in step1 (You can use initialization block precedence for this). This step ensures that the length of the variable is calculated only after it has been initialized.
    5. Now you can use this variable in your reports.
    Hope this helps.
    Thank you,
    Dhar

  • Variable conversion in BEx Web 3.5 after EHP1 Update

    Hello experts,
    we have a problem after updating to ehp1 with a 3.5 web query. When we enter in the variable screen for the characteristic variable of fiscal year "0032010" then the bi clears that field. Without ehp1 the system replaces "00332010" with "003.2010". When we execute the query in BEx Analyzer everyting works correctly with ehp1. Does anybody know a solution?
    Thanks and regards.
    Edited by: Gerrit Lober on May 18, 2010 11:17 AM

    Hi,
    Please check note 1368772. You need to set the parameter ALLOW_INVALID_VARIABLE_VALUES to reactivate the same behaviour as in release 700.
    Best regards,
    Janine

  • Variable Conversion to XML

    Using: FM 8.0
    I am exporting a structured fm file as XML and trying to setup my read/right (rw) rules to eliminate the characters that are placed around each variable when exported.
    When I export a fm file as XML the words that were set as a variable within Framemaker are export with a preceding & and a trailing ;
    For example if the word Cardboard is set as a fm variable, it appears like this when exported as XML:
    &Cardboard;
    Is there a r/w rule that would strip the “&” and the “;” away from these words during the export process?
    Thanks in advance for everyone’s help.

    Russ, thanks for your response.
    I did fail to mention that the following line was also generated in the XML file:
    <!-- Begin Document Specific Declarations -->
    <!ENTITY Cardboard " Cardboard Box">
    <!-- End Document Specific Declarations -->
    Sorry about that.
    I wanted to keep my XML file as clean as possible without declaring Entities, unfortunately it appears that there is no easy way to suppress this using r/w rules.
    Thanks again for your help.

  • Variable conversion, which layer is best?

    I'm retireving several inputs from an html page into my jsp. I need to convert the Strings that were collected as doubles and ints in the JSP / web layer.
    It's currently doing the conversion in the JSP. Is it considered a better practice to do the conversions in the Java layer, and / or would it improve performance?

    I'd use .mov and ensure that AIC compression is used.
    You really only have two choices since only mp4 and mov will work at all out of that list.

  • DOUBT IN A BOX

    HI
    am doing a script in which i need to put a smaal box at the right hand side corner ..now my doubt is i need to print the document number and the date inside the box which i need to retrive from the respective tables and also one more doubt how to have blank spaces in betwenn...like on a line am printing the document text
    the next line there shouldnt be anything it should be a gap and after i want to print sometingg.please help
    vijay

    Hi Vijay,
    Setting default parameters for a box:
    You can use the POSITION and SIZE commands to set default parmeters for a box.
    Instead of: 
    /: BOX XPOS '11.21' MM  YPOS '5.31' MM  HEIGHT '10' MM WIDTH '20' MM INTENSITY 10 FRAME 0 TW
    You can write:
    /: POSITION XORIGIN '11.21' YORIGIN '5.31' MM
    /: SIZE HEIGHT '2' MM WIDTH '76' MM
    /: BOX  FRAME 10 TW INTENSITY 10
    This can be usefull if you gave several boxes that share the same parameters.
    If you want to set the position realtively to the window use POSITION WINDOW
    to set the position to the top/left start of the window. Then use POSITION 
    to set the current position relatively to the start of the Window. 
    Note that you uses "+" or "-" in the ORIGIN position to the set the position relatively.
    /: POSITION WINDOW
    /: POSITION XORIGIN '5' MM  YORIGIN '10' MM
    the position is now 5 MM from the left and 10 MM from the top of the window
    NOTE: After using the position command you can move the current position
    realtively to the last used position
    /: POSITION XORIGIN '10' MM  YORIGIN '20' MM
    Now the position will be X = 15 and Y = 30
    Drawing a line. You can draw a line by setting the Height or Weidth to 0
    and add a frane. E.g. a horizontal line:
    /: SIZE HEIGHT '0' MM WIDTH '200' MM
    /: BOX FRAME 10 TW XPOS '11.21' MM YPOS '14.81' MM INTENSITY 100
    SAP Printer commands in SAPScripts
    The command line in the editor must be as follows:
    /:  PRINT-CONTROL xxxxx
    or
    /:  PRINT-CONTROL 'xxxxx'
    where xxxxx stands for the five-character name of the print control.
    Example:
    /:  PRINT-CONTROL ZM100
    The complete printer command normally resides in the print control.
    If characters belonging to the print command follow after the print control in the text (only useful for the HPL2 printer driver for PCL-5 printers), the text line following after the PRINT-CONTROL command should begin with an equals sign (=) in the format column.
    Example:
    /:  PRINT-CONTROL SESCP = *c5G
    If you do not use the equals sign, a space character is inserted between the print control SESCP and the character *c5G.
    Different font on the same line
    You can have different font on the same line by defining a character format.
    For example B for bold text and U for Underline. 
    In your SAPScript apply like this : 
    <U>Underline Text</> <B>Bold Text</>
    Print Footer notes only on the last page
    Command to used in your sapscripts :-
    /: IF &NEXTPAGE& EQ 0 
          whatever footer you want. 
    /: ENDIF 
    SAPscripts How to calculate Totals and Subtotals
    I have some doubs in BDC and SMART FORMS.  I want to change the material number using the transaction code MM02 through BDC.
    In scripts and smartforms how to calculate totals and subtotals?
    To calculate totals and sub totals in sap scripts you have to use subroutines.
    Say if you have to add the unit price (KOMVD-KBERT) then in the main window whereever tat value is picked write this routine
    /: DEFINE &TOT_PRICE&
    /: PERFORM F_GET_PRICE IN PROGRAM <subroutine prog name> /:USING &KOMVD-KBERT& /:CHANGING &TOT_PRICE& /:ENDPERFORM
    Then write the variable where ever you want it to be printed (mostly it will be in footer window)
    Then create subroutine pool program and you have to write the code.
    FORM F_GET_PRICE tables int_cond structure itcsy
                                        outt_cond structure itcsy. data : value type kbert.
    statics   value1 type kbert.
    Read int_cond table index 1.
    value = int_cond-value.
    value1 = value1 + value.
    Read outt_cond table index 1.
    outt_cond-value = value1.
    Modify outt_cond index 1.
    ENDFORM.
    I have given a rough outline, please be aware of the variable conversions as Int_cond-value and outt_cond-value are characters.
    Rewards some points,
    Rgds,
    P.Nag

  • Alternative unit of Measure for variant material

    Dear All,
    Here is an interesting scenario,
    There is a naterial Billet with two variant characteristics length and size. and base unit of measure is TON. Now alternative unit of measure is PCS.  How can define the conversion factor on the basis of these two variant characteristics.
    In normal material (without variant char.)
    we can define conversion factor 1PCS= 2TON
    For variant material,
    For the material Billet with variant charc length and size how can i define conversion
    so that system calculates diff. PCS with diff. length and size but material is same. So how can i Do that.
    for example for same material Billet but variant char. Length is 6 M and size is 120*120 ,its wt will be 2 TON for 1 PCS.
    for the same material Billet with variant char. length 12 M and size 120*120, its wt will be 12TON for 1 PCS.
    How can i cater this for the same material.

    Hi Shoaib,
    We have faced the similar scenario for steel industry. Based on my experience, it is not possible to define variable values for Alternative UOM conversion with the variant characteristic/configuration, specially if you want SAP to maintain inventory with variable conversion rate.
    Use the Batch specific unit of measure for this situation.
    1) Create batch specific UOM i.e. Ton_per_pc (TOP) --- User proportional unit conversion
    2) Create batch characteristic ton_per_pc and assigned UOm.
    3) In material master additonal data select proportion unit and enter the standard conversion rate between ton & pcs.
    4) While doing GR - In batch creation you can enter whatever the conversion rate is and Inventory will be updated accordingly.
    Regards,
    Ravi.

  • Question related to measures dimension...

    Hi,
    I have nearly 10 reports, and for every report there are nearly 20 measures which need to keep in the outline.If we are keeping certain measures belonging to seperate report,how to sepeate the measures of one report to another report.
    can i keep group like this...
    ACCOUNTS(+)
    Brand wise report measures(+)(label only)
    volume(+)
    per case workings(+)
    gr per unit(+)
    tp per unit(+)
    Variable conversion Report measures(+)(label only)
    Total(+)(dynamic calc)
    a(+)
    b(+)
    c(+)
    If my approach is correct,then how to aggregate a,b,c to total.some error is coming in verifying the outline saying "parent must be dynamic calc)
    Pls post the approach...
    regards
    Vardhan...

    It's hard to tell from the way you [posted it, but I'm guessing "Total" is the only child of "Variable Conversion Report measures".  Total is dynamic calc and "Variable Conversion Report measures" is label only.
    That is not allowed.  Make "Variable Conversion Report measures" dynamic calc.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to add sub total

    hi
    how to add sub total in SAP Script using subroutine

    SAPscripts How to calculate Totals and Subtotals
    I have some doubs in BDC and SMART FORMS.  I want to change the material number using the transaction code MM02 through BDC.
    In scripts and smartforms how to calculate totals and subtotals?
    To calculate totals and sub totals in sap scripts you have to use subroutines.
    Say if you have to add the unit price (KOMVD-KBERT) then in the main window whereever tat value is picked write this routine
    /: DEFINE &TOT_PRICE&
    /: PERFORM F_GET_PRICE IN PROGRAM <subroutine prog name> /:USING &KOMVD-KBERT& /:CHANGING &TOT_PRICE& /:ENDPERFORM
    Then write the variable where ever you want it to be printed (mostly it will be in footer window)
    Then create subroutine pool program and you have to write the code.
    FORM F_GET_PRICE tables int_cond structure itcsy
                                        outt_cond structure itcsy. data : value type kbert.
    statics   value1 type kbert.
    Read int_cond table index 1.
    value = int_cond-value.
    value1 = value1 + value.
    Read outt_cond table index 1.
    outt_cond-value = value1.
    Modify outt_cond index 1.
    ENDFORM.
    I have given a rough outline, please be aware of the variable conversions as Int_cond-value and outt_cond-value are characters.

  • How shd i convert 30.00  to 15 char 000000000030.00 ?

    Hi guys,
    i have a requirement to convert variable packed decimal 30.00  to 15 char 000000000030.00 ?
    Is there any std FM or i will have to manually prefix Zero's in variable.

    Conversion exit ALPHA, external->internal
    ALPHA conversion is used especially with account numbers. During conversion from the external to the internal format, the system checks to see if input in the INPUT field is purely numeric, that is, if this input consists only of numbers, possibly with spaces before and after them. If this is the case, then the number string is inserted right- justified in the display field OUTPUT and all spaces to the left of the value are filled with zeroes ('0'). If the input is not purely numeric, it is inserted in the display field from left to right and all extra spaces are filled with blanks.
    Example:
    (Input field and output field are both eight characters in length)
    1. '1234 ' --> '00001234'
    2. 'ABCD ' --> 'ABCD '
    3. ' 1234 ' --> '00001234'
    Conversion from the internal to the external format (function module CONVERSION_EXIT_ALPHA_OUTPUT) is undertaken in exactly the opposite manner.
    Usage:
    call function 'CONVERSION_EXIT_ALPHA_INPUT'
    exporting
    input = v_input
    importing
    output = v_output
    exceptions
    others = 1.
    CONVERSION_EXIT_ALPHA_INPUT - converts any number into a string fill with zeroes-right
    example:
    input = 30.00
    output = 000000000030.00
    regards,
    srinivas
    <b>*reward for useful answers*</b>

  • Variable substitution & Seeburger conversion module

    Hi everybody!
    I would like to use the variable substitution in a receiver file adapter to add the order no. (which is contained in the XML file) to the filename.
    In addition I have to convert the XML file to an edifact format using the seeburger module "localejbs/CallBicXIRaBean".
    As soon as this entry is made in the modules the following error message occurs:
    "com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: Caught SAXException while parsing XML payload: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 53, 4f, 48(:main:, row:1, col:3)"
    My problem is that the conversion from XML to edifact is done before the variable substitution is started. That`s why the reference for the variable is no longer valid as the file is already converted to a edifact (=flatfile) format.
    If I disable one of the two steps (either 1:1-mapping or variable substitution) the other step runs properly.
    Has anybody an idea how to solve this topic? Is it possible to specify the variable substitution as module? If this is possible I could solve it by just reordering the two steps in the module chain.
    Kind regards
    Chris

    Use Dynamic Configuration Bean to set this value. You have to use this well before "localejbs/CallBicXIRaBean".
    Check SAP note : 974481 for more information.
    Blog: [/people/jin.shin/blog/2007/04/27/sap-netweaver-xi-variable-substitution-with-adapter-specific-message-attributes-via-dynamicconfigurationbean|/people/jin.shin/blog/2007/04/27/sap-netweaver-xi-variable-substitution-with-adapter-specific-message-attributes-via-dynamicconfigurationbean]
    Second Approach if the above approach doesnt work.
    Use Dynamic Configuration concept in UDF to set the filename under message Mapping.
    Thanks,
    - Gujjeti.
    Edited by: Praveen Gujjeti on Feb 25, 2009 11:25 AM

  • FILE CONTENT CONVERSION/ VARIABLE SUBSTITUTION

    Hi Experts,
    I have a reciver file which should have
    HEADER
    field 1
    field 2
    DETAIL
    field 1
    field 2
    TRAILER
    field 1
    field 2
    My reciever structure is
    HEADER
    field 1
    field 2
    DETAIL
    field 1
    field 2
    TRAILER
    field 1
    field 2
    TEMP
    field 1
    I am using TEMP field1 only for variable substitution and do not want
    it to be written to file. How can i use it in FCC.
    Pl. Help
    Akhil

    Hi,
    Plz do refer the folowing links:
    Sender -
    /people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1
    Key value:
    /people/venkat.donela/blog/2005/06/08/how-to-send-a-flat-file-with-various-field-lengths-and-variable-substructures-to-xi-30
    /people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file
    /people/shabarish.vijayakumar/blog/2005/08/17/nab-the-tab-file-adapter -
    TAB delimited
    /people/jeyakumar.muthu2/blog/2005/11/29/file-content-conversion-for-unequal-number-of-columns
    /people/shabarish.vijayakumar/blog/2006/02/27/content-conversion-the-key-field-problem
    /people/michal.krawczyk2/blog/2004/12/15/how-to-send-a-flat-file-with-fixed-lengths-to-xi-30-using-a-central-file-adapter
    NAB the TAB (File Adapter)
    /people/shabarish.vijayakumar/blog/2005/08/17/nab-the-tab-file-adapter
    Receiver FCC no need of Endseparator
    /people/shabarish.vijayakumar/blog/2007/08/03/file-adapter-receiver--are-we-really-sure-about-the-concepts
    Regards,
    Vinod.

  • Sorting Currency conversion Variables in Query Selection screen

    Hi Experts,
    I have an issue in sorting variables.
    A Currency translation is used here which has two selection options here, one for "Currency" and one for "Currency conversion date". They just pop in somewhere in the selection screen with out order. I want to put them together either in the middle or at the bottom.
    They are not visible in the Variable sequence tab of query properties.
    I changed the text for each of them (Ex. "XCurrency"), so that it sorts alphabetically, but no difference.
    Had anybody come accross this issue before.
    regards
    G Rai

    Hi,
    This seems strange that the variable does not show in the query properties. One thing I can suggest it to try changing the technical name/desciption of the variable if that changes the order.
    Please update back the thread if that helps.

  • File Sender, Content Conversion - how to define variable length last field?

    XI 3.0 SP17
    With a File Sender communication channel, that uses Content Conversion - how do I define a 'variable length' last field?
    The scenario - the input file has four fields, of which the first three are a known fixed length, and the last (fourth, trailing) field is variable in length.
    Using a Message Protocol of 'File Content Conversion', how do I define that last variable length field (field name 'WOData' below) in the Content Conversion Parameters section?
    My current parameters are:
    Recordset Structure  -  Row,*
    ignoreRecordsetName  -  true
    Row.fieldFixedLengths  -  1,12,5,99999
    Row.fieldNames  -  WOType,WONum,WOLine,WOData
    I've tried the following for 'Row.fieldFixedLengths' to no avail -
    '1,12,5,*'
    '1,12,5,0'
    '1,12,5,'
    '1,12,5'
    The last two were grasping at straws )
    The only thing I've got to work is specifying a 'large' value for the final field (99999 above).
    In addition, does anyone know if specifying a large value (e.g. 99999) for the final trailing field will give rise to performance issues when the file is being processed?
    In the help for "Converting File Content in a Sender Adapter", it states -
    <Begin Quote>
    NameA.fieldFixedLengths
    If you make a specification here, the system expects a character string that contains the lengths of the structure columns as arguments separated by commas.
    If you also specify a separator for the columns, you must not add its length to the length of the columns.
    This entry is mandatory if you have not made an entry for NameA.fieldSeparator.
    <End Quote>
    http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm

    << note that fieldFixedLengths will not take any wildcard entries like *. So in these case it is ideal to provide a maximum char length.  But note that while the file is being created that many spaces will be created in your file !!! >>
    Hi Shabarish,
    Yes, no wildcard is the conclusion I came to, hence my maximum )
    The message size did not increase by any 'blank padding'.  When I look in [Message Display Tool (Detail Display)] 'Audit Log for Message: X'  -
    2006-10-17 18:22:42 Success Channel X: Entire file content converted to XML format
    2006-10-17 18:22:42 Success Send binary file  "X" from FTP server "X", size 103290 bytes with QoS EO
    2006-10-17 18:22:42 Success Application attempting to send an XI message asynchronously using connection AFW.
    2006-10-17 18:22:42 Success Trying to put the message into the send queue.
    2006-10-17 18:22:42 Success Message successfully put into the queue.
    2006-10-17 18:22:42 Success The application sent the message asynchronously using connection AFW. Returning to application.
    The input flat file in non-XML format was 92,132 bytes and the message payload into XI was 103,290 bytes.
    My understanding is that trailing spaces are stripped from XML nodes.

Maybe you are looking for

  • White screen after Apple charging screen, only loads OS X in Safe Boot

    Well, since yesterday, I have been annoyed because of a problem that my iMac has: On booting up the Mac, it does the chime and appears the Apple logo and its loading bar, and begins loading. Everything's ok, isn't it? Well, problem is about to happen

  • Error in running the jsf file.

    Hi, I am using jdev 11.1.2.0. I am creating the sample tutorial task as "Developing Rich Web Applications With Oracle ADF". After giving the HireDate default value as adf.currentDate, I got the error 500: Internal Server Error. It give the message as

  • How to control the output types in PO MESSAGES

    Hi Friends, As per the requirement I need to control the message in Standard PO(ME22N). Scenario is like below. 1.     I am modifying some field value in PO and saving it. Then clicking on MESSAGES tab. Now I am seeing some output types are adding in

  • Led Light on MageSafe Charger Does not light;MacBook Air Recognizes it but does not charge

    So I've had my MacBook Air (Mid-2011) for over a year now. The reason I am posting this is because I originally had a 40W MagSafe "L" Shape that came with my MacBook Air. Well I accidently spilled Pepsi on it while it was plugged in and you get the g

  • Flash Help Not Updating on Web

    I've uploaded a Flash help project to our web site. But the latest information is NOT showing up, no matter how many times I click refresh or clear out the associated cached files. I've even deleted all the items on the server and re-uploaded the ent