IDOC to XML Mapping

Hi,
We have a requirement to sum up the total amount by credit card
i.e.. there will be multiple credit cards, and for each credit card there will be multiple entries,
so i need to sum up AMOUNT for each CREDITCARD and map it to TOTALAMOUNT in Destination.
Please tell me the best way to do this?
Thanks,
Sarva.

Hi Sarva,
You can use Cumulative Sum functoid with second parameter as "1".
I have created one sample xsd from the sample u provided. Used below instance for testing:
<ns0:ZPAYMENT_EXTRACT xmlns:ns0="http://sample_dynamicXSLT.input_idocSchema">
  <IDOC>
    <BEGIN>BEGIN_0</BEGIN>
    <EDI_DC40>
      <field1>field1_0</field1>
      <field2>field2_0</field2>
    </EDI_DC40>
    <Z1PAYHDR>
      <SEGMENT>Girish</SEGMENT>
      <ACCOUNT>111</ACCOUNT>
      <XMIT_DATE>XMIT_DATE_0</XMIT_DATE>
      <Z1PAYDTL>
        <PAYMENT_DATE>PAYMENT_DATE_0</PAYMENT_DATE>
        <AMOUNT>100</AMOUNT>
        <CREDIT_CARD>ABC</CREDIT_CARD>
      </Z1PAYDTL>
 <Z1PAYDTL>
        <PAYMENT_DATE>PAYMENT_DATE_0</PAYMENT_DATE>
        <AMOUNT>200</AMOUNT>
        <CREDIT_CARD>PQR</CREDIT_CARD>
      </Z1PAYDTL>
 <Z1PAYDTL>
        <PAYMENT_DATE>PAYMENT_DATE_0</PAYMENT_DATE>
        <AMOUNT>300</AMOUNT>
        <CREDIT_CARD>XYZ</CREDIT_CARD>
      </Z1PAYDTL>
    </Z1PAYHDR>
<Z1PAYHDR>
      <SEGMENT>Naveen</SEGMENT>
      <ACCOUNT>222</ACCOUNT>
      <XMIT_DATE>XMIT_DATE_0</XMIT_DATE>
      <Z1PAYDTL>
        <PAYMENT_DATE>PAYMENT_DATE_0</PAYMENT_DATE>
        <AMOUNT>40</AMOUNT>
        <CREDIT_CARD>ABC</CREDIT_CARD>
      </Z1PAYDTL>
 <Z1PAYDTL>
        <PAYMENT_DATE>PAYMENT_DATE_0</PAYMENT_DATE>
        <AMOUNT>80</AMOUNT>
        <CREDIT_CARD>PQR</CREDIT_CARD>
      </Z1PAYDTL>
    </Z1PAYHDR>
  </IDOC>
</ns0:ZPAYMENT_EXTRACT>
Got the output as:
<ns0:ZPAYMENT_OUT xmlns:ns0="http://sample_dynamicXSLT.output_idocSchema">
<CUSTOMER>
<SEGMENT>Girish</SEGMENT>
<ACCOUNT>111</ACCOUNT>
<TOTALAMOUNT>600</TOTALAMOUNT>
</CUSTOMER>
<CUSTOMER>
<SEGMENT>Naveen</SEGMENT>
<ACCOUNT>222</ACCOUNT>
<TOTALAMOUNT>120</TOTALAMOUNT>
</CUSTOMER>
</ns0:ZPAYMENT_OUT>
Thanks, Girish R. Patil.

Similar Messages

  • DESADV.DELVRY03 idoc to XML Mapping issue.

    Hello Experts,
    I am facing a problem in Mapping of an idoc DESADV.DELVRY03 with the given XML file.
    Please suggest me how to map E1ADRM1/E1ADRE1/EXTEND_D with qualifiers such as RG,AG,WE.
    Please help me out.
    If step by step document will be provided then it would be a great help.
    I will appreciate every helpful suggestion.
    Thanks,
    Dipen.

    Hi Dipen,
    Please follow the basic mapping functions and  find my bellow Mapping Logic may its help you.
    Regards,
    Rajendar K

  • Mapping issue for Idoc to xml

    hello all,
           my scenario is idoc to xml file
    E1EDKT1-------segment (1:n)
       -TDID----
    ele
       -E1EDKT2----segment (1:n)
          -TDLINE-----ele
    When TDID value is X then all values in TDLINE of undeline sement E1EDKT2 needs to be cocatenated and passed to target elemnt A
    if  TDID value is Y then all values in TDLINE of undeline sement E1EDKT2 needs to be cocatenated and passed to target elemnt B
    i have written java function(for all values in context) to conctenate TDLINE elements.
    also the context of TDLINE is changed to  E1EDKT1.
    i am getting all the concatenaed values of TDLINE for TDID=X in target element A but i am not geting any value in target element B for TDID=Y
    can any one suggest what could be the problem.
    Regards,
    Sandip

    Hi Sandip,
    Map like this for target element A:
    use simple if stament.  and for If give TDID  equals(text function) to constant X
    and for then TDLINE-->concattdline(udf) --> output A
    Map like this for target element B:
    use simple if stament.  and for If give TDID  equals(text function) to constant Y
    and for then TDLINE-->concattdline(udf) --> output B
    concattdline udf:
    Create a Context udf with one argument a and name it as concattdline.
    Imports:  java.*;
    Add this code:
    //write your code here
    String value = "";
    for(int j=0; j<a.length - 1; j++){
         value += a[j] + "";
    value +=  a[a.length - 1];
    result.addValue(value);
    I just tested this and it should work for you.
    Regards,
    ---Satish

  • HOW TO MAP IDOC TO XML

    Hi,
      I need to map IDOC to xml but the problem is I have 400 fields in IDOC which  are to be mapped to 20 elements in XML.
          As it a tedious process to go to 400 fields for each xml element.Is their any better way to find correct field in IDOC with very minial time rather going 400 fields for each xml element.
    thanks
    sreeram

    hi,
    >>1)Even SAP it self does not encourage to use ABAP >>MAPPING and
    i dont know where you have read this, but ABAP mapping is one of the most popular/ most efficient and highly recomended by SAP. I have used it in tons of places.
    >>2)More over Iam not ABAP resource.
    you could also do a java mapping.
    there is no other easy way if you are not doing abap/java mapping. you are then left with the only option of using the graphical editor.
    cheers,
    Naveen
    Message was edited by: Naveen Pandrangi

  • Retreive IDOC number and map it to a field in Target XML

    Hi Experts,
    IDOC to file scenario
    I have a requirement where I have to retreive the number of the IDOC generated and map it to a field ID in the target XML.
    Do i have to use a UDF for this? can ne one pls explain?
    Regards,
    Teja

    Hi Ravi,
    You dont need use a UDF for this.
    this is a very simple requiremen.
    You can get the IDOC number from source IDOc
    under EDI_DC40 node field name DOCNUM.
    This DOCNUM fielsd will contain the IDOC number
    Map this DOCNUM field from source IDOC to target XML structure.

  • Regarding receiver determination problem in IDOC-XI-XML file scenario

    Dear All ,
    In IDOC-XI-xml file scenario , I have configured SLD , IR . But in ID , after file adapter , reciever agreement configuration when I am doing receiver determination configuration I am not able to insert mapping program in configuration overview of receiver determination as I am not getting "New Specific" option in mapping .
    Can anybody suggest what could be the reason behind this .
    Thanks in Advance
    Prabhat

    Hi PRabhat,
    In RCVR determination, you need to select the party & service (as appropriate) save the obeject
    then refresh the configuration overview of recr det.
    then you can see the partner/service
    then you can open it & add the necessary objects.
    Regards
    Vishnu

  • Idoc to XML, namespace is not getting created in output XML

    Hi All
    My interface is idoc to XML.
    I am using graphical message mapping.
    In output xml , namespace is not  formed
    Can any one tell why namespace is not  created in the XML and
    How to add the  namespace to the  output XML .
    Kindly help
    Regards,
    Sheela

    Hi,
    You can change your external definition to achieve it.  just compare the structure of your xsd with some other normal data type xsd and change accordingly.
    Inder

  • Automate flat IDOC to XML IDOC using one interface

    Hello all,
    We are currently going through a migration process where XI will be replacing a legacy system.  As part of our testing procedure, we are using historical data pairings from the legacy system and using an automated tool to compare if the interfaces we develop in XI match.  The catch is we need the data that we are comparing in XML format for the automated tool to be able to do the comparison, and unfortunately the legacy data is a flat format.  So now I would like to automate a way to convert this data to XML format.
    Specifically for IDOCs, I would like to have an interface which picks up the flat files, transforms them to XML, and then drops them back into another file directory in the XML format.  It would need to be able to pick up any kind of IDOC (given that XI has the metadata already imported), recognize what message type it is, then do the conversion.
    I have been reading on SDN and found that there is a standard tool to do the conversion, but it appears it can only handle one kind of IDOC at a time, and it appears it only picks up one specifically named file at a time.
    Has anybody tried to implement a scenario like this?  Any help is appreciated (A walkthrough would be the best!).
    Thanks in advance,
    Mike

    Mike,
    What version of PI will you be using? PI 7.11 can now auto-convert Flat File IDocs to XML IDoc and vice versa.
    Here is the documentation:
    http://help.sap.com/saphelp_nwpi711/helpdata/en/b5/bd93642dd3410f90ebea702399fac4/frameset.htm (flat to XML)
    http://help.sap.com/saphelp_nwpi711/helpdata/en/74/a45bc07e2043fb9b63295229178903/frameset.htm (XML to flat)
    I have not tried this personally, but seems like you might be able to use a "File to File" scenario with no mapping, and use the "IDOCFlatToXmlConvertor" Module in your File Adapter Comms Channel and it may just work, giving you files that are the IDoc XML version of the flat file it is reading. It looks like it does an RFC call to the back-end SAP system where the IDocs are originally from (or could be any system as long as you know the IDocs in there are identical), and reads the IDoc metadata (which has always included flat file field offsets for each IDoc Segment Field), and applies that either to convert from flat file IDoc to XML IDoc, or XML IDoc to flat file IDoc.
    It does mention that there is a limitation that there can only be one IDoc in the source flat file - could be a problem if you have many in one file, which is pretty typical.
    Regards,
    Brendan

  • IDOC to XML using HTTP

    Hi Friends,
    Is there any possibilities to Convert IDOCs as XML using HTTP Adapter in SAP PI?
    Because in my Scenario i need to send Idocs from ECC to Red Prariie using SAP PI.
    Also is it there any possibilities using FTPS?
    Please help me.
    Thanks.

    Hi PIstarter,
    Sure this is possible. Just treat the IDoc like any other Service Interface that you use in the HTTP Receiver Adapter. You can even use the no-mapping approach if no additional processing is required by PI.
    Hope this helps,
    Greg

  • IDOC to XML

    Hi All,
    In partner profile, i have set XML port for outbound IDOC. IDOC in XML format is generated successfully on App. server.
    when I view this file using AL11 I see its shows only the control records not the data records.
    I also see one xml tag <SERIAL>20110831085519</SERIAL>. 
    Is this id contains the data ?
    How to view contents of this Id ?
    Thanks
    Jitendra

    Hi Michael,
    i suppose you r using a message mapping?
    And u have a problem if the source field is empty?
    Use function "exist" to ask if field exist and may be ask for the string lenght > 0. Only in that case (function if) map the field. Or use a XSLT mapping.
    Regards,
    Udo

  • How to Use IDOC in Java Mapping?

    Hello -
    1. How can i use an IDOC to map to an xml file using Java mapping in an IDOC -> XI -> XML file scenario?
    2. How can i test this scenario outside XI, i mean using Eclipse?
    3. How can i create a test data for IDOC for the above scenario in XML format to test it using Java program?
    Thanks,
    Tirumal

    Hi,
    <i>***1. How can i use an IDOC to map to an xml file using Java mapping in an IDOC -> XI -> XML file scenario?</i>
    It will be a direct xml to xml mapping. Is your requirement requires Java Mapping? Otherwise you can easily do without that - check this-
    Is there simply way to map an idoc to an flatfile?
    <i>***2. How can i test this scenario outside XI, i mean using Eclipse?</i>
    You need to have XML input for this. Just try to get the IDoc XML or create xml input based on the Idoc Structure. You can make use of  WE60 to get  IDOC xsd .
    <i>***3. How can i create a test data for IDOC for the above scenario in XML format to test it using Java program?</i>
    Go to Tcode WE19 in the R/3 and generate the outbound Idoc . And then use that xml ( for question no 2). as a test data to test independently.
    Hope this helps..
    Regards,
    Moorthy

  • Using ABAP Web Service tor convert IDoc to XML and transfer to SOAP Server

    Hi all,
    I have a problem to use ABAP Web Service to convert IDoc's to XML and then send them to a SOAP Server.
    Currently we have the following landscape:
    SAP->XI->Archive
    The sap-system (ECC6.0) sends an IDoc to the Exchange Infrastructe. The XI maps the IDoc and converts it to the required XML format, used by the archive. Afterwards, the XML documents are sended to the SOAP Server.
    So I'm trying to replace the Exchange Infrastructure with ABAP Web Service.
    I've read a lot of posts and documents reagarding ABAP Web Serivce, converting IDoc's to XML, RFC and so on, but I'm not able to do the replacement.
    I don't know how to start and which steps are required.
    The required roles and authorizations at the sap-system and the service for soamanager and the Web Service Viewer are available.
    First I thought to create the RFC and partner profiles and then the report to convert IDoc to XML as a BAPI. With this BAPI I supposed to create and define a Web Service. The problem is, I don't know how to trigger the report if the Idoc should be send to the archive.
    Hopefully, someone has an idea or a how-to for me.
    Thanks in advance.
    Regards,
    Christoph
    Edited by: BigTicket on May 12, 2010 9:36 AM

    Hi BigTicket.
    A suggestion to trigger the BAPI / WebService at the IDoc receiving is to use a user exit or enhanced inside the idoc function module. When the idoc arrived to the idoc port the system start the related function module and then your user exit/enhanced in which you invoke your BAPI.
    I hope this help.
    Ciao.
    Nicola

  • Convert Idoc into xml string

    Hi,
    We have Idoc to web service scenario. The real problem, web service has only one field named "STRING"
    I need to pass Idoc into xml format as shown below to this STRING.
    e.g.
    <ZQM_NOTIFICATION><QMNUM>000000006471</QMNUM><QMART>Z2</QMART><MATNR>000000000007515116</MATNR><MATKTX>0.89 BRONZE R2400 HT - BS900 -PNEUM</MATKTX><MAWERK>HL</MAWERK>.......</ZQM_NOTIFICATION>
    How can I achive this via mapping?
    Thanks & Re

    Hi , If you are using PI 7.1 it is very simple''
    refer below blog
    /people/jyothi.anagani/blog/2010/06/17/convert-the-input-xml-to-string-in-pi-71-using-standard-graphical-mapping
    Regards,
    Raj

  • Xcelsius Dashboard on SAP R/3 Table using BSP and XML Mapping

    Hi Experts,
    I have developed a simple dashboard on small data set (10 records) that I am fetching from a R/3 Table into BSP and generating XML from there and consuming it in Xcelsius (SAP R/3 + BSP + XML Mapping).
    Now I want to fetch data based on Variables values that should be passed from the dashboard at the runtime and should display the data  accordingly. Any help on how it can be achieved?
    Thanks..!!
    Sharad

    Hi,
    You could try doing this by using XML data connection. You would have to make use of Enable load to get the data from XML and Enable send to send data back to XML from dashboard.
    This would require you to write a script.
    Thanks,
    Amit

  • How can I convert IDoc in XML format w/DTD into a string?

    I want to send by e-mail outbound IDoc in XML format with its document type definition (DTD).
    I want to be able to get the same output result into a string than the XML file IDoc port type with DTD activated.  I have created a FM (based on SAP "OWN_FUNCTION") assigned to an IDoc port of type ABAP-PI that executes the following processing steps:
    1-Extract outbound IDoc information to get the sender & recipient mail addresses (EDP13 / EDIPHONE tables).
    2-Convert & Transform IDoc data into XML string using FM IDX_IDOC_TO_XML.
    3-Prepare and send e-mail with XML attachement using FM SO_NEW_DOCUMENT_ATT_SEND_API1.
    I cand generate the e-mail with the XML file attachement but FM IDX_IDOC_TO_XML does not convert the IDoc with proper formating and DTD.
    What should I use to accomplish the IDoc conversion to XML w/DTD into a string?
    Should I use XSLT tools ?
    How does that work?
    Thank you
    Carl

    muks wrote:
    Use decimal string to number
    Specifically, you can define a constant with a different datatype on the input on the lower left if you need a different datatype (e.g. U8, I64, DBL, etc) Are all your values integers or do you also need to scan fractional numbers? In this case, you should use "fract/exp string to number" instead.
    LabVIEW Champion . Do more with less code and in less time .

Maybe you are looking for