Ansicht
Dokumentation

ABENCONVERSION_FLAT_FLAT - CONVERSION FLAT FLAT

ABENCONVERSION_FLAT_FLAT - CONVERSION FLAT FLAT

Fill RESBD Structure from EBP Component Structure   General Data in Customer Master  
This documentation is copyright by SAP AG.
SAP E-Book

Conversion Between Flat Structures

When flat structures are converted, the fragment view of the structures must be considered. The following rules apply when converting a flat structure to another flat structure.

  • When assigning structures with the same fragment view, the structure is assigned unconverted.

  • When assigning structures of different lengths where the length of the fragment view exactly matches the length of the shorter structure, the assignment is made in the length of the shorter structure without conversion.
  • If the target structure is longer than the source structure, the components of the target structure located behind the shared fragments are filled with type-dependent initial values and any alignment gaps are set to hexadecimal 0.

  • If the target structure is shorter than the source structure, the components of the source structure located behind the shared fragments are cut off.

  • When assigning structures of different lengths whose fragment views match until the second last fragment of the shorter structure, and in which the next fragment is either character-like in one and byte-like in the other, the part in which the fragments are the same is assigned unconverted. The characters of the next fragment of the source structure are assigned to the corresponding fragment of the target structure without conversion and left-aligned. If this fragment in the target structure is greater than that in the source structure, the right hand side is padded with blanks or with hexadecimal 0, depending on the data type. If it is shorter, it is truncated on the right. The remaining components after this fragment are either cut off or padded with type-dependent initial values.

No conversion rule is defined for any other cases, which means that no assignment is possible.

Notes

  • If components of data type p occur in the involved structures, these components form individual fragments for which only the length is significant and not the number of decimal places. When assigning such structures, the value of the source components of type p is cast to the number of decimal places of the target components, and the decimal point may shift. This means that the result for such a component can differ from the result of a direct assignment between the components.
  • If a component of a flat structure has an enumerated type, this is a separate fragment of the fragment view, regardless of its basis type, and must exist at the same position and with the same type in assignments between these structures in the source and target structure.
  • If a syntax error occurs due to an invalid assignment between flat structures, the fragment views for the corresponding structures can be displayed when displaying the syntax error in the ABAP Editor by choosing the pushbutton with the information icon.
  • Since only Unicode systems are supported in which a character is always represented by 2 bytes, the conversion rules for flat structures are less strict than in systems in which also non-Unicode systems are still supported. There, all possible alignment requirements for characters have to be considered, regardless of the actual length of a character in its character representation. When downporting programs from higher to lower releases, syntax errors might occur in the lower releases because of the stricter rules there.

Examples

Assignment of struc1 to struc2 and vice versa is not allowed because the fragment views are not the same, since unlike struc2-b, struc1-x only fills one byte.

Assignments of struc3 to struc4 and vice versa are allowed because the fragment view of the shorter structure struc3 is the same as the fragment view in the first part of the longer structure struc4.

Assignments of struc5 to struc6 and vice versa are also not allowed because the fragment views in the two structures do not match due to the alignment gaps before struc5-b and before struc6-struc0-b.

Assignments of struc7 to struc8 and vice versa is possible because the fragment view is the same until the second last fragment p in the shorter structure struc7:

An assignment from struc9 to struc10 and vice versa is possible because the fragment view matches despite the differences in decimal places for the type p. If struc9-a has the value 999, then struc10-a has the value 0.999 after a mapping from struc9 to struc10. A direct mapping from struc9-a to struc10-a, on the other hand, raises an exception of the class CX_SY_CONVERSION_OVERFLOW.

The following assignment between two flat structures is possible in the current release, but it was not possible as long as non-Unicode systems were still supported. In the included substructure incl1, the character component has the same alignment as the integer component and there is no alignment gap. However, as long as non-Unicode Systems were supported, an alignment gap had to be assumed behind the included structure in order to make the program executable in Unicode systems as well as in non-Unicode Systems.






PERFORM Short Reference   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.

Length: 6287 Date: 20240424 Time: 171113     sap01-206 ( 127 ms )