cancel
Showing results for 
Search instead for 
Did you mean: 

If with Out else in Message mapping

Former Member
0 Kudos

Hi Experts,

I have scenario IDoc(ORDERS05) to cXML, where i am sending the Maufacturer part number(MFRPN) through the segment E1EDP19 od the IDoc,but not getting into the cXML.

I have mapped MFRPN to the element MPNID of cXML, as mentioned below:

IF E1EDP19-QUALF= 004 then move MFRPN into MPNID.

(using If without else function).

And when i checked the message in the Mapping test tab, i found that the Display queue is working correctly for all the inputs and If with out else function but for the target field(MPNID) it shows all fields with 'SUPPRESS' .

Please suggest why MPNID is not getting created in the cXML.

Thanks in advance,

MK

Accepted Solutions (0)

Answers (5)

Answers (5)

venky_b
Participant
0 Kudos

Hello MK,

I also faced the same problem with orders05 but i solved it with following logic

1. Change the Context of Qualf from E1EDP19 TO E1EDP01 this is done by right click on Qualf choos E1EDP01. similarly change context of MFRPN from E1EDP19 TO E1EDP01.

Once it is done plz follow the mapping

2. To Compare Qualf use Equals function then provide output of this to If without else function

3. The out put of If without else is giving to SPLIT BY VALUE

4. Output of this is given to Map with default and finaly to target field.

Reward points if it solves.

Thanks,

Venkatesh

Edited by: venkatesh bs on Apr 15, 2008 11:06 AM

Edited by: venkatesh bs on Apr 15, 2008 11:08 AM

Former Member
0 Kudos

Hi,

After your output of if without else put remove context and split by value ( each value ) in sequence and then check the queues.

Regards,

Shri

Former Member
0 Kudos

Hi Shri,

I checked your logic, it doesn't work.

Please suggest further.

Thank you.

Former Member
0 Kudos

test the message mapping with the original payload with which u r not getting the value filled. Aslo u change that particular field to 0004 manually and test. might be the payload has a value with an extra space or something like that for that field when entering XI....

Former Member
0 Kudos

Hi,

just check in msg mapping in display queue, the output of equalS function.........is this showing true for the constant 004......if not, then check your constant it should be 004 and check there should be no space in its end........if equals is showing correct output, then if without else will also show you correct output.

Regards,

Rajeev Gupta

Former Member
0 Kudos

Rajeev,

Both Equals and If without else are showing true in the display queue. but the the target element showing all 'SUPPRESS' .

and the constant does not have any spaces.

Please suggest further to resolve the issue.

Thank you.

Former Member
0 Kudos

Hi,

double click on your if-without-else function and use SUPPRESS for false.

Regards

Patrick

Former Member
0 Kudos

Patrick,

It already has SUPPRESS for false and which does not make any difference.

Please suggest further.

Thank you.

Former Member
0 Kudos

First make sure that you have a value in your source field coz if value is not there it will suppress it. Secondly use "splitByValue" after "ifWithOutElse".

Former Member
0 Kudos

Hi Sarvesh,

Source field has a value and also 'Splitbyvalue' does not solves the issue.

Please suggest further.

Thank you.

Former Member
0 Kudos

let me check in my system.

Edited by: Sarvesh Singh on Apr 7, 2008 3:52 PM

Former Member
0 Kudos

Hi,

in msg mapping, take E1EDP19-QUALF and then have removeContext function then send it to equalS function to check with constant 004, then take input from eqaulS function to ifwithoutelse function, then take it to the target element.

Regards,

Rajeev Gupta

Former Member
0 Kudos

Hi,

I have checked in my system like this.

ifWithoutElse ( QUALF EqualS 04 ) then MFPRN -


> TRRGET.

it is working fine, BUT if you have many E1EDP19 segments lets say 5, and if the top most QUALF is not having the value equal to 04 or it is empty then you will get suppressed value. To solve this do like this.

ifWithoutElse (QUALF EqualS 04) then MFPRN -


> removeContext -


> splitByValue -


> TRRGET.

Regards,

Sarvesh

Former Member
0 Kudos

Thanks Sarvesh and Rajeev,

It is working with the removeContexts function. what was the issue before.

And as we have multiple E1EDP19 segments, if we remove the context for E1EDP19-QUALF.

will it not effect the whole mapping of IDoc to cXML as the E1EDP19-QUALF and E1EDP19-MFRPN are need to be considered from the same context.

Please suggest further to resolve it.

justin_santhanam
Active Contributor
0 Kudos

MK,

What is the occurrence of QUALF and MFRPN elements?

raj.

Former Member
0 Kudos

Hi Raj,

The occurence of both the elements QUALF and MFRPN is same 0..1.

Will it effects the whole mapping of Idoc to cXML, if we use removeContexts for QUALF?

Please suggest further to resolve the issue.

Thank you,

MK

justin_santhanam
Active Contributor
0 Kudos

MK,

You must not use remove context. This is the reason I asked occurrence of it. Use MapWithDefault.



Qualf--->MapWithDefault["No Value"]---> 1
                                  Constant["4"]---> 2

1 & 2--->eQualsS--->IfWithoutElse--->Target

Then branch --->MFRPN

Can you try this and let me know if it works?

raj.

Former Member
0 Kudos

Hi Raj,

I tried it and it doesn't works.

Please suggest further.

Thank you.

justin_santhanam
Active Contributor
0 Kudos

MK,

If possible can u take snapshot and upload it into flickr and give me the link?

raj.

Former Member
0 Kudos

Raj, can i have mail id, so that i can mail you the mapping snapshot.

Thank you.

**********

Please read the Forum's Rules of Engagement,

i.e.,

[/thread/117188 [original link is broken];

and refrain from using email correspondence as the main objective of the Forums is to share knowledge.

SDN PI/XI Forum Moderator

justin_santhanam
Active Contributor
0 Kudos

Mk,

Please ,get it from my BusinessCard.

@All:Friends, either me or MK will update the thread once solution is achieved.

raj.

Former Member
0 Kudos

Thanks Raj,

Please see the link for the mapping snap shot.

[http://www.flickr.com/photos/25429360@N07/2397801992/]

And please suggest further.

justin_santhanam
Active Contributor
0 Kudos

MK,

Thanks for sharing the link! Why did you changed the context of MFRPN? Don't change the context.

Let me clear something, are u looking for the below logic

Source


<IDOC>
<E1EDP19>
  <QUALF>010</QUALF>
  <MFRPN>MAT1</MFRPN>
</E1EDP19>
<E1EDP19>
  <QUALF>004</QUALF>
  <MFRPN>MAT2</MFRPN>
</E1EDP19>
<E1EDP19>
  <QUALF>014</QUALF>
  <MFRPN>MAT3</MFRPN>
</E1EDP19>
<E1EDP19>
  <QUALF>004</QUALF>
  <MFRPN>MAT4</MFRPN>
</E1EDP19>
</IDOC>

Target


<Record>
<Material>
    <Field1>123</Field1>
     <Material>MAT2</Material>
</Material>
<Material>
    <Field1>ABC</Field1>
     <Material>MAT4</Material>
</Material>
</Record>

Am I right?

raj.

Former Member
0 Kudos

Hi Raj,

the source structure is

<IDOC>
<E1EDP19 SEGMENT="1">
<QUALF>002</QUALF>
<IDTNR>R-CA-34045676-T</IDTNR>
</E1EDP19>
<E1EDP19 SEGMENT="1">
<QUALF>001</QUALF>
<IDTNR>0000000000345768</IDTNR>
<KTEXT>LIBRARY BUNDEL</KTEXT>
</E1EDP19>
<E1EDP19 SEGMENT="1">
<QUALF>003</QUALF>
<IDTNR>345000053454</IDTNR>
</E1EDP19>
<E1EDP19 SEGMENT="1">
<QUALF>004</QUALF>
<MFRPN>WE300-4R4-30-FE-Z</MFRPN>
<MFRNR>080000213</MFRNR>
</E1EDP19><
</IDOC>

And the MFRPN is mapped to the below element of target cXML structure

<xsd:element name="ManufacturerPartID" type="ManufacturerPartID" />

Please explain how can we solve this issue.

Thank you.

justin_santhanam
Active Contributor
0 Kudos

MK,

Please confirm one more thing, you will have QUALF -004 only one time in the source is it?

raj.

justin_santhanam
Active Contributor
0 Kudos

MK,

I suggest you to write the simple UDF in order to achieve it.


QUALF ---> MapWithDefault["No Value"]---> RemoveContext---->1
MFRPN---> MapWithDefault["No Value"]---> RemoveContext---->2

1&2--->UDF---> ManufacturerPartID

UDF- Advanced(Queue), two input parameters


for(int i=0;i<QUALF.length;i++)
{
if(QUALF<i>.equals("004"))
{
result.addValue(""+MFRPN<i>+"");
}
}

You can think, before I said we should not use Remove Context. but in my logic I used Remove Context!

If you use RemoveCOntext right after QUALF, then your logic won't work, But in my logic I used it after MapWithDefault, hence it will work perfectly for sure!

If it doesn't helps. let me know!

raj.

Former Member
0 Kudos

Yes Raj.

Former Member
0 Kudos

Raj,

I followed your logic, but i am getting the below error on mapping test.

RuntimeException in Message-Mapping transformation: Exception:[java.lang.ArrayIndexOutOfBoundsException: 3] in class com.sap.xi.tf._IDOC_to_cXML_ method MFR_UDF$[com.sap.aii.mappingtool.tf3.CBufIter@1ba0341e, com.sap.aii.mappingtool.tf3.CBufIter@32bdabbd]

Please suggest further, to rectify the error.

Thank you.

justin_santhanam
Active Contributor
0 Kudos

MK,

Right click on both th RemoveContext funtion and choose Display Queue. Can you confirm both the queues shows equal no.of values, can you reply what you see over ther...

raj.

Former Member
0 Kudos

Hi Raj,

Please see the display queues in the link below,

[http://www.flickr.com/photos/25429360@N07/2397958164/]

They are not equal.

Please suggest further.

Thank you.

justin_santhanam
Active Contributor
0 Kudos

MK,

Did you followed the same logic which I said above? I won't think so. Please don't change the context of MFRPN. Use the MapWithDefault and then Remove context. I'm sure it will work.

raj.

Former Member
0 Kudos

Raj,

I have done as you said, please see at the link below

the correct link

[http://www.flickr.com/photos/25429360@N07/2397992046/]

Thank you,

MK

Edited by: mk.xi on Apr 8, 2008 2:21 PM

Edited by: mk.xi on Apr 8, 2008 2:23 PM

justin_santhanam
Active Contributor
0 Kudos

MK,

Can u check the context of MFRPN? It has to be E1EDP19...

raj.

Former Member
0 Kudos

Raj,

The display queue for MFRPN shows as below

/.../IDOC/E1EDP01/E1EDP19/MFRPN

SUPPRESS

[[AS200-2W3-20-DE-R ] ]

[[AS200-2W3-20-DE-R ] ]

thank you.

Edited by: mk.xi on Apr 8, 2008 2:54 PM

Former Member
0 Kudos

> Thanks Sarvesh and Rajeev,

>

> It is working with the removeContexts function. what was the issue before.

>

> And as we have multiple E1EDP19 segments, if we remove the context for E1EDP19-QUALF.

> will it not effect the whole mapping of IDoc to cXML as the E1EDP19-QUALF and E1EDP19-MFRPN are need to be considered from the same context.

>

> Please suggest further to resolve it.

The efect of remove context will be only in the mapping where you have used it not in the entire mapping.

Former Member
0 Kudos

Thanks Sarvesh.

but Raj suggested that we should not use removecontexts.

And the other thing is we need to change it similarly for the PO-change message,

where we have same logic as PO for the line(s) that have changed.

and for the line(s) that have not changed we are using BAPI_PO_GETDETAIL to retrieve rest of the details of PO.

Manufacturer part number is stored in the MANU_MAT of BAPI_PO_GETDETAIL, but it is not mapped to the cXML.

Please suggest on how can i change the logic so as to pass the MFRPN to cXML for the PO line(s) coming from the BAPI_PO_GETDETAIL.

Thank you,

MK

Former Member
0 Kudos

Hi,

what function are you using for comparing the elements?

You should use the Text function equalsS.

Regards

Patrick

Former Member
0 Kudos

Patrick,

Yes I am using the text function equalsS .

Please suggest to reslove the issue.

Thank you.