UDF Needed

Hi,
I have a requirement where in there is a field str where I need to load the XSD schema and pass to the target. There are some 10 tables and each of them have a different XSD . All of these I have loaded under imported archieves. Now I need to write a UDF to call these and pass on to the target.Can some one help me with this.
It is like if the table name is A then pass <str>Schema<str/> for that and so on for all the 10 of them..
Can some one please help me with the UDF logic as I am facing difficuilty in achieving this.
Thanks
Amit

Hi Harshvardhan,
The requirement is there are a set of tables defined in the legacy side and there is a URL which is used to make a call from PI and update the tables based on the XSD schema field.
I mean the output would be something like
<table> ABC <table/>
<Str>Will contain the XSD of that table<Str/>
table>YYY<table/>
<Str>XSD of this table <Str>
and it will repeat  for other tables.
I am not sure how to populate the schema XSD of the target table into this Str field as there is nothing that is coming from the source side. I mean how can this XSD be built in PI if there is no input from the source side. I am of the opinion that this cant be handled . But in case I am wrong in my understanding please clarify.
I hope I am clear in explaining . In case you need clarifications please let me know.
Thanks
Amit

Similar Messages

  • Mapping Help/UDF needed.

    Hi my source looks something like this
    Recordset.      0-Unbounded.               
         Record           0-Unbounded
    Value1
    Value2
    DOCNO
    MatNo
    target
    =====
    MT_Target
    Recordset 0-Unb
    Header
    Val1
    Val2
    DOCNO
    Material 0-Unb
    Matno     
    Example Mapping
    =============
    Recordset.      .               
         Record           
    XXX
    YYY
    100
    01
         Record           
    XXX
    YYY
    100
    02
         Record           
    AAA
    ZZZ
    200
    22
         Record           
    AAA
    ZZZ
    200
    33
    Then My Target would be like
    MT_Target
    Recordset
    Header
    XXX
    YYY
    100
    Material
    01
    02
    Recordset
    Header
    AAA
    ZZZ
    200
    Material
    22
    33
    Please notice the Grouping of DOCNo and Corresponding material numbers
    So I am trying to group the Materials in the Target structure based on the DOCNO field. So all the materials falling under the same DocNo are listed  under that DOCNo,Like if Matno 01,02 fall under Docno 100 so they are listed Under DOCNO :100
    So if there are 3 DOCNo’s then we will have 3 Recordset in the target and each Recordset will have the corresponding MATNO for that DocNo. Hope u understand.
    Could anybody please help me out with this, I have tried using SplitByValue Changing and Collapse Conetxt, it works for the Header but not for the "Material" Node. Help needed, Points Guaranteed.

    John,
    DO you know the  DOCNO value before runtime? Will it have only values 100 and 200? If so, then it is easy to do this using graphical mapping.
    You need to evaluate the condition at recordset level in target.
    Have a look at this thread for evaluating the condition at root level
    Re: How to get access to sub-node elements with a UDF?
    If the value of DOCNO is unknown at design time, then it is better to handle the mapping using JAVA mapping.
    Regards,
    Jai Shankar

  • UDF needed globally

    Hi all,
    I have done one UDF, for one of my interface , i need to use this for another interface , , i am not able to find the UDF in another namespace for my new interface please help me
    thanking you
    Sridhar

    Hi...
         You can use Function Library if you are using PI7.1 server. You can write the UDF in the function library and you can use the same function library in different namespaces in mapping.
    Check the below link.
    /people/william.li/blog/2008/01/02/sap-pi-71-mapping-enhancements-series-share-user-defined-functions
    Regards,
    Leela

  • UDF needed for Strin Concatenation.

    Dear Friends,
    I am new to XI The requirement is like.
    "In order to map field E1EDL20-VBELN, Concatenate field CH_VBELN with 00 in the left side.
    For example if we have in the file ""80008000"" as a value of field CH_VBELN then the field E1EDL20-VBELN will be mapped with 0080008000.
    E1EDL20-VBELN = 0080008000"               

    Hi,
    Use Constant as 00 and use Concatanate function and mapp CH_VBELN and constant field to the target field E1EDL20-VBELN
    Ex:
    Constant(00)
    Cocatenate----
    E1EDL20-VBELN
    CH_VBELN
    Regards
    Seshagiri

  • Mapping conversion help needed for date

    Hi Experts,
    I need help in message mapping convesion for date field
    The source date field can have value '2010-06-04T02:09:59.610-07:00' or 2010-06-04T02:09:60.610-07:00
    I have to change it to '2010-06-04T02:09:59.000-07:00'. ie, if the seconds are 59.XXX, or 60.XXX, then change to 59.000.
    Please let me know the best way to do this
    Thanks
    Mike

    Again, to make it more clear
    The source date field can have any date value such as
      2010-06-04T02:09:59.610-07:00 -
    This needs to be changed to 2010-06-04T02:09:59.000-07:00
      2010-06-04T02:09:60.610-07:00 -- This needs to be changed to 2010-06-04T02:09:59.000-07:00
    2010-06-04T02:09:60.000-07:00 -- This needs to be changed to 2010-06-04T02:09:59.000-07:00
    2010-06-04T02:09:59.000-07:00  - This need not be changed
    2010-06-04T02:09:58.610-07:00 -- This need not be changed
    2010-06-04T02:09:57.610-07:00  etc etc - These need not be changed.
    The only change using date function is for the first two dates, in which 59.XXX and 60.XXX need to be replaced with  59.000
    Using the above date function, all the seconds 59.XXX, 58.XXX, 60.XXX, etc etc,,, are converted to 59.000, 58.000 and 60.000
    I dont need this as per the requirement. So looks like the UDF needs to be altered a little to accomodate my requirement.
    Please help me.
    Thanks
    Mike

  • Message Mapping error in UDF

    I am receiving errors when trying to activate my MM.  I believe the issues are in one of two UDF's.  These UDF's do work in another MM without error.  Below are the error's and UDF's.
    ERRORS:
    Activation of the change list canceled Check result for Message Mapping MM_WPDBBY_WPDBBY01_TO_POS_WAWAFILE | http://wawa.com/xi/erp/pos:  Starting compilation  Source code has syntax error:  /usr/sap/XID/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map5420e070cabe11dcab4b00306ef38da9/source/com/sap/xi/tf/_MM_WPDBBY_WPDBBY01_TO_POS_WAWAFILE_.java:3291: cannot resolve symbol symbol : variable container location: class com.sap.xi.tf._MM_WPDBBY_WPDBBY01_TO_POS_WAWAFILE_ map = container.getTransformationParameters(); ^ /usr/sap/XID/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map5420e070cabe11dcab4b00306ef38da9/source/com/sap/xi/tf/_MM_WPDBBY_WPDBBY01_TO_POS_WAWAFILE_.java:3293: cannot return a value from method whose result type is void return constant; ^ 2 errors
    UDF's:
    public String getSender(Container container){
    String constant;
    java.util.Map map;
    // get constant map
    map = container.getTransformationParameters();
    constant = (String) map.get (StreamTransformationConstants.SENDER_SERVICE);
    return constant;
    IMPORTS:  com.sap.xi.mapping.parse.dom.;javax.xml.parsers.;java.io.;com.sap.aii.mapping.lookup.;org.w3c.dom.*;
    public String getSeqNum(String fileType,String objNum,String Sender,Container container){
    String request = "<ns0:ZRFC_NUMBER_GET_NEXT xmlns:ns0=\"urn:sap-com:document:sap:rfc:functions\"><NR_RANGE_NR>" + fileType + "</NR_RANGE_NR><OBJECT>" + objNum + "</OBJECT><QUANTITY/></ns0:ZRFC_NUMBER_GET_NEXT>";
    InputStream isRequest = new ByteArrayInputStream(request.getBytes());
    SystemAccessor accessor = null;
    String num  = null;
    try{
         // 1. Determine a channel.
         Channel channel = LookupService.getChannel(Sender, "R_RFC_ERP");
         // 2. Get a system accessor for the channel.
         accessor = LookupService.getSystemAccessor(channel);
         // 3. Create a payload according to the data type which the adapter expects.
         //    Use service.getBinaryPayload() for binary payload,
         //    and service.getTextPayload() for text payloads.
         Payload payload = LookupService.getXmlPayload(isRequest);
         // 4. Execute lookup.
         Payload response = accessor.call(payload);
         //Parse response
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         DocumentBuilder builder = factory.newDocumentBuilder();
         InputStream resStream = response.getContent();
         Document doc = builder.parse(resStream);
         Element sequence = doc.getDocumentElement();
         NodeList number = sequence.getElementsByTagName("NUMBER");
         //Extract Number
         num = DOMUtil.getSimpleElementText((Element) number.item(0));
    } catch (Exception e) {
         return e.getMessage();
    } finally {
         try {
              if (accessor != null) accessor.close();
         } catch (Exception e) {
              return e.getMessage();
    GlobalContainer gc = container.getGlobalContainer();
    gc.setParameter("Num", num);
    return num;
    Any help is appreciated.
    Regards,
    Darrell

    Fauver,
    Just to narrow down the problem first remove the first udf and only use the 2nd user defined function. Also in the 2nd udf you have to change this line:
    try{
    // 1. Determine a channel.
    Channel channel = LookupService.getChannel(Sender, "R_RFC_ERP");
    In the above line instead of Sender you use the business service or business system where R_RFC_ERP RFC communication channel is created in Integration Directory. So you are hardcoding it first.
    Once you have done this changes do save and test it once again. If this works then you can change back to original and your first udf needs to be checked.
    Regards,
    ---Satish

  • Batch Updating a UDF based on user input.

    I have been asked to come up with a way to update several PO's with a update.
    We have several PO that come in on 1 container, the Container NO (UDF) is updated per PO
    Then several weeks later the Rev. Delivery Date (UDF) needs updated.
    Is there a way to update all PO's with the same container no with the new date.
    Example:
    UPDATE OPOR
    SET OPOR.U_RevDelivery = '[%0]'
    WHERE U_ContRefNo = '[%1]'
    Both the Delivery date needs to be user input and the Container No needs to be input by the user.
    Thanks,
    Craig S.

    Hi,
    Update is not not allowed you may taking a risk of losing SAP Support.
    What you can do is to query then manually edit the result of the query
    by clicking each DocNum and update U_RevDelivery manually.
    This is the safest thing to do or you can try this using SDK.
    The query:
    Select T0.DocNum, T0.U_RevDelivery FROM OPOR T0
    WHERE U_ContRefNo = '%0'
    Thanks.
    Clint

  • OIM 11g: UDF disappears from User Attributes page

    Hi,
    I was modifying a user defined attribute using the 11.1.1.3 User Attributes configuration page. All I did was change its category to move it to another section of the user profile page. The last remaining field in the category 'disappeared'. It just went from the list of fields in the category. The field still exists on the USR object and still contains all the values. But it's gone from the UI.
    I exported the /file/User.xml from MDS and sure enough the missing attribute is not present in the User.xml file. It is there for the mapping to the back end column, and in another element. But the element that describes the field proper is not there. I've since added the attribute element back in manually and re-imported the metadata using the weblogic environment manager, but the field still does not appear.
    So, my question is does anybody know where else OIM stores the attribute details? Is it in the DB somewhere and merely mirrored in the MDS? What do I need to do to restore the field? (I can't add it in because it says it already exists.)
    Thanks

    PeachEye,
    I was unable to see the UDF's I had created on the user form until I set up a policy for them. Please check the policy around the UDF's.
    I am hoping this can help you.
    From Oracle documentation:
    User's Guide for Oracle Identity Manager
    11g Release 1 (11.1.1)
    E14316-03
    User-defined fields (UDFs) can be added by creating a policy and
    adding attributes in the self service user management
    administration policy in Oracle Identity Administration. To add
    the User defined attributes for view or modification under the
    Attributes tab, these UDFs need to be added to the modify user
    data set for self-service. Also, a custom policy needs to be created
    under self service user management to grant permission to view
    and/or modify these attributes.
    For details on authorization policies, refer "Creating and Managing
    Authorization Policies" on page 15-2.

  • Total calculation based on unit price and UDF field values

    Hi All,
    This is for a construction related company. Please find attached screen shot for details.
    My scenario is when we are creating sales order my client wants to calculate the total amount based on unit price towards the UDF fields defined. For example user will give the unit price  per sqft in Unit price ie 2800 as per screen shot column and constructed area in Sqft in he will enter the area like cons area in sqft =1500. So this 1500 need to calculate with unit price and will display in total. So in Total field it should show like 2800*1500= result. Like wise other amount values in udf needs to be calculated and displayed in total field  .
    Is this possible in SAP B1. Please help me with your valuable suggestions.

    Hi,
    Try this:
    SELECT ($[$38.U_Price.number]* $[ORDR.U_CArea.number)+ $[ORDR.U_EBexp.number]+ $[ORDR.U_RO.number]+ $[ORDR.U_Maintenance.number]+ $[ORDR.U_CorpFund.number]
    Thanks & Regards,
    Nagarajan

  • Correlation using file name

    Hi all
    i have a scenario where I have to place a file at target with a particular file name, say, my_name_is_itisha.txt .After the target processes the file,it places an acknowledgement file with the name my_name_is_itisha_txt.ack.
    In short, the ack file will replace the '.' with '_' and append '.ack' to the file placed by me at the target.
    I know that we can correlate 2 files with similar fields but how to correlate 2 files with the same name ?
    Please suggest a solution.
    Edited by: itisha alok on Apr 28, 2009 1:39 PM
    Edited by: itisha alok on Apr 28, 2009 1:40 PM
    Edited by: itisha alok on Apr 28, 2009 1:40 PM

    Hi,
    Sorry for the late response....
    can you please tell me how to get the filename in the mapping?
    This is achieved by writing a UDF in the corresponding Message Maping.....this udf will do the function of extracting the filename during runtime....the UDF is already provided by Srini....even you can search SDN for Dynamic FileName and you will get lot many threads....you need to use Adapter Specific Message Attributes (ASMA) for this purpose.
    The UDF need not have any arguments/ parameters.....as it does not need any input from any of the Source nodes.....it will extract the information (filename) from the message header....
    For more info: http://help.sap.com/saphelp_nw70/helpdata/EN/43/03612cdecc6e76e10000000a422035/frameset.htm
    Regards,
    Abhishek.

  • Query to combine document series name and number

    Hi all,
    Example of Sales Quotation document numbering as following:
    Document series name: SQ10
    Document number: 1001
    Can I have a query to combine the series name and number as one field, e.g. SQ101001?
    This is for the purpose of if there is revision in a sales quotation, new quotation will be raise and UDF need to display previous sales quotation no.
    Thanks in advance!
    Phoebe

    Hi,
    Thanks for your help.
    Got the query as following:
    select T1.SeriesName + cast(T0.docnum as CHAR(15)) AS 'SQ No.', T1.[SeriesName],T0.[DocNum], T1.BeginStr AS 'Prefix', T0.[CardCode], T0.[CardName]
    from OQUT T0, NNM1 T1
    where T1.ObjectCode = 23 and T1.Series = T0.Series

  • Need Help in writing a UDF

    Hi,
    Please help in writing a UDF for these fields in mapping, which I need for the object Iu2019m doing currently.
    The fields are like this:
    1)         batch_no = "TRUNC((GetMaxObjid('x_txn_sap_parts')-POWER(2,28))/5000)+1",
    2)         lot_id = "TRUNC((GetMaxObjid('x_txn_sap_parts')-POWER(2,28))/500)+1",
    3)        How to use JDBC connection factory class in the UDF.
    Some logic I can provide which I know i.e. Power (2, 28) means 2 to the power of 28 (2 multiplied 28 times), Trunc means truncate, X_TXN_SAP_Parts is a database table.The Target fields are Batch_no, lot_id & Objid.Actually, objid is mapped initially to a source field i.e. Object ID and in this function it is only being used for the calculation of the batch_no.
    Thanks in Advance,
    Sreedhar.

    Hi,
    Following with my query I've tried to use this code but still I'm unable to execute the mapping.
    import java.util.*;
    import com.sap.aii.mapping.lookup.*;
    import com.sap.aii.mapping.lookup.*;
    DataBaseAccessor accessor = null;
    DataBaseResult JDBCOutPayload = null;
    String BusinessSystem="clarify_dev_bizsys";
    //give your business system having channel name
    String CommunicationChannel="JDBC_TO_CDEV";
    //give your channel name
    String InputPayload= " select X_TXN_PRE_SITE_XFACE.nextval from dual;";
    //give your sql query
    try {
    Channel channel =
    LookupService.getChannel(BusinessSystem,CommunicationChannel);
    accessor = LookupService.getDataBaseAccessor(channel);     
    DataBaseResult resultSet = accessor.execute(InputPayload);
         for(Iterator rows = resultSet.getRows();rows.hasNext();){  
         Map rowMap = (Map)rows.next();
         Object cValue = rowMap.get("batchno");
    //field name of field required , as in database
          catch (Exception e) {}
          finally {
                  if (accessor != null)
                  accessor.close();
           result.addValue((String)cValue);
    --> I don't know what are the parameters to be used and how to be used in the UDF because this is the first time I'm writing a UDF.
    --> The problem in using this query is that both OBJID & BatchNo. are on the target side and the value for the OBJID is retrieved by a SELECT query from the database.
    Kindly help me how to resolve this query of mine.
    Thanks in Advance.
    Sreedhar.

  • Same filename from a sender to receiver :: DO we really need UDF ?

    Hi
    This is in refrence of Weblog " <i>same filename from a sender to a receiver file adapter "</i> by <i>Michal Krawczyk</i>.
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    Actually I worked on another weblog by " <i>Shabarish Vijayakumar</i> "-->
    /people/shabarish.vijayakumar/blog/2006/04/03/xi-in-the-role-of-a-ftp
    And I am getting file created on the receiver side with the same file name as on the sender side without using the user-defined function mentioned in Michal's weblog.
    Now my question do we really need UDF for same file name when on the sender we are polling for one file only by its name.
    I am not exaclty getting the benefit of this feature. Can you tell me why do we need this feature as in whatever scenarios I worked I mentioned the file names in both Sender & Receiver File Adapters.
    So I am not getting what is the use of using this UDF, when we mention the name of file needs to be created on Receiver side.
    - Lalit Chaudhary -

    Hi
    I put this code for UDF -->
    <i>String valueNew;
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String valueOld = conf.get(key);
    if (valueOld != null)
        valueNew = valueOld.replaceAll("input123",name);
        conf.put(key, valueNew);
    return valueNew;</i>
    Signature of UDF is this :: <u>public String GetFileName(String name,Container container)</u>
    But when I am testing this UDF, I am getting following RunTime exception -->
    <i>Runtime exception during processing target field mapping /ns0:FileFTP_InOut_MT/File_nm. The message is: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._FileFTP_MsgMapping_UDF_ method GetFileName$[lalit, com.sap.aii.mappingtool.tf3.rt.Context@735df3b0] com.sap.aii.mappingtool.tf3.MessageMappingException: Runtime exception during processing target field mapping /ns0:FileFTP_InOut_MT/File_nm. The message is: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._FileFTP_MsgMapping_UDF_ method GetFileName$[lalit, com.sap.aii.mappingtool.tf3.rt.Context@735df3b0]</i>
    I am not much of Java Guy, can you pls. suggest what am I doing wrong, I copied this code from <a href="http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/content.htm">SAP Help</a>
    - Lalit -

  • Need help with mapping( UDF)

    Hi,
      I had a mapping requirement where i need to transfer data with double quotes
          suppose data is
    sap-labs
    i need to send as "sap-labs".
    The main problem is when ever there is '-'(it can be any where in the string) I need to modify as above, otherwise data can be sent directly.
    I know how to do this requirement using Standard Functions.But, I am trying to use UDF so try to help me out with the code.
    and also what i have to import for this UDF. and why i have to import them?
    Thanks in advance,
    Siva.

    Hi Siva Bonthala,
    Note: - quote ("), apostrophe ('), ampersand (&), less than (<), greater than (>) are special characters in XML. They should not be present in data. [Link1|http://www.w3.org/TR/REC-xml/] [Link2|Re: Special Character Handling (&) in the payload content in PI 7.1]
    When you writing Java code to insert these special characters, you should use escape scequence characters.
    Test it for your self, in graphical mapping, use 'concat' function and type Delimiter String as ". Then check output XML, it will contain &quot ;.
    If you have to replace sap-labs with "sap-labs" for many element, I recomand you to use Java Mapping instead of UDF's for every field.
    Regards,
    Raghu_Vamsee

  • Need help in UDF

    Hello Gurus,
    Could you please help me if v need any UDF for splitting or can i do it with graphical mapping.
    Below is the source structure
    <header>id123</header>  
    <item>item123</item>         
    <data>abd1232011
    ^^efg4562011
    ^^hij7892012</data>
    Required target structure
    <header>id123</header>       1:1
    <item>item123</item>             1:1
    <content>                               1:1          
    <data>                                    1:unbounded
        <char>abd</char>
        <num>123</num>
        <date>2011</date>
    </data>
    my requirement is to break the 1 source field "data" into  3 target fields "char","num","date". Field data is of type string and received as a raw string. The new line is determined by "^^" in the string. fields are separated by "~"
    Kindly help
    Thanks in advance.

    which version of PI u r working on??
    In case ur version is PI7.1 (or greater) then chk this code:
    UDF1:
    Input will be: var1 of type argument
    and add 3 result type with name result1, result2, result3
    Execution type: all values of a context
    String [] temp = var1[0].split("^^");
    for(int i=0;i<temp.length;i++)
    String [] split1 = temp<i>.split("~");
    result1.addValue(split1[0]);
    result2.addValue(split1[1]);
    result3.addValue(split1[2]);
    result1.addContextChange();
    result2.addContextChange();
    result3.addContextChange();
    UDF2:
    String [] temp = var1[0].split("^^");
    for(int i=0;i<temp.length;i++)
    result.addValue("");
    mapping:
    Input----UDF2---data
                           -----char
    Input----UDF1 -------num
                        -------date

Maybe you are looking for

  • Error auto-firing an approval workflow inside a project's workspace

    Hi all, I have activated the SS2010 Workflow in PWA site collection features in order to use an approval workflow in one of my project's workspace. I setup the workflow under "Project Documents" and select to auto-start upon an item's creation. Howev

  • Portal Activirty Reporting and logs tracing for user activities

    We operate under a WAS JAVA 6.40 SP19 environment portal... Can the portal generate reports base on users activities … can the portal report on users’ login attempts with any of the followings: Login attempts by numbers of tries Login attempts by dat

  • Adding new field in MCSI

    Hi All, I want to add new <b>Sales Office</b> in <b>T.Code : MCSI</b>...... Can anybody help me how its possible???? Is It possible by using User exit or BADI....... Regards, <b>Anil Kumar</b>

  • When we talk about healthy

    When we talk about healthy fats those is a faster all structure and this engine or are they are just benign meeting their sources calories and don't cause hormonal chaos and atoll change our body's ability to responsive more calories in more calories

  • File not being written!! really weird! help!!

    Hello everyone. My problem is very strange.     private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {         fc.setFileFilter(new MLPfilter());         // my own custom file filter         int returnVal = fc.showSaveDialog(this);