‎2008 Feb 15 5:43 AM
Hi,
Can anyone explain me the difference between data types
P, X C.
Thanks.
‎2008 Feb 15 5:45 AM
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb2fd9358411d1829f0000e829fbfe/content.htm
award points if helpful.
‎2008 Feb 15 5:46 AM
hi,
Char type p u can define like this,
data : l_data type p decimals 3.
about char type c,
data: l_data type c, here u cant maintain any decimals
that's is the main difference with these two.
reward points if useful,
seshu.
‎2008 Feb 15 5:49 AM
John,
Character types
Of the five non-numeric types, the four types C, D, N, and T are character types. Fields with these types are known as character fields. Each position in one of these fields takes up enough space for the code of one character. Currently, ABAP only works with single-byte codes such as ASCII and EBCDI. However, an adaptation to UNICODE is in preparation. Under UNICODE, each character occupies two or four bytes.
Hexadecimal Type
The remaining non-numeric type - X - always interprets individual bytes in memory. One byte is represented by a two-digit hexadecimal display. The fields with this type are called hexadecimal fields. In hexadecimal fields, you can process single bits.
XSTRING for byte strings
A byte string is a hexadecimal type with variable length. It can contain any number of bytes. The length of a byte string is the same as the number of bytes.
‎2008 Feb 15 5:49 AM
hi
Predefined ABAP Types
The table below shows the predefined ABAP types. Additional attributes can be found under value ranges and initial values.
Type Length Standard length Description
b 1 Byte 1 byte integer (internal)
*c 1 to 65,535 characters 1 character Text field* cursor as i as i Database cursor
d 8 characters Date field
f 8 bytes Floating point number
i 4 bytes 4 byte integer
n 1 to 65,535 characters 1 character Numeric text
*p 1 to 16 bytes 8 bytes Packed number* string variable Text string
s 2 bytes 2 byte integer (internal)
t 6 characters Time field
x 1 to 65,535 bytes 1 byte Byte field
xstring variable Byte string
These types are predefined in every ABAP program.
All predefined ABAP types in this table are elementary.
Apart from the types b and s, the predefined ABAP types can also be used to define your own data types and data objects and for typing. The types b and s cannot be specified directly in ABAP statements. Self-defined data types and data objects in ABAP programs are of the data type b and s if they are defined with reference to data elements to the ABAP Dictionary which are of the external data types INT1 or INT2.
The predefined data types string and xstring describe data objects of variable length (dynamic data objects). While the length of data objects in all other elementary data types is determined for its whole lifetime, the length of text and byte strings varies according to their content (the maximum size of a string is determined by profile parameter ztta/max_memreq_MB, see Maximum size of dynamic data objects).
The program-globally predefined data type cursor is currently synonymous with the predefined ABAP type i. This is required for the declaration of a cursor variable for database cursor handling.
All predefined ABAP types for which a length interval is specified in second column in the table are generic, which means that the length is not part of the type description. For the type p, the fractional portion is indefinite as well as the length.
The entries in the standard length column specify the length that is used for the corresponding generic data type when declaring data objects, if no explicit length is specified in the relevant statement.
In Unicode systems, the length must either be specified in characters and bytes. In non-Unicode systems, the length of a character is one byte, but in Unicode systems the length of a character depends on which Unicode character representation is used.
thanks and regards
sreelatha gullapalli
‎2008 Feb 15 5:50 AM
‎2008 Feb 15 5:51 AM
Hi
type C it accepts alpha numeric variables.
type P --packed it accepts decimals u can give how many decimal places u want.
example : T type P decimal 2,
T will accept 2 decimals points.
‎2008 Feb 15 5:57 AM
Hi,
P is for Packed decimals, i.e. you can have a decimal point in this data type.
C is for Character, i.e. it can have numbers , characters as well as special characters like (*, $, etc).
X is for hexadecimal numbers. Here number is mentioned in its hexadecimal format, i.e. 1 , 2, 3....9, A , B....E. This is generally used to handle special charaters such as TAB or Carriage Return(Enter).
Regards,
Kirti.
‎2008 Feb 15 5:58 AM
hi,
Data Type Initial field length Valid field length
P 8 1 - 16
p is numeric type meaning packed number.
Data Type Initial field length Valid field length
C 1 1 - 65535
C is character type meaning text field.
Data Type Initial field length Valid field length
X 1 1 - 65535
X is hexadecimal type meaning hexadecimal field.
hope it is useful.
regards,
sreelakshmi