Search code examples
sap-aribaaml-condition

Why a validity condition seems to be ignored on ReqLineItem.SupplierPartNumber?


For customization shown below, when editing the line item, validity is never triggered and its error message is not shown. I can even back out from the line item to editing of requisition header by pressing OK button (and thus saving changes) what should be blocked.

<inClass name="ariba.purchasing.core.ReqLineItem">
    <inField name="SupplierPartNumber">
        <validity combine="and">
            <context enclosingDocument="ariba.purchasing.core.Requisition"/>
            <condition expression="false">
                <parameter name="Message" value="Temporarily, this validity is always NOT valid."/>
            </condition>
        </validity>
    </inField>
</inClass>

However, the expected error message is shown on header level, when I press Submit button or Show Approval Flow button.

How can I make validity to work normally on the line item?


Solution

  • Set validity condition at value source instead.

    ReqLineItem.SupplierPartNumber is actually an alias for LineItemDescription.SupplierPartNumber. Although its visibility and editability conditions can be controlled separately, its validity condition is transferred from the originating field. This is logical, because when the content is shared via alias, it still has to keep the same validity rules.

    The answer:

    • implement validity condition at originating field LineItemDescription.SupplierPartNumber, it also applies to its aliases
    • do not use validity condition at aliased ReqLineItem.SupplierPartNumber. The usage is technically possible without getting an error but it actually leads to somewhat unexpected behavior described above.