Problem in bodi

I have coded like this
$TEXT_LINE_VALUE = sql( 'ds_stage','SELECT text_line FROM MANAGEMENT_LONGTEXT where ROOT = 43004003');
in sql the value is having 1500 characters ,but in bodi it is returning 1020 characters only..
the length of $text_line_value is 8000 which I have declared (This may not be the problem),
I tried printing it like this too
print(   sql( 'ds_stage','SELECT text_line FROM MANAGEMENT_LONGTEXT where ROOT = 43004003') );(here is the real problem)
In the trace also I can see only 1020 characters...
what is the maximum limit a sql transform can return in bodi??

Try the same SELECT statement in SQL SERVER. (if that is your database). Copy and paste the retreived string into a notepad. It shows only 1020 characters.
Cannot blame BODI for this
What if the string length is more that 2040? How about this?
$G_String_Start = 1;
$G_String_Limit = 1020;
$G_String = '';
while($G_String_Limit <= 8000)
begin
$G_String = $G_String||sql('DATASTORE','SELECT substring(STRING, [$G_String_Start],[$G_String_Limit]) FROM STRING_TABLE');
$G_String_Start = $G_String_Start + 1020;
$G_String_Limit = $G_String_Limit + 1020;
end
print($G_String);
Regards,
Suneer.

Similar Messages

  • Problem with BODS and TERADATA bulkload Utilities

    Hi,
    While loading data into VARCHAR column by using MLOAD/FLOAD Bulkload utilities, we have observed that NULL values are getting loaded as BLANKS.
    It seems that this issue is happening only with CHAR/VARCHAR data. With all other data types like DATE or INTEGER, NULL values are getting loaded as NULLs only.
    I should have used "INDICATOR" if I am loading data through MLOAD Script directly, to handle this issue.
    But through BODS, I am not sure how I can handle the conversion of NULL values to BLANKS for CHAR/VARCHAR datatypes with MLOAD/FASTLOAD utilties.
    Any input on this issue is much appraciated.
    Regards,
    Sudhakar

    I had similar problem while migrating in one of my earlier projects. Hope you have tried following
    Full Rebuild of Index
    Install Archiver Replication Exception component
    Finally you can export part by part based on say Content Type and import on your QA.
    regards,
    deepak

  • Problem in retreiving string 1020 using ms sql  in BODI sql query

    I am taking a column from ms sql using select statement in bodi like
    $temp=sql('ds_stage',select x from table A where X>1);
    print('[$temp]');
    it is printing the value upto 1020 characters of my data,after that it is not showing the remaining data.
    I tried printing the sql statement directly in print statement rather than assigning it to a variable,
    I tried casting teh value in select statemet like cast(x as text) or varchar and more.. nothing works..
    no change in the result.
    is that problem with BODI ? same query give full 1500 characters in ms sql but it doesnt come in BODI
    I do not understand the problem.
    Thanks

    I assume from your message that you are attempting to
    deploy your application into OC4J - you're probably
    implicitly using the inbuilt OC4J if your using JSPs.
    If so, try placing the jdbc jars into the <JDEVHOME>\lib directory
    and referencing them from the j2ee\home\application.xml
    file:
    use lines like:
    <library path="../../../lib/msbase.jar" />
    regards, Karl

  • BODI XI crashes with signal 15 when attempting to select from DB2 on AIX.

    I have inherited the task, started 18 months ago, of upgrading from DI 6.1 to XI release 2. My predecessor set up an AIX evalution box to test the impact of the changes to DI, especially the handling of Nulls. As soon as we try extracting DB2 data on this box (using a query transform) we get a signal 15 error, and a core dump. The query can be as simple as selecting a single column from a single table into a template table with no where clause. An SQL function in a script also crashes.
    DB2 connect (version 7.1) is on the AIX evaluation box, and is working - I can go to the DB2 prompt, connect to a database and select data. Designer works with DB2, and I can create a new datastore, import metadata, and view data. Oracle to Oracle and oracle to XML work fine on the job server, DB2 to anything optimises the query then falls over.
    We thought that it may be a problem with the version of DB2 on the mainframe, but I've tried against DB2 OS/390 7.1.2 and against DB2/6000 7.2.4, both with the same result.
    As far as I can see all the environmental variables on the AIX box are OK. Most are the same as on the functioning development box, except for changes that are part of the XI install. One difference is in the libpath - the working box includes '/usr/opt/db2_08_01/lib', which does not exist!!!  The evalution box has '/usr/opt/db2_07_01/lib' instead, which does exist. - can a valid reference instead of an invalid one cause a problem?
    BODI 6.1 continues to work fine with DB2, as did 5.5 and 5.1.
    Anyone seen anything similar? Anyone got any clues as to what is happening?

    Which version of Data Integrator are you exactly migrating to ? It this is DI 11.7.x (XI Release 2 Accelerated) -> a big difference with DI 6.1 is that DI 11.7 is a 64-bit application now, hence also needs 64-bit versions of the database drivers. Could that be the issue ?
    I would definitely look into that direction to try to locate what's going on. You already indicated there is a difference in the libpath for the working and not-working environment. Maybe do some cleanup in the libpath to make sure DI will pick u the correct version.
    You could also open a case with support, they will be able to give you a faster response time and work with you to troubleshoot the issue.

  • BODS and Oracle RAC

    Do we know of any problems with BODS and Oracle Real Application Clusters architecture? For example, a RAC TNS entry would specify one service name but multiple hosts for load balancing and failover. In BODS the connections are specified in many places (web console, datastores, job server). As far as I remember in some of those places we do have to enter the host name. Would this disqualify BODS from benefiting from RAC or would it (even worse) cause problems? Any official note by SAP on BODS and Oracle RAC?
    Thanks.

    Hi Mahir,
    As far as I know it's only the web console that requires the hostname, however I am using DS XI 3.1 and when selecting database type Oracle in the web console there is a checkbox for 'Oracle RAC'. If you check this box then you do not require to enter the hostname.

  • BODS : Column delimiter errors on SAPR/3 datastore

    Hi All.
    Can anyone advise as to why this error comes up while we try to pull data from SAP R/3 TABLE.
    We are using a datastore which has the option to Generate & execute / direct download with a path defined locally on the BODS dev server.
    We dont see the error on production server.
    Can anyone advise as to how to resolve this : https://cw.sdn.sap.com/cw/ideas/2596
    I dont seem to understand... as to what exactly needs to be done for resolving this error.
    The workflow to be done to fix this... would be helpful.
    Thanks
    indu
    =========================================================
    ERROR ON BODS :
    3848     7508     FIL-080104     7/20/2011 6:42:52 PM     |Dataflow Test_WF|Reader New_R3DataFlow1
    3848     7508     FIL-080104     7/20/2011 6:42:52 PM     A column delimiter was seen after column number <15> for row number <1> in file <D:/bodi/ZR3TEST.DAT>. The total number of
    3848     7508     FIL-080104     7/20/2011 6:42:52 PM     columns defined is <15>, so a row delimiter should be seen after column number <15>. Please check the file for bad data, or
    3848     7508     FIL-080104     7/20/2011 6:42:52 PM     redefine the input schema for the file by editing the file format in the UI.

    Hi.
    Request help to resolve this problem of delimiters :
    We have this problem on BODS jobs when we use execute-preloaded option while using SAP R/3 data source. 
    This problem we see on a new table of sap R/3 which we are trying to use in our work flow.
    The existing jobs on sap R/3 tables do not have any problems.
    This is the error seen on error log :
    (12.1) 08-02-11 19:31:02 (E) (3968:4204) FIL-080105: |Dataflow DF_Zunbill_rev|Reader ZUNBILLREVENUE
                                                         A row delimiter was seen for row number <1> while processing column number <8> in file
                                                         <//172.10.16.69/bods_share/zunbill_rev.dat>. The row delimiter should be seen after <9> columns. Please check the file for bad
                                                         data, or redefine the input schema for the file by editing the file format in the UI.
    (12.1) 08-02-11 19:31:03 (E) (3968:4204) FIL-080105: |Dataflow DF_Zunbill_rev|Reader ZUNBILLREVENUE
                                                         A row delimiter was seen for row number <2> while processing column number <8> in file
                                                         <//172.10.16.69/bods_share/zunbill_rev.dat>. The row delimiter should be seen after <9> columns. Please check the file for bad
                                                         data, or redefine the input schema for the file by editing the file format in the UI.
    (12.1) 08-02-11 19:31:03 (E) (3968:4204) FIL-080105: |Dataflow DF_Zunbill_rev|Reader ZUNBILLREVENUE
                                                         A row delimiter was seen for row number <3> while processing column number <8> in file
                                                         <//172.10.16.69/bods_share/zunbill_rev.dat>. The row delimiter should be seen after <9> columns. Please check the file for bad
                                                         data, or redefine the input schema for the file by editing the file format in the UI.
    =======================================================================
    Can anyone advise as to how we resolve this.
    In this post : https://cw.sdn.sap.com/cw/ideas/2596 there is a suggestion.
    Since am relatively new to BODS / BW, am not understanding what is being said,
    as to use the replace sub string function.
    How do we include this function in the ABAP program ?
    iF Anyone can help on this, that would be great.
    Many thanks.
    indu
    Edited by: Indumathy Narayanan on Aug 3, 2011 8:10 AM

  • BODI and automatic use of table alias

    I have a problem with BODI's automatic use of table alias as the same as the table name, when the table name is a reserved word.
    I'm reading from an Informix database, where I've got a table named aggregate. This is a reserved word and gives me problems when BODI is generating the optimized SQL for my select statement.
    The generated SQl would look like this (simplified):
    SELECT  aggregate.aggr_id
    FROM informix.aggregate aggregate
    This will fail (I'm using an odbc connection), due to syntax error.
    Running this within Aqua Studio will also fail. Changing the table alias to aggr will work fine.
    My question is how I can prevent or owerride BODI's use of aggregate as the table alias in this case.

    Have you tried the Templates?
    1. Select Tools > General Options
    2. Expand Naming Standards and select Templates
    3. Set the template structure you want to use. I used abbreviation (table) or short name(entity) here. i.e use the "Add Variable button to see the options available and add as required. In this instance I'd suggest using the abbreviation e.g. for the primary key I have {table abbr}_PK. Note that you can use "substr" here too.
    4. Apply the change and go to the model.
    Now these template work in 3 different ways.
    1. When transforming or forward engineering the logical to relational models, the templates are applied to the key creation.
    2. In the Relational diagram when drawing new relationships between tables or adding new constraints.
    3. After the fact, if you apply the templates. Either 1 at a time or globally.
    a. To update a single table: To do this select any table and invoke the property palette. Select the Naming Rules button. Check the rules you want to update and click OK. The templates are now applied to your table, renaming the keys.
    b. To update multiple tables, select the relational model mode int he Browser, right-click for the context menu and select "Apply Naming Standards" This will update all the items in the model using the template structure set. Please note, regrettably this last (3b), does not work in the latest patch release, but if you are on the initial production release, then the tables are all updated. This has been bugged and fixed and so will be rectified in the next release.
    Regards
    Sue

  • Add ship-to-party company data in ZXRSAU02

    Hi,
    I got the following problem. The customer master data is extracted via 3 extractors into our BODS system:
    - 0CUSTOMER_ATTR - customer basic data, KNA1 table
    - 0CUST_COMPC_ATTR - customer company data, KNB1 table
    - 0CUST_SALES_ATTR - customer sales data, KNVV table
    Ship-to-parties do not and will never have company related data (KNB1 table), therefore there will never be data in the extractor 0CUST_COMPC_ATTR. At the moment, this is causing problem in BODS because company related data is required at the moment.
    I'm looking for a short term solution in ZXRSAU02 user-exit, to add a new (empty) company record to 0CUST_COMPC_ATTR, while I'm processing the 0CUST_SALES_ATTR extractor. I need only the customer number and company data, and these ones can be found in the sales data.
    We will switch to full load mode of course, that will be not a problem.
    Is it possible to add a record to a different extractor, that I'm processing?
    Thank you
    Tamas

    Hi Tamas,
    I don't think you are able to add a record to 0CUST_COMPC_ATTR while processing 0CUST_SALES_ATTR. If you want to add a record to 0CUST_COMPC_ATTR, then you have to do it here in Enhancement RSAP0001 or BAdI RSU5_SAPI_BADI.
    Alternatively, you could create a Generic DataSource (e.g. Function Module) to fetch this specific group of Ship-to Parties. It will be even more transparent from a data staging perspective,
    Best regards,
    Sander

  • Facing problem which starting a real time services BODS Management Console

    Hello All ,
    I am facing a issue while starting the real time services from managment console
    Error Log
    Log: error_10_05_2011.log 
    (12.2) 10-05-11 11:05:55 (E) (1700:2324) Unknown: SP(NewService2, INDRMD36Q2:3501):flowThread() could not start real time job (BODI-300101)
    List of congiurations done
    1) Access Server configured and able to ping as well
    2)Real time job create in BODS designer and can see that in management console
    Note :
    ETL tool : BODS
    DB : Oracle
    Any help is highly aprreciated
    Thanks,
    Rishi

    Rishi -
    I think below URL can help you for the same.
    https://wiki.sdn.sap.com/wiki/display/BOBJ/Settingupthe+Service
    thx
    Deep

  • Bode Plot Problem - Multisim

    Hello
    I'm a new user of Multisym and I am trying to get a Bode Plot, where the input to the circuit is a current source (not a voltage source), please see the attached file. Any ideas?
    Best Regards,
    David
    Attachments:
    Simulation.ms12 ‏244 KB

    Hi David,
    In order to use the Bode Plotter tool with a current source:
    1. Place a current probe on the current source
    2. Connect the other end (output) of the current source to the input of the Bode plotter
    I have created that setup in your original file (see attached)
    Regards,
    Puneet Mehra
    Attachments:
    Simulation - modified.ms12 ‏846 KB

  • BODI 11.7.3 - Custom Function Problem

    Could someone please tell me what I am doing wrong here? I am hitting walls each time I think I have it right.
    I wrote a custom function to select min(record id) from a list of about 15000 records where the record id may match many other fact ids.
    I am using BODI V 11.7.3 with parameters and variables declared all over the place.  I am able to get only 1 record to return when I know I should get over 2000 to return.
    I have all screen shots and details available via word doc for additional assistance. But let me lay out the custom function:
    $p_i_last_used = lookup_ext([table, 'no_cache', 'min'], [interaction_id], [null], [call_fact_id,'=',$in_call_fact_id, row_id, '=', $in_row_id, interaction_id, '<>' $p_i_last_used], [interaction_id], [$out_interaction_id]);
    return $p_i_last_used  || $out_interaction_id;
    On the left side I have parameters set up
    - anything with "in" is inward
    - "out" is outward
    - $p_i_last_used is in/out
    Then I go back into my Work Flow - declare variables and parameters.  Then set up my lookup function call within the query look up to take in the Call_Fact_ID, ROW_ID, and set $p_i_last_used as -1 or 0.
    I am able to see only 1 record return. Like it is not going thru all 15K records.
    TIA.
    Edited by: Margot Bowen on Nov 20, 2008 1:29 AM

    1. Yes, 12.2 finally suports the rfc.ini file, one reason was for the load balancing.
    2. Yes, you are right, one datastore is bound to one application server in 11.7. However, this one apllication server could submit the ABAP as a spool job rather than executing it in dialog mode and then you have your load balancing again. Checkout the datastore property "execute in background".

  • Problem with mail displaying message bodies

    I'm having problems with Mail displaying the body of an email. It will show the headers and that's all. I've turned on the raw format and can see everything so I know it's getting the emails ok.
    I'm running my own mail server using IMAP. I also use two other email clients. Squirrelmail and Thunderbird on Windows 7. Both Squirrelmail and Thunderbird display the emails fine, but Mail on my Mac doesn't work.
    Any suggestions???
    Thanks!!

    Anyone have anything on this??

  • IPhone 5 locksreen is green. Do any bod have the same problem?

    When my iphone is locked and i press the homebutton i get a green shine under the slider. Is this normal or should i send my iphone back?

    Battery life will depend heavily on what you're doing with it. The advertised battery life is a maximum, achievable through extreme measures like turning off wifi and Bluetooth, turning the screen brightness to minimum, turning the sound off and running only very low-demand apps. If you're getting up to 6 hours while not maximizing your power-savings, you're not seeing anything unusual.

  • Bods problem

    i was taken source datasource as bw and target as hana   and schema in hana is my own created..the replication will be successfull...
    i waas taken source datasource as ecc and target as hana and schema in hana is my own created but replication is failed it is showing error like below screenshot..please help

    Is the SLT RFC connection working fine ?

  • Can any bod sol thıs problem?

    Hi..I wore some text editor ..and found some codes for highlighting ...My text editor has menu bar and 3 menus..Open ,save and exit..it works well. but in cods of highlighting there is a window too whit out any menubar..ext..I want to use my window with menubar instead of this window...i tryed to connecet them ..but allways i see window of SyntaxText class... What I must do? My class which i wrote JText ..i must delete some thing but i couldnt find..does any body can help me?
    import javax.swing.*;
    import javax.swing.text.*;
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.io.File;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.util.*;
    class SyntaxTest extends DefaultStyledDocument
    Element rootElement;
    String wordSeparators = ",:;.()[]{}+-/*%=!&|~^@? ";
    Vector keywords = new Vector();;
    SimpleAttributeSet keyword;
    public SyntaxTest()
    rootElement= this.getDefaultRootElement();
    keyword = new SimpleAttributeSet();
    StyleConstants.setForeground(keyword, Color.blue);
    keywords.add( "abstract" );
    keywords.add( "boolean" );
    keywords.add( "break" );
    keywords.add( "byte" );
    keywords.add( "case" );
    keywords.add( "catch" );
    keywords.add( "char" );
    keywords.add( "class" );
    keywords.add( "continue" );
    keywords.add( "default" );
    keywords.add( "do" );
    keywords.add( "double" );
    keywords.add( "else" );
    keywords.add( "extends" );
    keywords.add( "false" );
    keywords.add( "final" );
    keywords.add( "finally" );
    keywords.add( "float" );
    keywords.add( "for" );
    keywords.add( "if" );
    keywords.add( "implements" );
    keywords.add( "import" );
    keywords.add( "instanceof" );
    keywords.add( "int" );
    keywords.add( "interface" );
    keywords.add( "long" );
    keywords.add( "native" );
    keywords.add( "new" );
    keywords.add( "null" );
    keywords.add( "package" );
    keywords.add( "private" );
    keywords.add( "protected" );
    keywords.add( "public" );
    keywords.add( "return" );
    keywords.add( "short" );
    keywords.add( "static" );
    keywords.add( "super" );
    keywords.add( "switch" );
    keywords.add( "synchronized" );
    keywords.add( "this" );
    keywords.add( "throw" );
    keywords.add( "throws" );
    keywords.add( "true" );
    keywords.add( "try" );
    keywords.add( "void" );
    keywords.add( "volatile" );
    keywords.add( "while" );
    public void insertString(int offset, String str, AttributeSet a) throws BadLocationException
    super.insertString(offset, str, a);
    int startOfLine = rootElement.getElement(rootElement.getElementIndex(offset)).getStartOffset();
    int endOfLine = rootElement.getElement(rootElement.getElementIndex(offset+str.length())).getEndOffset() -1;
    //highlight the changed line
    highlightKeyword(this.getText(0,this.getLength()), startOfLine, endOfLine);
    public void remove(int offset, int length) throws BadLocationException
    super.remove(offset, length);
    int startOfLine = rootElement.getElement(rootElement.getElementIndex(offset)).getStartOffset();
    int endOfLine = rootElement.getElement(rootElement.getElementIndex(offset+length)).getEndOffset() -1;
    //highlight the changed line
    highlightKeyword(this.getText(0,this.getLength()), startOfLine, endOfLine);
    public void highlightKeyword(String content,int startOffset, int endOffset)
    char character;
    int tokenEnd;
    while (startOffset < endOffset)
    tokenEnd = startOffset;
    //find next wordSeparator
    while(tokenEnd < endOffset)
    character = content.charAt(tokenEnd);
    if(wordSeparators.indexOf(character) > -1)
    break;
    else
    tokenEnd++;
    //check for keyword
    String token = content.substring(startOffset,tokenEnd).trim();
    if(keywords.contains(token))
    this.setCharacterAttributes(startOffset, token.length(), keyword, true);
    startOffset = tokenEnd+1;
    public class JText extends JFrame{
         private JTextPane textarea ;
         private JFileChooser fileChooser = new JFileChooser();
    private Action open =new OpenAction() ;
    private Action save = new SaveAction();
    private Action exit = new ExitAction();
    public static void main(String args[])
         JFrame f = new JFrame();
         JTextPane pane = new JTextPane(new SyntaxTest());
         JScrollPane scrollPane = new JScrollPane(pane);
         f.setContentPane(scrollPane);
         f.setSize(600,400);
         f.setVisible(true);
         //Text Area
         public JText(){
         JPanel content = new JPanel();
         //Menu Bar
    JMenuBar menu=new JMenuBar();
    JMenu file=menu.add(new JMenu("FILE"));
    file.setMnemonic('F');
    file.add(open);
    file.add(save);
    file.addSeparator();
    file.add(exit);
    setContentPane(content);
    setJMenuBar(menu);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setTitle("Project");
    pack();
    setLocationRelativeTo(null);
    setVisible(true);
         class OpenAction extends AbstractAction {
         //============================================= constructor
         public OpenAction() {
         super("Open...");
         putValue(MNEMONIC_KEY, new Integer('O'));
         //========================================= actionPerformed
         public void actionPerformed(ActionEvent e) {
         int retval = fileChooser.showOpenDialog(JText.this);
         if (retval == JFileChooser.APPROVE_OPTION) {
         File f = fileChooser.getSelectedFile();
         try {
         FileReader reader = new FileReader(f);
         textarea.read(reader, ""); // Use TextComponent read
         } catch (IOException ioex) {
         System.out.println(e);
         System.exit(1);
              class SaveAction extends AbstractAction {
              //============================================= constructor
              SaveAction() {
              super("Save...");
              putValue(MNEMONIC_KEY, new Integer('S'));
              //========================================= actionPerformed
              public void actionPerformed(ActionEvent e) {
              int retval = fileChooser.showSaveDialog(JText.this);
              if (retval == JFileChooser.APPROVE_OPTION) {
              File f = fileChooser.getSelectedFile();
              try {
              FileWriter writer = new FileWriter(f);
              textarea.write(writer); // Use TextComponent write
              } catch (IOException ioex) {
              JOptionPane.showMessageDialog(JText.this, ioex);
              System.exit(1);
                   class ExitAction extends AbstractAction {
                   //============================================= constructor
                   public ExitAction() {
                   super("Exit");
                   putValue(MNEMONIC_KEY, new Integer('X'));
                   //========================================= actionPerformed
                   public void actionPerformed(ActionEvent e) {
                   System.exit(0);
    }

    import javax.swing.*;
    import javax.swing.text.*;
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.io.File;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.util.*;
    class SyntaxTest extends DefaultStyledDocument
    Element rootElement;
    String wordSeparators = ",:;.()[]{}+-/*%=!&|~^@? ";
    Vector keywords = new Vector();;
    SimpleAttributeSet keyword;
    public SyntaxTest()
    rootElement= this.getDefaultRootElement();
    keyword = new SimpleAttributeSet();
    StyleConstants.setForeground(keyword, Color.blue);
    keywords.add( "abstract" );
    keywords.add( "boolean" );
    keywords.add( "break" );
    keywords.add( "byte" );
    keywords.add( "case" );
    keywords.add( "catch" );
    keywords.add( "char" );
    keywords.add( "class" );
    keywords.add( "continue" );
    keywords.add( "default" );
    keywords.add( "do" );
    keywords.add( "double" );
    keywords.add( "else" );
    keywords.add( "extends" );
    keywords.add( "false" );
    keywords.add( "final" );
    keywords.add( "finally" );
    keywords.add( "float" );
    keywords.add( "for" );
    keywords.add( "if" );
    keywords.add( "implements" );
    keywords.add( "import" );
    keywords.add( "instanceof" );
    keywords.add( "int" );
    keywords.add( "interface" );
    keywords.add( "long" );
    keywords.add( "native" );
    keywords.add( "new" );
    keywords.add( "null" );
    keywords.add( "package" );
    keywords.add( "private" );
    keywords.add( "protected" );
    keywords.add( "public" );
    keywords.add( "return" );
    keywords.add( "short" );
    keywords.add( "static" );
    keywords.add( "super" );
    keywords.add( "switch" );
    keywords.add( "synchronized" );
    keywords.add( "this" );
    keywords.add( "throw" );
    keywords.add( "throws" );
    keywords.add( "true" );
    keywords.add( "try" );
    keywords.add( "void" );
    keywords.add( "volatile" );
    keywords.add( "while" );
    public void insertString(int offset, String str, AttributeSet a) throws BadLocationException
    super.insertString(offset, str, a);
    int startOfLine = rootElement.getElement(rootElement.getElementIndex(offset)).getStartOffset();
    int endOfLine = rootElement.getElement(rootElement.getElementIndex(offset+str.length())).getEndOffset() -1;
    //highlight the changed line
    highlightKeyword(this.getText(0,this.getLength()), startOfLine, endOfLine);
    public void remove(int offset, int length) throws BadLocationException
    super.remove(offset, length);
    int startOfLine = rootElement.getElement(rootElement.getElementIndex(offset)).getStartOffset();
    int endOfLine = rootElement.getElement(rootElement.getElementIndex(offset+length)).getEndOffset() -1;
    //highlight the changed line
    highlightKeyword(this.getText(0,this.getLength()), startOfLine, endOfLine);
    public void highlightKeyword(String content,int startOffset, int endOffset)
    char character;
    int tokenEnd;
    while (startOffset < endOffset)
    tokenEnd = startOffset;
    //find next wordSeparator
    while(tokenEnd < endOffset)
    character = content.charAt(tokenEnd);
    if(wordSeparators.indexOf(character) > -1)
    break;
    else
    tokenEnd++;
    //check for keyword
    String token = content.substring(startOffset,tokenEnd).trim();
    if(keywords.contains(token))
    this.setCharacterAttributes(startOffset, token.length(), keyword, true);
    startOffset = tokenEnd+1;
    public class JText extends JFrame{
    private JTextPane textarea ;
    private JFileChooser fileChooser = new JFileChooser();
    private Action open =new OpenAction() ;
    private Action save = new SaveAction();
    private Action exit = new ExitAction();
    public static void main(String args[])
    JFrame f = new JFrame();
    JTextPane pane = new JTextPane(new SyntaxTest());
    JScrollPane scrollPane = new JScrollPane(pane);
    f.setContentPane(scrollPane);
    f.setSize(600,400);
    f.setVisible(true);
    //Text Area
    public JText(){
    JPanel content = new JPanel();
    //Menu Bar
    JMenuBar menu=new JMenuBar();
    JMenu file=menu.add(new JMenu("FILE"));
    file.setMnemonic('F');
    file.add(open);
    file.add(save);
    file.addSeparator();
    file.add(exit);
    setContentPane(content);
    setJMenuBar(menu);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setTitle("Project");
    pack();
    setLocationRelativeTo(null);
    setVisible(true);
    class OpenAction extends AbstractAction {
    //============================================= constructor
    public OpenAction() {
    super("Open...");
    putValue(MNEMONIC_KEY, new Integer('O'));
    //========================================= actionPerformed
    public void actionPerformed(ActionEvent e) {
    int retval = fileChooser.showOpenDialog(JText.this);
    if (retval == JFileChooser.APPROVE_OPTION) {
    File f = fileChooser.getSelectedFile();
    try {
    FileReader reader = new FileReader(f);
    textarea.read(reader, ""); // Use TextComponent read
    } catch (IOException ioex) {
    System.out.println(e);
    System.exit(1);
    class SaveAction extends AbstractAction {
    //============================================= constructor
    SaveAction() {
    super("Save...");
    putValue(MNEMONIC_KEY, new Integer('S'));
    //========================================= actionPerformed
    public void actionPerformed(ActionEvent e) {
    int retval = fileChooser.showSaveDialog(JText.this);
    if (retval == JFileChooser.APPROVE_OPTION) {
    File f = fileChooser.getSelectedFile();
    try {
    FileWriter writer = new FileWriter(f);
    textarea.write(writer); // Use TextComponent write
    } catch (IOException ioex) {
    JOptionPane.showMessageDialog(JText.this, ioex);
    System.exit(1);
    class ExitAction extends AbstractAction {
    //============================================= constructor
    public ExitAction() {
    super("Exit");
    putValue(MNEMONIC_KEY, new Integer('X'));
    //========================================= actionPerformed
    public void actionPerformed(ActionEvent e) {
    System.exit(0);
    }

Maybe you are looking for

  • HT4847 Viewing camera roll on iCloud

    How do I view my camera roll on iCloud so I can delete part, but not all of it?

  • Down Payment Process in Asset Accountng

    Hi, I want to know , what is the process of Down Payment in Asset Accounting I know the Tcodes, but i want to know what happens in each Tcode level F-47 next F-48 next F-90 next F-54 next AIAB next AIBU Pls send me Rgds sunfico

  • Animating a line graph

    Dear javafx coders I am a physics teacher in London and I am trying to learn JFX so that I can make animations for use in lessons. I don't know much about programming, but so far I have successfully managed to animate a circle which oscillates up and

  • Script for Place PDF file into a InDesign file

    Hi everyone, i need to import a PDF file into a InDesign document and in order to do this i used scripts found over  the net (e.g. Zanelli's script ecc.) but i tried this solution: function(){     app.scriptPreferences.userInteractionLevel = UserInte

  • Converting segments of MS Word doc to lists.

    I am pasting MS Word docs into my web page. There are segments of the doc that have names, placed initially by setting and using the tab key. there may be 3 columns of first and last names. HOW... can I align these when I copy them.  This must be a c