Start of Content Area

Assigning Fields Dynamically  Locate the document in its SAP Library structure

In previous releases in the MOVE-CORRESPONDING struc1 TO struc2 statement, the field types of both structures had to be known at the time they generated. This constraint no longer applies under Unicode.

In an NUS until now, there was no problem assigning structures with different Unicode fragment views using a MOVE statement. In a US, such assignments will cause a runtime error, even if both structures start with the same types:

Example

BEGIN OF struc1,
  a(2) TYPE C,
  b    TYPE I,
  c(1) TYPE C,
  d(4) TYPE X,
END OF struc1.

BEGIN OF struc2,
  a(2) TYPE C,
  b    TYPE I,
  c(1) TYPE C,
  g(6) TYPE P,
  f(2) TYPE X,
END OF struc2.

For example, the content of struc2-[a,c] (which starts with fields of the same type) is assigned to struc1. Until now, you could use a simple MOVE statement (although this could mean that the remainder of struc1 subsequently did not contain meaningful values). However, in Unicode, you must the MOVE-CORRESPONDING struc2 TO struc1; otherwise, a runtime error occurs (because you are attempting to MOVE struc2 to a structure with a different fragment view). You obtain the same result in Unicode, if the field names of the start of both structures are identical at runtime.

 

 

End of Content Area