cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

we need to store KUNN2 (from RawDEBMas IDOC) to Hybris custom string field(payerID) when PARVW == RE

mukulsahu7046
Explorer
0 Kudos
312

Extract and store the KUNN2 value from the segment hierarchy E1KNA1M-E1KNVVM-E1KNVPM of the RawDEBMas IDoc into a custom string field in Hybris named (payerID). The mapping should occur conditionally, only when the value of PARVW in the same E1KNVPM segment is equal to 'RE'.

We have asked a detailed question and also attempted to resolve the issue on StackOverflow: https://stackoverflow.com/questions/79231159/hybris-datahub-filter-rawdebmas-idoc-value

Accepted Solutions (1)

Accepted Solutions (1)

mansurarisoy
Contributor

I also answered your question on Stack Overflow. I will copy my answer here in case someone finds your question on this platform and wants to learn the answer:

If your TargetItem only updates the desired field on the B2BUnit, you can achieve your goal by using <filterExpression> attribute on your TargetItem. Your updated TargetItem definition should be as follows:

 

<item>
    <type>CanonicalPartyReB2BUnit</type>
    <exportCode>B2BUnit</exportCode>
    <description>Update payerId</description>
    <canonicalItemSource>CanonicalPartyRelationshipSales</canonicalItemSource>
    <updatable>true</updatable>
    <filterExpression>'RE'.equals(relationshipTypeCP)</filterExpression>
    <attributes>
        <attribute>
            <name>uid</name>
            <transformationExpression>resolve('CanonicalParty').externalPartyId.concat('_').concat(salesKey)</transformationExpression>
            <exportCode>uid[unique=true]</exportCode>
            <mandatoryInHeader>true</mandatoryInHeader>
        </attribute>
        <attribute>
            <name>payerId</name>
            <transformationExpression>businessCustomerNumber</transformationExpression>
            <exportCode>payerId</exportCode>
        </attribute>
    </attributes>
</item> 

 

The following part ensures that this item is published only when the condition is met.

<filterExpression>'RE'.equals(relationshipTypeCP)</filterExpression>

For more details, refer to the following SAP documentation:

Filtering Canonical Items with SpEL Before Publication

 

Answers (0)