Need help on Java Mapping

000000000000F0011000001448MSQUAL9010000000906                                                                                *
200798438321H001                                                                                SHEN.500010/10/200723:56:55NOSP                                                                                KWO4A                                                             MS*
2007984383215397                             00000500000205                                                                                *
2007984383215396                             00000200000205                                                                                *
200798438321C001                                                                                *
200798438322H001                                                                                SBHS.500011/10/200705:50:00NOSP                                                                                AGH4A                                                             MS*
2007984383225397                             00000500000205                                                                                *
2007984383225396                             00000238000205                                                                                *
2007984383220012                             00001480000355                                                                                *
200798438322C001                                                                                *
=============================================
Main header :000000000000F0011000001448MSQUAL9010000000906  ( relation 1:1 )
Each record ending with Start : *
Sub Header : 200798438321H001  ( relation  0:unbound )
body messages 00000500000205  ( relation  0:unbound )
Close Subheader :200798438322C001     ( relation  0:unbound )
any one could help how to write the Java mapping , am able to get the data from local folder , but error getting as a message mapping error, there is no key field values for in this message.
Probably it should be happen with Java mapping, actually I am from SAP SD back ground, can understand the ABAP.
Warm regards,
kumar.

Hi,
I think file adapter is sufficient for you. Dont need any java mapping. Refer to the file adapter content conversion for sender. Identify the key fields for heading, messages and footer. Then define record set with repeating structures in it like head,1,msg,*,footer,1.
This should solve the problem.
VJ

Similar Messages

  • Help with java mapping

    PI File adapter has a processing option u2018Empty-Message Handlingu2019 to ignore or Write Empty Files. In case there is no data created after mapping on target side then this option determines whether to write an empty file or not. But there is a catch to this option when it comes to using it with File Content Conversion which is described in SAP Note u2018821267u2019. It states following:
    I configure the receiver channel with File content conversion mode and I set the 'Empty Message Handling' option to ignore. Input payload to the receiver channel is generated out of mapping and it does not have any record sets. However, this payload has a root element. Why does file receiver create empty output file with zero byte size in the target directory?  Example of such a payload generated from mapping is as follows:                                                           
    <?xml version="1.0" encoding="UTF-8"?>                          
    <ns1:test xmlns:ns1="http://abcd.com/ab"></ns1:test>
    solution :
    If the message payload is empty (i.e., zero bytes in size), then File adapter's empty message handling feature does NOT write files into the target directory. On the other hand, if the payload is a valid XML document (as shown in example) that is generated from mapping with just a root element in it, the File Adapter does not treat it as an empty message and accordingly it writes to the target directory. To achieve your objective of not writing files (that have just a single root element) into the target directory, following could be done:
    Using a Java or ABAP Mapping in order to restrict the creation of node itself during mapping. (This cannot be achieved via Message Mapping)
    Using standard adapter modules to do content conversion first and then write file. 
    can someone help with java mapping that can be used in this case?

    Hi,
        You have not mentioned the version of PI you are working in. In case you are working with PI 7.1 or above then here is the java mapping code you need to add after message mapping in the same interface mapping
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import com.sap.aii.mapping.api.AbstractTransformation;
    import com.sap.aii.mapping.api.StreamTransformationException;
    import com.sap.aii.mapping.api.TransformationInput;
    import com.sap.aii.mapping.api.TransformationOutput;
    public class RemoveRootNode extends AbstractTransformation{
         public void execute(InputStream in, OutputStream out)
         throws StreamTransformationException {
    // TODO Auto-generated method stub
    try
         DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
         DocumentBuilder builderel=factory.newDocumentBuilder();
         /*input document in form of XML*/
         Document docIn=builderel.parse(in);
         /*document after parsing*/
         Document docOut=builderel.newDocument();
         TransformerFactory tf=TransformerFactory.newInstance();
         Transformer transform=tf.newTransformer();
         if(docIn.getDocumentElement().hasChildNodes())
              docOut.appendChild(docOut.importNode(docIn.getDocumentElement(),true));
              transform.transform(new DOMSource(docOut), new StreamResult(out));
         else
              out.write(null);
    catch(Exception e)
    public void setParameter(Map arg0) {
    // TODO Auto-generated method stub
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    try{
         RemoveRootNode genFormat=new RemoveRootNode();
         FileInputStream in=new FileInputStream("C:\\apps\\sdn\\rootNode.xml");
         FileOutputStream out=new FileOutputStream("C:\\apps\\sdn\\rootNode1.xml");
         genFormat.execute(in,out);
         catch(Exception e)
         e.printStackTrace();
    public void transform(TransformationInput arg0, TransformationOutput arg1)
              throws StreamTransformationException {
         // TODO Auto-generated method stub
         this.execute(arg0.getInputPayload().getInputStream(), arg1.getOutputPayload().getOutputStream());
    In case you are working in PI 7.0 you can use this code
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationException;
    public class RemoveRootNode implements StreamTransformation{
         public void execute(InputStream in, OutputStream out)
         throws StreamTransformationException {
    // TODO Auto-generated method stub
    try
         DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
         DocumentBuilder builderel=factory.newDocumentBuilder();
         /*input document in form of XML*/
         Document docIn=builderel.parse(in);
         /*document after parsing*/
         Document docOut=builderel.newDocument();
         TransformerFactory tf=TransformerFactory.newInstance();
         Transformer transform=tf.newTransformer();
         if(docIn.getDocumentElement().hasChildNodes())
              docOut.appendChild(docOut.importNode(docIn.getDocumentElement(),true));
              transform.transform(new DOMSource(docOut), new StreamResult(out));
         else
              out.write(null);
    catch(Exception e)
    public void setParameter(Map arg0) {
    // TODO Auto-generated method stub
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    try{
         RemoveRootNode genFormat=new RemoveRootNode();
         FileInputStream in=new FileInputStream("C:\\apps\\sdn\\rootNode.xml");
         FileOutputStream out=new FileOutputStream("C:\\apps\\sdn\\rootNode1.xml");
         genFormat.execute(in,out);
         catch(Exception e)
         e.printStackTrace();
    The code for PI 7.0 should also work for PI 7.1 provided you use the right jar files for compilation, but vice-versa is not true.
    Could you please let us know if this code was useful to you or not?
    Regards
    Anupam
    Edited by: anupamsap on Dec 15, 2011 9:43 AM

  • Need help in modifying mapping parameters of out the box mapping

    Hi There,
    I am a new bee to dac.
    Need help in modifying mapping parameters of out the box mapping, which is invoked by DAC task.
    We got a requirement to edit mapping parameter. When I go and see parameter under mappings tab in a mapping, I could not see any values in it.
    But when I set any value, and validate it. It is successful.
    Is it right way to do it?
    What my concern is, When I initially go and see parameter values under maapings tab in a mapping, they are blank.
    Where is it storing these values?
    Thanks,
    Rag

    If you modify mapping then u have to create new task in dac and dac itself craete parameter file at run time. if you want to add more parameters then do it in dac system parameters tab.
    Thanks
    Jay.

  • XI Mail Adapter: sending emails with attachment with help of java mapping

    Hi ,
    On trying out the scenerio mentioned in the blog, using the java mapping provided
    "XI Mail Adapter: An approach for sending emails with attachment with help of Java mapping
    The scenerio works just fine.
    But the payload as the content of the attachment is not getting generated in proper XML format.
    I suppose it's because of the replace special characters code part..
    Can anyone help me state the modification required in the code.
    Thanks!
    Regards,
    Faria Mithani

    It might be a codepage issue. Is your original payload UTF-8?

  • I need help with my mapping - CL_MAPPING_XMS_PLSRV3-ENTER_PLSRV

    hi, guys, i need help with my mapping, i dont know this error (i not speak english)
    <Trace level="1" type="B">CL_MAPPING_XMS_PLSRV3-ENTER_PLSRV</Trace>
    <Trace level="2" type="T">......attachment XI_Context not found </Trace>
    <Trace level="3" type="T">Mapping already defined in interface determination </Trace>
    <Trace level="3" type="T">Object ID of Interface Mapping 4B903E2DDC853C1493E1DED5C5ED70A3 </Trace>
    <Trace level="3" type="T">Version ID of Interface Mapping 88D96A70BAAE11DFAE5EE925C0A800C2 </Trace>
    <Trace level="1" type="T">Mapping-Object-Id:4B903E2DDC853C1493E1DED5C5ED70A3 </Trace>
    <Trace level="1" type="T">Mapping-SWCV:88D96A70BAAE11DFAE5EE925C0A800C2 </Trace>
    <Trace level="1" type="T">Mapping-Step:1 </Trace>
    <Trace level="1" type="T">Mapping-Type:JAVA_JDK </Trace>
    <Trace level="1" type="T">Mapping-Program:com/sap/xi/tf/_mm_sgipi_fi001_vta_clientes_ </Trace>
    <Trace level="3" type="T">MTOM Attachments Are Written to the Payload </Trace>
    <Trace level="3" type="T">Dynamic Configuration Is Empty </Trace>
    <Trace level="3" type="T">Executing multi-mapping </Trace>
    <Trace level="1" type="E">CL_XMS_PLSRV_MAPPING~ENTER_PLSRV</Trace>
    help me please

    you can use the sharedobject to record a user/computer has taken your quiz, the session data and record their results.  at the start of your quiz, check for the sharedobject and, if it exists, check the other data and take appropriate action.

  • Need help with java

    ok so i have a midterm and need help this question that is gonna be on the midterm. i dont know how to do it and its worth 16 marks!!!! here it is
    the UW Orchestra wants to produce a CD containing all the pieces of music
    from its upcoming concert. In order to do that, it needs to calculate the total length of time for the
    CD. In addition, the conductor wishes to know which piece of music has the longest duration.
    Sample output for the program.
    The Swan (3.88)
    The Bee (0.98)
    Claire de Lune (6.02)
    Liebesfreund (3.38)
    Ragtime (3.48)
    The total time for the CD is 18.74 minutes.
    The longest piece is Claire de Lune.
    Do not include the HTML that is required to embed the program into a Web page (that is, show
    only what you would write between <script> and </script> tags).
    [4 marks] In the following space, define a function, Print, that takes two parameters, Title and
    Length, and outputs a line of text such that Title appears in italics, followed by Length in
    parentheses. The function also returns the value of Length.
    For example, Print("My World",30) will output the line
    My World (30)
    and return the value 30.
    Put your JavaScript program for the remainder of this question in the space provided on the next
    two pages.
    [9 marks]. For each piece of music, your program should input the title of the piece and the
    duration (in minutes) for that piece, and it should output a line showing those values using the
    Print function just defined. After all pieces have been listed, the program should output the
    total length of time for the CD, adding in 0.25 minutes between each piece of music (which is
    needed on the CD to separate the pieces).
    [3 marks] The program should also output the name of the piece that has the longest playing
    time.
    Use reasonable variable names, indentation and good programming style. Documentation and
    comments are not required, but you may add them to explain any assumptions you might want to
    make. You need not check that the input is valid, and you may assume that no two pieces have the
    same duration.
    can anyone help me out! i would be indebt of ur kindness if u can help me out!

    This forum is for Java, not JavaScript. The two have nothing to do with each other.
    And anyway, this is your studying, so you should try to do it, put forth your best effort, and ask specific questions (on the proper fourm).

  • Need help with Java Script to perform a calculation in Adobe Acrobat Pro 9 form

    I have a form (test) that I am creating in Adobe Acrobat Pro 9.
    I need help creating custom Java Script so I can get the desired answer.
    1) There are several questions in each group that require a numerical answer between 0-4
    2) There is a total field set up to sum the answers from all above questions
    3) The final "score" takes the answer from Step 2 above and divides by the total possible answer
    Any help on what Java Script I need to complete this would be greatly appreciated!
    I've attached a "spreadsheet" that shows it in more detail as well as what formulas I used in Excel to get the desired end result.
    Thanks in advance.

    Have you tried the "The field is the average of:"?

  • Need help in Multi mapping

    Hi experts,
    we have a scenario need to send an EDI text file to 2 different receivers. We are receving the EDI file using the JMS adapter as Sender and File/FTP adapter as a receiver.
    We are using Multi mapping (includes Java mapping and Graphical ) to send the Messages to receivers, While sending we are getting the Error In Moni as "Error in creating Multi XML Document".
    In Java Mapping we are Converting the EDI text to EDI xml with <ns0:Messages1> and the output of Java mapping to Graphical Mapping,
    While testing in Interface Mapping Test it works fine.
    Please provide your Valuable inputs.
    Thanks,
    Ramg

    HI
    The below is the output im getting from Interface mapping
    =====
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge"><ns0:Message1><ns2:MT_Req xmlns:ns2="http://test.com/CommonServices"><DataConversionArea><SapQtySign>P</SapQtySign><Filler>                                                              </Filler></DataConversionArea><DataElement><RspShipToLoc>000000</RspShipToLoc><Filler>                                                                       </Filler></DataElement></ns2:MT_Req></ns0:Message1>
    <ns0:Message2><ns2:MT_In_Req xmlns:ns2="http://test.com/CommonServices"><DataElements><ProdSchedNbr>             </ProdSchedNbr><Filler>0030</Filler></DataElements></ns2:MT_In_Req></ns0:Message2></ns0:Messages>
    =====
    Thanks
    Ramg

  • Need help on Parameterized mapping in PI 7.1

    Dear all,
      i had a requirement in which Username, password & client values should pass from interface determination and these values should call through the  java mapping. i had gone through some of the discussions in SCN , but i cant understand. So can any one  please explain   step by step with java mapping.
    thanks in advance.

    hi Shaik Samir,
        In this pic you can see the user is creating the parameter called  TAG_NAME with a value "TAG"
    Then the java mapping code reads this parameter here in this line
    String inParam = arg0.getInputParameters().getString("TAG_NAME");
    In the string inParam we will have the value "TAG". You can do whatever you want with this value.
    Similarly you can write your own java code in NWDS as given in this sample mapping here
    http://wiki.scn.sap.com/wiki/display/XI/Parametrized+Java+Mapping+in+PI+7.1?original_fqdn=wiki.sdn.sap.com
    In your case you need to add Username, password & client values as parameters and their values as shown above and use them in your mapping. Hope I could explain you the process.
    All the best.
    Regards
    Anupam

  • Need help with instruments mapping

    I have Korg PA80 and i hooked up midi out from it to midi in to Logic8, I have some nice realtime accompaniment tunes i can play on that keyboard, what i want to do is to play on my PA80 accompaniment tracks but replace all sounds with my custom sounds from my Logic plug ins, right now when I hit play all i hear is some garbage playing because no instruments properly mapped on Logic, I even created all 16 instrument tracks and set them all on all 16 channels, drums on 10 and so on, but when i start play on PA80 in Logic I still hear like bass trying to play all parts and not bass part only, same for drums when i press Am or Dm drums will play properly with some another drums sounds that trying to play all other instruments parts, need to separate them so the bass will play only bass part, drums will play drum part and so on, need help on how can i do that, lets say for drums i will choose logic drums sounds, for base Logic bases and so on, so Logic will become something like sound module for my PA80 instead of internal sounds I would like to use my virtual instruments sounds, thanks a lot

    Thanks for your reply Dave.
    I have no answer to your question but I found a way to create my SQL code with OWB mapping operators. Unfortunately it is very very slow compared to the execution of the SQL code and therefore not useful at all. I connected the following steps all in one mapping:
    1. Table operator(T006_SITE) -> Filter(T006A01PK_SITEID where T006A11FK_COUNTRYID IS NULL)
    2. Table operator(T002_COUNTRY) -> AGG (MAX T002A01PK_COUNTRYID)
    3. JOIN the output from 1. and 2.(T006A01PK_SITEID and T002A01PK_COUNTRYID))
    4. UPDATE T006_SITE with the output from 3. (T006A01PK_SITEID as matching column and T006A11FK_COUNTRYID as column to be updated)
    The execution mode of the mapping should be set-based fail over to row-based, but it used row-based mode even without getting an error. Are UPDATE mappings only executable in row-based mode or is there a way to change that?
    Does anyone have an idea how I can speed up that mapping or integrate my SQL code in the OWB?
    Thanks in advance,
    Dirk

  • Need help in Java Script

    i Need some help in Java Script,
    am using the following code :
    <script type="text/javascript">
    var newwindow;
    function poptastic(url)
    newwindow=window.open(url,'name','height=300,width=400,left=100, top=100,resizable=yes,scrollbars=yes,toolbar=yes,status=yes');
    if (window.focus) {newwindow.focus()}
    else {newwindow.close()}
    //     if (window.focus) {newwindow.focus()}
    </script>
    In HTML,
    thWorld Environment
    Day, June 5<sup>th</sup>,2005
    Am using onmouseover event, so that when my mouse in on the link, popup is opened....and when my mouse is out of the link, the new window should b closed....
    but according to the above code, the new window is opened but have to close it manually....
    Is there any other way to close the popup when my mouse is out of the link

    Prawn,
    This is not really a good way to make friends. With the cross posting and the posting in a wrong forum anyway thing you have going.
    Please kindly take your question to an appropriate JavaScript forum.
    Have a happy day.
    Cross post from http://forum.java.sun.com/thread.jspa?messageID=3797201

  • Need Help Regarding JAVA BEAN

    Is any one tell me that JAVA BEAN only used in WEB or also you in Desktop applications???? and aslo tell how i implement Java class and use JAVA BEAN. I need help regarding above matter
    thanks in advance
    Rehan MIrza

    Here is a good link that indicate that JavaBean is not only for applets
    http://java.sun.com/docs/books/tutorial/javabeans/whatis/beanDefinition.html
    quote:
    The JavaBeans API makes it possible to write component software in the Java programming language. Components are self-contained, reusable software units that can be visually composed into composite components, applets, applications, and servlets using visual application builder tools. JavaBean components are known as Beans.
    Francois

  • New to Illustrator, need help creating a map?

    Need to create a map of a neighborhood.  New to program any help would be great!

    rdelaroca,
    There are vector maps available for many areas.
    Or you may work on a locked image from Google Maps or something including the important parts/themes/whatever, using the Pen Tool as the primary tool for shapes in general.

  • Need help on Java in sound application

    A good day to everyone here,
    I need help on using Java.My project is mainly manipulating WAV sound files with Java. There is some problem.I hope you all can help me. I couldn't find much info about Java in sound manipulating,sample coding or something like that. I need to find the command to
    1) Find each sampling point value in a sound file.
    2) Find the number of sampling point and the average value of the all the sampling point.
    3) Record the sound file in a different bit rate format.
    I dont know how to go about it.I really hope you all can help me, or direct me to any resources that may help me. Your help is very much appreciated.
    Thank you very much....

    i found this coding in a website n i not very sure that i understand it.
    can anyone tell me if i can find the sample point value of a sound file with this coding (byte[] source is byte array of the sound file).
    thanks...for all the help
    public byte[] executeAmplitudeTransformationInternal(byte[]
    source)
    int[] sampleArray = getSampleArray(source);
    int[] newSampleArray = executeTransformation(sampleArray);
    //convert 16 bit samples back to 8 bit byte[]
    return getByteArray(newSampleArray);
    public int[] getSampleArray(byte[] eightBitByteArray) {
    //create an array 1/2 the size (since every 2
    //8bit samples makes 1 16bit sample)
    int[] toReturn = new int[eightBitByteArray.length];
    int index = 0;
    for (int t = 0; t < eightBitByteArray.length; t += 2) {
    //read the high bit
    int low = (int) eightBitByteArray[t];
    //read the low bit
    int high = (int) eightBitByteArray[t + 1];
    //bit shift the high bit 8 bits to the left and
    // "And" the low bit against 255 to drop any
    //sign extended data in the top 8 bits.
    //refer to the tutorial for more clarification
    toReturn[index] = (high << 8) (low & 0x00ff);
    index++;
    return toReturn;
    public byte[] getByteArray(int[] sampleArray) {
    //create a new byte[] twice as big as the sample array
    //because it takes two 8-bit bytes to represent one
    //16-bit sample
    byte[] toReturn = new byte[sampleArray.length * 2];
    int index = 0;
    for (int t = 0; t < sampleArray.length; t++) {
    int sample = sampleArray[t];
    //this places the low byte in the array.
    //the downcasting automatically lops off the high byte
    toReturn[index] = (byte) sample;
    index++;
    //this byte shifts the sample 8 bits to the right
    //this puts the old high byte in the position of the low byte.
    //this way the high byte remains after the downcasating from
    //an int to a byte
    toReturn[index] = (byte) (sample >> 8);
    index++;
    return toReturn;
    public int[] executeTransformation(int[] sampleArray) {
    //create a clone sample array
    int[] newSampleArray = new int[sampleArray.length];
    //apply algo to each sample
    for (int t = 0; t < sampleArray.length; t++) {
    int result = (int) (sampleArray[t] );
    //add the sample
    newSampleArray[t] = result;
    return newSampleArray;

  • Plz , need help on IDOC mapping

    Hi friends
    I need help on mapping IDOC (invoic02) to a customer fields to be sent to a printhouse .
    The idoc contains several Item lines , from 1  and up after for instance
    The fields  E1EDP01-MENGE and E1EDP26-BETRG  could be repeated many times , the customer wants  eah line item (quantity , price and subtotal )  in separate  lines.
    What is the best approach to do the mapping , and how can I loop in the idoc segments in order to get each line separetly.
    Many thanks in advance.

    Hi
    Thanks again , plz bear with me as i am new to this kind of assignment.
    This is a part of my requirement, so i suppose that I have to create a Data type as node for the customer fields corresponding to the node in IDOC and just map the source node to the target node , and it will repeat it self as many times as there is line items in the sales order.
    Customer fields              Idoc fields.
                        segment E1EDP01
    DETAIL_ANTAL     E1EDP01-MENGE  -  LOOP
                         segment E1EDP26
    DETAIL_STK_PRIS     E1EDP26-BETRG - QUALIFIER = 001- LOOP
    DETAIL_SUBTOTAL     E1EDP26-BETRG - QUALIFIER = 003 LOOP
    If I change the context of the source, will it not affect the source node at all.
    best regrads.

Maybe you are looking for