Generate fixed-length unique strings

Hi all,
I'm trying to generate 16 byte unique string from two input strings. Essentially, the unique string will be used as primary key in the database. The two input strings are (siteUrl, productId) in which siteUrl is the url of a website which has one or more productId. Each productId in a site is unique but there might be duplicate productIds from different sites. I want to generate 16 byte ids from each pair of (siteUrl, productId) such that they are unique (or have a very small chance of collision). Has anyone done this before? Please share your experience! Thanks heap!

>>>>>
KajThanks for the answer. However, what I want toknow
is how to convert say productId to unique 8
byte
string. Any idea?What does the product id look like?Product id is usually a string of digits andletters:
2323, 234lasfd1kj3,....
What I'm looking for is a hash function h suchthat:
h(siteUrl) -> 8 byte string
h(productId) -> 8 byte string
I now can combine h(siteUrl) and h(productId) toget
16 byte unique string.
Sorry but you can't! Since the hashes will not be
unique the combination will not be unique.There should be such hash function somewhere but I haven't found it. The definition is here http://www.x5.net/faqs/crypto/q94.html.

Similar Messages

  • Generating fixed length DSA signatures

    hello,
    i have this query. I am working on an application that generates a DSA signature on a string that is of 8bytes. i am using SHA1withDSA algorithm. My data string is always 8 bytes. However the signature length is always varying ,sometimes the signature that is generated is of 46 characters sometimes 47 and sometimes 48. Is it possible to control this and generate a fixed length Digital Signature????
    Thanks in advance

    Could yo resolve the problem? I've got the very same problem and y don't know what to do.

  • How to map xml to a fixed length string?

    Hi All,
    I have a requirement to map request xml to a string of fixed length and format:
    For eg,
    Source:
    <Person>
    <Name>George</Name>
    <Age>21</Age>
    </Person>
    Target:
    String of format
    Name : 8 chars
    Age : 2chars.
    so the required mapping should result in
    "George 21".
    Note: 2 blanks after "George" to allow for 8 characters. Is this kind of mapping possible using ALSB xquery? I have tried to create a MFL representation for the string , and used it in the xquery as the targer but it is generating
    "George21".Only data present in source is getting mapped :(

    My advice would be to use MFL transformation for that.
    Documentation about MFL can be found at edocs: http://edocs.bea.com/alsb/docs26/fbhelp/index.html
    Find tips and tricks about ALSB at my blog: http://dev2dev.bea.com/blog/jordinho/

  • A better way of building the fixed-length String

    I created the following code to build a fixed length string. I checked other posts for the same topic, but I found mine is better. The code below converts a double numeric value to a fixed length string with padding of white spaces (or other types):
    Line 15 initializes the char array to while space; line 13 creates a character array; lines 17, 18 copy the array created in line 13 to the one initialized in line 15.
    Any comment is welcomed.
    1. import java.text.*;
    2.
    3. public class jformat {
    4.
    5. public static void main(String[] args) {
    6.
    7. char[] fb=new char[14];
    8. char[] tb;
    9. int c, f;
    10. DecimalFormat fmt=new DecimalFormat("########0.00");
    11. double dbl=12345.66;
    12.
    13. tb=fmt.format(dbl).toCharArray();
    14.
    15. for(c=0; c<fb.length; c++) fb[c]=' ';// this line is not required in JDK 1.5
    16.
    17. for(c=tb.length-1, f=fb.length-1; c>=0; c--, f--){
    18.     fb[f]=tb[c];
    19. }
    20. System.out.println(new String(fb));
    21.
    22. }
    23.
    24. }

    Here's a couple of alternatives. One uses a StringBuffer and the second, for Java 5 only, uses the Formatter capabilities.
    import java.text.DecimalFormat;
    public class jformat
        public static void main(String[] args)
            int fieldSize = 14;
            double dbl = 12345.66;
            String dblString = new DecimalFormat("0.00").format(dbl);
            StringBuffer sb = new StringBuffer();
            for (int j = 0; j < fieldSize - dblString.length(); j++)
                sb = sb.append(' ');
            System.out.println(sb.append(dblString).toString());
             *  The above code works in Java versions 1.3, 1.4, and 1.5.
             *  However, 1.5 provides the Formatter class, and the single
             *  line below can replace the preceeding code.
            System.out.printf("%14.2f%n", dbl);
    }

  • Fixed-length numbers and strings

    Hello,
    I have to make a critical decision about API usage. I would be grateful if some of you could share their experiences. This will help me make an informed decision and avoid potential trouble further down the line.
    I have to use fixed-length integer numbers and fixed-length strings such as for example:
    -A string that is exactly 5-letter long (no longer and no shorter than 5 letters). e.g. "abcde"
    -A number that is exactly 8-digit long (no longer and no shorter than 8 digits). e.g. "12345678"
    Ideally I would get some sort of exception when the "container" for the letters or digits contains less or more than what the spec says.
    I am not sure which classes or primitives could meet my needs. As far as the fixed-length string is concerned I initially thought of using a array of chars but an array of chars is not that easy to manipulate and contains "garbage" until you explicitely fill it in with data. I'd rather some sort of class.
    Can anyone please advise me?
    Thanks in advance,
    Julien.

    Why not use the same thing like in the case of the String
    /**Warning: this is an example and not very good design.*/
    public class FixedInteger {
       private int min, max;
       private int value;
       public int getValue() { return value;}
       public void setValue(int v) {
            if (v >= min && v < max) {
                throw new Exception();
            value = v;
       /**ex. min = 10000, max = 100000 for 5 digit numbers*/
       public FixedInteger(int min, int max, int value) {
           this.min = min; this.max = max;
           setValue(value);
    }You can do tricks like convert it to immutabla like the String and Integer class in the Java Api
    Edited by: szgy on Oct 5, 2007 2:22 PM

  • ABPA  code to compress table into a table of fixed-length strings

    Hi all,
    I need to compress a large, sparse table into a table of fixed-length strings in my ABAP code, and then uncompress it.  Is there a standard format or facility to do this?  I seem to remember a function that does this, but any other hints would be appreciated.
    Thank you in advance,
    Sunny

    For example, given a table like:
    Column0    Column1    Column2
    abc            C               !@#&@
                     P
    def                              $*(
    Compress it into a table consisting of one column of fixed-length strings, like:
    Column0
    0abc1C2
    !@#&@01
    P20def1
    2$*(
    ..and then uncompress it back out to the original table.
    Sunny

  • On E series Card with 2 counters I want to generate a fixed length pulse train and want to continuously monitor it.

    On E series Card with 2 counters I want to generate a fixed length pulse train and want to continuously monitor it.

    Depending on the software you are using, there are many shipping examples and example programs on the web that illustrate generating a finite pulse train. The E series boards have the DAQ-STC counter/timer chip, and so make sure you search for DAQ-STC examples. I have included links to a LabVIEW example and Measurment Studio Example in Visual Basic.
    Generate finite pulse train in LabVIEW.
    http://eagle.ni.com/stage/we/niepd_web_display.DISPLAY_EPD4?p_guid=B45EACE3DA2156A4E034080020E74861&p_node=DZ52328&p_submitted=N&p_rank=&p_answer=&p_source=Internal
    Generate finite pulse train in Visual Basic with Measurement Studio
    http://eagle.ni.com/stage/we/niepd_web_display.DISPLAY_EPD4?p_guid=B45EACE3D96156A4E034080020E74861&p_node=DZ52328&p_submitted=N&p_rank=&p_answe
    r=&p_source=Internal

  • I have to generate a 4 char unique string from a long value

    I got a requirment
    I have to generate a 4 char unique string from a long value
    Eeach char can be any of 32 character defined has below.
    private static final char char_map[] = new char[]{'7','2','6','9','5','3','4','8','X','M','G','D','A','E','B','F','C','Q','J','Y','H','U','W','V','S','K','R','L','N','P','Z','T'};
    So for 4 char string the possible combination can be 32 * 32 * 32 * 32 = 1048576
    If any one passes a long value between 0 - 1048576 , it should generate a unique 4 char string.
    Any one with idea will be a great help.

    Well, a long is 64 bits. A char is 16 bits. Once you determine how you want to map the long's bits to your char bits, go google for "java bitwise operators".

  • How to get a string with fixed length

    I want to implement something like movechar() of c in java. I want to return a string which has a fixed length that contains the given string and spaces for remaining length.
    Please let me know how can I implement it.
    Thanks & Regards,
    Nasrin.n

    Do you mean padding a String?
          * This method pads the string s to size n using char c to make up for missing characters.
         public static String padString(String s, int n, char c, boolean paddingLeft) {
              StringBuffer str = new StringBuffer(s);
              int strLength = str.length();
              if (n > 0 && n > strLength) {
                   for (int i = 0; i <= n; i++) {
                        if (paddingLeft) {
                             if (i < n - strLength) str.insert(0, c);
                        else {
                             if (i > strLength) str.append(c);
              return str.toString();
         }

  • How to build a fixed-length string representing an integer

    Hi,
    I would like know how can I use the API to get a String representing an int with fixed length. I mean, I would like something similar to Integer.parseInt(), but I need to set the length of that String in such a way that, for instance, if I need the String to be 5 character long, and the int is 37, the String would be 00037
    Thanks in advance and best regards,
    Miguel ?ngel

    I wrote pad() methods in my string helper that can be used for this purpose.
    In particular, you want to prepad with '0' to a length of 5:
    com.Ostermiller.StringHelper.prePad(Integer.toString(37), 5, '0');
    http://ostermiller.org/utils/StringHelper.html

  • Fixed Length Strings.

    Hi ,
       I have to download a longtext from SAP.
       The length of the longtext has to be fixed 5000 ie...Even if the length of the longtext from SAP is 1000 remaining 4000 spaces should get appended.
      I am moving the long text into a variable l_line which I have declared in the following way L_LINE(5000).
       But after moving the longtext into this variable it still shows the actual length of the longtext whereas I need 5000 fixed length.
      How to solve it.
    Thanks,

    Hi Renu Raj,
    Just WRITE the LONG TEXT again in to the variable with RIGHT
    JUSTIFIED. It will prefixes SPACEs and STRLEN will return 5000.
    i.e. as follows,
      WRITE : L_LINE TO L_LINE RIGHT-JUSTIFIED.
      CNT_LEN = STRLEN( L_LINE ).
    Now the CNT_LEn will have '5000'.
    While you process the LONG TEXT, just CONDENSE it and go ahead. It will remove LEADING SPACEs.
    i.e. as follows,
      CONDENSE L_LINE.
      CNT_LEN = STRLEN( L_LINE ).
    Now CNT_LEN will have an actual length.
    Regards,
    R.Nagarajan.
    We can -

  • Reading fixed length flatfile & splitting it into header and lineitem data

    Hi Friends,
    I am reading a fixed length flat file from application server into an Internal table.
    But problem is, data in flat file is in the below format with fixed start and end positions.
    1 - 78 -  control header
    1 - 581 - Invoice header data
    1 - 411 - Invoice Line item data
    1 - 45 -   trailer record
    There will be one control header and one trailer record per file and number of invoice headers and its line items can vary.
    There is unique identifiers to identify as below.
    Control header - starts with 'CHR'
    Invoice Header starts with - '000'
    Invoice Lineitem stats with - '001'
    trailer record - starts with 'TRL'
    So its like
    CHR.......control  data..(79)000.....header data...(660)001....lineitem1...(1481)001...lineitem2....multiples of 411 and 581 and ends with... TRL...trailer record..
    (position)
    I am first reading the data set and store in internal table with a field of 255char.
    by looping on above ITAB i have to split it into Header records and line item records.
    Did anyone face this kind of scenario before. If yes appreciate if you can throw some ideas on logic to split this data.
    Any help in splitting up the data is highly appreciated.
    Regards,
    Simha
    ITAB declaration
    DATA: BEGIN OF ITAB OCCURS 0,
                   FIELD(255),
               END OF ITAB,
                lt_header type table of ZTHDR,
                lt_lineitem type table of ZTLINITM.

    Hi,
    i am sending sample code which resembles your requiremeant.
    data: BEGIN OF it_input OCCURS 0, "used for store all the data in one line.
          line type string ,
          END OF it_input,
          it_header type TABLE OF string WITH HEADER LINE,"use to store all header with corresponding items
          it_item   type TABLE OF string WITH HEADER LINE.."used to store all item data
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                      = 'd:\test.txt'
      FILETYPE                      = 'ASC'
      HAS_FIELD_SEPARATOR           = ' '
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      tables
        data_tab                      = it_input
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_READ_ERROR               = 2
      NO_BATCH                      = 3
      GUI_REFUSE_FILETRANSFER       = 4
      INVALID_TYPE                  = 5
      NO_AUTHORITY                  = 6
      UNKNOWN_ERROR                 = 7
      BAD_DATA_FORMAT               = 8
      HEADER_NOT_ALLOWED            = 9
      SEPARATOR_NOT_ALLOWED         = 10
      HEADER_TOO_LONG               = 11
      UNKNOWN_DP_ERROR              = 12
      ACCESS_DENIED                 = 13
      DP_OUT_OF_MEMORY              = 14
      DISK_FULL                     = 15
      DP_TIMEOUT                    = 16
      OTHERS                        = 17
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT  it_input.
       write : it_input-line.
    ENDLOOP.
    before doing the below steps just takethe controle record and trail record cutt of from the table input based up on the length
      split it_input-line AT '000' INTO TABLE it_header IN CHARACTER MODE.
      LOOP AT  it_header.
        split it_header AT '0001' INTO TABLE it_item IN CHARACTER MODE.
        write :/ it_header.
      ENDLOOP.
    after this you need to cut the records in tocorresponding  fields in to respective tables by putting loop on item and header table as i decleared above.
    i think this may solve your problem you need to keep some minnor effort.
    Regaurds,
    Sree..

  • Reading a fixed length file

    Hi All,
    I am trying to read a fixed length file with .DAT extension through an FTP Adapter. I am using a read(polling) operation.
    In the file there are three records(H,D,T). The length of all the three records is more than 100.When I am trying to build a schema for that file using native format builder, maximum position that i get is 100 and if i manually try to put the position beyond 100 say 120,while building the schema and then run the composite using the generated schema, the file is not polled from the location So if anyone could help me to clarify my doubts regarding reading of fixed length files.
    a. Can i read i fixed length file which contains records whose position is more than 100.
    b. If yes, then how do i do that?
    Any help is appreciated.
    Thanks in Advance.

    Here's one way to start. Extend this class for the particular functionality you want:import java.io.DataInputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.IOException;
    /** Processes binary files which have embedded data records. */
    public abstract class BinaryInputFile extends File
    * Class constructor.
    * @param fileName The input file name.
    * @throws NullPointerException if the <code>pathname</code> parameter is <code>null</code>
    protected BinaryInputFile(String fileName) throws NullPointerException
       super(fileName);
    * Reads the file, one line at a time, passing each line to the subclass� process()
    * function.
    * @throws IOException if an error occurs.
    public void process() throws IOException
       DataInputStream stream = new DataInputStream(new FileInputStream(this));
       process(stream);
    * Process the file data.
    * @param stream The input stream.
    protected abstract void process(DataInputStream stream);
    }

  • File Adapter Fixed Length File issue

    Hi,
    I have a fixed length flat file with each row 13 characters long. First character of each row represents a record type i.e. 0,1,2,3,4,5,6,7,8,9 here is my sample file:
    0123456     
    960373      
    A602710542583
    7602710542583
    1602750499275
    4602750499275
    1602750529800
    7602750529800
    1603030507732
    7603030507732
    1603030509055
    7603030509055
    1603030509229
    7603030509229
    2603600556240
    0603600566095
    2603600567460
    3603310536370
    5603310525810
    3603310531092
    3603310521842
    0603310521842
    3603310521842
    3603310521842
    860201450SA A
    560201451SA A
    560201452SA A
    560201453SAN
    1603630565355
    7603630565355
    1603630565500
    7603630565500
    9603460539390
    2603460535260
    3603790509870
    560200401ABIL
    660372TX066 
    660373TX01531
    660373TX01532
    860373TX066 
    660373TX068 
    360373TX09465
    660373TX09471Here is the schema
    <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://xmlns.oracle.com/pcbpel/tstSchema/SMP" xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd" targetNamespace="http://xmlns.oracle.com/pcbpel/tstSchema/SMP" elementFormDefault="qualified" attributeFormDefault="qualified" nxsd:version="NXSD" nxsd:stream="chars">
         <element name="SMP">
              <complexType>
                   <choice maxOccurs="unbounded" nxsd:choiceCondition="fixedLength" nxsd:length="1">
                        <element ref="tns:smpRecords" nxsd:conditionValue="0" minOccurs="0" maxOccurs="unbounded"/>
                        <element ref="tns:smpRecords" nxsd:conditionValue="1" minOccurs="0" maxOccurs="unbounded"/>
                        <element ref="tns:smpRecords" nxsd:conditionValue="2" minOccurs="0" maxOccurs="unbounded"/>
                        <element ref="tns:smpRecords" nxsd:conditionValue="3" minOccurs="0" maxOccurs="unbounded"/>
                        <element ref="tns:smpRecords" nxsd:conditionValue="4" minOccurs="0" maxOccurs="unbounded"/>
                        <element ref="tns:smpRecords" nxsd:conditionValue="5" minOccurs="0" maxOccurs="unbounded"/>
                        <element ref="tns:smpRecords" nxsd:conditionValue="6" minOccurs="0" maxOccurs="unbounded"/>
                        <element ref="tns:smpRecords" nxsd:conditionValue="7" minOccurs="0" maxOccurs="unbounded"/>
                        <element ref="tns:smpRecords" nxsd:conditionValue="8" minOccurs="0" maxOccurs="unbounded"/>
                        <element ref="tns:smpRecords" nxsd:conditionValue="9" minOccurs="0" maxOccurs="unbounded"/>      
                   </choice>
              </complexType>
         </element>
         <element name="smpRecords" type="tns:smpRecordsType"/>
         <complexType name="smpRecordsType">
              <sequence>
                   <element name="data1" type="string" nxsd:style="fixedLength" nxsd:length="2" nxsd:padStyle="tail" nxsd:paddedBy=" "/>
                   <element name="data2" type="string" nxsd:style="fixedLength" nxsd:length="3" nxsd:padStyle="tail" nxsd:paddedBy=" "/>
                   <element name="emp" type="string" nxsd:style="terminated" nxsd:terminatedBy="${eol}"/>
              </sequence>
         </complexType>
    </schema>When I run the process I get the following output and that is not correct as the first character is also being shown in the output as opposed to be skipped as it is the record type and the output should start from second character.
    output
    <SMP>
    <smpRecords>
    <data1>12</data1>
    <data2>345</data2>
    <emp>6 </emp>
    </smpRecords>
    <smpRecords>
    <data1>96</data1>
    <data2>037</data2>
    <emp>3 </emp>
    </smpRecords>
    <smpRecords>
    <data1>A16</data1>
    <data2>027</data2>
    <emp>10542583</emp>
    </smpRecords>
    <smpRecords>
    <data1>76</data1>
    <data2>027</data2>
    <emp>10542583</emp>
    </smpRecords>
    <smpRecords>
    <data1>16</data1>
    <data2>027</data2>
    <emp>50499275</emp>
    </smpRecords>
    <smpRecords>
    <data1>46</data1>
    <data2>027</data2>
    <emp>50499275</emp>
    </smpRecords>
    <smpRecords>
    <data1>16</data1>
    <data2>027</data2>
    <emp>50529800</emp>
    </smpRecords>
    <smpRecords>
    <data1>76</data1>
    <data2>027</data2>
    <emp>50529800</emp>
    </smpRecords>
    <smpRecords>
    <data1>16</data1>
    <data2>030</data2>
    <emp>30507732</emp>
    </smpRecords>
    <smpRecords>
    <data1>76</data1>
    <data2>030</data2>
    <emp>30507732</emp>
    </smpRecords>
    <smpRecords>
    <data1>16</data1>
    <data2>030</data2>
    <emp>30509055</emp>
    </smpRecords>
    <smpRecords>
    <data1>76</data1>
    <data2>030</data2>
    <emp>30509055</emp>
    </smpRecords>
    <smpRecords>
    <data1>16</data1>
    <data2>030</data2>
    <emp>30509229</emp>
    </smpRecords>
    <smpRecords>
    <data1>76</data1>
    <data2>030</data2>
    <emp>30509229</emp>
    </smpRecords>
    <smpRecords>
    <data1>26</data1>
    <data2>036</data2>
    <emp>00556240</emp>
    </smpRecords>
    <smpRecords>
    <data1>06</data1>
    <data2>036</data2>
    <emp>00566095</emp>
    </smpRecords>
    <smpRecords>
    <data1>26</data1>
    <data2>036</data2>
    <emp>00567460</emp>
    </smpRecords>
    <smpRecords>
    <data1>36</data1>
    <data2>033</data2>
    <emp>10536370</emp>
    </smpRecords>
    <smpRecords>
    <data1>56</data1>
    <data2>033</data2>
    <emp>10525810</emp>
    </smpRecords>
    <smpRecords>
    <data1>36</data1>
    <data2>033</data2>
    <emp>10531092</emp>
    </smpRecords>
    <smpRecords>
    <data1>36</data1>
    <data2>033</data2>
    <emp>10521842</emp>
    </smpRecords>
    <smpRecords>
    <data1>06</data1>
    <data2>033</data2>
    <emp>10521842</emp>
    </smpRecords>
    <smpRecords>
    <data1>36</data1>
    <data2>033</data2>
    <emp>10521842</emp>
    </smpRecords>
    <smpRecords>
    <data1>36</data1>
    <data2>033</data2>
    <emp>10521842</emp>
    </smpRecords>
    <smpRecords>
    <data1>86</data1>
    <data2>020</data2>
    <emp>1450SA A</emp>
    </smpRecords>
    <smpRecords>
    <data1>56</data1>
    <data2>020</data2>
    <emp>1451SA A</emp>
    </smpRecords>
    <smpRecords>
    <data1>56</data1>
    <data2>020</data2>
    <emp>1452SA A</emp>
    </smpRecords>
    <smpRecords>
    <data1>56</data1>
    <data2>020</data2>
    <emp>1453SAN </emp>
    </smpRecords>
    <smpRecords>
    <data1>16</data1>
    <data2>036</data2>
    <emp>30565355</emp>
    </smpRecords>
    <smpRecords>
    <data1>76</data1>
    <data2>036</data2>
    <emp>30565355</emp>
    </smpRecords>
    <smpRecords>
    <data1>16</data1>
    <data2>036</data2>
    <emp>30565500</emp>
    </smpRecords>
    <smpRecords>
    <data1>76</data1>
    <data2>036</data2>
    <emp>30565500</emp>
    </smpRecords>
    <smpRecords>
    <data1>96</data1>
    <data2>034</data2>
    <emp>60539390</emp>
    </smpRecords>
    <smpRecords>
    <data1>26</data1>
    <data2>034</data2>
    <emp>60535260</emp>
    </smpRecords>
    <smpRecords>
    <data1>36</data1>
    <data2>037</data2>
    <emp>90509870</emp>
    </smpRecords>
    <smpRecords>
    <data1>56</data1>
    <data2>020</data2>
    <emp>0401ABIL</emp>
    </smpRecords>
    <smpRecords>
    <data1>66</data1>
    <data2>037</data2>
    <emp>2TX066 </emp>
    </smpRecords>
    <smpRecords>
    <data1>66</data1>
    <data2>037</data2>
    <emp>3TX015 </emp>
    </smpRecords>
    <smpRecords>
    <data1>66</data1>
    <data2>037</data2>
    <emp>3TX01531</emp>
    </smpRecords>
    <smpRecords>
    <data1>66</data1>
    <data2>037</data2>
    <emp>3TX01532</emp>
    </smpRecords>
    <smpRecords>
    <data1>86</data1>
    <data2>037</data2>
    <emp>3TX066 </emp>
    </smpRecords>
    <smpRecords>
    <data1>66</data1>
    <data2>037</data2>
    <emp>3TX068 </emp>
    </smpRecords>
    <smpRecords>
    <data1>36</data1>
    <data2>037</data2>
    <emp>3TX09465</emp>
    </smpRecords>
    <smpRecords>
    <data1>66</data1>
    <data2>037</data2>
    <emp>3TX09471</emp>
    </smpRecords>
    </SMP>As the output for the very first row comes up fine i.e. 0123456
    for this the output is
    <smpRecords>
    <data1>12</data1>
    <data2>345</data2>
    <emp>6 </emp>
    </smpRecords>But for all the rest it keeps adding the first character too i.e. 960373
    for this the output is wrong
    <smpRecords>
    <data1>96</data1>
    <data2>037</data2>
    <emp>3 </emp>
    </smpRecords>as the correct output should be:
    <smpRecords>
    <data1>60</data1>
    <data2>373</data2>
    <emp/>
    </smpRecords>Any idea what I am doing wrong or how I can fix the schema. Also if I add any character other than 0....9 for the first character it still picks up the record i.e. A602710542583
    as it should only process records starting with 0....9
    Thanks

    I tried using transformation to check if the starting 2 chars are 56 then output else continue but the ourput is blank even though I have multiple records that start with 56. Here is the xsl I have
    <?xml version="1.0" encoding="UTF-8" ?>
    <?oracle-xsl-mapper
      <!-- SPECIFICATION OF MAP SOURCES AND TARGETS, DO NOT MODIFY. -->
      <mapSources>
        <source type="XSD">
          <schema location="test2.xsd"/>
          <rootElement name="SMP" namespace="http://xmlns.oracle.com/pcbpel/tstSchema/SMP"/>
        </source>
      </mapSources>
      <mapTargets>
        <target type="XSD">
          <schema location="test2.xsd"/>
          <rootElement name="SMP" namespace="http://xmlns.oracle.com/pcbpel/tstSchema/SMP"/>
        </target>
      </mapTargets>
      <!-- GENERATED BY ORACLE XSL MAPPER 10.1.2.0.2(build 060111.0746) AT [TUE OCT 31 08:47:08 CST 2006]. -->
    ?>
    <xsl:stylesheet version="1.0" xmlns:ldap="http://schemas.oracle.com/xpath/extension/ldap" xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:tns="http://xmlns.oracle.com/pcbpel/tstSchema/SMP" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:ns0="http://www.w3.org/2001/XMLSchema" xmlns:orcl="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc" xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd" exclude-result-prefixes="xsl tns ns0 nxsd ldap xp20 bpws ora orcl">
      <xsl:template match="/">
        <tns:SMP>
          <xsl:for-each select="/tns:SMP/tns:smpRecords">
            <xsl:if test="tns:data1 = '56'">
              <tns:smpRecords>
                <tns:data1>
                  <xsl:value-of select="tns:data1"/>
                </tns:data1>
                <tns:data2>
                  <xsl:value-of select="tns:data2"/>
                </tns:data2>
                <tns:emp>
                  <xsl:value-of select="tns:emp"/>
                </tns:emp>
              </tns:smpRecords>
            </xsl:if>
          </xsl:for-each>
        </tns:SMP>
      </xsl:template>
    </xsl:stylesheet>and here is the out I get
    <part   name="SMP" >
    <SMP/>
    </part>Any ideas what might be wrong in the xsl itself.
    Thanks

  • Need to download a file which si space delimted and has fixed length char

    Hi,
    I have a custom report which downloads an output file in text format.I need the contents to be space delimited.My file data contains numbers as well as characters.I ahve pased the parameter WRITE_FIELD_SEPARATOR = ' ' in the FM.Hwoever the space is introduced only oif the column value is a character.If its a number/digit,the columns are not seperated by space.
    Now my data appears like that:
    0000101310179.28 +0827200808 DHLBSRF VISA AUG 2008US021SW111 RYAN,BICOVNY
    I want my data to be like this :
    0000101310 179.28 + 0827200808 DHLBSRF VISA AUG 2008 US02 1SW111 RYAN,BICOVNY
    DO I need to pass any additinal parametre?Also for fixed length characrets,do i need to pack/unpack data before passing to the FM ?
    Thanks.

    Hi,
    try this way.
    REPORT ztest_notepad.
    DATA: BEGIN OF it_download OCCURS 0,
           data TYPE string,
          END OF it_download.
    DATA: BEGIN OF it_vbrk OCCURS 0,
            vbeln TYPE vbrk-vbeln,
            fkart TYPE vbrk-fkart,
            fktyp TYPE vbrk-fktyp,
            netwr TYPE vbrk-netwr,
          END OF it_vbrk.
    DATA : l_netwr TYPE char21.
    "START-OF-SELECTION.
    START-OF-SELECTION.
      SELECT  vbeln
              fkart
              fktyp
              netwr
       FROM vbrk
       INTO CORRESPONDING FIELDS OF TABLE it_vbrk
       UP TO 100 ROWS.
      LOOP AT it_vbrk.
        l_netwr = it_vbrk-netwr.
        CONCATENATE it_vbrk-vbeln
                    it_vbrk-fkart
                    it_vbrk-fktyp
                    l_netwr
            INTO it_download-data
            SEPARATED BY space.
        APPEND it_download.
        CLEAR  it_download.
      ENDLOOP.
      CALL FUNCTION 'GUI_DOWNLOAD'
           EXPORTING
                filename = 'C:\test.txt'
                filetype = 'ASC'
           TABLES
                data_tab = it_download.
    Thanks
    Venkat.O

Maybe you are looking for