Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Check failed in condition

friendlycoder
Participant
0 Kudos
518

Hi all,


I am using simple transformation to serialize and deserialize a XML file.Some of the xml element is optional which means it can appear in the XML structure but it is not a must.
The code below is a snippet from the transformation file that I have created:
    ....
<tt:cond check="$INVL.PRICE.PRICE_AMOUNT > P(0.00)">
<cbc:PriceAmount>
<tt:attribute name="currencyID" value-ref="$INVL.PRICE.PRICE_CURRENCY"/>
<tt:value ref="$INVL.PRICE.PRICE_AMOUNT"/>
</cbc:PriceAmount>
</tt:cond>
....

What it should do is to check if the value of INVL.PRICE.PRICE_AMOUNT is greater then 0.00. The PRICE_AMOUNT has data type CURR length 23 decimal 2.However when the amount is 0.00 as the example shows below the system dumps.
    <cac:Price>
<cbc:PriceAmount currencyID="EUR">0.00</cbc:PriceAmount>
</cac:Price>

The error message:
An exception has occurred in class "CX_ST_COND_CHECK_FAIL". As the exceptionwas not
caught, a runtime error occurred. The reason for the exception
occurring was:
The following error has occurred in row 147 of program
XML_FILE==============XT: "Check failed in condition"

What am I doing wrong?
Best regards
1 REPLY 1

ThorstenHoefer
Active Contributor
425

Hi,

have you included: <tt:switch-var> ?

ST - tt:switch-var, Case Distinction for Variables - ABAP Keyword Documentation (sap.com)

Conditional transformations are normally used as cases in tt:switch and tt:group.

or try to replace > with "& g t ;" (without spaces)

<tt:condcheck="$INVL.PRICE.PRICE_AMOUNT > P(0.00)">