MaskFormatter with variable length

I'm trying to create a MaskFormatter with the following mask:
"AAAA AAAA AAAA AAAA"
The user should be able to enter whatever he likes as long as it is automatically formatted with a space between each group.
Valid combinations are:
1234 45
12
FF12 5454 546
etc...
Further on, small letters should be converted to Uppercase when typing. How do I do this?
I have already tried to write a custom VariableMaskFormatter as described in (http://forum.java.sun.com/thread.jspa?forumID=57&threadID=461577&start=3)
but I doesn't work as expected.
It only works if the placeholdercharacter which is used is also an allowed charachter when typing. But I don't want to make the space character an allowed character.
How can this be solved?
Thanks
Fabian

Thank you. I have been able to create a custom MaskFormatter which will dynamically adapt the mask based on what was entered.
But I still have two open issues:
1. How can I do so that all smaller letters are converted to captital letters when typing? Normally you would use the letter "U" in the mask, but, users should be able to enter a alphanumeric character, so I use "A" instead.
2. Cursor problem:
- How can I make delete and backspace button act as if it was in a notepad? If I press delete, charachters at the right from the cursor should be deleted and the cursor should not move forward.
Please find below some code samples.
package test.component;
import java.text.ParseException;
import javax.swing.text.MaskFormatter;
public class VariableLengthMaskFormatter extends MaskFormatter {
    public VariableLengthMaskFormatter() {
        super();
    public VariableLengthMaskFormatter(String mask) throws ParseException {
        super( mask );
     * Override the setMask method
    public void setMask(String mask) throws ParseException {
        super.setMask(mask);
     * Update our blank representation whenever the mask is updated.
    public void setPlaceholderCharacter(char placeholder) {
      super.setPlaceholderCharacter(placeholder);
    /* (non-Javadoc)
     * @see javax.swing.text.MaskFormatter#stringToValue(java.lang.String)
    public Object stringToValue( String value ) throws ParseException {
        Object rv;
        // Get the mask
        String mask = getMask();
        if ( mask != null ) {
            // Change the mask based upon the string passed in
            setMask( getMaskForString( mask, value ) );
            // Using the substring of the given string up to the mask length,
            // convert it to an object
            rv = super.stringToValue( value.substring( 0, getMask().length() ) );
            // Change mask back to original mask
            setMask( mask );
        } else
            rv = super.stringToValue( value );
        // Return converted value
        return rv;
     * Answer what the mask should be for the given string based on the
     * given mask. This mask is just the subset of the given mask up to
     * the length of the given string or where the first placeholder
     * character occurs in the given string. The underlying assumption
     * here is that the given string is simply the text from the
     * formatted field upon which we are installed.
     * @param value The string for which to determine the mask
     * @return A mask appropriate for the given string
    protected String getMaskForString( String mask, String value ) {
        StringBuffer sb = new StringBuffer();
        int maskLength = mask.length();
        char placeHolder = getPlaceholderCharacter();
        for (int k = 0, size = value.length(); k < size && k < maskLength ; k++) {
            if ( placeHolder == value.charAt( k ) ) {
                //break;
                sb.append(' ');               
            } else {
                sb.append( mask.charAt( k ) );
        return sb.toString();
         MaskFormatter theRekFormat = null;
         try {
             theRekFormat = new VariableLengthMaskFormatter( "AAAA AAAA AAAA AAAA" );
             theRekFormat.setPlaceholderCharacter(' ');
             theRekFormat.setValueContainsLiteralCharacters( false);
         } catch (Exception ex) {
             System.out.println(ex.toString());
         JFormattedTextField myMaskAccount = new JFormattedTextField(theRekFormat);
          myMaskAccount.addKeyListener(new KeyAdapter(){
                        public void keyReleased(KeyEvent ke){
                          if(ke.getKeyCode() == KeyEvent.VK_DELETE) {
                              myMaskAccount.setCaretPosition(myMaskAccount.getCaretPosition()-1);
                          } else {
                              System.out.println("listening to key: " + ke.getKeyCode());
                          }}});

Similar Messages

  • How to deal with variable length data struct in C/JNI

    I have another JNI related question. How do you handle variable length
    data structures in Java and pointer to a pointer?
    Basically, I have a backend in C which has records but we don't know
    how many. The API looks like
    typedef struct rec_list_s {
    int rec_list_cnt;
    rec_list_data_t rec_list_data[1];
    } rec_list_t;
    int rec_list_show(void handle, rec_list_t *list_ptr);
    /* Code snippet for rec_list_show */
    int rec_list_show(void handle, rec_list_t *list_ptr)
    rec_list_t *ptr;
    sz = sizeof (rec_list_t) +
    ((record_count - 1) * sizeof (rec_list_data_t));
    ptr = malloc(sz);
    /* fill the data */
    *list_ptr = ptr;
    return (0);
    So I need to wrap rec_list_show() in JNI call so I can have Java call
    it. How do i pass a pointer to a pointer from Java? I tried in the
    native C code for JNI to return the pointer to pointer as a result
    and store in a member in the Java class rec_list_t and then I pass
    that to JNI call for rec_list_show. The C backend code was fine
    since it got the pointer to pointer but Java become unhappy when
    the object it was referencing changed memory location (I suspect
    the garbage collection becomes unhappy).
    So what would be a good way to deal with this kind of code?
    Thanks,
    Sunay
    Edited by: st9 on Aug 30, 2010 5:47 PM

    I did not imply that you don't know C but you are implying that I don't understand C. Perhaps
    google Sunay Tripathi and click I am feeling lucky so that we don't get into teaching C
    discussions :) On the other hand, I am definitely looking for someone to teach me Java
    otherwise I wouldn't be asking.
    Anyway, let me explain again. The sample function rec_list_show() runs on the backend. It
    is a different process with a different VM space. It of course knows the size of the array
    and what to fill in. As a caller to that API (which is a separate process), I don't know
    what that size is but I need to get the size and corresponding data in one shot because
    the backend locks the table when its providing me the info to make sure its synchronous.
    Now I (the Java process) needs to get that count and data in one shot. Since the C library
    underneath me (wrapped around my JNI interface) has private IPC mechanism to copy
    the contiguous memory from the backend into my memory space, all I need is to provide
    a pointer to a pointer which gets filled in by backend and is available to my process. So
    my equivalent C frontend just passes a pointer to a pointer and casts the return value in
    rec_list_t. The rec_list_cnt tells it how many members it got. The first member is part of
    the struct itself but then following members are right after.
    Another way to help you understand this is with this code snippet from front end C program
    rec_list_t     *ptr, *save_ptr;
    rec_list_data_t *data_ptr;
    int          cnt;
    save_ptr = ptr = malloc(sizeof(rec_list_t));
    rec_list_show(handle, &ptr);
    assert(save_ptr != ptr);
    cnt = ptr->rec_list_cnt;
    for (i = 0; i < cnt; i++) {
         data_ptr = &ptr->rec_list_data;
    Notice the assert(). Also notice the for loop. How do I expect to walk more that one
    member when rec_list_data is a fixed size array of one member?typedef struct rec_list_s {
         int               rec_list_cnt;
         rec_list_data_t          rec_list_data[1];
    } rec_list_t;
    Anyway, I do understand that Java will not allow me to get a reference to a long and
    how Java memory management works. But the JNI native implementation is C
    and I was wondering if people have managed to do some tricks there between C
    and Java.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to use datamerge with variable lengths of text?

    Hello,
    I'm looking for a way to automaticly format brochures from a database . I allready found out that datamerge lets you do this quite easily. But I encounter a problem when I use large amounts of text.
    How I see it, the only solution is to reserve enough space for the larges text in order to make all of the text appear in the document. But this leaves large open spaces and even blank pages in my document when I deal with less text.
    Is there a way to make the document adapt to the amount of text? So that Indesign creates more space for large amounts of text and erases blank pages when there is less text?
    Maybe Datamerge isn't the right solution for my problem, I'm open to suggestions.
    Thanks in advance!
    Iris

    I'm just finishing up a directory that I build with data merge and I have the problem of variable length business descriptions, as well as some have extra mailing addresses or websites. My solution is to do it in several steps with multiple files. I do a normal merge first (and I use a single record per page for this, but only bcause that allows me to create some alphabetical lists of business names and owners's names that I can key to a listing number), then I stitch together the individual stories into a single text thread that I copy/paste into place in the final document. If you have a lot of frames, Rorohiko.com has a nifty text stitch script that will help.
    One tip that helps with this method is to be sure you have a paragraph break at the end of each story so stiching the frames together maintains your paragraphs.

  • How to browse MQ queue with variable length messages?

    I am trying to browse messages on an Websphere MQ queue using PL/SQL and Oracle Gateway for Websphere MQ (both 11g2)
    However, the (XML) messages are of variable length: they can be less than 1k or over 100k.
    I found that the pgm.mqget procedure is overloaded, so if the message is longer than 32k, you need to use the PGM.MQGET_BUFFER, and else you use the RAW variable.
    However, in order to know the length, you’ll need to browse the message first, to get the message length.
    If I try to get a message using the buffer variable, and the messsage is 32k or shorter, the program aborts with
    ORA-28511: lost RPC connection to heterogeneous remote agent using SID= +<db_link_name>+
    ORA-06512: at "SYS.PGM", line 390
    ORA-06512: at "SYS.PGM", line 849
    If I try to browse a message longer than 32k using the RAW variable, the ‘mqget’ statement just hangs. I tried with and without setting the MQGMO option ‘mqgmo_acccept_truncated_message’.
    Any advise on how to solve this issue?
    Arnold

    I am trying to browse messages on an Websphere MQ queue using PL/SQL and Oracle Gateway for Websphere MQ (both 11g2)
    However, the (XML) messages are of variable length: they can be less than 1k or over 100k.
    I found that the pgm.mqget procedure is overloaded, so if the message is longer than 32k, you need to use the PGM.MQGET_BUFFER, and else you use the RAW variable.
    However, in order to know the length, you’ll need to browse the message first, to get the message length.
    If I try to get a message using the buffer variable, and the messsage is 32k or shorter, the program aborts with
    ORA-28511: lost RPC connection to heterogeneous remote agent using SID= +<db_link_name>+
    ORA-06512: at "SYS.PGM", line 390
    ORA-06512: at "SYS.PGM", line 849
    If I try to browse a message longer than 32k using the RAW variable, the ‘mqget’ statement just hangs. I tried with and without setting the MQGMO option ‘mqgmo_acccept_truncated_message’.
    Any advise on how to solve this issue?
    Arnold

  • Pieces with variable lengths and Packing

    We have a scenario where a fabric is received from production in rolls and after quality it is cut and stored in multiple pieces with multiple lengths. We need to identify each piece individually.
    After storing, these pieces are then packed in different handling units i.e. pallets, rolls, bales, etc. depending on the customer order instructions. These are then stored for delivery. The requirement is to identify each handling unit along with the individual pieces packed so that it any given time it is viewed how much fabric is available in pallets and pieces for delivery.
    Please let me know how this can be handled in MM.

    Thanks For your reply guys,the above mentioned Scenario has been catered and it in the following way:
    I did it with the help of multiple level packaging.
    I actually considered the Piece length as a Packing material .
    Then In Hu02 select the material to be packed and the mention the partial quantity as a length and pack it in considered packing material.
    And then in Pack HUs tab select all the piece lengths to be packed and click on (NEW HU Per*H) and enter their the final packing unit and pack it.The system allocate the handling unit and that is the pallet number.
    Finally that can be attached to the delivery order.

  • Form with variable length pages

    Hi,
    I have a form which has categories of data - some categories require many fields and some require only a handful of fields. I want to put each category on a single page. My Master Page has a graphic which serves as a background for all of the pages.
    Is there a way through Designer ES or JavaScript to vary the length of each page? Or, could I somehow assign the background graphic image to a variable so that if I have a different Master Page assigned to each category's page, the image can be stored once and somehow referenced by each page. (I want to avoid creating multiple copies of the image that are of varying lengths - this will take the file length unwieldly.)
    Thanks,
    Jeff

    I think the table would handle the layout and repetition of rows. But if some of the input fields are text input and some are checkboxes or another type, how would I get the right type of input on each row? Do you have an example where the backing bean dynamically builds components, that I could look at? Thanks.

  • How to tokenize a column with variable length string

    I have a question regarding tokenizing string in a column I have table like
    id list
    1 i love dogs
    2 i like cats and dogs
    and so on
    it should be converted to
    id list
    1 i
    1 love
    1 dogs
    2 i
    2 like
    2 cates
    2 and
    2 dogs
    How do I tokenize this? I tried using this code inside cursor and procedure
    SELECT id, regexp_substr(str, '[^ ]+', 1, level) TOKEN from test CONNECT by level <= length(regexp_replace (str, '[^ ]+')) + 1;
    but this is very slow when called from java. Is there any other alternative?
    Thanks

    69edfef1-01fd-49c3-b83d-ece76195d26c wrote:
    I have a question regarding tokenizing string in a column I have table like
    id list
    1 i love dogs
    2 i like cats and dogs
    and so on
    it should be converted to
    id list
    1 i
    1 love
    1 dogs
    2 i
    2 like
    2 cates
    2 and
    2 dogs
    How do I tokenize this? I tried using this code inside cursor and procedure
    SELECT id, regexp_substr(str, '[^ ]+', 1, level) TOKEN from test CONNECT by level <= length(regexp_replace (str, '[^ ]+')) + 1;
    but this is very slow when called from java. Is there any other alternative?
    Thanks
    The reason yours is slow is because you don't have sufficient connect by conditions to restrict the iterations properly...
    e.g. What you are doing...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 1 as id, 'i love dogs' list from dual union all
      2             select 2, 'i like cats and dogs' from dual union all
      3             select 3,'precipitevolissimevolmente' from dual)
      4  --
      5  --
      6  --
      7  SELECT id
      8        ,regexp_substr(list, '[^ ]+', 1, level) TOKEN
      9  from t
    10* CONNECT by level <= length(regexp_replace (list, '[^ ]+')) + 1
    SQL> /
            ID TOKEN
             1 i
             1 love
             1 dogs
             2 and
             2 dogs
             2 cats
             2 and
             2 dogs
             2 like
             1 dogs
             2 and
             2 dogs
             2 cats
             2 and
             2 dogs
             2 i
             1 love
             1 dogs
             2 and
             2 dogs
             2 cats
             2 and
             2 dogs
             2 like
             1 dogs
             2 and
             2 dogs
             2 cats
             2 and
             2 dogs
             3 precipitevolissimevolmente
             1 love
             1 dogs
             2 and
             2 dogs
             2 cats
             2 and
             2 dogs
             2 like
             1 dogs
             2 and
             2 dogs
             2 cats
             2 and
             2 dogs
    45 rows selected.
    And with additional connect by criteria...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 1 as id, 'i love dogs' list from dual union all
      2             select 2, 'i like cats and dogs' from dual union all
      3             select 3,'precipitevolissimevolmente' from dual)
      4  --
      5  --
      6  --
      7  SELECT id
      8        ,regexp_substr(list, '[^ ]+', 1, level) TOKEN
      9  from t
    10  CONNECT by level <= length(regexp_replace (list, '[^ ]+')) + 1
    11         and id = prior id
    12*        and prior sys_guid() is not null
    SQL> /
            ID TOKEN
             1 i
             1 love
             1 dogs
             2 i
             2 like
             2 cats
             2 and
             2 dogs
             3 precipitevolissimevolmente
    9 rows selected.

  • SQL Extract Variable String in Variable Position with Variable length from ntext field

    i want to extract a variable string from an ntext field. 
    Sample Data in Background_text (ntext)
    function changeFocus()  {         document.getElementById('skipContent').style.visibility = 'visible';         document.getElementById('flashContent').blur();        
    document.getElementById('skip').focus();  }  </script>    </head>  <body onload='hideDiv()'>    <div id="flashContent" align="center">     <object
    classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="700" height="440" id="Animation" align="middle">      <param name="movie"
    value="/assets/abc/images/abcdef.swf" />      <param name="quality" value="high" />
    I want to extract this data:      "/assets/abc/images/abcdef.swf"
    The string will always be preceded by value="     AND end in
    .swf"
    As a first attempt, I tried
    SELECT SUBSTRING([Background_text], CHARINDEX('value="/assets/', [background_text]) + 15, LEN(convert(varchar(max), background_text) -
    CHARINDEX('value="/assets/', [Background_text]) + 15) - 1)
    but I received this error
    Msg 245, Level 16, State 1, Line 1
    Conversion failed when converting the varchar value .......  to data type int
    This query won't completely accomplish what I want. Do you have a suggestion?
    Thanks.

    I'd add an extra bit of logic into the expression to only look for 'swf' AFTER the start of the string - it might be that you can guarantee that no occurrence of 'swf' will ever appear in the ntext, but who knows what might change in the future, and it's
    good practice to code defensively.
    SELECT
    SUBSTRING(
    Background_text,
    CHARINDEX('value="/assets/', background_text) + 6,
    CHARINDEX('.swf', SUBSTRING(
    Background_text,
    CHARINDEX('value="/assets/', background_text) + 6,
    LEN(cast(background_text as varchar(max)))
    ) + 4

  • Data plug-in for binary data with byte streams of variable length

    Hi there,
    I would like to write a data plug-in to read binary data from file and I'm using DIAdem 10.1.
    Each data set in my file consists of binary data with a fixed structure (readable by using direct access channels) and of a byte stream of variable length. The variable length of each byte stream is coded in the fixed data part.
    Can anyone tell me how my data plug-in must look like to read such kind of data files?
    Many thanks in advance!
    Kind regards,
    Stefan

    Hi Brad,
    thank you for the very quick response!
    I forgot to mention, that the data in the byte stream can actually be ignored, it is no data to be evaluated in DIAdem (it is picture data and the picture size varies from data set to data set).
    So basically, of each data set I would like to read the fixed-structure data (which is the first part of the data set) and discard the variable byte stream (last part of the data set).
    Here is a logical (example) layout of my binary data file:
    | fixedSize-Value1 | fixedSize-Value2 | fixedSize-Value3 (=length of byte stream) | XXXXXXXXXXXXX (byte stream)
    | fixedSize-Value1 | fixedSize-Value2 | fixedSize-Value3 (=length of byte stream) | XXXXXX (byte stream)
    | fixedSize-Value1 | fixedSize-Value2 | fixedSize-Value3 (=length of byte stream) | XXXXXXXXXXXXXXXXXXXX (byte stream)
    What I would like to show in DIAdem is only fixedSize-Value1 and fixedSize-Value2.
    ´
    If I understood right, would it be possible to set the BlockLength of each data set by assigning Block.BlockLength = fixedSize-Value3 and to use Direct Access Channels for reading fixedSize-Value1 and fixedSize-Value2 ?
    Thank you!
    Kind regards,
    Stefan

  • Bank statement: problem to load variable length field

    we have many bank accounts with different banks, and we would like to use the bank reconciliation module to do bank reconciliation.
    we have problem in load the MT940 bank statement. All these banks are providing so called standard SWIFT940 format, which not able to give fixed length field.
    we have problem on line 61 which have a lot of variable length fields.
    line 61 comprise of 7 fields, which are:
    A) Value date - fixed 6 chars.
    B) Entry date - fixed 4 chars.
    C) Credit/debit - variable 1-2 chars.
    D) Fund Code - fixed 1 char
    E) Transaction amount - variable 15 chars
    F) Transaction code/type - fixed 4 chars
    G) MID, cheque#, BIS - variable 16 chars
    How can we write the SQL Loader script if there is no delimiter, and the start position of the fields are not fixed?
    we can load A and B easily, but C onwards we will have problems.
    please help.
    INTO TABLE ce_stmt_int_tmp
    WHEN rec_id_no = '61'
    TRAILING NULLCOLS
    (rec_no RECNUM,
    rec_id_no POSITION(1:2) CHAR,
    column1 POSITION(4:9) CHAR,
    column2 POSITION(10:13) CHAR,
    column3 ??
    column4 ??
    column5 ??
    column6 ??
    column7 ??
    ------

    Hi Linda,
    As said by gupta, please check, whether the bank statement has the statement 62F:
    If not, please get the statement again from bank and ensure that the end statement 62F exists in the statement..
    This will help you to overcome your problem..
    Regards,
    Praisty

  • Problem in sending a variable length string

    Hello friends,
    I have created a scenario as follows.
    Our
    Application ==>(SOAP) ==> XI  ==> (RFC) ==> SAP TABLE.
    I am sending a record with one of the fields of the type 'VARILRAW'
    When I send this, it is sending me a response that it was inserted in the table succesfully, But when I try to retrieve, all fields get returned correctly, but not this variable length field. This sends me back a huge string of letter 'A's.
    Here is what I see on SXMB_MONI
    The following shows that for insertion, the proper data is coming in XML format.
    ===============================================
      <?xml version="1.0" encoding="UTF-8" ?>
    - <ns1:ZBAPI_ADD_CONFIG_DNA xmlns:ns1="urn:sap-com:document:sap:rfc:functions">
    - <CONFIG_DNA_DATA>
      <CONFIG_ID>4607.1164846986188077.494</CONFIG_ID>
      <STRING_NAME>USC1</STRING_NAME>
      <STRING_FORMAT>TXT</STRING_FORMAT>
      <STRING_VALUE>ONE,TWO,THREE,FOUR</STRING_VALUE>
      <OBJECT_NAME>TEMP</OBJECT_NAME>
      </CONFIG_DNA_DATA>
      </ns1:ZBAPI_ADD_CONFIG_DNA>
    =================================================
    When I try to search for the same data again using the Key field CONFIG_ID,
    I am getting back the following. Notice that all fields are coming back with right data but for STRING_VALUE, which is coming as a long string of As
    ====================================================
      <?xml version="1.0" encoding="UTF-8" ?>
    - <ns1:SEARCH_CONFIG_DNA_RESPONSE xmlns:ns1="http://cincom.com/config">
    - <RETMSG>
      <RETURNMESSAGE>1 Records found</RETURNMESSAGE>
      <SUBRC>0</SUBRC>
      </RETMSG>
    - <CONFIG_DATA>
    - <item>
      <CONFIG_ID>4607.1164846986188077.494</CONFIG_ID>
      <STRING_NAME>USC1</STRING_NAME>
      <STRING_FORMAT>TXT</STRING_FORMAT>
      <STRING_VALUE>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</STRING_VALUE>
      <OBJECT_NAME>TEMP</OBJECT_NAME>
      </item>
      </CONFIG_DATA>
      </ns1:SEARCH_CONFIG_DNA_RESPONSE>
    ========================================================
    Any help will be greatly appreciated.
    Thanks
    Ram

    go to RFC and insert a BREAK-POINT and check what do you receive in the field. if you receive same you send so its a problem of SAP Team.
    try this

  • Problem with variable name in ZXRSRTOP include (virtual KF)

    Hi all,
    I am coding a routine to use a virtual key figure in the BEx.
    I have just a little problem with the name of a variable:
    as explained in the documentation, I created the variable with the prefix G_POS_, the name of the infocube and the name of the infoobject all together:
    DATA: G_POS_BC_ST_003_C_DIV__C_COMPAR   type i.
    The problem is that this variable name is longer than 30 characters, so the system doesn't accept it.
    Is there a workaround, other than changing the name of the infoobject (which is a navigational attribute)?
    Any help would be appreciated.
    Loï

    Hello Marc,
    I understand that I have to use a concatenate function and a dynamic call of the variable with (variable) instruction, but i do not understand how to implement it.
    the infocube name is BC_ST_003
    the characterisdtic name is C_DIV__COMPAR
    So, in the include ZXRSRTOP the statement
    DATA : G_POS_BC_ST_003_C_DIV__COMPAR
    does not work due a length problem (see first post)
    But in the same include the statement
    +DATA: l_global_name type c.
    concatenate 'GPOS' 'BC_ST_003' 'C_DIV__C_COMPAR' into l_global_name separated by '_'.+
    drives to the following error : statement is not accessible.
    Could u please provide me with an example of the code in the include ZXRSRTOP, and in the include ZXRSRZZZ for the use of this variable.
    Thanks in advance.
    Loï

  • How to handle flat file with variable delimiters in the file sender adapter

    Hi friends,
    I have some flat files in the ftp server and hope to poll them into XI, but before processing in XI, I hope to do some content conversion in the file sender adapter, according to the general solution, I just need to specify the field names, field seperator, end seperator, etc. But the questions is:
    The fileds in the test data may have different amount of delimiters (,), for example:
    ORD01,,,Z4XS,6100001746,,,,,2,1
    OBJ01,,,,,,,,,,4,3     
    Some fileds only have 1 ',' as the delimiter, but some of them have multiple ','.
    How can I handle it in the content conversion?
    Regards,
    Bean

    Hi Bing,
    Plz do refer the following blogs u will get an idea:
    File content conversion Blogs
    /people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1
    /people/venkat.donela/blog/2005/03/03/introduction-to-simple-file-xi-filescenario-and-complete-walk-through-for-starterspart2
    /people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion
    /people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file
    /people/shabarish.vijayakumar/blog/2005/08/17/nab-the-tab-file-adapter
    /people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1
    /people/venkat.donela/blog/2005/03/03/introduction-to-simple-file-xi-filescenario-and-complete-walk-through-for-starterspart2
    /people/venkat.donela/blog/2005/06/08/how-to-send-a-flat-file-with-various-field-lengths-and-variable-substructures-to-xi-30
    /people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file
    /people/shabarish.vijayakumar/blog/2005/08/17/nab-the-tab-file-adapter
    /people/jeyakumar.muthu2/blog/2005/11/29/file-content-conversion-for-unequal-number-of-columns
    /people/shabarish.vijayakumar/blog/2006/02/27/content-conversion-the-key-field-problem
    /people/michal.krawczyk2/blog/2004/12/15/how-to-send-a-flat-file-with-fixed-lengths-to-xi-30-using-a-central-file-adapter
    /people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion
    http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/content.htm
    Regards,
    Vinod.

  • How to save blob data (variable length string) in a customized table?

    Dear Friends
    I have written a very simple program to update table with 2 fields which
    looks as follows.
    ========================================================
    Table name ZTESTBLOBDATA
    Field         Key          Init    Data Element   Data Type  Length  
    ID          Checked                 ZID                 NUMC        2
    BLOB                                   ZBLOB           STRING       0
    =========================================================
    FOllowing is the sample program that I have written (Transaction SE38).
    =========================================================
    REPORT ZTESTBLOBPROG
    TABLES: ZTESTBLOBDATA
    data :  itab like ZTESTBLOPDATA occurs 1 with header line.
    select * from ztestblobdata into table itab.
    ztestblobdata-id  =   sy-dbcnt +1.
    ztestblobdata -blob = 'abcdefghijklmnopqrstuvwxyz.'.
    insert ztestblobdata.
    =========================================================
    When I try to save and activate the program, I get the following
    error message
    'ztestblopdata' must be a flat structure. You cannot use internal
    tables, strings, references, or structures as components.
    ==========================================================
    Using the data type STRING is a must since it is a variable length
    data which varies from few characters to few gig.
    How can go around this problem.
    Any feedback will be highly appreciated.
    PS. I have checked old postings on SDN, spoken to my ABAP contacts and also couple of instructors from SAP when I took XI courses but didn't get a satisfactory answers.
    Edited by: Ram Prasad on Oct 15, 2008 12:28 PM

    Thanks a lot for the response.
    The string that we are getting is from another application via netweaver XI integration and is being sent as a string which has to be saved in an SAP table. I am not sure if IDOC option will suit our needs, but will definitely read more about it.
    If there is any other suggestion of feedback I would appreciate it a lot.;
    Tks
    Ram

  • SQL*Loader and "Variable length field was truncated"

    Hi,
    I'm experiencing this problem using SQL*Loader: Release 8.1.7.0.0
    Here is my control file (it's actually split into separate control and data files, but the result is the same)
    LOAD DATA
    INFILE *
    APPEND INTO TABLE test
    FIELDS TERMINATED BY ','
    OPTIONALLY ENCLOSED BY '"'
    first_id,
    second_id,
    third_id,
    language_code,
    display_text VARCHAR(2000)
    begindata
    2,1,1,"eng","Type of Investment Account"
    The TEST table is defined as:
    Name Null? Type
    FIRST_ID NOT NULL NUMBER(4)
    SECOND_ID NOT NULL NUMBER(4)
    THIRD_ID NOT NULL NUMBER(4)
    LANGUAGE_CODE NOT NULL CHAR(3)
    DISPLAY_TEXT VARCHAR2(2000)
    QUESTION_BLOB BLOB
    The log file displays:
    Record 1: Warning on table "USER"."TEST", column DISPLAY_TEXT
    Variable length field was truncated.
    And the results of the insert are:
    FIRST_ID SECOND_ID THIRD_ID LANGUAGE_CODE DISPLAY_TEXT
    2 1 1 eng ype of Investment Account"
    The language_code field is imported correctly, but display_text keeps the closing delimiter, and loses the first character of the string. In other words, it is interpreting the enclosing double quote and/or the delimiter, and truncating the first two characters.
    I've also tried the following:
    LOAD DATA
    INFILE *
    APPEND INTO TABLE test
    FIELDS TERMINATED BY '|'
    first_id,
    second_id,
    third_id,
    language_code,
    display_text VARCHAR(2000)
    begindata
    2|1|1|eng|Type of Investment Account
    In this case, display_text is imported as:
    pe of Investment Account
    In the log file, I get this table which seems odd as well - why is the display_text column shown as having length 2002 when I explicitly set it to 2000?
    Column Name Position Len Term Encl Datatype
    FIRST_ID FIRST * | O(") CHARACTER
    SECOND_ID NEXT * | O(") CHARACTER
    THIRD_ID NEXT * | O(") CHARACTER
    LANGUAGE_CODE NEXT 3 | O(") CHARACTER
    DISPLAY_TEXT NEXT 2002 VARCHAR
    Am I missing something totally obvious in my control and data files? I've played with various combinations of delimiters (commas vs '|'), trailing nullcols, optional enclosed etc.
    Any help would be greatly appreciated!

    Use CHAR instead aof VARCHAR
    LOAD DATA
    INFILE *
    APPEND INTO TABLE test
    FIELDS TERMINATED BY ','
    OPTIONALLY ENCLOSED BY '"'
      first_id,
      second_id,
      third_id,
      language_code,
      display_text    CHAR(2000)
    )From the docu:
    A VARCHAR field is a length-value datatype.
    It consists of a binary length subfield followed by a character string of the specified length.
    http://download-west.oracle.com/docs/cd/A87860_01/doc/server.817/a76955/ch05.htm#20324

Maybe you are looking for

  • Regarding RESB table changes

    Hi.. I m working on one interface, in which i hav RESB extraction process. For the initial run of this interface all the records should be downloaded .But on subsequent execution i need only the changed records. The problem is there is no means for m

  • Browser upload window too large

    After downloading Yosemite, the drop down window that comes open when uploading files for emails or imessage is now so large that I can't see the Open or Cancel buttons.  How do I resize this?

  • Why can only use CS6 with loose elements on desktop?

    2 months of pulling my hair out and rebuilding hard drives, installing OX10.8.2 and CS6 multiple times.... no fix in sight. 10.8.2 only works with all files, loose on the desktop, CS6 InDesign, Photoshop, Acrobat etc, work fine. The moment any files

  • Macbook pro OS 10.6.8 bootcamp 3.0.4 cannot download drivers

    Trying again: i have spent hours searching the forums, and have even repaired disk (so clean start) no solution thus far. Trying to install windows 7 from USB, no cd. Using boocamp assistant, was able to partition drive.      two options: download so

  • Before & After

    How do I compare before and after adjustments to a photo?