cancel
Showing results for 
Search instead for 
Did you mean: 

Need help on XPATH Condition

sahithi_moparthi
Contributor
0 Kudos

Hello Everyone,

     I need help on the XPath Condition.I have gone through so many links/forums,but nothing me in going forward.

Please have a look on my Requirement.It is IDOC to SOAP scenario.We have to check some conditions by placing XPATH conditions.

Source file:

case 1 - Should not pass

IDOC-

E1ANAM

     VKORG

      ---------

      -------

       E1MVKEM

          <VTWEG>Z3</VTWEG>

           ==============

           ================

        E1MVKEM

          ===========

          ==============

/IDOC

case 2 - Should pass

IDOC-

E1ANAM

     VKORG

      ---------

      -------

     

        E1MVKEM

          ===========

          ==============

/IDOC

Conditions:

1. If VTWEG doesnnot exist in E1MVKEM then it has to pass to target system.

I have placed the below condition and it is working /ZMATMAS05_XXXX/IDOC/E1MARAM/E1MVKEM[not(VMSTA)]

2.But if in One IDOC if i have multiple VTWEG with  a value in  and without a with a value then it shouldnot pass as per case 1

So could any one help how to check both the conditions in case 1 as well as case2.

Accepted Solutions (0)

Answers (4)

Answers (4)

sahithi_moparthi
Contributor
0 Kudos

Hi,

Please provide your valuable solutions on the above query ?


engswee
Active Contributor
0 Kudos

Hi Sahithi

Since your routing condition is quite complex and you are unable to achieve it using XPath for multiple IDocs, I would suggest that you consider going for Extended Receiver Determination and build the condition logic with graphical mapping.

Defining Extended (Dynamic) Receiver Determination - Integration Directory - SAP Library

Rgds

Eng Swee

sahithi_moparthi
Contributor
0 Kudos


Hi Swee,

  I have gone through the above link,but could not able to understand how to implement it as we are on PI 7.31 single stack,i believe it is not required to create receiver determination.

engswee
Active Contributor
0 Kudos

Hi Sahithi

Extended Receiver Determination is available in ICO configuration for single stack from SP4 of PI7.31 as per the link below:

You can refer to the following wiki pages on the steps to implement it - the screenshots are based on classical dual-stack configuration but conceptually it is still applicable for usage in ICO.

Dynamic receiver determination through mapping - Process Integration - SCN Wiki

Step by Step guide to Explain Enhanced Receiver Determination - Application Server Infrastructure - ...

Rgds

Eng Swee

former_member191435
Contributor
0 Kudos

Hi Sahiti,

It will work like kanda and Ankur  says

use like this



ZMATMAS05_XXXX/IDOC/E1MARAM/E1MVKEM/[count(VMSTA)] = 0 OR != to 0.


let me know if it doesnt work


Thanks,

Sreenivas

sahithi_moparthi
Contributor
0 Kudos

Hi,

I tried by placing the below condition still it is not working.

if VMSTA is not present in the payload then it has to pass

Please find the screenshot for the same.

If VMSTA is present with some value then it should not pass.

former_member191435
Contributor
0 Kudos

Hi sahiti,

Please try like this.....

Thanks,

Sreenivas

sahithi_moparthi
Contributor
0 Kudos

Hi,

Now the logic for XPATH  is working as expected.But the logic is not working incase of bundling of IDOC's.

From ECC they are sending 10 IDOC's in one message,so in my case XPATH is checking only first IDOC and passing remaining 9  as-is without checking the condition.

In XPATH i have checked multi line,but still not working.

Please suggest ?

former_member191435
Contributor
0 Kudos

can you please check like this suppose

mesage_1/Name/[SecondNAME]

please check below link...

XPath Examples

sahithi_moparthi
Contributor
0 Kudos

Hi,

I have multiple IDOC in one message,so is this the correct way of expressing the condition.

I have to check Multiple conditions as below:

Condition 1:

/ZMATMAS05_XXXX/IDOC/E1MARAM/MTART = ABC        AND

/ZMATMAS05_XXXX/IDOC/E1MARAM/E1MVKEM[(VKORG = "AB") and (VTWEG = "00") and (MVGR4 = "M03" or MVGR4 = "M04" ) and (count(VMSTA) = "0")]       AND

/ZMATMAS05_XXX/IDOC/E1MARAM/E1MARCM[(WERKS = "123" or WERKS = "456")]

OR

Condition 2

/ZMATMAS05_XXXX/IDOC/E1MARAM/MTART =  LMN       AND

/ZMATMAS05_XXXX/IDOC/E1MARAM/E1MVKEM[(VKORG = "HF") and (VTWEG = "00") and (MVGR4 = "M03" or MVGR4 = "M04" ) and (count(VMSTA) = "0")]       AND

/ZMATMAS05_XXX/IDOC/E1MARAM/E1MARCM[(WERKS = "123" or WERKS = "456")]

If any of the the above one conditions satisfies then it has to pass.

Note: They have to pass to the same Receiver.

The above conditions are working fine if we test for single IDOC.But it is not working when they are using collect IDOC.

Could you please suggest how can change the logic inorder to work for multiple IDOC's.

Former Member
0 Kudos

Hi Sahithi,

For the above scenario, if you are using Graphical mapping then at mapping level itself you can handle it.

PFA the screenshot for your reference.

Else if you want to do it exclusively using Xpath, then you can the following:

ZMATMAS05_XXXX/IDOC/E1MARAM/E1MVKEM/[count(VMSTA)] = 0 OR != to 0.

Thanks & Regards,

Ankur.

former_member220103
Active Participant
0 Kudos

Hi, Check like this

/ZMATMAS05_XXXX/IDOC/E1MARAM/E1MVKEM/[count(VMSTA)] is EQUAL to '0' or NOT EQUAL to '0'.

Thanks,

Kanda

sahithi_moparthi
Contributor
0 Kudos


Hi ,

Thanks for your reply.

But i have multiple condition with AND along with the above one.

My complete req:

VKORG = X or VKORG = y AND WERKS = 12 or WERKS =15 AND

E1MVKEM/[count(VMSTA)] = 0 or  VMSTA !=  0 .

I applied above condition but it is not working.

Please help !!

sahithi_moparthi
Contributor
0 Kudos

Hi Ankur,

My Structure is as below:

Material(1..1)

    Soap Header (0..1)

       Userid

       Password

  XMaterial (0..1)

     Xmaterials(0..unbounded) - this is mapped to IDOC.

We have have multiple IDOC's in one message.

We can do it with mapping,but i believe we have to change all the field values.Also the soap header is getting created as we are checking condition at xmaterials.


former_member220103
Active Participant
0 Kudos

I would ask you to try conditions one by one. Then you can figure-out which one is not working.

Even if it is not working, then provide the screen-shot.

Let's start with VMSTA first.

Thanks,

Kanda    

Former Member
0 Kudos

Hi Sahithi,

Is it possible for you to share the exact scenario with all the structure details(both source and target) as well as all the conditions involved in the scenario?

Regards,

Ankur

Former Member
0 Kudos

Hi.

Check my thread

http://scn.sap.com/thread/1915764

You need to put the condition in one level up.

Try this.

/ZMATMAS05_XXXX/IDOC/E1MARAM[ ./E1MVKEM[not(VMSTA)]


Or

Try this.

/ZMATMAS05_XXXX/IDOC/E1MARAM[ ./E1MVKEM[count(VMSTA)=0]


Regards

Lucho.