Round up character data?
I am a newbie in SAP.
I have a variable declared like this:
DATA y_dots(6) TYPE c.
I performed some mathematical operation on this variable and it ends up as 56.5.
So do I round up this variable so that it becomes 57 or 56?
Please help and I will reward you.
Thanks
Hi,
Just do like this,
define one local variable with type p then move your field (type c field) into this variable and display this.
sample code shows here how to do that,
DATA: data(5) TYPE c VALUE '12.60',
data1 type p.
data1 = data.
WRITE: data1, data.
it'll solve your problem.
seshu.
Similar Messages
-
Problem with the round function using Date
Hi,
I have a problem with round function for Date. The input is the four digit year which was picked out from say SYSDATE.
In these scenarios the original value should be rounded up and should get the output as shown under rounded column.
Scenario1
Original Rounded
2020 ---> 2020
2021 ---> 2020
2022 ---> 2020
2023 ---> 2020
2024 ---> 2020
2025 ---> 2025
2026 ---> 2025
Scenario2
Original Rounded
2020 ---> 2020
2021 ---> 2025
2022 ---> 2025
2023 ---> 2025
2024 ---> 2025
2025 ---> 2030
2026 ---> 2030
Scenario3
Original Rounded
2020 ---> 2020
2021 ---> 2020
2022 ---> 2020
2023 ---> 2025
2024 ---> 2025
2025 ---> 2025
2026 ---> 2025
Can anyone help with this....Urgent Please
Thanx for your time1.
SQL> select n,n-mod(n,5) rnd from test;
N RND
2020 2020
2021 2020
2022 2020
2023 2020
2024 2020
2025 2025
2026 2025
2.
SQL> select n,n+(case when mod(n,10) = 0 then 0
2 when mod(n,10) < 5 then 5-mod(n,5)
3 else 10-mod(n,10)
4 end) rnd
5 from test;
N RND
2020 2020
2021 2025
2022 2025
2023 2025
2024 2025
2025 2030
2026 2030
7 rows selected.
3.
SQL> select n,n+(case when mod(n,10) < 3 then mod(n,10)*-1
2 when mod(n,10) < 8 then 5-mod(n,10)
3 else 10-mod(n,10)
4 end) rnd
5 from test;
N RND
2020 2020
2021 2020
2022 2020
2023 2025
2024 2025
2025 2025
2026 2025
2027 2025
2028 2030
2029 2030
2030 2030
11 rows selected. -
SAX parser splits up character data; I expected Ign. whitesp
Im am working on a XML parser for loading data from some back
end systems into an Oracle 8i database. I am using the SAX
parser for this purpose. After doing some tests with larger
amounts of XML data (> 1M), I found some unexpected behaviour.
The parser sometimes splits up character data into two chunks of
data. The XML looks as follows:
<TAGNAME> this is the character data </TAGNAME>
The parser raises the following events:
1 startElement name = "TAGNAME"
2 characters chbuf = " "
3 characters chbuf = "this is the character data "
4 endElement name = "TAGNAME"
I expected an ignorableWhitespace event at step 2. The XML
document contains repetitive tagnames. The strange thing about
the parse process is that the parser splits up the character
data only sometimes, and I can't determine any kind of logica
for this behaviour. Most occurrences of exactly the same tagname
and character data are parsed correctly (that is, as I
expected).
Am I dealing with correct behaviour here, or is it a bug??
Rolf.
nullOracle XML Team wrote:
: Rolf van Deursen (guest) wrote:
: : Im am working on a XML parser for loading data from some
back
: : end systems into an Oracle 8i database. I am using the SAX
: : parser for this purpose. After doing some tests with larger
: : amounts of XML data (> 1M), I found some unexpected
behaviour.
: : The parser sometimes splits up character data into two
chunks
: of
: : data. The XML looks as follows:
: : <TAGNAME> this is the character data </TAGNAME>
: : The parser raises the following events:
: : 1 startElement name = "TAGNAME"
: : 2 characters chbuf = " "
: : 3 characters chbuf = "this is the character data "
: : 4 endElement name = "TAGNAME"
: : I expected an ignorableWhitespace event at step 2. The XML
: : document contains repetitive tagnames. The strange thing
about
: : the parse process is that the parser splits up the character
: : data only sometimes, and I can't determine any kind of
logica
: : for this behaviour. Most occurrences of exactly the same
: tagname
: : and character data are parsed correctly (that is, as I
: : expected).
: : Am I dealing with correct behaviour here, or is it a bug??
: : Rolf.
: The behavior is expected and correct. Could you elaborate on
why
: you would expect the parser to treat the whitespace signalled
in
: step 2 as ignorable?
: Oracle XML Team
: http://technet.oracle.com
: Oracle Technology Network
Thank you for your quick response.
In my test XML, there are about 27500 tags containing character
data. All character data starts with a whitespace character.
After parsing the xml, the whitespace of only 5 (!) tags is
treated as a seperate character event (so two character events
are raised in succession). The remaining tags all raise only ONE
character event for the entire character data. I can't explain
the difference in treatment.
null -
Is BPEL supports writing character data into binary format ?
Hello,
I can write a BLOB data from DB to a file using Opaque feature in File Adapter.
But is it possible to write Character data into Binary or Hex Format either by using base64Binary or Hex or bytes formats supported in XML?
ThanksI am looking WHOLE FORMA DATA in either XSTRING or BINARY FORMAT or any other format, except STRING format.
I gave COUNTRY as an example, but am looking the HWOLE form AS IS
Any help pls.
Thank you -
Issue Migrating Character Data Using a Full Export and Import
Hi There;
I have a database in my local machine that doesn't support Turkish characters. My NLS_CHARACTERSET is WE8ISO8859P1, It must be changed to WE8ISO8859P9 , since it supports full Turkish characters. I would like to migrate character data using a full export and import and my strategy is as follows:
1- create a full export to a location in network,
2- create a new database in local machine that it's NLS_CHARACTERSET is WE8ISO8859P9 (I would like to change NLS_LANGUAGE and NLS_TERRITORY by the way)
3- and implement full import to newly created database.
I 've implemented first step, but I couldn't implement the second step. I 've created the second step by using toad editor by clicking Create -> New Database but I can not connect the new database. I must connect new database in order to perform full import. How can I do this?
Thanks in advance.
Technical Details
NLS_LANGUAGE.....................AMERICAN
NLS_TERRITORY.....................AMERICA
NLS_CURRENCY.....................$
NLS_ISO_CURRENCY..............AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CHARACTERSET.............WE8ISO8859P1
NLS_CALENDAR.....................GREGORIAN
NLS_DATE_FORMAT................DD-MON-RR
NLS_DATE_LANGUAGE...........AMERICAN
NLS_SORT...............................BINARY
NLS_TIME_FORMAT.................HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT......DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT............HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT..DD-MON-RR HH.MI.SSXFF AM TZR
NLS_DUAL_CURRENCY............ $
NLS_COMP...............................BINARY
NLS_LENGTH_SEMANTICS.......BYTE
NLS_NCHAR_CONV_EXCP........FALSE
NLS_NCHAR_CHARACTERSET...AL16UTF16
NLS_RDBMS_VERSION............10.2.0.1.0First, if your applications run on Windows, do not use WE8ISO8859P9. Use TR8MSWIN1254.
Second, if you create a new database, the database is not necessarily immediately accessible to outer world. I do not know Toad and I have no idea if it performs all necessary steps required for the new database to be visible. For example, in the Toad itself, I assume you should create a new connection that references the new SID of the newly created database and use this new connection to connect. However, connections without a connection string use the ORACLE_SID setting in Registry to tell connecting applications which instance (database) to use. To change the database accessed with an empty connection string you need to modify Registry (unless Toad has an option to do this for you). If you want to connect without changing Registry, you need a connect string. This requires setting up Oracle Listener to serve the new database (unless default configuration is used and the database registers itself with the default listener). It also requires changing tnsnames.ora file to create an alias for the new database. Net Manager and/or Net Configuration Assistant can help you with this.
I wonder if Database Configuration Assistant would not be a better tool to create new Oracle databases.
Thanks,
Sergiusz -
Is it possible to include character data in a cube?
I would like to include some table columns which contain character data and it doesn't look like it can be done.I mean data with a data type of char or varchar. We currently are using Business Objects to create reports that include columns of text like name, address, state, and county and I want to know if it is possible to use cubes, and bibeans, etc to recreate these reports.
The OLAP User's Guide says on page 4-9 that measures are required to be numeric or date data type. So is the only way to include data like this is include them in dimensions? -
Using JDBC to update nvarchar (foreiegn character data)
We have an application that updates tables in Oracle with foreign character data. The database character set is not UTF-16 but nvarchar columns are set to be nvarchar.
The application is working correctly in our development environment (using ORAOLEDB to connect to the server with the NDATATYPE value set to true). The development env is Eclipse/Tomcat 5.5/JRE 1.4
Our production environment is Weblogic using JDBC. In this environment we cannot correctly update our database with ???? written to the database.
What can we do to fix this issue?
TksMark,
I believe Kuassi Mensah has an example of this in his book.
Sorry but I don't have my copy handy now.
Just search for his threads in the forum archives: Not just this one.
Try the JDBC forum and the Oracle database JVM forum.
Basically you can load the DB2 JDBC driver into Oracle database and then use a java stored procedure to get the data.
Good Luck,
Avi. -
Found character data inside an array element while deserializing
Hi Experts,
When I am trying to execute the webservice I am getting the following error
Found character data inside an array element while deserializing
Actual structure is as follows
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://10.1.2.21:8090/axis/services/InventoryManager" targetNamespace="http://10.1.2.21:8090/axis/services/InventoryManager">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:element xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns="" name="retrieveInventoryRequest" type="retrieveInventoryRequest" />
<xsd:complexType xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="ArrayOf_xsd_string">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]" />
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="ArrayOf_tns1_SkuQuantity">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="tns1:SkuQuantity[]" />
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
I know XI doesnt support array types thats why I have created my own structure as follows
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="retrieveInventory" type="InvArray" />
<xsd:complexType name="InvArray">
<xsd:sequence>
<xsd:element name="pOutletList" type="xsd:string" maxOccurs="unbounded" form="qualified" />
<xsd:element name="pSkuQuantityList" type="xsd:string" maxOccurs="unbounded" form="qualified" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
This webservice takes input like
storenumber1;storenumner2....
item1,qty;item2,qty.
I am passing values like this to my webservice. But still I am getting the same problThe problem doesn't seem to be related to the XI system. Have you done any configuration at receiver Webservice to convert the string data passed through XI into string array data? I think there is a mismatch in what XI sends and receiver expects.
Regards,
Prateek -
my niece's device is locked for 23 million minutes!!!! How can i get round without losing data as at 8 she hasnt backed up!
If you restore you will have to restore to latest Apple's software, that frankly *****. I did it and I completely regret. On iOS 6.1.5 NOTHING works.
-
Hi,
I am uploading character data in a input file using the Business object BUS1088 using LSMW. I am able to generate the IDOCs but when the IDOCs are posted at the inbound, I am getting an error 51 'application document not posted'. Can someone figure this out.
Points assured.
Thanks.Hi Raju,
Pls check the IDOC # with status 51 in Inbox through txn <b>WE05</b>. In status record display, you will find the reason for error. Probably some field could not have been determined leading the error.
Cheers,
Vikram
Pls reward for helpful replies!! -
Is there a function module that does Rounding for Analytical Data?
If I use function module ROUND, 1.25 becomes 1.3 and 1.35 becomes 1.4
But in analytical rounding rules, if the last digit is even round down and last digit is odd round up. So 1.25 becomes 1.2 and 1.35 becomes 1.4.megan,
do one thing.
check the last digit of the number(dec_digit in the code snipet). (1st digit after decimal as per your rule). u can pass it to string and then use split or some other thing to get the 1st digit after decimal.
then use a if block either to floor or ceil.
gv_val = dec_digit mod 2.
if gv_val = 0.
gv_result = floor (amount).
else.
gv_result = ceil (amount)
endif.
i am not givign a executed code here as i dont have sap currently with me. but use this logic. hope this will do your job.
thanks
Somu -
Query help with round up of dates
Hi,
I have a problem with my query.
I am calculating the difference between two dates and I want to get the hours.
The problem is that I want the following to happen:
if the difference is x such that x > 0 it should round it up to 1 (example: x = 0.1 it should be rounded up to 1)
if the difference is y such that y >1 it should be rounded to 1 (example y = 1.05 it should be rounded up to 2)
i have the following query at the momet:
select to_char(arrivaldate,'DD/MM/YYYY hh24:mi:ss') as "ARRIVAL", to_char(departuredate,'DD/MM/YYYY hh24:mi:ss') as "DEPARTURE", round(trunc(mod((departuredate-arrivaldate)*24,24),2)) as duration from stay_log;
thanks.Hi,
Format your code so that the physical appearance of the code gives some hint as to what you're doing, as I did below.
When posting code on this forum, always type {code} tags at the beginning and end of formatted sections.
Do you mean that, instead of 21, you want to use the flightid from the main query?
If so, that's called a "correllated query". The tables in the main query (and their columns) can be reference in the sub-query, like this:
select flightid as "FLIGHT",
select destairport_id
from journey,
flight
where flight.flightid = stay_log.flight_id -- correlated to main query
and flight.journeyid = journey.journeyid
) AS "AIRPORT",
to_char(arrivaldate,'DD/MM/YYYY hh24:mi:ss') as "ARRIVAL",
to_char(departuredate,'DD/MM/YYYY hh24:mi:ss') as "DEPARTURE",
ceil((departuredate-arrivaldate)*24) as "DURATION",
cost as "COST"
from stay_log;Often, people give a table alias to the main query table that is being referenced in the sub-query, as shown below.
That's only required when the table name appears in both FROM-clauses.
select flightid as "FLIGHT",
select destairport_id
from journey,
flight
where flight.flightid = s.flight_id -- table alias s used here
and flight.journeyid = journey.journeyid
) AS "AIRPORT",
to_char(arrivaldate,'DD/MM/YYYY hh24:mi:ss') as "ARRIVAL",
to_char(departuredate,'DD/MM/YYYY hh24:mi:ss') as "DEPARTURE",
ceil((departuredate-arrivaldate)*24) as "DURATION",
cost as "COST"
from stay_log s -- table alias s defined here
; -
Convert from String data type to Character data type
Hi...,
I'm a beginner. I try to make a program. But I don't know how to convert from string to data type. I try to make a calculator with GUI window. And when somebody put "+" to one of the window, I just want to convert it to Character instead of String.
Sorry of my bad english..
Please help me....
ThanksString s = "a+b";
char theplus = s.charAt(1); -
Export/import character data conversion in NLS_LANG FAQ
The [OTN NLS_LANG FAQ|http://www.oracle.com/technology/tech/globalization/htdocs/nls_lang%20faq.htm#_Toc110410566] says:
>
In Oracle9i the Export utility always exports user data, including Unicode data, in the character set of the database. The Import utility automatically converts the data to the character set of the target database.
>
But I don't think this is correct for Oracle 9i. Example:
export NLS_LANG=AMERICAN_AMERICA.US7ASCII
sqlplus /
SQL*Plus: Release 9.2.0.6.0 - Production on Wed Jun 17 10:05:57 2009
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
JServer Release 9.2.0.6.0 - Production
SQL> select * from v$version;
BANNER
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
PL/SQL Release 9.2.0.6.0 - Production
CORE 9.2.0.6.0 Production
TNS for HPUX: Version 9.2.0.6.0 - Production
NLSRTL Version 9.2.0.6.0 - Production
SQL> select * from nls_database_parameters where parameter like '%SET%';
PARAMETER VALUE
NLS_CHARACTERSET WE8ISO8859P15
NLS_NCHAR_CHARACTERSET AL16UTF16
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
JServer Release 9.2.0.6.0 - Production
exp / owner=test file=test.dmp
Export: Release 9.2.0.6.0 - Production on Wed Jun 17 10:06:42 2009
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to: Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
JServer Release 9.2.0.6.0 - Production
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8ISO8859P15 character set (possible charset conversion)
About to export specified users ...Could you please:
- check and update NLS_LANG FAQ for Oracle 9i
- update NLS_LANG FAQ for Oracle 10g, Oracle 11g and Data Pump.
Thanks.
Edited by: P. Forstmann on Jun 17, 2009 10:14 AMI was wrong and you are right like the OTN NLS_LANG FAQ.
I made the following test with Oracle 9.2.0.6 and with Oracle XE:
sqlplus test/test
SQL*Plus: Release 10.2.0.1.0 - Production on Ven. Juin 19 10:20:23 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connecté à :
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> create table t (x varchar2(10));
Table créée.
SQL> insert into t values(chr(233));
1 ligne créée.
SQL> select * from t;
X
é
SQL> select dump(x,1017) from t;
DUMP(X,1017)
Typ=1 Len=1 CharacterSet=WE8MSWIN1252: e9
SQL> exit
Déconnecté de Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
set NLS_LANG=AMERICAN_AMERICA.US7ASCII
exp test/test tables=t file=t.dmp
Export: Release 10.2.0.1.0 - Production on Fri Jun 19 10:21:54 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8MSWIN1252 character set (possible charset conversion)
About to export specified tables via Conventional Path ...
. . exporting table T 1 rows exported
Export terminated successfully without warnings.
sqlplus test/test
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jun 19 10:22:07 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> drop table t;
Table dropped.
SQL> exit
Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
imp test/test tables=t file=t.dmp
Import: Release 10.2.0.1.0 - Production on Fri Jun 19 10:22:23 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
Export file created by EXPORT:V10.02.01 via conventional path
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses WE8MSWIN1252 character set (possible charset conversion)
. importing TEST's objects into TEST
. importing TEST's objects into TEST
. . importing table "T" 1 rows imported
Import terminated successfully without warnings.
sqlplus test/test
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jun 19 10:22:32 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> select dump(x,1017) from t;
DUMP(X,1017)
Typ=1 Len=1 CharacterSet=WE8MSWIN1252: e9 -
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.
Maybe you are looking for
-
How To Set Up a Virtual Windows 7 Pro OS on a Windows 7 Pro Host - 64-bit
This may be as easy as stating, "Windows 7 Pro 64-bit cannot run on a Windows 7 64-bit host." Most of the documentation I find states something to that effect - however, ALL of that documentation is 5-8 years old. I cannot find ANYTHING in the last y
-
How to get the SR NO in a report
Hi all, I am new to report and was wondering how I get the SrNO in a report like below example. SrNO Name Dept 1 ABC Sales 2 xyz Admin Should i use CF or CP etc ??? Regards Sunny
-
How to do message splitting in a two steps mapping?
Hi, I have the following scenario: 1. about 200~300 rows of results are returned from the JDBC sender adapter; 2. The messages need to be mapped to an intermediate message type; 3. The output messages will then need to go through another step of java
-
NIO - Invalid argument (errno:22)
We have a mutlthreaded framework that spawns many individual threads with each merging extremely large files (1-3GB) to their own [thread] seperate files. We are using Java 1.4.2.10 and running on HP-UX. The following is the bit of code that does our
-
What is the 'src' folder really meant for ?
Is it customary to put stuff that is not AS3 code inside the projects "src" folder ? And if it is, why do folders that do not contain any source code look like AS3 code packages ? I would much prefer to put stuff that is not code in their own specifi