Thursday, February 5, 2015



Offset and length access and elementary data objects


Offset/length specifications are permitted for character-type and bye-type data object. The specification of offset and length is interpreted either as a number of characters or a number of bytes. For character-type fields and fileds of type STRING, offset and length are interpreted on a character-by-character basis. Only for types X and XSTRING, the values for offset and length are interpreseted in bytes. The rules that determines which data objects in Unicode programs count as character-type or byte-type objects do not allow for offset/lenght specifications for data objects of numeric data types.
Access to single fields specifying offset and length
<Statement> <field>+<off>(<len>) …
EXAMPLE:
 DATA: c_field(6) TYPE c VALUE '*ABAP#',
       x_field(6) TYPE x VALUE 'E391B9A203F6'.

 WRITE:/ 'c_field+1(4):',c_field+1(4).
 WRITE:/ 'x_field+3(2):',x_field+3(2).
OUTPUT:
 c_field+1(4): ABAP
 x_field+3(2): A203

No comments:

Post a Comment