How to use standard java functions in a XSLT mapping

Hi All,
I wish to use a standard java function in a XSLT mapping, The issue is either i am giving incorrect namespace which is used to invoke the function or the signature of the function call is incorrect, I have read all the links in http://help.sap.com, and i know <b> one can enhance a XSLT mapping by writing one's own java code and thereby using java standard functions </b>, but the requirement is such that i need to try and use java standard function in XSLT mapping itself.
Please refer to the sample code below:
<?xml version="1.0" encoding="UTF-8"?>
  <xsl:stylesheet version="1.0"  
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:javamap="java:java.lang.String">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:variable name="input" select="Title">
<xsl:if test="function-available('javamap:toUpperCase')">
<xsl:value-of select="javamap:toUpperCase($input)"/>
</xsl:if>
Author:<xsl:value-of select="Author"/>
</xsl:template>
</xsl:stylesheet>
error encountered is: Illegal number or type of arguments.
please reply if you have tried a similar scenario in SAP XI.
Thanks & Regards,
Varun

Hi Varun,
    First of all i want to tell you that as per the documentation you can only call the static function inside xslt mapping. Your toUpperCase method is a non static function.
What i am getting is that you have an element called Author and you want to convert its value into uppercase.
you can write your own user defined function which is static.
Signature of your java method :
public static string toUpperCase(String Author,Map inputparam)
try this xslt map.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:javamap="java:JavaProgram">
     <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
     <xsl:param name="Author">
             <xsl:value-of select="//Author_name"/>
     </xsl:param>
     <xsl:param name="inputparam" />
     <xsl:template match="/">
     <Author>
             <xsl:if test="function-available('javamap:toUpperCase')">
              <xsl:value-of select="javamap:toUpperCase($Author,$inputparam)"/>
             </xsl:if>
     </Author>
     </xsl:template>
</xsl:stylesheet>
Hope this will work.
Thanks and Regards
Vishal Kumar

Similar Messages

  • How to use  Advance java function in graphical mapping in XI 2.0?

    Hi,
    currently I am using a simple java function to make an RFC call to R3 system.
    I want to avoid making connection for each lookup. Instead I want to make a single connection for whole message queue and get the corresponding values in some array or container object.
    please suggest a solution.
    I think this is possible using Advance java function, but I am not able to find any example on using Advance java function at help.sap.com.
    thaks in advance.

    Hi!!!
    I'm not sure if I understood you well.
    Do you want to preload some data into your structures in the memory and keep them there so you don't need to make a new connection during processing the whole message or every message?
    In my opinion you can cache some data during processing a message, but it's impossible to cache some data between processing messages.
    If you write your java mapping or you use graphical mapping (even with user-defined function), then you have a java class. The problem is that XI 2.0 reloads this class during processing every message, so even if you load some data from your data source into your structures in the memory, this data will be lost after reloading your mapping class.
    Regards,
    Andrzej Filusz

  • How to use xsl document() function with LiveCycle XSLT processor

    Hello,
    I would like to use LiveCycle XSLT processor to merge xml documents by using the xsl document() function.
    However, I have not, yet, found  clear reference information on the specifics of how to accomplish in LC. For instance if you have
    a transformation that does merging using a standalone xml editor (such as Oxygen), than what is required to accomplish the same
    using the LiveCycle XSLT service.  How do you specify the URI of the XML document that is specified as an input in the xsl document() function. Your insight is appreciated.   Regards

    Hello Steve,
    I checked the reference that you cited (XSLT Transformation).   The reference omits discussing how to use xlst document() function within a stylesheet.  I think that probably means that feature of xslt technology is not directly available through LiveCycle.  When I find a workaround, I'll post an update...for the user community that might encounter the same issue.  Thank you for your response and insight.  Regards, jb1809

  • How to use standard Java file in custom module

    Hi All,        
    I want to use some CatalogItemImpl.java file in my custom DC but i was unable to find any entry in the standard component in businessobject.xml file as <businessObject name="XYZ" className="x"/>. Can anyone let me know how can we use the file file in my custom DC.
    Please provide your inputs......
    Regards,
    Rahul.

    Hi Rahul,
    You will not find the "CatalogItemImpl" in the 'businessobject.xml'. The 'businessobject.xml' is there to define session based API of modules. Those API have properties and web channel builder values injected when the user start a web session.
    For the "CatalogItem", you will have to use the Generic Factory concept. The Generic Factory is used to allocate instance given a configuration. If no configuration exists, the default implementation is used. By adding an entry in the Generic Factory you can choose to allocate your class instead of the default class.
    Within the catalog module, the alias to use for classes extending "CatalogItemImpl" is "com.sap.wec.app.common.module.catalog.businessobject.ext.interf.CatalogItemExtInterf".
    Please refer to the extension guide on how to manage the Generic Factory configuration file.
    Regards,
    Robin

  • How can I use Seeburger java functions on SAP XI's user defined functions?

    Hi All,
    As my title implies; how can I use Seeburger java functions on SAP XI's user defined functions?  I've tried searching over the net in tutorials regarding this topic but I failed to find one; can someone provide me information regarding my question? thanks very much.
    best regards,
    Mike

    Hi Mike !
    You should check your documentation about which java classes you need to reference in the "import" section of your UDF. And also deploy the java classes into the java stack or include them as a imported archive in integration repository...it should be stated in the seeburger documentation.
    What kind of functions are you trying to use?
    Regards,
    Matias.

  • How to use standard function keys as custom keys

    how to use standard function keys as custom keys.
    i have encountered that problem while developing a screen, there i'm supposed to use standard function key F2 ( which actually meant for choose) for clearing the screen fields where the cursor is present and f1 for saving data that entered in screen fields, etc...
    kindly help me out.

    Hi ,
    Solution to use SAP reserve function keys F1 .. F4 (mostly this requirement comes up for RF screens) can be acheived by assigning your new Function code using the Menu path Utilities --> F key Consistency in the Menu Painter (SE41) . Once you assign your cutom function code to the standard Fn keys the only remaining step is to make sure that you set a curson on any of the field on sceen by using the Key Word "SET CURSOR" .
    If you dont use the key word SET CURSOR in the PBO of the screen then you might not see any response for F4.
    Thanks

  • How to Use the JAVA SCRIPT code in .htm page of the component

    Hi .
    In my requirement i have to use Java Script Function in .htm code ..how to use the java script code and functions in .htm???
    thank you
    B.Mani

    Check this document  [Arun's Blog|http://wiki.sdn.sap.com/wiki/display/CRM/CRMWebClientUI-TalkingwithJava+Script]
    Regards
    Kavindra

  • How to use the CMS functionality in Sun Portal Server 7.2

    Hi All,
    How to use the CMS functionality using the ccd.war(Portlet) which is available in the library as i could add it to my channel but not able to show the functionality as it is showing the error msg "You are currently not logged in. Please login." should I create userid and there respective roles inorder to use the CMS functionality.
    Has any one used this as I could this in glass fish server.
    Any Input is appreciated.
    Thanks & regards
    Srikanth

    Have a look at the "*Roles*" section of the portal server 7.2 content management system guide
    http://docs.sun.com/source/820-4275/index.html . You can also look at [project mirage|https://mirage.dev.java.net] for some screencasts
    Alternatively,
    1. ccd.war has 3 portlets in it:
    (a) custom content definition portlet
    (b) custom content portlet
    (c) workflow portlet
    2. Inorder to work with these portlets, user needs to be in anyone of the below roles:
    (a)Consumer (b) Editor (c) Approver (d) Administrator (e) Submitter (f) Contributor (g) Publisher
    3. By default ccd.war gets deployed using a default roles file (/var/opt/SUNWportal/tmp/ccd.roles.properties)
    Note: In windows, you may not find this file
    4. Access the portlets as a user in any of the role mentioned in the ccd.roles.properties
    (OR)
    you can use a new roles file which has mapping to your custom roles. For this , undeploy existing ccd.war and deploy again with a new roles.properties file
    Hope this helps!

  • How to use Standard Text in ALV

    How to use Standard Text in ALV header part? Can you please help me by giving the answer?

    Hi ,
           You can read the Standard text using read_text function module and then print in LV header part.

  • How to use standard Smart forms

    hi All,
    Pls give me the detail for smartform ie how to use standard smart forms and how to modify them in SAP 4.7EE
    Thanks,
    Nitin

    Hi,
    first u copy the standrad smartform to z and then modify it,
    SOME STANDARD SMARTFORMS
    SF_EXAMPLE_01,
    SF_EXAMPLE_02,
    SF_EXAMPLE_03,
    LB_BILL_INVOICE,
    ENETR SMARTFORMS TCODE
    PRESS F4 HERE U FIND ALL STANDARD SMARTFORMS
    OR
    U GO TO TRANSACTION CODE NACE
    SAMPLE PROGRAM FOR SMARTFORM,
    . Create a new smartforms
    Transaction code SMARTFORMS
    Create new smartforms call ZSMART
    2. Define looping process for internal table
              Pages and windows
          First Page -> Header Window (Cursor at First Page then click Edit -> Node -> Create)
          Here, you can specify your title and page numbering
          &SFSY-PAGE& (Page 1) of &SFSY-FORMPAGES(Z4.0)& (Total Page)
          Main windows -> TABLE -> DATA
          In the Loop section, tick Internal table and fill in
          ITAB1 (table in ABAP SMARTFORM calling function) INTO ITAB2
    3. Define table in smartforms
               Global settings :
               Form interface
               Variable name    Type assignment   Reference type
               ITAB1               TYPE                  Table Structure
               Global definitions
               Variable name    Type assignment   Reference type
               ITAB2               TYPE                  Table Structure
    4. To display the data in the form
        Make used of the Table Painter and declare the Line Type in Tabstrips Table
         e.g.  HD_GEN for printing header details,
                 IT_GEN  for printing data details.
         You have to specify the Line Type in your Text elements in the Tabstrips Output options.
          Tick the New Line and specify the Line Type for outputting the data.
          Declare your output fields in Text elements
          Tabstrips - Output Options
          For different fonts use this Style : IDWTCERTSTYLE
          For Quantity or Amout you can used this variable &GS_ITAB-AMOUNT(12.2)&
    5. Calling SMARTFORMS from your ABAP program
    REPORT ZSMARTFORM.
    Calling SMARTFORMS from your ABAP program.
    Collecting all the table data in your program, and pass once to SMARTFORMS
    SMARTFORMS
    Declare your table type in :-
    Global Settings -> Form Interface
    Global Definintions -> Global Data
    Main Window -> Table -> DATA
    Written by :  SAP Hints and Tips on Configuration and ABAP/4 Programming
                        http://sapr3.tripod.com
    TABLES: MKPF.
    DATA: FM_NAME TYPE RS38L_FNAM.
    DATA: BEGIN OF INT_MKPF OCCURS 0.
            INCLUDE STRUCTURE MKPF.
    DATA: END OF INT_MKPF.
    SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
    SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
       MOVE-CORRESPONDING MKPF TO INT_MKPF.
       APPEND INT_MKPF.
    ENDSELECT.
    At the end of your program.
    Passing data to SMARTFORMS
    call function 'SSF_FUNCTION_MODULE_NAME'
      exporting
        formname                 = 'ZSMARTFORM'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
      IMPORTING
        FM_NAME                  = FM_NAME
      EXCEPTIONS
        NO_FORM                  = 1
        NO_FUNCTION_MODULE       = 2
        OTHERS                   = 3.
    if sy-subrc <> 0.
       WRITE: / 'ERROR 1'.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    call function FM_NAME
    EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
      CONTROL_PARAMETERS         =
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
      OUTPUT_OPTIONS             =
      USER_SETTINGS              = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
      JOB_OUTPUT_INFO            =
      JOB_OUTPUT_OPTIONS         =
      TABLES
        GS_MKPF                    = INT_MKPF
      EXCEPTIONS
        FORMATTING_ERROR           = 1
        INTERNAL_ERROR             = 2
        SEND_ERROR                 = 3
        USER_CANCELED              = 4
        OTHERS                     = 5.
    if sy-subrc <> 0.
       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    Thanks&Regards,
    Phani
    POINTS HELPFUL

  • How to use Copy-Value function?

    Dear Friends,
    I have query on how to use Standard function Copy-Value.
    Please have a look @ the help.sap.com example use of Copy-Value function.
    http://help.sap.com/saphelp_nw70/helpdata/en/26/d22366565be0449d7b3cc26b1bab10/content.htm
    I have designed the same example. Please see the mapping I've defined for this example :
    http://www.flickr.com/photo_zoom.gne?id=930440086&size=o
    Please see the resuts, its working perfectly. See the top image :
    http://www.flickr.com/photo_zoom.gne?id=930440300&size=o
    Ok, now lets come to the issue. Please consider the same example , If I have more than one partner
    and I want to use the address field to the customer street,city & zipcode using copy-value function, how will I achieve this?
    Please see the resuts.See the bottom image :
    http://www.flickr.com/photo_zoom.gne?id=930440300&size=o
    I think you all got the issue, if not please reply back.
    Looking for your answers!!!
    Best regards,
    raj.

    The CopyValue function considers only values in the first context of the queue.
    When the queue has more contexts, the other contexts are ignored.
    In online help, the element addrDat is 3 times under name, that means 3 values are in the first context.
    That means: For the first occurrence of the partner it is correct, for all other partners, the values of the first context is taken. The online help does not express this,  so it is misleading and should be changed to an example where address is not beyond a node with occurrence inbounded.
    In practical cases the copyValue can only be used for values that appear in source just one time, like the IDOC header fields, as it works like a constant.
    Regards
    Stefan

  • How to use a C function as a native method

    Could anybody tell me how to use a C function as a Java native method.
    Thanks

    Read all about it.
    You'd probably have to write a little wrapper (using JNI) that passes
    parameters and return values around between your C function and
    the JVM.
    kind regards,
    Jos

  • How to use case when function to calculate time ?

    Dear All,
    May i know how to use case when function to calculate the time ?
    for the example , if the First_EP_scan_time is 12.30,  then must minus 30 min.  
    CASE WHEN FIRSTSCAN.EP_SHIFT <> 'R1' AND FIRSTSCAN.EP_SHIFT <> 'R2'
    THEN ROUND(CAST((DATEDIFF(MINUTE,CAST(STUFF(STUFF((CASE WHEN SHIFTCAL.EP_SHIFT = 'N1'
    THEN CONVERT(VARCHAR(8),DATEADD(DAY,+1,LEFT(FIRSTSCAN.EP_SCAN_DATE ,8)),112) + ' ' + REPLACE(CONVERT(VARCHAR(8),DATEADD(HOUR,+0,SHIFTDESC.EP_SHIFT_TIMETO + ':00'),108),':','')
    ELSE LEFT(FIRSTSCAN.EP_SCAN_DATE ,8) + ' ' + REPLACE(CONVERT(VARCHAR(8),DATEADD(HOUR,+0,SHIFTDESC.EP_SHIFT_TIMETO + ':00'),108),':','') END),12,0,':'),15,0,':') AS DATETIME),CAST(STUFF(STUFF(LASTSCAN.EP_SCAN_DATE,12,0,':'),15,0,':') AS DATETIME)) / 60.0 - 0.25) AS FLOAT),2)
    ELSE ROUND(CAST((DATEDIFF(MINUTE,CAST(STUFF(STUFF(FIRSTSCAN.EP_SCAN_DATE,12,0,':'),15,0,':') AS DATETIME),CAST(STUFF(STUFF(LASTSCAN.EP_SCAN_DATE,12,0,':'),15,0,':') AS DATETIME)) / 60.0) AS FLOAT),2) END AS OTWORK_HOUR

    Do not use computations in a declarative language.  This is SQL and not COBOL.
    Use a table of time slots set to one more decimal second of precision than your data. You can now use temporal math to add it to a DATE to TIME(1) get a full DATETIME2(0). Here is the basic skeleton. 
    CREATE TABLE Timeslots
    (slot_start_time TIME(1) NOT NULL PRIMARY KEY,
     slot_end_time TIME(1) NOT NULL,
     CHECK (start_time < end_time));
    INSERT INTO Timeslots  --15 min intervals 
    VALUES ('00:00:00.0', '00:14:59.9'),
    ('00:15:00.0', '00:29:59.9'),
    ('00:30:00.0', '00:44:59.9'),
    ('00:45:00.0', '01:00:59.9'), 
    ('23:45:00.0', '23:59:59.9'); 
    Here is the basic query for rounding down to a time slot. 
    SELECT CAST (@in_timestamp AS DATE), T.start_time
      FROM Timeslots AS T
     WHERE CAST (@in_timestamp AS TIME)
           BETWEEN T.slot_start_time 
               AND T.slot_end_time;
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Using standard node functions

    Hi all, i am newbie
    i want to knwo how can i convert following source message to target message
    using standard node functions?
    Source Message
    <devices>
        <device>
            <sn>123</sn>
            <city>Berlin</city>
        </device>
        <device>
            <sn>345</sn>
            <city>Berlin</city>
        </device>
        <device>
            <sn>777</sn>
            <city>Bonn</city>
        </device>
    </devices
    Target Message
    <cities>
        <city>
            <name>Berlin</name>
            <devices>
                <sn>123</sn>
                <sn>345</sn>
            </devices>
        </city>
        <city>
            <name>Bonn</name>
            <devices>
                <sn>777</sn>
            </devices>
        </city>
    </cities>

    Hi,
    Since you are newbie i would suggest follow the stefan's blog. use formatbyexample for your requirement.
    New functions in the Graphical Mapping Tool XI ... | SCN
    Please read the comments also you will get more idea
    Regards,
    Muniyappan.

  • Does anyone know how to use the bcc functionality for apple mail while accessing it on the cloud from my PC?

    I am currently away from my MAC and want to send an email through apple mail with the bcc functionality.  I am using the cloud to get to my mail, however, I can't figure out how to use the BCC functionality, please help.  Thanks!

    Open your mail,
    lower left corner click on settings,
    go to composing and check BCC, save and your done

Maybe you are looking for

  • What is the best practice in this case?

    I want to create a vending machine simulation program. The design will be something like this : GUI----use----VendingMachine----has----ProductStorage Previously, i want everything inside VendingMachine will be transparent from the GUI. The GUI just u

  • Simple Question about a web service

    Hi, I have been playing with Java and the graphics api to build some multitouch desktop apps, but now I have a new project but don't even know where to begin. What would be the best way to create a very simple webpage with buttons that when clicked w

  • How can I delete an email on my phone but still keep it on my computer?

    When I delete an email on my phone, it also deletes on my computer. I would like to be able to delete only on my phone and not on my computer. How do I take emails off my phone but leave them on my computer? Thanks!

  • Berkeley DB High Availability  Work Error (VxWorks)

    VxWorks 5.4 ; Berkeley DB works at ha client mode, can not works. error information: -> DB ha: unlink: /tffs0/__db__db.tmp: errno = 0x380003 DB_EVENT_REP_CLIENTvalue = 0 = 0x0 -> DB ha: /tffs0/log.0000000002: log file unreadable: errno = 0x380003 DB

  • Q: Set time restriction for UPK assessments

    in knowledge Center there is way of setting a start and end date for an assessment, but we would like to restrict it by time as well. Is it possible to set time restriction for an assessment, say from starting the assessment the user have only 1 hour