NUMC equivalent datatype in ABAP
Hello All,
i have a user input '12889' which is of type char 12.
in program i want to convert it to '000000012889' for comparison.
I tried TYPE n(12), but its throwing an exception.
Pls suggest.
Dear Shails,
I have used the following code and it works perfectly fine..:)
Hope it resolves your issue.
DATA:
lv_numc TYPE n LENGTH 12,
lv_char12(12) TYPE c.
lv_char12 = '1234'.
lv_numc = lv_char12.
WRITE lv_numc.
Regards
s@k
Similar Messages
-
Equivalent datatype in Oracle for datetime of SQL Server
Hello Everyone,
I'm very much new to Oracle. I have been working with SQL Server since 3yrs. Currently I'm working with Oracle 11g.
What is the equivalent datatype in oracle for datetime in sql server with which has the format YYYY-MM-DD HH:MM:SS?
I tried with timestamp and date which didnt solve my prob.... Please help me in using the equivalent datatype for the format provided above...
Regards,
Bhanu Yalamanchi.Oracle date format can be anything you want, either by default at the session level or preferably explicitly using to_char and a format mask.
Format masks are documented here.
http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/sql_elements004.htm#CDEHIFJA
SQL> create table t (d date);
Table created.
SQL> insert into t values (sysdate);
1 row created.
SQL> select * from t;
D
19-JUL-11
SQL> alter session set nls_date_format = 'YYYY-MM-DD HH:MI:SS';
Session altered.
SQL> select * from t;
D
2011-07-19 08:27:59
SQL> select d, to_char(d, 'YYYY-MM-DD'), to_char(d,'Day') from t;
D TO_CHAR(D, TO_CHAR(D
2011-07-19 08:27:59 2011-07-19 Tuesday
SQL> alter session set nls_date_format = 'DD-MON-YY';
Session altered.
SQL> select d, to_char(d, 'YYYY-MM-DD HH24:MI:SS') from t;
D TO_CHAR(D,'YYYY-MM-
19-JUL-11 2011-07-19 08:27:59 -
What is the equivalent for 'On Change of' Event in ABAP OBJECTS?
What is the equivalent for 'On Change of' Event in ABAP OBJECTS? and how to use it in LOOP control?
hi,
There is no such Equivalent in OO ABAP.
You have to Raise your own Event within tha class checking the value of the field whose value is changing.
Regards
Sumit Agarwal -
Hello Everybody
what is the difference between pack and floating point datatypes, i ABAP Objects book, there is mentioned that if you are concious about accuracy then use pack datatype, otherwise use floating point. i write a program
data p1 type p.
p = 3 / 4.
write p. the result of this statement is 0,75
data f1 type f.
f1 = 3 / 4.
write f1 and the result of this is statement is 7,5000000E
so when we use pack number and what floating point give me example in detail and clear
Thanks
RaiHi,
This is taken from ABAP Help Documentation.
ABAP contains a range of built-in elementary data types: Character (text), Numerical character (number string), Date, Time Integer, Floating point number, Packed number, and HeX code). Some of these data types are fully types (D, T, I, F), others (C, N, P, X) are generic, in the sense that you must provide further type information (length, for type p also the number of decimal places) when you create the data object .
The value range of type P fields depends on their length and the number of decimal places. P fields can be 1 to 16 bytes long, with two decimal digits packed into each byte, and one decimal digit and the sign packed into the last byte. There can be up to 14 decimal places. Auxiliary fields for intermediate results are always 16 bytes long and can thus hold up to 31 decimal digits. To ensure that the decimal point is correctly calculated, you should always set the program attribute "fixed point arithmetic". Otherwise, all numbers are specified as integers and all intermediate results for the next integer are rounded. If "fixed point arithmetic" is not set, the decimal places defined for the number only appear when outputting with WRITE.
Fixed point arithmetic is decimal arithmetic and is similar to using a pocket calculator or calculating with paper and pencil.
Type P is typically used for sizes, lengths, weights and sums of money.
Rule: If you want to calculate "down to the last penny", you should use the type P.
Type F values range from /- 2.2250738585072014E-308 to 1.7976931348623157E308, as well as the number 0, with an accuracy of at least 15 decimal places.
You cannot enter floating point numbers directly in your programs. Instead, you must use text literals that can be interpreted as floating point numbers. You may use the following formats:
Decimal numbers with or without sign, with or without decimal point. The form <mantissa> E<exponent>, where the mantissa is a decimal. The exponent may be specified either with or without sign. You may also use spaces before or after the number. Examples of text literals with "floating point numbers":
'1', '-12.34567', '-765E-04', '1234E5', '12E34', '+12.3E-4', '1E160'.
Use floating point arithmetic if you need a very large value range or you are making decimal calculations, but be aware of the following features of floating point arithmetic.
Internally, the exponent and the mantissa of floating point numbers are stored separately, each in two parts. This can lead to unexpected results, despite the high degree of intrinsic accuracy. These occur mainly when performing conversions from and to type F.
For example, the number 1.5 can be represented exactly in this notation, since 1.5 = 120 + 12**(-1), but the number 0.15 can only be represented approximately by the number 0,14999999999999999. If you round 0.15 up to 1 valid digit, the result is 0.1 rather than 0.2 as you would expect. On the other hand, the number 1.5E-12 is represented by the number 1.5000000000000001E-12, which would be rounded to 2E-12.
Another example which actually occurred is the calculation of 7.27% of 73050 to an accuracy of 2 decimal places. The intermediate result 5.3107349999999997E+03, since the correct result, 5310.735, cannot be represented exactly in two parts with 53 bits. (If the hardware cannot represent a real number exactly, it uses the next representable floating point number. After rounding, you therefore get 5310.73 rather than 5310.74 as you would expect.
The ABAP runtime system calculates commercially and not "numerically" like the underlying machine arithmetic. According to the rounding algorithm of the latter, the end digit 5 must always be rounded to the nearest even number (not the next largest number), i.e. from 2.5 to 2, 3.5 to 4.
You should also note that multiplication using powers of 10 (positive or negative), is not an exact operation. For example, although 100.5 can be represented exactly in two parts, after the operation
F = F / 100 * 100
F has the value 100.49999999999999.
As well as rounding errors, the restricted number of decimal places for the mantissa can lead to the loss of trailing digits. For example, 1 - 1.0000000000000001 results in zero.
This means that you cannot rely on the last digits in floating point arithmetic. In particular, you should not usually test two floating point numbers for equality; instead, you should check whether the relative difference abs((a - b)/a) is less than a predefined limit, e.g. 10**(-7).
Check this link also.
http://www.sapgenie.com/abap/example_code.htm -
ABAP CLASSES - XI don't create the Target File..
Hallo,
I have a problema in XI when I use an ABAP Class.
This is My FLOW:
1) R/3 SEND an IDOC DEBMAS to XI un idoc DEBMAS(Customer data)
2) XI have this Interface Mapping: Interface_Mapping_Anagrafica_Cliente.
It si composed on:
- Input: IDOC (DEBMAS)
- 1° Mapping ==> named: Message_Mapping_Anagrafica_Cliente
This mapping, from IDOC DEBMAS, create the message type Message_Type_Anagrafica_Cliente.
- 2° Mapping ==> Classe ABAP
This mapping, from Message_Type_Anagrafica_Cliente create the message type Message_Type_Click.
- Output: Message_Type_Click
3) I want that this Message_Type_Click will be in the file.
But, if I execute the transaction SXMB_MONI in XI, I can see the IDOC OK .. but if I make double click on it, I don't see the Payload for the target file. Infact the target file is not be created by XI...
I have made debug after my class and I found a Problem in the Trace with type E with message: CL_MAPPING_XMS_PLSRV3-ENTER_PLSRV.
What is this?
Can you help me?
Thanks.
MoniaHi Monia,
first put your trace to 3: SXMB_ADM, Integration Engine Configuaration, Specific Configuration, Runtime/Trace Level
Second delete your abap mapping from your interface mapping and look in the monitoring for the output. Is it what you expect? Is it the datatype the abap mapping can work with?
Copy the result as source for the next test. Now you put the ABAP mapping inside and delete the message mapping from your interface mapping. Test with transaction SXI_MAPPING_TEST. Look to the weblog <a href="/people/sameer.shadab/blog/2005/09/29/testing-abap-mapping ABAP Mapping</a> how to test an ABAP mapping.
The problem with more than one mapping program in one interface mapping is that you see only the result of both!
Regards,
Udo -
What are the basic objects in abap dictionary ?
Try to provide the details if anyone knows about it.
The DDIC is nothing but the ABAP Dictionary. The ABAP Dictionary centrally describes and manages all the data definitions used in the system.
Data types
Data types are the actual type definitions in the ABAP Dictionary. They allow you to define elementary types, reference types, and complex types that are visible globally in the system. The data types of database tables are a subset of all possible types, namely flat structures.
Data Elements
Data elements in the ABAP Dictionary describe individual fields. They are the smallest indivisible units of the complex types described below, and are used to specify the types of columns in the database. Data elements can be elementary types or reference types.
Structures
A structure is a sequence of any other data types from the ABAP Dictionary, that is, data elements, structures, table types, or database tables. When you create a structure in the ABAP Dictionary, each component must have a name and a data type. In an ABAP program, you can use the TYPE addition to refer directly to a structure.
If you define a local data type in a program by referring to a structure as follows:
TYPES <t> TYPE <structure>.
Table Types
Table types are construction blueprints for internal tables that are stored in the ABAP Dictionary.
When you create a table type in the ABAP Dictionary, you specify the line type, access type, and key. The line type can be any data type from the ABAP Dictionary, that is, a data element, a structure, a table type, or the type of a database table. You can also enter a predefined Dictionary type directly as the line type, in the same way that you can with a domain.
Type Groups
Before Release 4.5A, it was not possible to define standalone types in the ABAP Dictionary to which you could refer using a TYPE addition in an ABAP program. It was only possible to refer SAP AG BC - ABAP Programming
Data Types in the ABAP Dictionary to flat structures. Structures in programs corresponded to the structures of database tables or structures in the ABAP Dictionary. In ABAP programs, you could only refer to database tables and structures in the ABAP Dictionary using LIKE. It was, however, possible to refer to individual components of the Dictionary type. Complex local data types such as internal tables or deep structures had no equivalent in the ABAP Dictionary. The solution to this from Release 3.0 onwards was to use type groups. Type groups were based on the include technique, and allowed you to store any type definitions globally in the Dictionary by defining them using TYPES statements.
Views:
There are 4 types views are avilable in SAP.
Database View - To club more than one table
Projection View - To hide fields in one table
Maintanance View - To maintain database records in table
Help View - To provide help for a fields (Same functionality as Search help. This is outdated)
View are improves perfromance in the following aspects
1. If you want to use more than two table in 'JOIN' condition better to use Views . It will improves performance of a program
2. If you want to use mutiple FOR ALL ENTRIES clause, better to club all SELECT statement in a view.
Lock Objects:
Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database.
SAP Provide three type of Lock objects.
Read Lock(Shared Locked)
protects read access to an object. The read lock allows other transactions read access but not write access to
the locked area of the table
Write Lock(exclusive lock)
protects write access to an object. The write lock allows other transactions neither read nor write access to
the locked area of the table.
Enhanced write lock (exclusive lock without cumulating)
works like a write lock except that the enhanced write lock also protects from further accesses from the
same transaction.
You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.
Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.
Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes.
Technicaly:
When you create a lock object System automatically creat two function module.
1. ENQUEUE_<Lockobject name>. to insert the object in a queue.
2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.
You have to use these function module in your program.
Search Helps:
These are two types.
Elementary n Collective.
1) Elementary search helps describe a search path. The elementary search help must define where the data of the hit list should be read from (selection method), how the exchange of values between the screen template and selection method is implemented (interface of the search help) and how the online input help should be defined (online behavior of the search help).
2) Collective search helps combine several elementary search helps. A collective search help thus can offer several alternative search paths.
3)An elementary search help defines the standard flow of an input help.
4) A collective search help combines several elementary search helps. The user can thus choose one of several alternative search paths with a collective search help.
5)A collective search help comprises several elementary search helps. It combines all the search paths that are meaningful for a field.
6)Both elementary search helps and other search helps can be included in a collective search help. If other collective search helps are contained in a collective search help, they are expanded to the level of the elementary search helps when the input help is called.
See the below link to understand this completely:
http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ee93446011d189700000e8322d00/frameset.htm
Rewards if useful -
TIMESTAMP datatype in Oracle 8i.
'TIMESTAMP' datatype is not to be available in Oracle 8i.
Is there an equivalent datatype in Oracle 8i as 'TIMESTAMP' in 9i?
Regards,
BhagatTimestamp was a new globalization feature in 9i. The only way to handle time in 8i is with the regular DATE type and traditional date arithmetics.
-
How to create crystal reports from ecc abap program?
Hi all,
I am new to sap ecc to bo report!!
I heard that abap program cannot be directly connected to crystal reports,
So created a function module which is equivalent to the abap program!!
And happened to connect the same in crystal !!
Can anyone let me know how to proceed !!
will be there any performance issue ?
can anyone guide me how to do reporting from ecc function module to crystal reports directly?
ThanksHi Pooja,
From what I know, not all ABAP programs can be accessed in Crystal Reports. The program should return rows and columns, otherwise, CR would not be able to report off it.
I'm not sure if there are any performance issues if we follow your path. Do you experience any?
And, do you need help in creating a report on the function module, I mean do you also have any design related queries?
-Abhilash -
Proper Data type for transferring XML from ABAP to XI
Dear Colleagues,
I have a question on how to wrap XML data, that itself contains an encoding
declaration, so that it will be properly transferred to XI.
XML Generation: "always use X"
I have searched a lot on SDN and other resources but could not find
information, describing how a web service should wrap unicode-data when
making it available to XI. The XML processing group emphasizes that all generation of XML should be done using X-bases (HEX) datatypes in ABAP and preferably using UTF-8 as ancoding. This by itself is not a problem.
But transferring UTF-8-XML - through which interface?
When a webservice provides an XML Stream and wants to transfer it to XI then there is a bit of a paradox situation, because it has to choose between using an X-based or Character-based type for its interface
-> as Binary data?
- when using X-based data types in the interface, I have control of the character encoding, but I expect that the XML-information will probably be wrapped in base64 encoding and then the XI will receive a base64 encoded
XML-block instead of "plain" XML.
I did not find any reference information on how the soap interface of XI and the WAS behave when transferring X-based data, however.
-> as Character data?
- on the other hand when using Character-based data types (e.g. String), I have no control of the codepage being used. I have then only the choice to generate the default encoding of the application server. Maybe this encoding
will be transformed later to a different encoding, but usually during this process the header, which declares the encoding in use will not be adapted as well.
So if I have a unicode machine, it will generate UTF-16 - based XML. I have no other choice, if I use a character-based type for output. And this will also be stated in the header of the XML stream. If the XML stream
leaves the system it will probably be transformed to UTF-8, but the XML-header will still state the content to be UTF-16, because the header will probably not be auto-converted together while adapting the Character
encoding.
Because of these issues I am quite insecure, on how to generate and wrap UTF-8 - based XML, so that I can properly hand it over to XI, ensuring that
it stays UTF-8 and that XI can really unwrap it automatically.
Does anyone have a tip in which type to wrap XML-based data on the ABAP stack so it will be usable in XI?
Thank you very much for your attention and time.
Yours
Christian SteinertSomething like this should work (with a little tweek I imagine)
This would be in the 'Command on Target':
OdiFtpGet "-HOST=<%=odiRef.getInfo("SRC_DSERV_NAME")%>" "-USER= '<%=odiRef.getInfo("SRC_USER_NAME")%>'" "-PASSWORD= <%=odiRef.getInfo("SRC_PASS")%>" "-REMOTE_DIR=<%=odiRef.getInfo("SRC_SCHEMA")%>" "-REMOTE_FILE=<%=odiRef.getTable("L", "COLL_NAME", "W")%>" "-PASSIVE_MODE=YES"
Set the Technology of the 'Command on Source' as File, and the technology of the 'Command on Target' as ODI Tools
Edited by: Bos on Jun 30, 2011 11:53 AM -
Is there any equivalent datatype for creating a table inside a stored procedure or a package and the table being only valid in the stored procedure or package.
Something like this [http://www.developer.com/db/article.php/3414331/Using-the-Table-Data-Type-in-SQL-Server-2000.htm] what we have in the sql server.
I am pretty new to the Oracle world.
Any help will be much appreciated.
Thanks in advance.mgatzke wrote:
Hi,
you may have a look at the ref cursor type to get the sql server 'table type':
http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/06_ora.htm#1554
HTH
MatthiasHi Matthias
Is it preferable to use a cursor, in sql server, however, using a cursor locks the table on which the query is executed until the cursor is unallocated.
Naveen -
What should be the next after ABAP ?
DEAR EXPERTS,
I'm new in ABAP. I'm trying to link up ABAP with the other FUNCTIONAL MODULES, but unfortunately not getting much resources.
IF you tell me about any sites that discusses about those things , I shall be very much grateful to you.
BESIDES could you please tell me, after completing the ABAP-COURSE which SAP-MODULE (EG : BI, BW OR SOMETHING ELSE) I can take up next that would be helpful in the FUTURE ?Rimichan,
You are staying in one of the best sites now. I'm also new in abap, but here's what I can suggest you. You should choose 1 between the 2 first. If you want to learn abap, then learn it first. Once you've been good at abap, then move to other functional modules. Or if you want to be a functional consultant, then try to take an ACCA, or CFA, or something equivalent and ignore abap ( you can learn later, in fact ). For your FUTURE, if you are really good at any modules in SAP, you'll have a very bright future for sure. So be interested in the thing you like, and try to be the best at it
best regards,
paul -
Hi friends( I need ur support to learn ABAP)
Hi Friends,
I am venkat i would like to learn ABAP
can anybody suggest me where i can get DataDictionary Material(Views,Tables etc) with examples.
regards
venkatData types
Data types are the actual type definitions in the ABAP Dictionary. They allow you to define elementary types, reference types, and complex types that are visible globally in the system. The data types of database tables are a subset of all possible types, namely flat structures.
Data Elements
Data elements in the ABAP Dictionary describe individual fields. They are the smallest indivisible units of the complex types described below, and are used to specify the types of columns in the database. Data elements can be elementary types or reference types.
Structures
A structure is a sequence of any other data types from the ABAP Dictionary, that is, data elements, structures, table types, or database tables. When you create a structure in the ABAP Dictionary, each component must have a name and a data type. In an ABAP program, you can use the TYPE addition to refer directly to a structure.
If you define a local data type in a program by referring to a structure as follows:
TYPES <t> TYPE <structure>.
Table Types
Table types are construction blueprints for internal tables that are stored in the ABAP Dictionary.
When you create a table type in the ABAP Dictionary, you specify the line type, access type, and key. The line type can be any data type from the ABAP Dictionary, that is, a data element, a structure, a table type, or the type of a database table. You can also enter a predefined Dictionary type directly as the line type, in the same way that you can with a domain.
Type Groups
Before Release 4.5A, it was not possible to define standalone types in the ABAP Dictionary to which you could refer using a TYPE addition in an ABAP program. It was only possible to refer SAP AG BC - ABAP Programming
Data Types in the ABAP Dictionary to flat structures. Structures in programs corresponded to the structures of database tables or structures in the ABAP Dictionary. In ABAP programs, you could only refer to database tables and structures in the ABAP Dictionary using LIKE. It was, however, possible to refer to individual components of the Dictionary type. Complex local data types such as internal tables or deep structures had no equivalent in the ABAP Dictionary. The solution to this from Release 3.0 onwards was to use type groups. Type groups were based on the include technique, and allowed you to store any type definitions globally in the Dictionary by defining them using TYPES statements.
Views:
There are 4 types views are avilable in SAP.
Database View - To club more than one table
Projection View - To hide fields in one table
Maintanance View - To maintain database records in table
Help View - To provide help for a fields (Same functionality as Search help. This is outdated)
View are improves perfromance in the following aspects
1. If you want to use more than two table in 'JOIN' condition better to use Views . It will improves performance of a program
2. If you want to use mutiple FOR ALL ENTRIES clause, better to club all SELECT statement in a view.
Lock Objects:
Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database.
SAP Provide three type of Lock objects.
- Read Lock(Shared Locked)
protects read access to an object. The read lock allows other transactions read access but not write access to
the locked area of the table
- Write Lock(exclusive lock)
protects write access to an object. The write lock allows other transactions neither read nor write access to
the locked area of the table.
- Enhanced write lock (exclusive lock without cumulating)
works like a write lock except that the enhanced write lock also protects from further accesses from the
same transaction.
You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.
Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.
Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes.
Technicaly:
When you create a lock object System automatically creat two function module.
1. ENQUEUE_<Lockobject name>. to insert the object in a queue.
2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.
You have to use these function module in your program.
Search Helps:
These are two types.
Elementary n Collective.
1) Elementary search helps describe a search path. The elementary search help must define where the data of the hit list should be read from (selection method), how the exchange of values between the screen template and selection method is implemented (interface of the search help) and how the online input help should be defined (online behavior of the search help).
2) Collective search helps combine several elementary search helps. A collective search help thus can offer several alternative search paths.
3)An elementary search help defines the standard flow of an input help.
4) A collective search help combines several elementary search helps. The user can thus choose one of several alternative search paths with a collective search help.
5)A collective search help comprises several elementary search helps. It combines all the search paths that are meaningful for a field.
6)Both elementary search helps and other search helps can be included in a collective search help. If other collective search helps are contained in a collective search help, they are expanded to the level of the elementary search helps when the input help is called.
See the below link to understand this completely:
http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ee93446011d189700000e8322d00/frameset.htm
Rewards if useful. -
Data types pls..
Hi All,
What are all the data types we have, let me know each data type purpose pls....
Akshitha.Data types describe the technical attributes of data objects. They are purely descriptive and do not take up any memory space
Data Types in the ABAP Dictionary
The ABAP Dictionary allows you to define global data types. You can use the TYPE addition of an appropriate ABAP statement to refer to these data types in any ABAP program in the system.
There are three groups on the initial screen:
Database Tables and Views
One of the most important tasks of the ABAP Dictionary is to administer database tables in the R/3 database. The Dictionary contains metadescriptions of the database tables, and uses these to create the physical tables in the database. A view is a "virtual table" containing fields from one or more tables.
In the description of a database table, the table lines consist of single fields or columns. An elementary data type must be assigned to each column. The elementary types in the ABAP Dictionary are data elements. Like data objects in ABAP programs, database tables and views have data types as attributes. A line of a database table or view has the data type of a flat structure, which consists of individual data elements.
In ABAP programs, you can use the TYPE addition with the data type of a database table or view. You may refer to the whole structure or to individual components:
... TYPE <dbtab> ...
refers to the complex data type of the structure,
... TYPE <dbtab>-<ci> ...
refers to the elementary data type of component <ci>.
If you define a complex data type <t> as a structure using
TYPES <t> TYPE <dbtab>.
the components of the data type <t> inherit the names of the components of the database table or view, and can be addressed in the program using <t>-<ci>.
To ensure compatibility with previous releases, you can still use the LIKE addition to refer to database tables or views, except within classes. The reason for this is that in earlier releases, the physical presence of the database tables as objects was emphasized, even though the Dictionary only contains metadescriptions and data types.
Defining program-local data types by referring to database tables and views is one of the essential techniques for processing data from database tables in ABAP. Data objects that you define in this way always have the right type to contain data from the corresponding database table. ABAP Open SQL allows you to read a single field, a range of fields, or an entire database table or view into an internal table.
TYPES: city type spfli-cityfrom,
spfli_type TYPE STANDARD TABLE OF spfli WITH DEFAULT KEY.
DATA: wa_city TYPE city,
wa_spfli TYPE spfli_type.
SELECT SINGLE cityfrom FROM spfli
INTO wa_city
WHERE carrid = 'LH' AND connid = '400'.
SELECT * FROM spfli INTO TABLE wa_spfli.
This example defines an elementary data type CITY that refers to a single field of the database table SPFLI and an internal table SPFLI_TYPE, whose line type is the same as the structure of the database table. The SELECT statement reads data from the database into the corresponding data objects.
Data types
Data types are the actual type definitions in the ABAP Dictionary. They allow you to define elementary types, reference types, and complex types that are visible globally in the system. The data types of database tables are a subset of all possible types, namely flat structures. Global object types (classes and interfaces) are not stored in the ABAP Dictionary, but in the class library. You create them using the Class Builder.
For a detailed description of data types and their definitions, refer to the Types section of the ABAP Dictionary documentation. The following descriptions mention the types only briefly, along with how you can refer to them from ABAP programs.
Data Elements
Data elements in the ABAP Dictionary describe individual fields. They are the smallest indivisible units of the complex types described below, and are used to specify the types of columns in the database. Data elements can be elementary types or reference types.
Elementary Types
Elementary types are part of the dual-level domain concept for fields in the ABAP Dictionary. The elementary type has semantic attributes, such as texts, value tables, and documentation, and has a data type. There are two different ways to specify a data type:
By directly assigning an ABAP Dictionary type.
You can assign a predefined ABAP Dictionary type and a number of characters to an elementary type. The ABAP Dictionary has considerably more predefined types than the ABAP programming language. The number of characters here is not the field length in bytes, but the number of valid characters excluding formatting characters. The data types are different because the predefined data types in the ABAP Dictionary have to be compatible with the external data types of the database tables supported by the R/3 System.
When you refer to data types from the ABAP Dictionary in an ABAP program, the predefined Dictionary types are converted to ABAP types as follows:
Dictionary type
Meaning
Maximum length n
ABAP type
DEC
Calculation/amount field
1-31, 1-17 in tables
P((n+1)/2)
INT1
Single-byte integer
3
Internal only
INT2
Two-byte integer
5
Internal only
INT4
Four-byte integer
10
I
CURR
Currency field
1-17
P((n+1)/2)
CUKY
Currency key
5
C(5)
QUAN
Amount
1-17
P((n+1)/2)
UNIT
Unit
2-3
C(n)
PREC
Accuracy
2
X(2)
FLTP
Floating point number
16
F(8)
NUMC
Numeric text
1-255
N(n)
CHAR
Character
1-255
C(n)
LCHR
Long character
256-max
C(n)
STRING.
String of variable length
1-max
STRING.
RAWSTRING
Byte sequence of variable length
1-max
XSTRING
DATS
Date
8
D
ACCP
Accounting period YYYYMM
6
N(6)
TIMS
Time HHMMSS
6
T
RAW
Byte sequence
1-255
X(n)
LRAW
Long byte sequence
256-max
X(n)
CLNT
Client
3
C(3)
LANG
Language
internal 1, external 2
C(1)
("max" in LCHR and LRAW is the value of a preceding INT2 field. The "internal" length of a LANG field is in the Dictionary, the "external" length refers to the display on the screen.
Assigning a domain
The technical attributes are inherited from a domain. Domains are standalone Repository objects in the ABAP Dictionary. They can specify the technical attributes of a data element. One domain can be used by any number of data elements. When you create a domain, you must specify a Dictionary data type (see above table) and the number of characters.
Reference Types
Reference types describe single fields that can contain references to global classes and interfaces from the ABAP class library.
In an ABAP program, you can use the TYPE addition to refer directly to a data element. The predefined Dictionary data types of the domain are then converted into the corresponding ABAP types.
If you define a local data type in a program by referring to a data element as follows:
TYPES <t> TYPE <data element>.
the semantic attributes of the data element are inherited and will be used, for example, when you display a data object with type <t> on the screen. Since all data types in the ABAP Dictionary are based on data elements, they all contain the corresponding semantic attributes.
TYPES company TYPE s_carr_id.
DATA wa_company TYPE company.
wa_company = 'UA '.
WRITE: 'Company:', wa_company.
This example defines a local type COMPANY that refers to the data element S_CARR_ID. The data element is linked to the identically-named domain S_CARR_ID. The domain defines the technical attributes as data type CHAR with length 3. The local data type COMPANY in the program therefore has the ABAP type C(3). COMPANY also adopts the semantic attributes of the data element. In the above example, we declare a data object WA_COMPANY with this type and display it on a list. If the user chooses F1 help for the output field, the help text stored in the ABAP Dictionary will appear in a dialog box.
Structures
A structure is a sequence of any other data types from the ABAP Dictionary, that is, data elements, structures, table types, or database tables. When you create a structure in the ABAP Dictionary, each component must have a name and a data type.
In an ABAP program, you can use the TYPE addition to refer directly to a structure.
If you define a local data type in a program by referring to a structure as follows:
TYPES <t> TYPE <structure>.
the construction blueprint of the structure is used to create a local structure <t> in the program. The predefined Dictionary data types of the domains used by the data elements in the structure are converted into the corresponding ABAP types. The semantic attributes of the data elements are used for the corresponding components of the structure in the program. The components of the local structure <t> have the same names as those of the structure in the ABAP Dictionary.
To ensure compatibility with previous releases, it is still possible to use the LIKE addition in an ABAP program to refer to a structure in the ABAP Dictionary (except in classes).
Suppose the structure STRUCT is defined as follows in the ABAP Dictionary:
Field name
Type name
Description
COL1
CHAR01
Character field with length 1
COL2
CHAR08
Character field with length 8
COL3
CHAR10
Character field with length 10
The types CHAR01 to CHAR10 are data elements with corresponding domains. We can refer to this structure in ABAP:
TYPES struct_type TYPE struct.
DATA wa TYPE struct_type.
wa-col1 = '1'.
wa-col2 = '12345678'.
wa-col3 = '1234567890'.
This program creates a local structure in the program - STRUCT_TYPE - and a corresponding data object WA. We can address the components using the component names from the original structure.
Table Types
Table types are construction blueprints for internal tables that are stored in the ABAP Dictionary. When you create a table type in the ABAP Dictionary, you specify the line type, access type, and key. The line type can be any data type from the ABAP Dictionary, that is, a data element, a structure, a table type, or the type of a database table. You can also enter a predefined Dictionary type directly as the line type, in the same way that you can with a domain.
In an ABAP program, you can use the TYPE addition to refer directly to a table type.
If you define a local data type in a program by referring to a table type as follows:
TYPES <t> TYPE <table>.
the construction blueprint of the table type is used to create a local internal table <t> in the program. The predefined Dictionary data types of the domains used by the data elements in the structure are converted into the corresponding ABAP types. The semantic attributes of the data elements are used for the corresponding components of the internal table in the program.
Suppose the table type STRUCT_TABLE is defined in the Dictionary with the line type STRUCT from the previous example. We can refer to this in ABAP:
TYPES table_type TYPE struct_table.
DATA: table_wa TYPE table_type,
line_wa LIKE LINE OF table_wa.
LOOP AT table_wa INTO line_wa.
WRITE: line_wa-col1, line_wa-col1, line_wa-col1.
ENDLOOP.
This program defines an internal table type TABLE_TYPE. From it, we define data objects TABLE_WA and LINE_WA. LINE_WA corresponds to the line type of the table type in the Dictionary, and is therefore compatible with the structure STRUCT.
Type Groups
Before Release 4.5A, it was not possible to define standalone types in the ABAP Dictionary to which you could refer using a TYPE addition in an ABAP program. It was only possible to refer to flat structures. Structures in programs corresponded to the structures of database tables or structures in the ABAP Dictionary. In ABAP programs, you could only refer to database tables and structures in the ABAP Dictionary using LIKE. It was, however, possible to refer to individual components of the Dictionary type. Complex local data types such as internal tables or deep structures had no equivalent in the ABAP Dictionary. The solution to this from Release 3.0 onwards was to use type groups. Type groups were based on the include technique, and allowed you to store any type definitions globally in the Dictionary by defining them using TYPES statements.
The definition of a type group is a fragment of ABAP code which you enter in the ABAP Editor. The first statement for the type group <pool> is always:
TYPE-POOL <pool>.
After this came the definitions of data types using the TYPES statement, as described in Local Data Types in Programs. It was also possible to define global constants using the CONSTANTS statement. All the names of these data types and constants must begin with the name of the type group and an underscore:
In an ABAP program, you must declare a type group as follows before you can use it:
TYPE-POOLS <pool>.
This statement allows you to use all the data types and constants defined in the type group <pool> in your program. You can use several type groups in the same program.
Let the type group HKTST be created as follows in the ABAP Dictionary:
TYPE-POOL hktst.
TYPES: BEGIN OF hktst_typ1,
col1(10) TYPE c,
col2 TYPE i,
END OF hktst_typ1.
TYPES hktst_typ2 TYPE p DECIMALS 2.
CONSTANTS hktst_eleven TYPE i VALUE 11.
This type group defines two data types HKTST_TYP1 and HKTST_TYP2, as well as a constant HKTST_ELEVEN with the value 11.
Any ABAP program can use these definition by including a TYPE-POOLS statement:
TYPE-POOLS hktst.
DATA: dat1 TYPE hktst_typ1,
dat2 TYPE hktst_typ2 VALUE '1.23'.
WRITE: dat2, / hktst_eleven.
The output is:
1,23
11
The data types defined in the type group are used to declare data objects with the DATA statement and the value of the constant is, as the output shows, known in the program. -
A type table as a row in a table
The question is simple. Can I use a type table into a Z table ?? Any way to do this ??
Thanks in advance.hi maraia,
Structures
A structure is a sequence of any other data types from the ABAP Dictionary, that is, data elements, structures, table types, or database tables. When you create a structure in the ABAP Dictionary, each component must have a name and a data type.
In an ABAP program, you can use the TYPEaddition to refer directly to a structure.
If you define a local data type in a program by referring to a structure as follows:
TYPES dtype TYPE structure.
the construction blueprint of the structure is used to create a local structure dtype in the program. The predefined Dictionary data types of the domains used by the data elements in the structure are converted into the corresponding ABAP types. The semantic attributes of the data elements are used for the corresponding components of the structure in the program. The components of the local structure dtype have the same names as those of the structure in the ABAP Dictionary.
To ensure compatibility with previous releases, it is still possible to use the LIKE addition in an ABAP program to refer to a structure in the ABAP Dictionary (except in classes).
Suppose the structure STRUCT is defined as follows in the ABAP Dictionary:
Field name
Type name
Short Description
COL1
CHAR01
Character field with length 1
COL2
CHAR08
Character field with length 8
COL3
CHAR10
Character field with length 10
The types CHAR01 to CHAR10 are data elements with corresponding domains. We can refer to this structure in ABAP:
TYPES struct_type TYPE struct.
DATA wa TYPE struct_type.
wa-col1 = '1'.
wa-col2 = '12345678'.
wa-col3 = '1234567890'.
This program creates a local structure in the program - struct_type - and a corresponding data object wa. We can address the components using the component names from the original structure.
Table types
Table types are construction blueprints for internal tables that are stored in the ABAP Dictionary. When you create a table type in the ABAP Dictionary, you specify the line type, access type, and key. The line type can be any data type from the ABAP Dictionary, that is, a data element, a structure, a table type, or the type of a database table. You can also enter a predefined Dictionary type directly as the line type, in the same way that you can with a domain.
In an ABAP program, you can use the TYPEaddition to refer directly to a table type.
If you define a local data type in a program by referring to a table type as follows:
TYPES dtype TYPE table.
the construction blueprint of the table type is used to create a local internal table dtype in the program. The predefined Dictionary data types of the domains used by the data elements in the structure are converted into the corresponding ABAP types. The semantic attributes of the data elements are used for the corresponding components of the internal table in the program.
Suppose the table type STRUCT_TABLE is defined in the Dictionary with the line type STRUCT from the previous example. We can refer to this in ABAP:
TYPES table_type TYPE struct_table.
DATA: table_wa TYPE table_type,
line_wa LIKE LINE OF table_wa.
LOOP AT table_wa INTO line_wa.
WRITE: line_wa-col1, line_wa-col1, line_wa-col1.
ENDLOOP.
This program defines an internal table type table_type . From it, we define data objects table_wa and, consequently, line_wa. line_wa corresponds to the line type of the table type in the Dictionary, and is therefore compatible with the structure STRUCT
Type Groups
Before Release 4.5A, it was not possible to define standalone types in the ABAP Dictionary to which you could refer using a TYPEaddition in an ABAP program. It was only possible to refer to flat structures. Structures in programs corresponded to the structures of database tables or structures in the ABAP Dictionary. In ABAP programs, you could only refer to database tables and structures in the ABAP Dictionary using LIKE. It was, however, possible to refer to individual components of the Dictionary type. Complex local data types such as internal tables or deep structures had no equivalent in the ABAP Dictionary. The solution to this from Release 3.0 onwards was to use type groups. Type groups were based on the include technique, and allowed you to store any type definitions globally in the Dictionary by defining them using TYPES statements.
The definition of a type group is a fragment of ABAP code which you enter in the ABAP Editor. The first statement for the type group pool is always:
TYPE-POOL pool.
After that, you define data types using the statement TYPES. It was also possible to define global constants using the CONSTANTS statement. All the names of these data types and constants must begin with the name of the type group and an underscore: pool_
In an ABAP program, you must declare a type group as follows before you can use it:
TYPE-POOLS pool.
if you want complete info just click
http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3138358411d1829f0000e829fbfe/content.htm
thanks
karthik
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Apr 15, 2008 3:09 PM -
SAP BO Data Services - Bits Are One - O - f O hex operator
Hi Gurus,
I need to implement the Bits Are One - 'O' Bit Sequence Comparison opertor in SAP BO Data Services. The equivalent in SAP ABAP would look like:
IF <b> O hex01. ftab-inp = on. ENDIF.
IF <b> O hex02. ftab-req = on. ENDIF.
IF <b> O hex04. ftab-out = on. ENDIF.
IF <b> O hex08. ftab-act = on. ENDIF.
IF <b> O hex16. ftab-int = on. ENDIF.
IF <b> O hex32. ftab-inv = on. ENDIF.
I need to know how I implement this in SAP BO data services. Please help.
The ABAP help for the same is as follows:
Comparing Bit Sequences
Use the following three operators to compare the bit sequence of the first operand with that of the second:
<operator> Meaning
O bits are one
Z bits are zero
M bits are mixed
The second operand must have type X. The comparison takes place over the length of the second operand. The first operand is not converted to type X.
The function of the operators is as follows:
O (bits are one)
The logical expression
<f> O <hex>
is true if the bit positions that are 1 in <hex>, are also 1 in <f>. In terms of set operations with bit sequences, this comparison is the same as finding out whether the set represented by <hex> is a subset of that represented by <f>.
Z (bits are zero)
The logical expression
<f> Z <hex>
is true if the bit positions that are 1 in <hex>, are 0 in <f>.
M (bits are mixed)
The logical expression
<f> M <hex>
is true if from the bit positions that are 1 in <hex>, at least one is 1 and one is 0 in <f>.
Caution: The following programs are no longer supported in Unicode systems:
REPORT demo_log_expr_bits .
DATA: text(1) TYPE c VALUE 'C',
hex(1) TYPE x,
i TYPE i.
hex = 0.
DO 256 TIMES.
i = hex.
IF text O hex.
WRITE: / hex, i.
ENDIF.
hex = hex + 1.
ENDDO.
The output is as follows:
00 0
01 1
02 2
03 3
40 64
41 65
42 66
43 67
Here, the bit structure of the character 'C' is compared to all hexadecimal numbers HEX between '00' and 'FF' (255 in the decimal system), using the operator O. The decimal value of HEX is determined by using the automatic type conversion during the assignment of HEX to I. If the comparison is true, the hexadecimal number and its decimal value are displayed on the screen. The following table shows the bit sequences of the numbers:
hexadecimal decimal Bit sequences
00 0 00000000
01 1 00000001
02 2 00000010
03 3 00000011
40 64 01000000
41 65 01000001
42 66 01000010
43 67 01000011
The bit sequence of the character 'C' is defined for the current hardware platform by its ASCII code number 67. The numbers that occur in the list display are those in which the same bit position is filled with 1 as in the bit sequence of u2018Cu2019. The sequence 01000011 is the universal set of the bit sequences.
Best Regards, Murugesh*
Maybe you are looking for
-
How to go back to mountain lion from mavericks
What's the easiest way to revert back to Mountain Lion from Mavericks? I'm having troubles using Final Cut Pro X on Mavericks
-
Virsa CC 5.1: Showing incorrect violations with respect to a Role
Hi All, Following is the Scenario: I have a role in R/3 AA_BB_CCC which has the following TCODES: AS01 AS02 In Virsa CC 5.1, there is one Risk called S007 which has the following associated functions: AR0
-
I cropped the photo to 16x20. With this crop I ended up with some transparent pixels on the right and left edges. I used the Trim tool to remove the transparent pixels. Question - after removing the transparent pixels with the Trim tool do I still ha
-
PO price changes before the complete delivery
I have an issue..... we have ordered a certain material say 2000 pcs to be delivered over 6 months of time in a PO. The price at the tme of PO date was say 100 INR....now we have GRNd 200 pcs. After 1 month the vendor will charge 105 INR for the sam
-
Graphical teams for solaris 10
hi, i' ve installed the 8/10 version of solaris , do you know if there's some solaris graphical themes, where to download them and how to install?