cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping idoc to WS, using ReturnasXML

ernesto_cruz
Participant
0 Kudos

Hello guys, I am working with the SAP Netweaver 7.10 and I have the follow case:

My requirement is to map two substructures of the field xmlSolictud idoc which is defined as a string,

Any suggestions to proceed using the standard function Return as Xml?

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Muniyappan
Active Contributor
0 Kudos

Hi,

if standard function is not working for you try with xslt.

check below code is helpful to achieve this.

xsl code

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

<xsl:stylesheet version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  xmlns:ns0 = "wsTC">

<xsl:output method="xml" encoding="UTF-8" indent = "yes" />

<xsl:template match="/">

<ns0:GenerarSolicitud>

<ns0:xmlSolicitud>

    <xsl:text disable-output-escaping="yes">&lt;![CDATA[</xsl:text>

<SOLICITUD_TARJETA><ZSOLICITUD_TARJ>

   <xsl:copy-of select="//ZSOLICITUD_TARJ/*"/>

     </ZSOLICITUD_TARJ></SOLICITUD_TARJETA>

    <xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>

</ns0:xmlSolicitud>

</ns0:GenerarSolicitud>

</xsl:template>

</xsl:stylesheet>

output

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

<ns0:GenerarSolicitud xmlns:ns0="wsTC">

   <ns0:xmlSolicitud><![CDATA[<SOLICITUD_TARJETA>

         <ZSOLICITUD_TARJ>

            <TIPOSOLICITUD_ID/>

            <CANAL_ID/>

            <GENERA_PLASTICO/>

            <LINEA_COD/>

            <SIS_COD/>

         </ZSOLICITUD_TARJ>

      </SOLICITUD_TARJETA>]]></ns0:xmlSolicitud>

</ns0:GenerarSolicitud>

Regards,

Muniyappan.

ernesto_cruz
Participant
0 Kudos

Hi Ambrish/Muniyappan, thank you very much for the cooperation, the requirement was met.

Cheers.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello,

What's the output structure u r expecting?

Thanks

Amit Srivastava

ernesto_cruz
Participant
0 Kudos

Hello Amit, I attached the output structure file. With the tips of Ambrish I am near of the solution. The next week, I meet me with the department of testing, and surely appear some changes. I will update the thread with more info if it correspond.

Regards.

ernesto_cruz
Participant
0 Kudos

Hi folks, today updated the idoc structure, so my new requirement is attached. And I add a catch, indicating that this missing me add a tag in the xml string destination, which would be the root of the xml string.

XML STRING TARGET:

I am using the "Return as XML"

Any suggestions for moving forward?

ambrish_mishra
Active Contributor
0 Kudos

Hi Ernesto,

Just append the tag while creating the target field. Use standard concat function. You might have to write an XSLT for CDATA something like <xsl:text disable-output-escaping="yes"> but try concat first to see if it works.

cheers,

Ambrish

ambrish_mishra
Active Contributor
0 Kudos

Hi Ernesto,

Once you use returnAsXML, you can use concat function with a delimiter to map the 2 source segments and map it directly to xmlSolictud.

I am not sure what is your requirement.

hope it helps!

Ambrish