XSLT code - If Condition

Hello,
Can someone help me to give an XSLT code for the following condition?
Source Message:
/Order/Ident/ReceiverID = 203
Condition:
If the value of Source ReceiverID is 203, then, make it to the value to 456.
I've tried this code, but seems to be many error validations.
<xsl:template match="/Order/Ident/ReceiverID">
      <xsl:choose>
        <xsl:when test="203">
          <xsl:attribute name="203">
               <xsl:value-of select="456"/>
            </xsl:attribute>
         </xsl:when>
        <xsl:otherwise>
          <xsl:attribute name="203">unknown</xsl:attribute>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:template>
Should you have helpful links, please let me know. I will greatly appreciate it.
Thanks in advance!
Gerberto

Gerberto,
Try this -
<xsl:choose>
     <xsl:when test="*[local-name()='ReceiverID']='203' ">
          <ns:YourField>
               <xsl:value-of select="456"/>
          </ns:YourField>
     </xsl:when>
     <xsl:otherwise>
          <ns:YourField>
               <xsl:value-of select="203"/>
          </ns:YourField>
     </xsl:otherwise>
</xsl:choose>
Let me know if this works for you.
Regards,
Neetesh

Similar Messages

  • Xslt code to replace a node name to include ns0 prefix

    Hi,
    Is there some easy xslt code to change the following: (I want the ns0 tag and namespace introduced in the root node so that my mapping works. I have created the mapping using externally provided wsdl, but the input message expects the prefix ns0 whereas the message coming to me from third party does not have the prefix. So in order to force it through the mapping I am thinking of using xslt to translate <createOrUpdateJobsResponse> to <ns0:createOrUpdateJobsResponse xmlns:ns0="http://service.webservice.xxxxxxxx.com"> and the closing tag </createOrUpdateJobsResponse> to </ns0:createOrUpdateJobsResponse>.
    Source:
    <?xml version="1.0" encoding="UTF-8"?>
    <createOrUpdateJobsResponse>
       <createOrUpdateJobsReturn>
          <errorCode/>
          <errorMessage/>
          <goodResult/>
          <jobReferenceNumber/>
       </createOrUpdateJobsReturn>
    </createOrUpdateJobsResponse>
    Target:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:createOrUpdateJobsResponse xmlns:ns0="http://service.webservice.xxxxxxxx.com">
       <createOrUpdateJobsReturn>
          <errorCode/>
          <errorMessage/>
          <goodResult/>
          <jobReferenceNumber/>
       </createOrUpdateJobsReturn>
    </ns0:createOrUpdateJobsResponse>

    Hi James,
    You could give a try with this :
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://service.webservice.xxxxxxxx.com" version="1.0">
         <xsl:output indent="yes" omit-xml-declaration="no"/>
         <xsl:template match="/">
              <ns0:createOrUpdateJobsResponse>
                   <xsl:apply-templates/>
              </ns0:createOrUpdateJobsResponse>
         </xsl:template>
         <xsl:template match="createOrUpdateJobsReturn">
              <xsl:copy-of select="."/>
         </xsl:template>
    </xsl:stylesheet>
    It should recreate the same msg structure with a ns0 namespace for the output document
    Rgds
    Chris

  • Validation in STO: For vendor code in condition detail

    Dear All,
    i kindly request you for  expert advice on this requirement.
    1. User is creating Stock transfer Order ( PO STO MM ). Plant to Plant transfer through MM route
    2. Here user is entering conditions for different expenses
    3. but sometimes user forget to enter vendor code in condition details
    so i want to set validation so user will get error message if he forget to enter vendor code in condition detail.
    Pl. guide me on this
    Thanks
    h shah

    Nothing std I'm aware of. Suggest speak to an ABAPer, they could probably create a Routine for the Condition Type in the Pricing Schema.
    Regards,
    Nick

  • Xslt code help needed

    Dear SAP experts,
    Would you be able to help me in configuring the right xslt code to accomodate the looping logic?
    Source Document:
    School  (occur only once)
    - Name (can occur multiple times)
          - Nickname (occur only once)
          - Desired name (occur only once)
    Target Document:
    School
    - Name
         - Nickname (the value for this should be obtained from 'Desired name field')
         - Desired name
    I have this code, but seems not working in looping logic. (to accomodate the multiple Names):
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" version="1.0" media-type="xml" encoding="UTF-8" indent="yes"/>
    <xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
    </xsl:template>
    <xsl:template match="Order/OrderDetail/ListOfItemDetail/ItemDetail/BaseItemDetail/ItemIdentifiers/PartNumbers/BuyerPartNumber">
      <BuyerPartNumber>
         <PartNum>
            <PartID>
                <xsl:value-of select ="/Order/OrderDetail/ListOfItemDetail/ItemDetail/BaseItemDetail/ItemIdentifiers/PartNumbers/ManufacturerPartNumber/PartID"/>
            </PartID>
        </PartNum>
    </BuyerPartNumber>
    </xsl:template>
    </xsl:stylesheet>
    What happened is that the value was taken ONLY on the 1st line item. (1st Name occurence)
    The succeeding Name field just copied the value of Nicknames from the 1st Name field.
    Kindly advise how to handle the context (loop logic) in the xslt code.
    Thanks!

    Apologies, but, it seems i did not indicate the complete message structure for the document I am testing.
    Order (root)
    OrderHeader (1st parent segment)
    OrderNumber (child fields - 1st)
    Order.. (child fields - 2nd)
    Order...(child fields - 2nd)
    OrderDetail (1st parent segment)
    <fields under this segment were already mentioned from previous threads>
    OrderSummary (1st parent segment)
    NumOfLines (child fields - 1st)
    TotalAmount (child fields - 1st)
    Under Order, there are also OrderHeader and OrderSummary parent segment, other than OrderDetail, in which we focus our code.
    I've tried your code, but, the segments OrderHeader and OrderSummary and child fields under it were not appearing on my output.
    But it seems, I've already generated the correct code.
    Here it is,
    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <xsl:output method="xml" version="1.0" media-type="xml" encoding="UTF-8" indent="yes"/>
         <xsl:template match="@*|node()">
              <xsl:copy>
                   <xsl:apply-templates select="@*|node()"/>
              </xsl:copy>
         <xsl:template match="/Order/OrderDetail/ListOfItemDetail/ItemDetail/BaseItemDetail/ItemIdentifiers/PartNumbers/BuyerPartNumber">
              <xsl:for-each select=".">
                   <BuyerPartNumber>
                        <PartNum>
                             <PartID>
                                  <xsl:value-of select="../ManufacturerPartNumber/PartID"/>
                             </PartID>
                        </PartNum>
                   </BuyerPartNumber>
              </xsl:for-each>
         </xsl:template>
    </xsl:stylesheet>
    I believe, the code you've suggested last time will accomodate only OrderDetail parent segment. Is this correct?
    Thanks!

  • XSLT Code not working

    Hi All,
    I am doing on XSLT Mapping. It is having a lookup. Lookup is working fine and I am getting data back in one variable say 'Var1'.
    Now in my mapping all the field are mapped one to one from source to target except one field say "lookup' and I am mapping responce of RFC 'Var1' variable to this node.
    My XSLT code is as follows:
    <TargetNode>
    <Field1><xsl:value of select="/Isourcenode/Field1"/></Field1>
    <Field2><xsl:value of select="/Isourcenode/Field2"/></Field2>
    <Lookup><xsl:value of select="$Var1"/></Lookup>
    <Field3><xsl:value of select="/Isourcenode/Field3"/></Field3>
    <Field4><xsl:value of select="/Isourcenode/Field4"/>/<Field4>
    </TargetNode>
    Now here I get value of Variable Var1 in Lookup field whereas all the fields after that node like Field3,Field4 are not getting mapped value.
    Do I need to do anything special to access the nodes values in xpath once i access variables using $    ?
    Thanks and Regards,
    Atul

    Hi,
    You can use CALL TRANSFORMATION <NAME> to meet your requirement
    For an example, refer:
    Re: help in Xml to abap
    Thanks,
    Aabhas

  • XSLT code required

    Hi Mates,
    I have requirement like
    need to check value endwith Y then add comment line and populate output field using XSLT mapping.
    Ex:
    Input :Source=KolkataY
    check Source is ends with Y
    then Add comment line and populate Source =Kolkata
    Please provide XSLT code  for this requiremet.
    Thanks
    JAYAN

    Why do you need XSLT code ? it can be acheived by simple graphical mapping standard functions
    if input endswith y then input concatenate with comment and pass to target
    regards
    Ninad

  • Diff. between Tax Code and Condition Types

    Hi,
    What is the diff. between Tax Code and Condition Type???
    Why we maintain Tax Codes under Invoice Tab in PO, when Condition Types are available for Calculation Procedure...???
    Please guide..

    hi..
    Tax code : Tax code in some what more specific for calculating the tax...some material is having 2% tax..some having 3 % tax..etc..and these are input tax...so..these tax code will be of type input tax..
    now..based on the nature of tax type amount will be calculated....
    suppose tax code is calculation of 2 condtion type so ..we can do it in tax code conditon record fv11 also..
    so..tax code can be a combination of cond type...
    where as through cond type also we can also achieve this..by using one statistical cond type...
    Cond Type :  cond type is for the daily pricing configuration..how system will calculate the price for a centain material we can make define the rules here...
    Try this out..
    Thans

  • Need XSLT code for comparing 2 fields and looping the repatitive attirbute filed to destination schema

    Need an Custom XSLT code... where i need to compare 2 attribute fields( Name and Start Date) fromInputMessagePart_0 with the 2 fields ( Name and Start Date) from InputMessagePart_1 and need to map the repetitive attribute field ( phoneno) from InputMessagePart_1
    to attribute field( PhoneNo of Destination schema.
    this will look like this
    Source Schema                                           
    Destination Schema
    InputMessagePart_0                                                 Item
    Record
          - Name                                                                     
    -Name
          - StartDate                                                                
    - StartDate
          - Addres                                                                   
    - PhoneNo
    InputMessagePart_1
         -Name
         -StartDate
         -PhoneNo
    Final output should look like by
    Details
    Name
    StartDate
    PhoneNo
    Details
    Name
    StartDate
    PhoneNo
    Details
    Name
    StartDate
    PhoneNo
    Details
    Name
    StartDate
    PhoneNo
    Need urgent assistance
    Thank you in advance
    BizTalkLearner

    could you also post your sample input instance and expected output instance
    Please mark the post as answer if this answers your question. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • XSLT Code

    HI,
    Can anybody explain me where should i write the xslt code for error handling and how to use this error handling in Xi ?
    Regards,
    Tuhin

    Hi All,
    I followed this thread for a while. Because I'm also interested in good error handling during mapping.
    I just experimented with throwing a Runtime Exception. This stops mapping but the error message is buried within a large stack trace in the ErrorHeader of the XI-Message.
    I'm still searching for a method where the ErrorHeader clearly shows my error message like ...
    <i>  <SAP:ErrorHeader xmlns:SAP="http://sap.com/exchange/MessageFormat">
      <SAP:Context></SAP:Context>
      <SAP:Code p1="Error during mapping"
                p2="Field value XYZ out of Range"
                p3=""
                p4="">MAPPING.GENERIC</SAP:Code>
      <SAP:Text language="EN">Error during mapping</SAP:Text>
      </SAP:ErrorHeader></i>
    Regards,
      Marc

  • Anyone can check my xslt code ?

    i've tried to use JAXP to transform xml by using xslt. the java program has been written and compiled, but when i tried to run it, it come out the errors:
    error: 'unknown protocol: c'
    fatal error: 'could not compile stylesheet'
    i was suspecting my xslt code might be wrong, could anyone check for me ? i'm quite new to xslt, probably will make lots of silly mistakes.
    xml file: http://www.bbc.co.uk/travelnews/tpeg/en/local/rtm/rtm_tpeg.xml
    xslt file:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
    <xsl:for-each select="tpeg_document/tpeg_message">
    <xsl:value-of select="summary"><xsl:text>;<\xsl:text>
    </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>
    any suggestions will be appreciated,
    cheers,

    i'm not sure whether it'll be the case, but you migt be right. i posted my java source code here:
    public class FileDownload {
    public static void download(String address, String localFileName){
    OutputStream out = null;
    URLConnection conn = null;
    InputStream in = null;
    StringBuffer xmlContentBuffer = new StringBuffer();
    String temp = new String();
    String xmlContent;
    try {
    URL url = new URL(address);
    out = new BufferedOutputStream(
    new FileOutputStream(localFileName));
    conn = url.openConnection();
    in = conn.getInputStream();
    byte[] buffer = new byte[1024];
    int numRead;
    long numWritten = 0;
    System.out.println (in.toString ());
    while ((numRead = in.read(buffer)) != -1) {
    out.write(buffer, 0, numRead);
    numWritten += numRead;
    temp = new String(buffer);
    xmlContentBuffer.append(temp);
    System.out.println(localFileName + "\t" + numWritten);
    xmlContent = xmlContentBuffer.toString();
    String xsltString;
    FileInputStream xslt= new FileInputStream ("Tpeg.xslt");
    int x= xslt.available();
                        byte b[]= new byte[x];
                        xslt.read(b);
    xsltString = new String(b);
                        String htmlString = XmlUtil.applyXslt(xmlContent, xsltString);
                        System.out.println(htmlString);
    } catch (Exception exception) {
    exception.printStackTrace();
    } finally {
    try {
    if (in != null) {
    in.close();
    if (out != null) {
    out.close();
    } catch (IOException ioe) {
         public static void download(String address) {
              int lastSlashIndex = address.lastIndexOf('/');
              if (lastSlashIndex >= 0 &&
              lastSlashIndex < address.length() - 1) {
                   download(address, address.substring(lastSlashIndex + 1));
              } else {
                   System.err.println("Could not figure out local file name for " + address);
         public static void main(String[] args) {
              for (int i = 0; i < args.length; i++) {
                   download(args);

  • XSLT code giving emplty output

    Hi ,
    i am a beginer in XSLT.  when i execute the code  i am getting emplty structure.
    Can anyone point out what is missing in my code, are the xpath expressions correct??
    input Xml  will look as below
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_XSLT_Source xmlns:ns0="http://XYZ.com/gen">
         <Person>
              <FirstName>James</FirstName>
              <LastName>Bond</LastName>
              <Gender>Male</Gender>
              <Address>
                   <Street>6B</Street>
                   <Houseno>bbbb</Houseno>
                   <City>AAAA</City>
              </Address>
         </Person>
    </ns0:MT_XSLT_Source>
    my output should be...
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_XSLT_Target xmlns:ns0="http://XYZ.com/Gen">
          <Title>Male</Title>
         <Name> James Bond</Name>
          <Street> 6B bbbb</Street>
          <City>AAA</City>
    </ns0:MT_XSLT_Target>
    my XSLT code is  as below .. (  i think the xpath's are not executing)
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://XYZ.com/Gen">
         <xsl:template match="/">
              <ns0:MT_XSLT_Target>
                   <Title>
                        <xsl:value-of select="/ns0:MT_XSLT_Source/Person/FirstName"/>
    ( i doubt issue is in xpath??)
                   </Title>
                   <Name>
                        <xsl:value-of select="concat(concat(ns0:MT_XSLT_Source/Person/FirstName,' '),
                         Person/LastName)"/>
                   </Name>
                   <Street>
                        <xsl:value-of select="concat(concat(ns0:MT_XSLT_Source/Person/Address/Houseno,' '),ns0:MT_XSLT_Source/Person/Address/Street)"/>
                   </Street>
                   <City>
                        <xsl:value-of select="ns0:MT_XSLT_Source/Person/Address/City"/>
                   </City>
              </ns0:MT_XSLT_Target>
         </xsl:template>
    </xsl:stylesheet>
    Edited by: sam kumar on Aug 31, 2010 2:37 PM

    Hi, take this code:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://XYZ.com/gen">
         <xsl:template match="/">
              <ns0:MT_XSLT_Target>
                   <Title>
                        <xsl:value-of select="ns0:MT_XSLT_Source/Person/FirstName"/>
                   </Title>
                   <Name>
                        <xsl:value-of select="concat(concat(ns0:MT_XSLT_Source/Person/FirstName,' '),
                         Person/LastName)"/>
                   </Name>
                   <Street>
                        <xsl:value-of select="concat(concat(ns0:MT_XSLT_Source/Person/Address/Houseno,' '),ns0:MT_XSLT_Source/Person/Address/Street)"/>
                   </Street>
                   <City>
                        <xsl:value-of select="ns0:MT_XSLT_Source/Person/Address/City"/>
                   </City>
              </ns0:MT_XSLT_Target>
         </xsl:template>
    </xsl:stylesheet>
    I Just change the xmlns:ns0="http://XYZ.com/Gen" to xmlns:ns0="http://XYZ.com/gen"
    Regards,
    Edson Thomaz

  • Xslt code - adding suffix value

    Hello SAP experts,
    May we seek advise from you on a working xslt code for adding suffix?
    Source:  012345
    Target: 012345HELLO
    The suffix 'HELLO' will be placed at the end of the value.
    Please advise.
    Thanks!
    Gerberto!

    take reference as follows:
    <Name><xsl:value-of select="concat($fname, $lname)"/></Name>
    In your case
    <Name><xsl:value-of select="concat($srcnode, 'HELLO)"/></Name>
    Regards
    Liang

  • How to code complex conditions

    Hi Everyone,
    First, please forgive if I don't use programming terminology correctly, I am a beginner with no background in informatics.
    My question will be a general one: What is the good approach to code complicated conditions?
    I have a good example to start with which is actually a concrete task that I need to do in my small application:
    TODO: Shorten/abbreviate a person's full name to fit in to a 16 characters.
    For example: Johnathan Necromancer --> J Necromancer
    There are many possibilities how to do it based on the length of the first, last and middle names and there is an order of preference for these solutions.
    So if possible abbreviate only the first name like above; if it's still too long then then leave the space out, and so on. These would be the preferences demonstrated with examples:
    1. J L Smith
    2. JL Smith
    3. JLSmith
    4. John Languely S
    5. John Lang B S
    6. John L S
    7. JohnLS
    8. J L S
    9. JLS
    How to code it? With nested if -s or with if-else blocks or in an other way?
    First I did it with nested if -s, but it was kind of mess after a while, so the most straightforward way for me was to do it as follows:
    (Simply 'calculate' the abbreviated names in the preferred order and return if it fits into the 16 characters.)
    if (displayName.length() > 16) {
                   String[] dn = displayName.split("\\s+");
                   String lName = dn[dn.length - 1];
                   StringBuffer dName16 = new StringBuffer();
                   // J L Smith
                   dName16 = new StringBuffer();
                   for (int i = 0; i < dn.length - 1; i++) {
                        dName16.append(dn.charAt(0) + " ");
                   dName16.append(lName);
                   if (dName16.length() <= 16){
                        return new String(dName16);
                   // JL Smith
                   dName16 = new StringBuffer();
                   for (int i = 0; i < dn.length - 1; i++) {
                        dName16.append(dn[i].charAt(0));
                   dName16.append(" " + lName);
                   if (dName16.length() <= 16){
                        return new String(dName16);
                   // JLSmith
                   dName16 = new StringBuffer();
                   for (int i = 0; i < dn.length - 1; i++) {
                        dName16.append(dn[i].charAt(0));
                   dName16.append(lName);
                   if (dName16.length() <= 16){
                        return new String(dName16);
    //more code..
    I would like to know how to approach these kind of situations effectively and clearly in the least error prone way. How to code complex conditions? Is there any book or theory about it?
    I am not sure it is clear what I am asking, but I will follow up with more description on what I mean later. But please comment, ask, advice anything in the meantime - I would really appreciate any help with this.
    Thank you in advance!
    lemonboston                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    So this would be it. What do you think, what should I improve?
    public class Main {
         public static void main(String[] args) {
              String[] names = { "Bud Spencer", "Matthew MacFadyen",
                        "Juan Carlos Santiago Sanchez Estrella Ramirez",
              "Maria De Dios Otero" };
              for (String n : names) {
                   System.out.println(n + " -->\n" + abbreviateName(n, 16) + "\n");
         private static String abbreviateName(String fullName, int maxLength) {
              if (fullName.length() <= maxLength) {
                   return fullName;
              } else {
               * preferred formats for abbreviation:
               * J L Smith
               * JL Smith
               * JLSmith
               * John Languely S
               * John L S
               * JohnLS
               * J L S
               * JLS
               * if none works, return the first maxLength characters
                   String[] nameArr = fullName.split("\\s+");
                   String lastName = nameArr[nameArr.length - 1];
                   ArrayList<StringBuffer> abbreviatedList = new ArrayList<StringBuffer>();
                   StringBuffer abbreviatedName;
                   // J L Smith
                   abbreviatedName = new StringBuffer();
                   for (int i = 0; i < nameArr.length - 1; i++) {
                        abbreviatedName.append(nameArr.charAt(0) + " ");
                   abbreviatedName.append(lastName);
                   abbreviatedList.add(abbreviatedName);
                   // JL Smith
                   abbreviatedName = new StringBuffer();
                   for (int i = 0; i < nameArr.length - 1; i++) {
                        abbreviatedName.append(nameArr[i].charAt(0));
                   abbreviatedName.append(" " + lastName);
                   abbreviatedList.add(abbreviatedName);
                   // JLSmith
                   abbreviatedName = new StringBuffer();
                   for (int i = 0; i < nameArr.length - 1; i++) {
                        abbreviatedName.append(nameArr[i].charAt(0));
                   abbreviatedName.append(lastName);
                   abbreviatedList.add(abbreviatedName);
                   // John Languely S
                   abbreviatedName = new StringBuffer();
                   for (int i = 0; i < nameArr.length - 1; i++) {
                        abbreviatedName.append(nameArr[i] + " ");
                   abbreviatedName.append(lastName.charAt(0));
                   abbreviatedList.add(abbreviatedName);
                   // John L S
                   abbreviatedName = new StringBuffer();
                   abbreviatedName.append(nameArr[0] + " ");
                   abbreviatedName.append(lastName.charAt(0));
                   abbreviatedList.add(abbreviatedName);
                   // JohnLS
                   abbreviatedName = new StringBuffer();
                   abbreviatedName.append(nameArr[0]);
                   for (int i = 1; i < nameArr.length - 1; i++) {
                        abbreviatedName.append(nameArr[i].charAt(0));
                   abbreviatedList.add(abbreviatedName);
                   // J L S
                   abbreviatedName = new StringBuffer();
                   for (int i = 1; i < nameArr.length - 2; i++) {
                        abbreviatedName.append(nameArr[i].charAt(0) + " ");
                   abbreviatedName.append(lastName.charAt(0));
                   abbreviatedList.add(abbreviatedName);
                   // JLS
                   abbreviatedName = new StringBuffer();
                   for (int i = 1; i < nameArr.length - 1; i++) {
                        abbreviatedName.append(nameArr[i].charAt(0));
                   abbreviatedList.add(abbreviatedName);
                   // return the first one that fits in to maxLength
                   for (StringBuffer shortName : abbreviatedList) {
                        if (shortName.length() <= maxLength) {
                             return new String(shortName);
                   // If none of the above works, simply keep the first maxLenght character               
                   return fullName.substring(0, maxLength - 1);

  • JCOP Tools Problem Error code: 6985 (Conditions of use not satisfied)

    I have a problem with the JCOP tools. I am developing a very simple applet which does nothing at all. It is a "hello world" type applet so that I can get something working. It compiles ok, however as soon as I try to run it under the emulator I get an error.
    Status: Conditions of use not satisfied jcshell: Error code: 6985 (Conditions of use not satisfied) jcshell: Wrong response APDU: 6985
    This always happens when the jcshell issues the install command.
    The install command is:
    install -i 1234567890 -t -l -d -m -p -s -b -e -q C9#(1234567890) 1234567890 1234567890
    I must be doing something very basic incorrectly. I have tried searching the forums and internet and I haven't found anything. Any help would be appreciated.
    The code is this:
    package pt.microfil.test;
    import javacard.framework.*;
    import javacard.framework.ISO7816;
    import javacard.framework.ISOException;
    import javacard.framework.APDU;
    public class testcard extends Applet {
         final static byte CLASS = (byte) 0x80; // Class of the APDU commands
         final static byte INS_READ = (byte) 0x02; // instruction for the READ APDU command
         // this is the text string which will send back from the ICC to the IFD
         final static byte[] text = {(byte) 'e', (byte) 't', (byte) 's', (byte) ' ',
         (byte) 'g', (byte) 'e', (byte) 'h', (byte) 't', (byte) 's', (byte) ' ',
         (byte) 'd', (byte) 'e', (byte) 's', (byte) ' ',
         (byte) 'G', (byte) 'l', (byte) 'u', (byte) 'm', (byte) 'p'};
         public static void install(byte[] bArray, short bOffset, byte bLength) {
              // GP-compliant JavaCard applet registration
              //new testcard().register(bArray, (short) (bOffset + 1), bArray[bOffset]);
              new testcard().register();
         public static void install() {
              new testcard().register();
         public void process(APDU apdu) {
              byte[] cmd_apdu = apdu.getBuffer(); // the cmd_apdu variable is used because of performance reasons
              if (cmd_apdu[ISO7816.OFFSET_CLA] == CLASS) {  // it is the rigth class
              switch(cmd_apdu[ISO7816.OFFSET_INS]) {      // check the instruction byte
              case INS_READ: // it is a READ instruction
              // check if P1=P2=0
              if ((cmd_apdu[ISO7816.OFFSET_P1] != 0) || (cmd_apdu[ISO7816.OFFSET_P2] != 0)) {
              ISOException.throwIt(ISO7816.SW_WRONG_P1P2);
              } // if
              // check if P3=length of the text field
              short le = (short)(cmd_apdu[ISO7816.OFFSET_LC] & 0x00FF); // calculate Le (expected length)
              short len_text = (short)text.length; // the len_text variable is used because of performance reasons
              if (le != len_text) {
              ISOException.throwIt((short)(ISO7816.SW_CORRECT_LENGTH_00 + len_text)); // give the expected length back to the IFD
              } // if
              apdu.setOutgoing(); // set transmission to outgoing data
              apdu.setOutgoingLength((short)len_text); // set the number of bytes to send to the IFD
              apdu.sendBytesLong(text, (short)0, (short)len_text);
              break;
              default : // the instruction in the command apdu is not supported
              ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
              } // switch
              } // if
              else {         // the class in the command apdu is not supported
              ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED);
    }

    i also found this error and i change the package name and applet id.it is not changing.now i got same error.
    cm>  install -i 6d796170702e617070  -q C9#() 6d797061636b616765 6d796170702e617070
    jcshell: Error code: 6985 (Conditions of use not satisfied)
    jcshell: Wrong response APDU: 6985
    Unexpected error; aborting execution
    how can i solve the problem??

  • How can i get the tax code from Condition record number

    Hi all,
    i have the Condition record number from which i have to get the tax code as i looked inthe KNOP that Condition record number there but no tax code is maintained there.
    so is there any other way to find the tax code for particular Condition record number
    Regards
    suresh

    hi suresh,
    can u tell me the field name for condition record number and in which table it is stored.
    because i knew one condition number which is stored in table EKKO and the field name is
    KNUMV- Number of the document condition.
    from ekko take relevant details and look for  ekpo where u find the tax code
    filed name of the tax code id MWSKZ- Tax on sales/purchases code

Maybe you are looking for

  • MBAM 2.5

    I am trying to plan the integration of MBAM 2.5 into our deployment. I have tried to read the MBAM documentation and I got a bit confused. I understand that there is a separate GPOs for MBAM but I am not sure what to do with MDT (2013). At the moment

  • .avi converted to MPEG4 but problem

    Yes I was able to add a .mov ext to it but the video is not showing up. It was created on a PC using Tony Hawk helmet cam. I would like to use these clips to make low quality video of my bike rides etc. As I said, I get audio but the Quicktime video

  • Webdynpro ABAP Services on SUS

    Hi Gurus, I am working for process design with SRM 7.0 EhP1 and I needed one information on RFx outside firewall. RFx & supplier registration is now webdynpro & rest of SUS functionality remains BSP. I had questions how suppliers will be able to acce

  • BlackBerry Desktop Software (Update)

    I have been battling for weeks to update my current version (Software Version: 60 Bundle 2475) of BlackBerry Desktop Software to the updated version (Updated Version: 6.0 Bundle 2949) which is available as indicated by the red asterisk next to Update

  • K900 UPDATE FAIL, HELP PLEASE

    I am trying to update my k900 (rooted i think). The instalation seems to go ok but after the restart it says 'Installation failed, failed to install ota package'. Any help would be massively appreciated Thanks Matt.