Show TOC Start of Content Area

Function documentation copyValue  Locate the document in its SAP Library structure

Use

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

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 the addrDatfield 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/customer=/PartnersMsg/partner

 

/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