cancel
Showing results for 
Search instead for 
Did you mean: 

XPath expression in Interface determination not working!!!

Former Member
0 Kudos

Hi all,

I am trying an XPath expression in order to decide which interface to use. The expresion is

(/p1:CONFDELIVERY_MT/row/TrtCode ≠ EL AND

substring(/p1:CONFDELIVERY_MT/row/TrtCode,1,2) ≠ ZZ)

it seems however that the second statement (substring...) is always returning true.

any ideas? Basically what I am trying to do is to have an expression that exludes all TrtCode that are either EL or start with ZZ. Any help will be appreciated.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I think there is some problem in the substring function as it seems it is never evaluated.Why don't you try some other logic like write a UDF in ur mapping and check that CONFDELIVERY_MT/row/TrtCode is never populated with something starting with ZZ .If it does change it to EN.

This will eliminate your second condition in XPath.

Former Member
0 Kudos

Hi Pravesh,

I can not do that since I need the value also for mapping it into other fields of the target message. And furthermore, I need the logic to take place before the mapping since I have two different mapping producing two different IDOC type and I need the logic in the Interface determination in order to decide which mapping takes place.

Former Member
0 Kudos

can you check if this works

/p1:CONFDELIVERY_MT/row[TrtCode(substring(.,1,2)!='ZZ') and (TrtCode!='EL')] and use EX no right operand.

Former Member
0 Kudos

Nope! This has the opposite effect. It always evaluate in false. Therefore when TrtCode = 'ZDA' for exmplae is still false..

Former Member
0 Kudos

your requirement is to execute the interface mapping when

either Trtcode !='EL' or substring(TrtCode)!='ZZ" ,right?

uh...when TrtCode = 'ZDA' it should give true why its giving false.

I think systems checks existence if use EX,if it exists based on the condition we specified it returns 'true' and run the IM ,if not then 'false' it would not execute the IM.

Former Member
0 Kudos

Yes I Know!!! It seems as a system bug... I will post an OSS note and try a different logic without using substring. substring seems to confuse the XPath expression evaluation in Interface determination. Oh well...

Former Member
0 Kudos

Hi Socrates,

Did you get any solution as to why does your expression returns to false instead of True?

We are facing a similar problem. Kindly help us know if you arrived at any solution.

Kind Regards,

Charu

Former Member
0 Kudos

I solve by not using the substring function . Instead I use all possible cases (in my case 10 such cases) and use an OR logic. This solve the problem but in case where the substring really is needed this is a problem and should be solve in later releases (I hope). Try not using substring if you can...

Former Member
0 Kudos

hi,

if the value is in string then give a try keeping EL and ZZ in ' ' like 'EL' and 'ZZ'

chck the link for other functions

http://www.w3schools.com/xpath/xpath_operators.asp

check this may be useful

/people/shabarish.vijayakumar/blog/2006/06/07/customise-your-xpath-expressions-in-receiver-determination

do some search on SDN and try with different combinations.

Babu

Former Member
0 Kudos

I have try all possible compination I found in sdn

/p1:/p1:CONFDELIVERY_MT/row/TrtCode[substring(.,1,2)]

with " codes with single ' but the result is the same.

udo_martens
Active Contributor
0 Kudos

Hi Socrates,

check out instead

//row/TrtCode ≠ EL

AND

substring(//row/TrtCode,1,2) ≠ ZZ

Regards,

Udo

Former Member
0 Kudos

it exactly the same!! it behaves like the substring(//row/TrtCode,1,2) ≠ ZZ ia always true eventhough the value of ZZ is copy paste in the message as the first two characters of the value. Thanks anyhow

udo_martens
Active Contributor
0 Kudos

Hi Socrates,

would u plz provide the incoming msg?

Regards,

Udo

Former Member
0 Kudos

This is the message

<?xml version="1.0" encoding="UTF-8"?>

<ns:CONFDELIVERY_MT xmlns:ns="http://vivartia.aberon.sys/confdelivery">

<row>

<OwnerCode>3100</OwnerCode>

<DeliveryNo>0180000102</DeliveryNo>

<ErpWarehouseCode>31010001</ErpWarehouseCode>

<TrtCode>ZZEL</TrtCode>

<PostGIdate>2007-09-25 00:00:00.0</PostGIdate>

<PostGIdateChangedFlg>1</PostGIdateChangedFlg>

<DocumentNo>&#913;&#961;.&#928;&#945;&#961;&#945;&#963;&#964;&#945;&#964;&#953;&#954;&#959;&#973;</DocumentNo>

<DocumentDate>2007-09-25 00:00:00.0</DocumentDate>

<CancelFlg>0</CancelFlg>

<PostGIFlg>1</PostGIFlg>

<TacticalRouteCode />

<LicenceNo />

<PackagesQty>0</PackagesQty>

<CusPickUpFlg>0</CusPickUpFlg>

<CusPickUpChangedFlg>0</CusPickUpChangedFlg>

<RouteChangedFlg>0</RouteChangedFlg>

<DlvPriority />

<PickingDate>2007-09-26 17:18:59.0</PickingDate>

<PickingDateChangedFlg>0</PickingDateChangedFlg>

<DlvPriorityChangedFlg>0</DlvPriorityChangedFlg>

<OdtLineNumber>10</OdtLineNumber>

<ItemCode>770901</ItemCode>

<WmsStatusCode>&#935;</WmsStatusCode>

<Lot />

<ExpirationDate />

<ProductionDate />

<TraUnitQty>0.000</TraUnitQty>

<TraUnitCode />

<Qty>100.000</Qty>

<MainUnitCode>PCE</MainUnitCode>

<ConvFactor>1</ConvFactor>

<ConvDivisor>1</ConvDivisor>

<InitQty>100.000</InitQty>

<DocQty>100.000</DocQty>

<DeleteLineFlg>0</DeleteLineFlg>

<ParentLineNumber />

<ItemType />

<CusPickUpDescr />

<CusPickUpChangedFlg2>0</CusPickUpChangedFlg2>

</row>

</ns:CONFDELIVERY_MT>

udo_martens
Active Contributor
0 Kudos

Hi Socrates,

for

//row/TrtCode &#8800; 'EL'

AND

substring(//row/TrtCode,1,2) &#8800; 'ZZ'

the result should be now false coz second condition is false. Value of TrtCode '1234' for example should be true.

Regards,

Udo

Former Member
0 Kudos

Yes I know. And this is the proble.. it evaluates to true. And I get a mapping error since I have saveguarded the Mapping with a creatif using the same logic.

udo_martens
Active Contributor
0 Kudos

Hi Socrates,

is it possible, that you designed an OR instead of an AND?

Regards,

Udo