cancel
Showing results for 
Search instead for 
Did you mean: 

Can I send nullable attribute to the target element when no value present ?

Former Member
0 Kudos

Hi,

Is there a option in message mapping to send a nullable attribute to the target element when no value present in the source element. e.g., I have PGIdate field in the target as element mapped it from the IDoc pgi date. For the deliveries that are not posted, we will not have PGIdate, in that case I want to send nullable attribute like

<PGIdate xsi:nil="true" />

For deliveries with PGI data I want to send across the that date as value to element like

<PGIdate>20090820</PGIdate>.

Thank You,

Indra Janga

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Indrasena,

For PGIdate map using standard if then else function. If PGIdate exists then PGIdate else send constant with one space.

For the attribute nil map with standard function if without else. If PGIdate --> exists --> not --> then --> true --> nil.

I tried with two records one with date and one without date I got the result what you expected.

Regards,

---Satish

Former Member
0 Kudos

Hi Satish,

Thanks for the reply. It is not about mapping null value if data is not present in the source field. We have to create null attribute for the target element and send xsi:nil="true" as attibute value for the PGIdate element. Like

<pickedgoodsissueddate xsi:nil="true" />

I can get the <pickedgoodsissueddate> xsi:nil="true" <pickedgoodsissueddate />

as value. But thats not what we are looking for.

Thank You,

Indra Janga

Former Member
0 Kudos

Hi Indrasena,

Yes that what I tested and gave to you. Pleae implement that and see whether you are getting the correct result or not. I tested and I got what are you saying only.

If didnot work give me the target structure and the source structure and the payload you are testing. Someone can help you out here.

Regards,

---Satish

Former Member
0 Kudos

There is no attribute filed in our the target structure, we have to create an attribute field at runtime and assign a nil value.

Thank You,

Indra Janga

Former Member
0 Kudos

Hi Indrasena,

If there is no attribute how will you do it. The best thing is add the attribute in the datatype. So if the value is present it would not populate and if it is not there then it will populate at runtime. If the value is present the attribute will not populate, so dont worry. Add it and make it as an optional field so that you dont run into any issues.

If it is not messge type and if it is an xsd then take the xsd in altova xml spy or any other tool and manually edit and add this.

Regards,

---Satish

Former Member
0 Kudos

Well that was my question! If it is possible to add an attribute to the element at the runtime, as we dont have it in the structure. By the way, we are calling webservice, and our webserive guys could not add an attribute to the pgidate element in thier structure because of some technical issues on thier side. If no pgidate is present in source data (delivery Idoc from SAP), then some how we have to add nil attribute to the target pgidate element. I wanted to know if it is possible by using graphical mapping? I really appreciate your suggestion to change the target structure. Well, hope things are so eazy!!!!

Edited by: Indrasena R. Janga on Aug 13, 2009 5:17 PM

Former Member
0 Kudos

Hi Indrasena,

Your webservice guys have given you the wsdl and they dont have the attribute in the wsdl. So if you dont have the attribute in the wsdl itself then you cannot do it. Even if you edit the wsdl and add manually it will throw an error while you send data, because the webservice guys dont expect this. So please check them. If they want they need to change the wsdl.

Regards,

---Satish

Former Member
0 Kudos

Hello Indrasena,

Were you able to find a solution to the problem that you were facing? If yes,can you please provide an update? I am also facing a similar situation and it would help to get a response from you

Regards

Subhayu

Former Member
0 Kudos

You can use mapWithDefaults

Just place this function after PGIDate and double click on it and place "20090820"

Check the following.

http://help.sap.com/saphelp_nw04/helpdata/en/2c/2d8c4024d26e1de10000000a1550b0/content.htm

Thanks,

Venkat.

Edited by: Venkat Anusuri on Aug 13, 2009 2:25 PM