Checking for same data type
Im trying to do basic Math.sqrt(x*x +y*y) calculations with inputted 3 variables but want a simply error checking if-statement to find out if the variables are compatible, as in inputted 2,3,F...F will not work. Any help?
This works, and it guards against overflow when it calculates the square root of the sum of squares:
public class SquareRooter
public static void main(String [] args)
if (args.length > 1)
try
double x = Double.parseDouble(args[0]);
double y = Double.parseDouble(args[1]);
System.out.println("x : " + x);
System.out.println("y : " + y);
System.out.println("sqrt(x*x + y*y): " + SquareRooter.squareRoot(x, y));
catch (NumberFormatException e)
e.printStackTrace(System.err);
else
System.out.println("Usage: SquareRooter <x> <y>");
public static double squareRoot(final double x, final double y)
double xabs = Math.abs(x);
double yabs = Math.abs(y);
if (xabs > yabs)
double ratio = yabs/xabs;
return xabs*Math.sqrt(1.0 + ratio*ratio);
else
double ratio = xabs/yabs;
return yabs*Math.sqrt(1.0 + ratio*ratio);
}MOD
Similar Messages
-
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.KHello 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 -
How to use same Data Type and Length for two fields
How to use same data type and length for two fields when using 'FOR ALL ENTRIES IN' in a select statement? For instance the select queries are :
SELECT bukrs gjahr belnr lifnr budat bldat zlspr dmbtr waers shkzg
FROM bsik
INTO TABLE it_bsik
WHERE bukrs = p_bukrs
AND lifnr IN s_lifnr.
IF it_bsik IS NOT INITIAL.
SELECT belnr gjahr awkey awtyp
FROM bkpf
INTO TABLE it_bkpf
FOR ALL ENTRIES IN it_bsik
WHERE belnr = it_bsik-belnr
AND gjahr = it_bsik-gjahr.
IF it_bkpf IS NOT INITIAL.
SELECT belnr gjahr lifnr xblnr
FROM rbkp
INTO TABLE it_rbkp
FOR ALL ENTRIES IN it_bkpf
WHERE belnr = it_bkpf-awkey+0(10)
AND gjahr = it_bkpf-awkey+10(4).
ENDIF.
ENDIF.
Here it gives an error in the 3rd select query that 'When you use the addition "FOR ALL ENTRIES IN itab", the fields "GJAHR" and "IT_BKPF2-AWKEY+10(4)" must have the same type and the same length.'
Kindly clarify.Hi Saurabh,
Please see the example code that I have developed for you. It will help you solve the problem.
REPORT ZTEST_3 .
tables : BKPF.
data : begin of it_bkpf occurs 1,
belnr type RE_BELNR,
awkey type awkey,
awtyp type awtyp,
gjahr type GJAHR,
end of it_bkpf.
data : begin of it_bkpf1 occurs 1,
belnr type RE_BELNR,
awkey type gjahr, " change the data type
awtyp type awtyp,
gjahr type GJAHR,
end of it_bkpf1.
data : begin of it_rbkp occurs 1,
belnr type BELNR_D,
gjahr type gjahr,
lifnr type LIFRE,
xblnr type XBLNR,
end of it_rbkp.
select belnr
awkey
awtyp
gjahr
from bkpf
into table it_bkpf
where BUKRS = 'TELH'.
loop at it_bkpf.
it_bkpf1-belnr = it_bkpf-belnr.
it_bkpf1-awkey = it_bkpf-awkey+10(4). "Here only append the required length.
it_bkpf1-awtyp = it_bkpf-awtyp.
it_bkpf1-gjahr = it_bkpf-gjahr.
append it_bkpf1.
clear it_bkpf1.
endloop.
select belnr
gjahr
lifnr
xblnr
from RBKP
into table it_rbkp
for all entries in it_bkpf1
where belnr = it_bkpf1-belnr
This is just an example. Change the fields according to your requirement.
Regards
Abhii
Edited by: Abhii on Mar 9, 2011 9:08 AM -
I'm writing a calendar applet for a programming class and I've nearly completed it but I'm stuck at checking for valid data.
What seems to be happening is that paintComponent() is being called before actionPerformed.
In actionPerformed (when they click the button), it checks to make sure they entered a valid month (1 to 12). If the didn't it dispalys a message, but if they did it calls repaint().
But even if repaint() isn't called, Java still seems to call it before actionPerformed and I get exceptions.
So I tried checking inside of paintComponent() by using a simple if(...) return; but that doesn't seem to do anything... it just keeps going through with the method.
So -- Once the user presses my button I want to make sure the data is valid before repainting the screen. How can I do this?I validate it in actionPerformed which is called by
the action listener... that is what you meant right?
The problem is that it seems paintComponent() is being
called before I can validate the data with
actionPerformed(). I need to stop paintComponent()
from always being calledMVC. (Model, View, Controller)
Initially the internal value of the data (the model) should be valid (or null with a check in the paintComponent method)
paintComponent (the view part) shows the state of the valid data.
You press the button.
actionPerformed is called (the controller).
It checks the value and, if valid, writes it to the data (model), then updates the view.
At no point will the view have to render invalid data, because the model is only updated after actionPerformed checks the value.
The pattern may be applied with different classes performing the three roles, or different methods in the same class (sometimes it's easier that way for simple cases).
Pete -
Receiver determination doesn't work for same IDoc type but in differentSWCV
hi guys,
we have an emergency now. Receiver determination doesn't work for same IDoc type but in different SWCV.Please check below for detail.
1. The process flow is : R/3 IDoc -> XI -> Third party system
2. In previous release R13, IDoc ORDERS05 was imported and used in XI and software component version is R13. And receiver determination was created.
3. Now, in new release R17, IDoc ORDERS05 was imported from R/3 to XI again and software component version is R17. And in R17, the receiver determination created in R13 was used for both old interface(R13) and new interface in R17.
Then we encountered the problem, both interfaces doesn't work now, even we deleted the receiver condition(In R13, IDoc ORDERS05 was sent to system A, and in R17 IDoc ORDERS05 was sent to system B, RCVPRN was used as an condition).
Does anyone encounter this problem? really need and appreciate your help.
-Eddieinformation from monitor:
Status Sender Service Sender Namespace Sender Interface
reschedul XXXCLNT100 urn:sap-com:document:sap:idoc:messages ORDRSP.ORDERS05
columns for "Receiver Service","Receiver Namespace", "Receiver Interface" are blank
And then double click records in monitor, go into detail information...
Normally there's lots of setps existed, such as
Inbound Message ( CENTRAL )
Receiver Identification
Interface Determination
Receiver Grouping
Message Branch According to Receiver List
Technical Routing
Call Adapter
But now there's only one setp -
"Inbound Message ( CENTRAL )" existed, no any another setp..., and payload in inbound message looks good.
And in SMQ2, I checked the queue information, found there's an error - "An exception occurred that was not caught." No any other detail information for this error. -
[SOLVED] Value too large for defined data type in Geany over Samba
Some months ago Geany started to output an error whith every attempt to open a file mounted in smbfs/cifs.
The error was:
Value too large for defined data type
Now the error is solved thanks to a french user, Pierre, on Ubuntu's Launchpad:
https://bugs.launchpad.net/ubuntu/+bug/ … comments/5
The solution is to add this options to your smbfs/cifs mount options (in /etc/fstab for example):
,nounix,noserverino
It works on Arch Linux up-to-date (2009-12-02)
I've writed it on the ArchWiki too: http://wiki.archlinux.org/index.php/Sam … leshootingAn update on the original bug. This is the direct link to launchpad bug 455122:
https://bugs.launchpad.net/ubuntu/+sour … bug/455122 -
Hi there,
I am having a kind of weird issues with my oracle enterprise db which was perfectly working since 2009. After having had some trouble with my network switch (replaced the switch) the all network came back and all subnet devices are functioning perfect.
This is an NFS for oracle db backup and the oracle is not starting in mount/alter etc.
Here the details of my server:
- SunOS 5.10 Generic_141445-09 i86pc i386 i86pc
- Oracle Database 10g Enterprise Edition Release 10.2.0.2.0
- 38TB disk space (plenty free)
- 4GB RAM
And when I attempt to start the db, here the logs:
Starting up ORACLE RDBMS Version: 10.2.0.2.0.
System parameters with non-default values:
processes = 150
shared_pool_size = 209715200
control_files = /opt/oracle/oradata/CATL/control01.ctl, /opt/oracle/oradata/CATL/control02.ctl, /opt/oracle/oradata/CATL/control03.ctl
db_cache_size = 104857600
compatible = 10.2.0
log_archive_dest = /opt/oracle/oradata/CATL/archive
log_buffer = 2867200
db_files = 80
db_file_multiblock_read_count= 32
undo_management = AUTO
global_names = TRUE
instance_name = CATL
parallel_max_servers = 5
background_dump_dest = /opt/oracle/admin/CATL/bdump
user_dump_dest = /opt/oracle/admin/CATL/udump
max_dump_file_size = 10240
core_dump_dest = /opt/oracle/admin/CATL/cdump
db_name = CATL
open_cursors = 300
PMON started with pid=2, OS id=10751
PSP0 started with pid=3, OS id=10753
MMAN started with pid=4, OS id=10755
DBW0 started with pid=5, OS id=10757
LGWR started with pid=6, OS id=10759
CKPT started with pid=7, OS id=10761
SMON started with pid=8, OS id=10763
RECO started with pid=9, OS id=10765
MMON started with pid=10, OS id=10767
MMNL started with pid=11, OS id=10769
Thu Nov 28 05:49:02 2013
ALTER DATABASE MOUNT
Thu Nov 28 05:49:02 2013
ORA-00202: control file: '/opt/oracle/oradata/CATL/control01.ctl'
ORA-27037: unable to obtain file status
Intel SVR4 UNIX Error: 79: Value too large for defined data type
Additional information: 45
Trying to start db without mount it starts without issues:
SQL> startup nomount
ORACLE instance started.
Total System Global Area 343932928 bytes
Fixed Size 1280132 bytes
Variable Size 234882940 bytes
Database Buffers 104857600 bytes
Redo Buffers 2912256 bytes
SQL>
But when I try to mount or alter db:
SQL> alter database mount;
alter database mount
ERROR at line 1:
ORA-00205: error in identifying control file, check alert log for more info
SQL>
From the logs again:
alter database mount
Thu Nov 28 06:00:20 2013
ORA-00202: control file: '/opt/oracle/oradata/CATL/control01.ctl'
ORA-27037: unable to obtain file status
Intel SVR4 UNIX Error: 79: Value too large for defined data type
Additional information: 45
Thu Nov 28 06:00:20 2013
ORA-205 signalled during: alter database mount
We have already checked in everywhere in the system, got oracle support as well without success. The control files are in the place and checked with strings, they are correct.
Can somebody give a clue please?
Maybe somebody had similar issue here....
Thanks in advance.Did the touch to update the date, but no joy either....
These are further logs, so maybe can give a clue:
Wed Nov 20 05:58:27 2013
Errors in file /opt/oracle/admin/CATL/bdump/catl_j000_7304.trc:
ORA-12012: error on auto execute of job 5324
ORA-27468: "SYS.PURGE_LOG" is locked by another process
Sun Nov 24 20:13:40 2013
Starting ORACLE instance (normal)
control_files = /opt/oracle/oradata/CATL/control01.ctl, /opt/oracle/oradata/CATL/control02.ctl, /opt/oracle/oradata/CATL/control03.ctl
Sun Nov 24 20:15:42 2013
alter database mount
Sun Nov 24 20:15:42 2013
ORA-00202: control file: '/opt/oracle/oradata/CATL/control01.ctl'
ORA-27037: unable to obtain file status
Intel SVR4 UNIX Error: 79: Value too large for defined data type
Additional information: 45
Sun Nov 24 20:15:42 2013
ORA-205 signalled during: alter database mount -
Problem importing two service interfaces using the same data types
Hi,
I've been playing around with BPM for a while. Now I wanted to add a custom service interface to my starting event. I created the interface in ESR of CE 7.11. After importing I get this error message and I can't use the interface:
Cannot change XsdSimpleTypeDefinition AcademicTitleCodeContent by importing the document http://sap.com/xi/APPL/SE/Global::src/wsdl/TestInterface.wsdl, because it is already defined in the document http://sap.com/xi/APPL/SE/Global::src/wsdl/rootwsdl_CustomerERPByIDQueryResponse_InService.wsdl in this project. Importing into another project might be possible.
Of course the problem is clear, but how can I achieve importing two service interfaces that use the same data type without changing the xsd source?
Thanks in advance,
ManeSorry for the late answer, but I am really busy at the moment.
Unfortunately I can't the Interface and data types are already changed.
But this happened various times. Each time I already had imported a SAP Enterprise Service into NW BPM that contains a bunch of inline data types. While creating my own interface I referenced one of those data types that are stored in a SAP namespace. After import the error message appeared.
In the wsdl of the created interface there is a import statement for the namespace where the referenced data types origin from. Additionally there is a namespace definition xmlns:p1="SAPnamespace". In the element the type is "p1:ReferencedType". Could this maybe cause the error, because one time it is with this leading p1 in my created wsdl and once without in the SAP Service wsdl?
Thanks and I am looking forward to next EhP of NW BPM,
Mane -
Configuration for consolidated check for same vendor from different company
Hi All,
My company is trying to print a single check for same vendor with same vendor number in multiple company code.
The Automatic payment parameters has all company codes where the vendor is having open items.
But when payment run is carried out and the check is printed, there are more than 1 check printed for the same vendor corresponding to the cleared invoices.
One company is paying for all other companies and still multiple checks are printed.
Can someone help with some lead to resolve this issue.
Points will be assigned for helpful tips and answers.
Thanks alot in advanceHi,
i understood ur problem so dont worry.... solution is there in sap
while confiqure automatic payment program in FBZP give paying company code payment transaction give company code what check through you want to pay that ....ofter that payment will go through this company code check only
may be this information is useful to you -
Microsoft OLE DB Provider for Oracle: Data type is not supported.
I got the error:
Microsoft OLE DB Provider for Oracle: Data type is not supported.
Shortly after upgrading from Oracle 8 to Oracle 9. I was advised to download more up to date oracle drivers, but I was wondering if there was a way to tell what version of the 'OLE DB Provider for Oracle' is already at. Is there a command I can use via SQL Plus or something?I have found Microsoft ODBC for Oracle to be more stable than the Microsoft OLEDB for Oracle driver. I have also found both Microsoft ODBC and OLEDB drivers to be more stable than the drivers from Oracle.
You could always get the latest MDAC (Microsoft Data Access Components) from Microsoft's MSDN Download site and then get the ODAC (Oracle Data Access Components) from Oracle's OTN Download site. ODAC requires MDAC. And ODAC has the latest drivers.
I suppose it would help to have the latest patches for your Oracle client software too. Maybe Oracle MetaLink would have these?
It may even help to have the latest service pack for Visual Studio 6 (Visual C++ 6 and Visual Basic 6) too. -
'Value too large for defined data type' error while running flexanlg
While trying to run flexanlg to analyze my access log file I have received the following error:
Could not open specified log file 'access': Value too large for defined data type
The command I was running is
${iPLANET_HOME}/extras/flexanlg/flexanlg -F -x -n "Web Server" -i ${TMP_WEB_FILE} -o ${OUT_WEB_FILE} -c hnrfeuok -t s5m5h5 -l h30c+5 -p ctl
Which should generate a html report of the web statistics
The file has approx 7 Million entries and is 2.3G in size
Ideas?I've concatenated several files together from my web servers as I wanted a single report, several reports based on individual web servers is no use.
I'm running iWS 6.1 SP6 on Solaris 10, on a zoned T2000
SunOS 10 Generic_118833-23 sun4v sparc SUNW,Sun-Fire-T200
Cheers
Chris -
Java rounding for Double data type
Hi,
Is there a way to change the default precision to 2 digits after decimal point for Double data type.java.text.DecimalFormat:
import java.text.DecimalFormat;
DecimalFormat format = new DecimalFormat("#.00");
StringBuffer formatted = format.format(Math.PI, new StringBuffer(), new FieldPosition(0));
System.out.println(formatted); // prints out 3.14Probably as applicable today as it was 3 years ago -
Initialization for char data type?
I observed that as String I can declare something like this:
String str = ""; but for char data type, if I declare:
char ch = ''; the compiler will have an error: "empty character literal". So how can I fixe this problem when I want to initialize my char variables as "empty"? Anyone got an idea?
Message was edited by:
hoangSoccer
Message was edited by:
hoangSoccerStrings (and StringBuffers/Builders) are collections* of characters - so it makes
sense to be able to refer to a String with precisely zero characters. But char is not a collection of anything - it has whatever value it has and can never
be empty.
*collections with a small 'c'. -
Data change after call xml transformation for RAW data type
Hi,
Can someone explain what is workarround or any help for below problem
when call transformation is called for usr02 records, after xml string is generated is showing different data for RAW data type for example content of fields BCODE,PASSCODE etc get convert into different data
for example: content of BCODE fields before xml transformation say -7F8087472FB996E5
after xml transformation it display as f4CHRy+5luU=
why is this so happening? is this known behaviour after xml transformation or it is bug in xml transformation?
thanks in advance.
Regards,
John.Hi,
I think this is because RAW data is BASE64 encoded when using CALL TRANSFORMATION.
Old post, but did you ever find a way to change that?
Thanks -
Mkisofs: Value too large for defined data type too large
Hi:
Does anyone meet the problem when use mkisofs command?
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Warning: creating filesystem that does not conform to ISO-9660.
mkisofs 2.01 (sparc-sun-solaris2.10)
Scanning iso
Scanning iso/rac_stage1
mkisofs: Value too large for defined data type. File iso/rac_stage3/Server.tar.gz is too large - ignoring
Using RAC_S000 for /rac_stage3 (rac_stage2)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Thanks!An update on the original bug. This is the direct link to launchpad bug 455122:
https://bugs.launchpad.net/ubuntu/+sour … bug/455122
Maybe you are looking for
-
MacBook Pro firmware update after erase & install
Hi, I just tried to update from 10.4.10 to 10.4.11 with software update last night and got the error message a lot of people have been experiencing, then, got stuck at the apple logo with the never-ending spinning wheel... well... tried repairing dis
-
Aperture 3.0.1 - Fix the crashing bugs now Apple!
I'm coming from Aperture 2 and was so excited about the new brushes features that I had to buy version 3 straight away. What a mistake that was! I can't run this version for more than about 5 mins (while using the new brushes feature) before the appl
-
Hi friends Do we have a standard report that gives total number of labour hours (activity type) per work center for a particular period. Thanks
-
My Iphone is constantly trying to turn itself off and also taking screen shots when I'm not touching it. I think it may have something to do with the Sleep button but would welcome any suggestions. I have already restored it to Factory settings but
-
I am trying to get a serial number for the student edition of Lightroom
Can I use an alternate email address for my redemption number? During the student validation process I was told the number was sent to my student email address but it is not there.