CL_ABAP_VIEW_OFFLEN - ABAP Structure View with Offsets and Lengths

TXBHW - Original Tax Base Amount in Local Currency   General Data in Customer Master  
This documentation is copyright by SAP AG.

Functionality

Objects of the class CL_ABAP_VIEW_OFFLEN represent descriptions of structured binary data. (Thebinary data is typically stored in type X or XSTRING variables.) An object of the classCL_ABAP_VIEW_OFFLEN can store the position (offset) and length of all fields in a structure.The offset is counted in bytes, starting at 0. The length is also specified in bytes. The type information is not stored in objects of the class CL_ABAP_VIEW_OFFLEN.

For a specified structure, the methods CREATE_UNICODE16_VIEW snd CREATE_LEGACY_VIEW returnan instance that contains the offsets and lengths of all fields in accordance with the alignment requirements of a Unicode or non-Unicode system.

If you use the APPEND method, you can specify offsets and lengths yourself and they do not have to comply with the ususal ABAP layout. Note that there can be alignment gaps between the fields of a structure.

You can use the class CL_ABAP_CONV_IN_CE to convert binary data to ABAP structures. For this you need an object of the class CL_ABAP_VIEW_OFFLEN that describes the structure of the binary data.

Relationships

CL_ABAP_CONV_IN_CE
Converting Binary Data into Valid ABAP Data Objects.

Example

For a simple structure, the following example program returns the offsets and lengths of the fields in a non-Unicode system (irrespective of whether the program is running on a Unicode or non-Unicode system).

data:
begin of struc,
text(5) type c,
int type i,
end of struc.

data:
view type ref to cl_abap_view_offlen,
tab  type abapofflentab,
wa   type line of abapofflentab.

view = cl_abap_view_offlen=>create_legacy_view( struc ).
call method view->get_view_into_table( importing tab = tab ).

loop at tab into wa.
  write :/ wa-ioff, wa-ilen.
endloop.

The output is:
0 5
8 4

The following example shows the use of the APPEND method.

DATA: view TYPE REF TO cl_abap_view_offlen.
view = cl_abap_view_offlen=>create( ).
CALL METHOD view->append( off = 6 len = 2 ).
CALL METHOD view->append( off = 8 len = 4 ).
CALL METHOD view->append( off = 0 len = 3 ).

Notes

Further information

For details refer to the documentation for the individual methods.


BAL Application Log Documentation   TXBHW - Original Tax Base Amount in Local Currency  
This documentation is copyright by SAP AG.


Length: 2664 Date: 20120526 Time: 083503     triton ( 106 ms )