Start of Content Area

Function documentation copyValue  Locate the document in its SAP Library structure

Use

You can use CopyValue() to copy the value of a position in the source structure and assign it to a target field for a frequently occurring source structure element. The value is copied each time the target field occurs in the target structure. However, it is copied a maximum of maxOccurs times (also see: Frequently Occurring Elements).

Example

In the example below, the address data is represented in the source structure (street, city, zip code) by the field addrDat, which occurs three times. However, in the target structure, this information is separated into three individual fields (street, city, zipCode):

Source Structure (left) and Target Structure (right)

Field Name

minOccurs

maxOccurs

Field Name

minOccurs

maxOccurs

PartnerMsg

1

1

CustomersMsg

1

1

  partner

0

unbounded

  customer

0

unbounded

name

1

1

    name

1

1

    addrDat

3

3

    street

1

1

     

    city

1

1

     

    zipCode

1

1

Using the CopyValue() function you can copy the values of field addrDat to the individual target fields. To do so, specify the position that you want to copy. Note that the 0 position refers to the first occurrence of the source field:

Message Mapping Using CopyValue()

Target Field Mapping

Position for CopyValue()

/CustomersMsg=/PartnersMsg

 

/CustomersMsg=/PartnersMsg

 

/CustomersMsg/customer/name=
/PartnersMsg/partner/name

 

/CustomersMsg/customer/street=
CopyValue(/PartnersMsg/partner/addrDat)

0

/CustomersMsg/customer/city=
CopyValue(/PartnersMsg/partner/addrDat)

1

/CustomersMsg/customer/zipCode=
CopyValue(/PartnersMsg/partner/addrDat)

2

 

 

 

 

End of Content Area