Performance of an UDF v/s standard graphical mapping functions

Hello Experts,
I would like to get your opinion/comments on the performance issues with respect to speed of execution when using graphical functions for doing the date conversion requirement given below:
Requirement is to convert input date u20182008-12-03u2019 from the source side to u201820081203u2019 on the target side.
We have used the standard graphical mapping functions 'substring' & 'replacestring' for doing this conversion as explained here: The u2018substringu2018 function is used to capture the part of the string from the source. A u2018constantu2019 with value u2018u2013u2018 is replaced by u2018constantu2019 (empty value) by using the standard text function u2018replaceStringu2019 in the target side.
We did the same using the following UDF too:
public String convertDate(String dateStringInOriginalFormat) {
            SimpleDateFormat originalFormatter = new SimpleDateFormat("yyyy-MM-dd");
            SimpleDateFormat newFormatter = new SimpleDateFormat("yyyyMMdd");
            ParsePosition pos = new ParsePosition(0);
            Date dateFromString = originalFormatter.parse(
                        dateStringInOriginalFormat, pos);
            String dateStringInNewFormat = newFormatter.format(dateFromString);
            return dateStringInNewFormat;
From a critical performance point of view, which approach will fare better?
Thanks in Advance,
Earnest A Thomas
Edited by: Earnest Thomas on Dec 4, 2008 6:54 AM

Hi,
Not only in this case but in general it is always better to use the functions available in MM and only if your requirement is not satisfied with the standard mapping functions then go for UDF.
Also for your requirement no need of going for substring....you can directly use the DateTransform function available.
Source --> DateTransform --> Target
Regards,
Abhishek.
Edited by: abhishek salvi on Dec 4, 2008 11:25 AM

Similar Messages

  • Conditional mapping in Graphical mapping

    Hi All,
    I have a conditional mapping requirement i.e.I have 2 nodes ( collections/collection/object and  extensions/collection/@name) in the source structres. Both nodes are identical and have unbound occurences. Based on certain condtions I need to map second node in the  source node to target node ( Items ). Below is the condition.
    If first node '/MT_FCI_CONTRACT_EXPORT/fcidataexport/objects/object/collections/collection/object/@classname' (Occurs Unbounded ) value is not  'contracts.LineItem'  and second node '/MT_FCI_CONTRACT_EXPORT/fcidataexport/objects/object/extensions/collection/@name' ( Occurs Unbounded ) value is 'MATGRP_COLLN' then only map source field '/MT_FCI_CONTRACT_EXPORT/fcidataexport/objects/object/extensions/collection/row' ( occurs unbounded ) to target node 'Items' ( Occurs unbounded ).
    I have done this mapping using If condtions and did some context changes. My second condition is working fine but my first condition is not working as expected. Its only taking value in the first occurences and based on that passing first condition. But I need to check in all occurences whether value 'contracts.LineItem' is not exist  then only I need to pass that condition. Please let me know how to achieve this.
    Please help me to achieve my requirement.Thanks.
    Regards,
    Rajesh

    Hi Rajesh,
    To reply your query first we have to understand the exact requirement . So I am writing my understanding below and solution for it .Kindly reply if your requirement is different.
    you have three source field which is involved in mapping .@classname, @name, and row and target side you have node item .
    Now you have to check for all classname and name that if classname is not equal to contracts.LineItem and @name is equal to MATGRP_COLLN ( both the values I have considered as constant) then map row to target node item. i.e if classname and lineitem is occuring 4 time and two time both are satisfying both the codition then generate two target Item node .
    Solution.
    classname -> (CollapseContext)->equals to ContractLineitem --not -->
                                                                                    AND -
    IIF WITHOUT ELSE
    Name -
    >(CollapseContext)-->equals to MATGRP_COLLN--
    >
    the condition of if without else function will be output of AND and in then map row----.(collpasecontext) finally the output of if without else will be mapped to item
    note :all ittalic is Graphical mapping functions .
    Regards,
    Saurabh

  • Using a DOM Document in Graphical Mapping

    Hi,
    I have the following scenario:
    A string stream is received from a SOAP adapter. From this   I extract a part that is in essence a XML document.
    I then parse this into a DOM Document object. 
    I want to pass this XML structure on to other graphical mapping functions so that I can map parts of this document to other structures. I cannot add it to the 'result' object in an 'Advanced user defined function'
    Do I have to add it to some component of the 'container' object passed to the function ?.  If not - any ideas of how I would do this ?.
    Thanks
    Andre

    Hi Andre,
    It looks to me like you have an XML document with another XML document embedded (and encoded) inside some element. Something like:
    <outerDoc>
    <element>
      &lt;innerDoc&gt; ...more embedded XML... &lt;/innerDoc&gt;
    </element>
    </outerDoc>
    It is not possible to both "unwrap" the inner document and continue to work on it in a graphical mapping. The simplest approach is to have 2 mapping steps in your interface mapping:
    1. A pure Java mapping in which you get the complete outer document as input, parse your way through and extract the inner document, which is the output of this first mapping step.
    2. A graphical mapping which has your inner document as input and your final result as output.
    Hope that clarifies it somewhat
    Best regards,
    Thorsten

  • How to debug global values in UDF in a graphical mapping

    Hi Every one,
    I  got a situation in PI where i have to use global values in graphical mapping UDF.
    I can't able to get the values in "Display Queue " option.
    Can you please tell me what is the best way of debugging global variable in graphical mapping UDF.
    1. I declare one array list in the global values
    2. store some values using another UDF to the arraylist.
    3. I am traversing the values in the arraylist, but the values are not showing in "Display Queue".
    What is the solution to this.

    Did you try with trace.addInfo?
    https://help.sap.com/javadocs/NW04/current/pi/com/sap/aii/mapping/api/AbstractTrace.html
    Sample code for the setMail UDF (Carrier B2B) - Business Process Expert - SCN Wiki

  • Create Attachment within Graphical Mapping using UDF

    Hi!
    We want to create an attachment witihn a graphical mapping using an UDF function.
    I use that function:
    public String addAttachment(String filename, String mimeType, String content, Container container) throws StreamTransformationException{
         BASE64Decoder decoder=new BASE64Decoder();
         try {
              GlobalContainer globalContainer = container.getGlobalContainer();
              OutputAttachments outputAttachments = globalContainer.getOutputAttachments();
              Attachment attachments = outputAttachments.create(filename, mimeType,decoder.decodeBuffer(content));
              outputAttachments.setAttachment(attachments);
              return "Adde1: "+filename;
         } catch (Exception e) {
              return e.toString();
    (SDN helped me much in creating that
    This function has no compiling errors, anything workes fine:
    It takes 3 input-parameters, see also: http://help.sap.com/javadocs/pi/SP3/xpi/com/sap/aii/mapping/api/OutputAttachments.html
    filename (ok, more or less contentID)
    mimeType (more or less contentType)
    content: Base64-encoded String which should be set as content
    In my sample I use the following constants for that function:
    filename = "fn1.txt"
    mimeType="application/xml"
    content = "UG9seWZvbiB6d2l0c2NoZXJuZCBhw59lbiBNw6R4Y2hlbnMgVsO2Z2VsIFLDvGJlbiwgSm9naHVydCB1bmQgUXVhcms=" --> cames directly from http://de.wikipedia.org/wiki/Base64
    When using the message, I got this error within SXMB_MONI:
    <SAP:AdditionalText>com.sap.engine.interfaces.messaging.api.exception.MessagingException: Could not queue receive for
    message 0022642d-b106-02df-8e8c-f41c243bd112(INBOUND). Reason: java.lang.NullPointerException: while trying to
    invoke the method com.sap.aii.af.sdk.xi.lang.Binary.getBytes() of an object returned from
    com.sap.aii.af.sdk.xi.mo.xmb.XMBPayload.getContent()</SAP:AdditionalText>
    This looks pretty much the same as Add Attachment from ABAP Mapping but this tread is also not answered.
    Adding attachment from PI level looks also in that direction, again, no answer.
    So, I was wondering if someone has solved such problem?

    Hi Divyesh!
    We did it that way:
    1. Choosing the XML-Mailstructure as Destination as described in Configuring the Receiver Mail Adapter - Advanced Adapter Engine - SAP Library -  Example (XI payload with mail package)
    2. now we have created a UDF for creating the "content"
    public void getContent(String[] text, String[] attFname, String[] attType, String[] attContent, ResultList result, Container container) throws StreamTransformationException{
    // vergleich ob alle att-Arrays selbe anzahl haben
    if (attFname.length!=attType.length || attFname.length!=attContent.length) {
        result.addValue(Integer.parseInt("Fehler: alle Attachment-Eingänge müssen die selbe Anzahl an Elementen haben!"));
        String CRLF = "\r\n";
        String output="This is a multi-part message in MIME format."+CRLF+CRLF+
        "--"+getBoundary(container)+CRLF+
        "Content-Type: text/plain; charset=UTF-8"+CRLF+
        "Content-Disposition: inline" + CRLF + CRLF +
        text[0]+CRLF;
    for (int i=0;i<attFname.length;i++) {
        output+="--"+getBoundary(container)+CRLF+
        "Content-Type: "+attType[i]+"; name="+((char)34)+attFname[i]+((char)34)+CRLF+
        "Content-Disposition: attachment; filename="+((char)34)+attFname[i]+((char)34)+CRLF+
        "Content-Transfer-Encoding: Base64"+CRLF+CRLF+attContent[i]+CRLF;
    output+="--"+getBoundary(container)+CRLF;
    result.addValue(output);
    This UDF is configured as "QUEUE"
    We have configured this input-structure
    The Content itself is allready base64.
    So we can call this mapping and it creates a Multipart-Mail for us.

  • Graphical mapping or UDF

    Hi,
    In my mapping i have a requirement where the input can be any of three values or not existing. (lets just call them V0, V1, V2 and V3, where V0 is the not existing tag)
    If the input is V0, or V1 or V2 i need output an Empty Constant, If the input is V3 i need to pass the value.
    I've worked this out with a graphical mapping, but it involves a lot of boxes. It works though.
    I'm still wondering if i can do it with a UDF though. Only problem is that my JAVA knowledge is not nearly as good as it should be, so maybe one of you out there can give me some ideas/code.
    The thing that give the most headache is the fact that the tag might not exist at all in the source message. How do I deal with that in JAVA code?
    Any ideas are welcome.
    Kind regards
    Robert

    Hi Robert,
    below is the Jave code, below code is w.r.t exection type as CONTEXT/QUEUE
    public void calculate(String[] var1, String[] var2, String[] var3, String[] var4, ResultList result, Container container) throws StreamTransformationException{
    if(var1.length != 0 || var2.length != 0 || var3.length != 0)
             result.addvalue(" ");
    else if(var4.length != 0)
         result.addValue(<passthe value>);

  • View source code of UDF's and Standard Functions

    Hi Friends,
    Is it possible to view the source code written in the UDF's and Standard Functions.
    If possible please enlighten me.
    Thanks,
    Swapna.

    Hi,
    I dont think u can view the src code for Standard function but try this.
    While holding down "ctrl" + "shift" + "0" key click on the standard function.See if u can export it and check for some src
    code
    Regards,
    Shabari

  • Vga standard graphics adapter driver update

    Hi does anyone know where I can find an updated VGA standard graphic adapter driver.? or what make it is?My young one is trying to play Roblox but keeps getting a message that the driver needs to be updated.Also if it is possible to install an other graphics card.

    Hi,
    You need to be running DirectX 9 at a minimum and it's not on your PC per PC image that you posted. You can try installing Directx but I suspect that you might need a video card.  If you need a video card, then it's an older AGP style, 1.5v card that would be rated for Directx 9 and would work with the power supply size in your PC.
    Good luck!
    HP DV9700, t9300, Nvidia 8600, 4GB, Crucial C300 128GB SSD
    HP Photosmart Premium C309G, HP Photosmart 6520
    HP Touchpad, HP Chromebook 11
    Custom i7-4770k,Z-87, 8GB, Vertex 3 SSD, Samsung EVO SSD, Corsair HX650,GTX 760
    Custom i7-4790k,Z-97, 16GB, Vertex 3 SSD, Plextor M.2 SSD, Samsung EVO SSD, Corsair HX650, GTX 660TI
    Windows 7/8 UEFI/Legacy mode, MBR/GPT

  • Performance Tab in OEM   ( Oracle database Standard Edition )

    We have Oracle database 11g ( Standard edition ONE).
    We have installed OEM (oracle enterprise manager) with database installation.
    We are not able to access the PERFORMANCE tab in OEM.
    1) Is it because Performance tab cannot be seen in Standard Edition ONE version ?
    2) When I tried to setup the control_management packaccess parameter in SPFILE, its failing . Is it because
    of the database edition ?
    3) Any work around in Standard Edition ONE to make the performance tab and tuning pack available with licensing ?

    Pl identify which specific version of 11g.
    I believe the answers are in the docs -
    http://download.oracle.com/docs/cd/E11882_01/license.112/e10594/editions.htm#CIHBAEID
    http://download.oracle.com/docs/cd/E11882_01/license.112/e10594/options.htm#autoId28
    HTH
    Srini

  • Seeburger Predefined Standard Graphical Mappings XI/PI mappings.

    Hi All,
    As I am aware that Seeburger provides E2X and X2E Mapping through BIC Mapping Designer.
    Does it also provides Predefined Standard Graphical Mappings for XI/PI for different versions like
    ---  850 (Purchase Order to Idoc)
    ---  810 (INVOIC to 810)
    ---  Dispatch Advice (856)
    ---  FunctionalAcknowledgements (997)
    I do not have Seeburger with me currently. Can i get the xsd/xslt of the above mappings.
    Please let me know for the same.

    Hi Rick,
    > Does it also provides Predefined Standard Graphical Mappings for XI/PI for different versions
    Yes you are correct. When you buy the seeburger adapter you will have all the xsds and the mappings which conversts from edi xml to xml and vice versa for all these transactions given by them. If you need to do any customization then you need to do on your own or else you can take the help of seeburger consulting or any consultant who is aware of making these changes. You need to do MM for all of these.
    > I do not have Seeburger with me currently.
    Without the seeburger or any other edi adapters you cannot do it on  your own using xi. You need to have an adapter for this to do. I dont think we have the xsds for edi online anywhere. But you can see some help in this link:
    http://www.erpgenie.com/sap/sapedi/mapping.htm
    http://www.linkedin.com/news?viewArticle=&articleID=55241305&gid=41612&articleURL=http%3A%2F%2Fit%2Etoolbox%2Ecom%2Fblogs%2Fehadzipetros%2Fsap-edi-mapping-an-idoc-for-every-interface-33013&urlhash=3x2A&trk=news_discuss
    Regards,
    ---Satish

  • UDF or Graphical Mapping

    Hello All
    I have a requirement like below:
    Source fields              
    TXT                                 
    AddTXT
    Target Field
    Node
    I want to create Node as many times as AddTXT comes with value Concatinate(TXT+AddTXT). This I have achieved not a issue.
    Now I want concatinate should happen only for 1st Node other nodes should contain only value of AddTXT.
    e.g.
    TXT = 001
    AddTXT = James
    AddTXT = Dheeraj
    AddTXT = Rajesh
    Result should be
    Node = 001-James
    Node = Dheeraj
    Node = Rajesh
    I believe using Graphical mapping this is not possible so how can I achieve this using UDF.
    Thanks
    Dheeraj Kumar

    Hi Dheeraj
    Please use the below code.
    In the UDF
    TXT = var1
    AddTXT = var2
    Regards
    Osman

  • UDF(user defined function) for standard date transformate function,

    Hi All,
    Hope you are doing good !!!
    I have a requirement where i need to write an UDF(user defined function). Please help me in writing the code for below logic-
    I am getting my Input as 111213 where 11 denotes HH 12 denotes mm 13 denotes ss. I need ti insert : between hh:mm:ss
    Please help me achieving a code for below logic
    I have used standard date transformate function, there i am getting spaces as separator in my input resulting an errors i am sending without spaces.
    Regards,
    Vijay Kumar.

    Hello,
    I am getting my Input as 111213 where 11 denotes HH 12 denotes mm 13 denotes ss. I need ti insert : between hh:mm:ss
    Please help me achieving a code for below logic
    I have used standard date transformate function, there i am getting spaces as separator in my input resulting an errors i am sending without spaces.
    What do you mean by spaces? Can you try the mapping below?
    inputDate -> replaceString -> dateTrans(inputDateFormat: HHmmss outputDateFormat: HH:mm:ss) -> target
    Constant: -> /
    Constant:-> /
    Hope this helps,
    Mark

  • Do we any tool to test the UDF other than Graphical Mapping

    Hi Experts,
    in graphical mapping we come across UDF i just want to is there any seperate tool in market to test the UDF
    Thanks
    Metha

    Hi,
    Here you have the Effective Tool to Test Our Mappings
    The specified item was not found.
    Regards
    Seshagiri

  • Should we avoid Graphical mapping and stick with Java mapping?

    After developing mappings in XI for a month, I just don't see any good reasons to use Graphical mappings over Java mappings. Maybe some experienced users here can give me some valid reasons why we should choose Graphical mappings. Here is what I think:
    Disadvantages of Graphical mappings:
    1. No way to perform automated unit testings. This is probably the biggest reason I hate it. You can do some tests manually when you work in Integration Builder. But there is no way you can write some unit testing utilities to automate the task.
    2. Complexity. Even for some simple requirements, your Graphical mappings can become complicated and hard to understand. A lot of times, I find myself staring at several dozens of graphical nodes and try to understand what it does.
    3. Impossible to reuse. This is totally against the DRY (Don't repeat yourself) principle. For example, to generate messages for JDBC adapter, it is common to have two identical fields for primary keys: one in the access node and another in the key node. If you change the mapping logic in one, you have to remember to change the other.
    Advantage with Java mappings:
    1. Fully automated unit testing. You can create JUnit tests along with your Java mapping classes and use Maven or other build tools to perform automated unit testing.
    2. Your choice of XML parsing and binding. With Java mapping, you can choose any open source framework for XML parsing and binding. For example, with XMLBeans, I can convert XML input message to a Java object, transform to another Java object and write to output message. And each Java object is generated from its corresponding XML schema.
    3. Highly reusable. We can use fundamental object-oriented designs to create highly reusable mapping components.
    4. Better version control. Since the mappings are just Java classes, we can use CVS or SVN to track code changes.
    5. Better build tools. We can fully utilize build tools like Ant and Maven to automate the build, unit tests, or even generate documents and mapping web sites.
    So do you guys agree? Maybe I am still new to XI or I am missing some important things. But at this point, I just don't see why I should use Graphical mappings. Is there anyone developing XI interfaces completely with Java mappings?
    Thanks in advance for any comments!
    Kenny Cheang

    Hi Suraj,
    > Since its graphical the blocks will take space, but
    > there is always an adavntage of processing time.
    > Ebven though it may appear bigger, it will take less
    > time as compared with Java code (for the same
    > mapping).
    Could you explain more why the graphical mapping has better performance? I thought the graphical mapping is compiled into a Java class in the runtime anyway.
    > Yes thats there, but same goes with Java mapping too
    > right (if you haven't mentioned it as constants)
    I mainly think about inheritance. If I have to build 10 interfaces and they all have some common behavior, I can create a base interface class to encapsulate the common logic. But with graphical mapping, you have to duplicate them in each interface.
    > Disadvantages of Java mapping:
    > 1. Performance
    Same as above. I just don't see why Java has worse performance. I actually think Java should have better performance. You can optimize the code anyway you want. In some cases, you have to use queue functions in graphical mapping but it's not necessary in Java.
    > 2. All might not be well versed with Java Code(though
    > everyone may know basic java) .
    I am not asking everyone to abandon graphical mapping. I am just wondering which one is better when you have skills for both.
    > 3. Lot of standard functions are available in GM
    > which you can choose, but you have to remember the
    > exact code for those in Java mapping.
    You can create functions in Java too. All you have to do is to remember the function name.
    Kenny

  • XSLT using Java function from graphical mapping (RFClookup)

    Hi,
    I was wondering if it is possible to use the standard Java functions of the graphical mapping (RFCLookup, Datetrans, ...) or from my own UDF inside an xslt mapping. Does anyone have every tried this or is an example available ?
    Regards Bernd

    Hi Bernd,
    here you can find an example how to use RFC lookup from an XSLT Mapping:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/05a3d62e-0a01-0010-14bc-adc8efd4ee14?quicklink=index&overridelayout=true
    Is this what you're looking for?
    Regards,
    Gábor

Maybe you are looking for