Need help on search string in EBS
Hi,
We have a situation where multiple BAI transactions comes with same code, ex: 451 and based on the text in the note to payee they need to be posted to different clearing accounts.
I did config taking advantage of search string and posting rule in tareget field (EBVGINT)
For some reason getting an error message saying " Account symbol in account assignment not replaceable"
For example of CITI in the note to payee, my config is like this :
Created Account symbol CITI, Assigned GL account to account symbol CITI and account modifier as CITI too
Created posting key as CITI and posting rules are posting rule CITI , 40 (debit) post to bank accounting (option 1) for account symbol CITI and 50 (credit) post to bank as account symbol with posting to bank accounting (option 1) document type SA.
In the search string section, created a search string CITI with source (text from note to payee) and target as CITI (posting rule key)
then this searchs tring has been assigned to the company code, house bank, no algorithm, target field as posting rule and no prefix.
Can anybody explain me why i am getting the above error message based on this config ??
Thanks in advance
uma
Hi Uma,
The search string works this way:
Step 1: You define a search string. The search string should be a unique word or number or a combination which appears in the 88 record of the BAI statement. In the definition:
a. you give a name for the search string
b. a definition or long text
c. the search string - the unique word you want the system to search for in the 88 record. Please note that the search string you enter here should appear exactly in the same way in your bank statement.
d. you map this search string to a Posting rule or cost center or whatever you want to replace in the next step.
Step 2. Here you tell the system how this mapped information (in (d) above) is to be used. The mapped information could be used as a posting rule, as cost center, as profit center or in any way you want if you define your own logic.
The usage could be specific to a House bank, Account ID, Company code, BAI code combination or you can leave it as generic so that it will be used for all House Bank and Account ID in all company code.
But I would advise you to keep it very specific otherwise the results would not be what you want to be.
To answer your question: Also, do i need to add the entries in transaction type and assign them to the external transaction and posting rule ?
It is not required. But if you have assigned a posting rule under the Transaction type, the configuration in search string will override it. So you really don't need the assignment of posting rule under transaction type, but I would advise you to do it because if the system does not find your search string, then it will take this assignment as default.
Hope I made myself clear.
Kalyan
Similar Messages
-
Define Search String for EBS in SAP 4.6c
Hi All,
I have some question for search string for EBS in SAP 4.6c. I have already done this thing in ECC 6 and work well with "target field" as account number. but in 4.6c target field account number doesn't exist. Please suggest me, if there is a same way like account number target field in 4.6c?
Thanks in advance
GlennHi Shanumonu,
Thx for the answer, you save my life!
But I have another issued. I already implement SE11 instruction, but item with wrong note to payee number from MT940 keep cleared. Do you have suggestion for me?
Thanks,
Glenn -
Has anyone ever used target field EBFK0A1 BDC Account Type successfully? If so, can you please explain the basic settings?
We want to influence changing the G/L account number for posting area 1, line item 1. Any specific examples would be very helpful. We wish to avoid the creation of a new posting rule for each G/L account.
Regards,
SandyWhen creating search strings, I use both the mapping and the target field - the mapping is the value that is assigned to the target field. Take my ACH RETURN example from my previous post. The text ACH RETURN comes through in the note to payee and I use that to change the posting rule to posting rule Z120.
I set up a search string with search string value "ACH RETURN" and the following mapping:
A->Z
C->1
H->2
space->0
R->blank
E->blank
T->blank
U->blank
R->blank
N->blank
Then in the search string usage, I assigned the search string to target field "Posting Rule".
When the BAI file is loaded, if SAP finds "ACH RETURN" in the note to payee, it maps that value to Z120 and then assigns Z120 to the Posting Rule. Make sense?
No, we do not have any cross-company transactions coming through in our BAI files.
We do not have any cases where one transaction in the BAI file offsets transactions in multiple GL accounts. We do have situations where one transaction in the BAI file offsets multiple transactions in one GL account. For most of those cases, I'm using interpretation algorithm 121 (Reference document number search without test read) and using a search string to extract the reference number from the note to payee that matches to the reference number on the documents.
We do, however, have a scenario where we use a user exit to select multiple transactions from a GL account to clear against one transaction from the bank statement. The user exit is ZXF01U01 (Enhancement FEB00001, Function Module EXIT_RFEBBU10_001). We have logic in the user exit to find the line items to clear and populate those line items in table T_FEBCL. SAP then uses T_FEBCL to post the BAI transaction. If your user can come up rules for clearing the transactions from the multiple GL accounts, you might be able to use this user exit to accomplish the clearing.
If the user cannot come up with rules that you can program, then I would suggest a process change. Either the postings need to be originally made as one posting to one account. Or once the multiple items are posted, they need to be manually cleared into one account/one posting prior to the BAI file being loaded. Or you leave the process of posting to multiple GL accounts as is and the user has to clear the postings manually via post-processing (FEBA/FEBAN).
Hope this helps!
Regards,
Shannon
Edited by: Shannon Moberg on Jun 16, 2010 9:55 AM -
Failing Search String in EBS through IDOC
Dear All,
we upload our EBS through idoc processing of type finsta. The problem is that for a particular bank theres a search string attached which will replace the posting rule if a certain but fix narration (say "Trf 66852") is received in note to payee field apart from the fixed external transaction code. The problem is that, in the idoc segment, though i am putting the same fixed narration as Trf66852 however the posting rule is not replacing. I am not able to determine even if the search string is working. I tried checking in EBSTS but apart from two blank lines nothing much is appearing. If anyone ever come across this issue pls share your experience.
best regds
SubhaHi Subha,
The Notes to payee updates from FINSTA IDoc should work.
1. If you want to know if the configured search string is working or not, you can simulate it in OTPM, where the search strings are defined in the search string definition > Simulation. You need to entry the text from bank in Simulation and click on test.
2. Secondly, you can check in table FEBRE where the notes to Payee fields are updated.
Regards,
Kavita -
Need help in the String Format method
really need help in string.Format method. I would like to show the s in two digit numbers.
for example:
if s is below 10 then display *0s*
the expecting result is 01,02,03.. 09,10,11....
I tried this method, somehow i got the errors msg. pls advise. thx.
public void setDisplay(String s) {
String tmpSS=String.format("%02d",s);
this.ss.setText(tmpSS);
Edited by: bluesailormoon on May 19, 2008 10:30 AMApparently, you expect the string to consist of one or two digits. If that's true, you could do this:String tmpSS = (s.length() == 1) ? ("0" + s) : s; or this: String tmpSS = String.format("%02d", Integer.parseInt(s));
-
Issue With Similar Search Strings in EBS
Hi Everybody, I'm experiencing some issue regarding a Search String that I have, the config is very similar, the only difference between one and the other is that there's a specific posting rule for one particular account.
EG: Search String 1: (^)ACCOUNT TRANSFER TRSF TO( |$)
Search String 2:(^)ACCOUNT TRANSFER TRSF TO 1111111111( |$)
(Where 1111111111 is the bank account)
Same Extenral transaction, NTRF, Same house bank and account id. Same Comapny also
But when executing a Statement with the 1st one it works fine, but when runing the 2nd one it does not use any of them(it takes the Posting rule set for NTRF in the EBS configuration).
I've tested it in the SS test and it takes the right posting rule.
If you have any clue on this I'll really appreciate it.
Regards
LucianoI apologize for the above and the thread has been posted here as I was unable to access the correct category due to some technical issues with Oracle forums. Also, the mentioned issue is in critical state and has a deadline so thought of posting to get it resolved as soon as possible. Specific categorization will be surely taken care in future.
Moving the thread to below location:
http://myforums.oracle.com/jive3/thread.jspa?threadID=1023776
Edited by: 931435 on Jun 6, 2012 12:25 AM -
Need help in handling string of characters
Hi,
I am trying to scan string and separate different text based on business logic. For example:
String = 'My bus comes at 999 F Street at 8 am'
Now I need to scan the string and break the sentence into multiple words like:
- First occurrence of number which is 999 goes into var1 variable.
- Last occurrence of number which is 8 goes into var2 variable.
I am wondering if this can be achieve with regular expression of any oracle internal function.
Thanks,
Edited by: skas on Jun 6, 2013 10:34 PMnkvkashyap wrote:
or you can even try like this...
with data(str) as
(select 'My bus comes at 999 F Street at 8 am' from dual),
data1 as
(select regexp_replace(str, '[^[:digit:]]+', ' ') a from data)
select regexp_substr(a,'[^ ]+',1,1) var1,regexp_substr(a,'[^ ]+',1,2) var2 from data1;
Output:
var1 var2
999 8
No need to make this complicated ;)
SQL> with data(str) as
2 (
3 select 'My bus comes at 999 F Street at 8 am'
4 from dual
5 )
6 select regexp_sUBsTR(str, '\d+') VAR1,
7 regexp_sUBSTR(str, '\d+',1,2) VAR2
8 from data;
VAR V
999 8Edited by: jeneesh on Jun 7, 2013 11:11 AM
Missed David's post.. This is the same as his post.. -
Need Help with a String Binary Tree
Hi, I need the code to build a binary tree with string values as the nodes....i also need the code to insert, find, delete, print the nodes in the binarry tree
plssss... someone pls help me on this
here is my code now:
// TreeApp.java
// demonstrates binary tree
// to run this program: C>java TreeApp
import java.io.*; // for I/O
import java.util.*; // for Stack class
import java.lang.Integer; // for parseInt()
class Node
//public int iData; // data item (key)
public String iData;
public double dData; // data item
public Node leftChild; // this node's left child
public Node rightChild; // this node's right child
public void displayNode() // display ourself
System.out.print('{');
System.out.print(iData);
System.out.print(", ");
System.out.print(dData);
System.out.print("} ");
} // end class Node
class Tree
private Node root; // first node of tree
public Tree() // constructor
{ root = null; } // no nodes in tree yet
public Node find(int key) // find node with given key
{ // (assumes non-empty tree)
Node current = root; // start at root
while(current.iData != key) // while no match,
if(key < current.iData) // go left?
current = current.leftChild;
else // or go right?
current = current.rightChild;
if(current == null) // if no child,
return null; // didn't find it
return current; // found it
} // end find()
public Node recfind(int key, Node cur)
if (cur == null) return null;
else if (key < cur.iData) return(recfind(key, cur.leftChild));
else if (key > cur.iData) return (recfind(key, cur.rightChild));
else return(cur);
public Node find2(int key)
return recfind(key, root);
public void insert(int id, double dd)
Node newNode = new Node(); // make new node
newNode.iData = id; // insert data
newNode.dData = dd;
if(root==null) // no node in root
root = newNode;
else // root occupied
Node current = root; // start at root
Node parent;
while(true) // (exits internally)
parent = current;
if(id < current.iData) // go left?
current = current.leftChild;
if(current == null) // if end of the line,
{ // insert on left
parent.leftChild = newNode;
return;
} // end if go left
else // or go right?
current = current.rightChild;
if(current == null) // if end of the line
{ // insert on right
parent.rightChild = newNode;
return;
} // end else go right
} // end while
} // end else not root
} // end insert()
public void insert(String id, double dd)
Node newNode = new Node(); // make new node
newNode.iData = id; // insert data
newNode.dData = dd;
if(root==null) // no node in root
root = newNode;
else // root occupied
Node current = root; // start at root
Node parent;
while(true) // (exits internally)
parent = current;
//if(id < current.iData) // go left?
if(id.compareTo(current.iData)>0)
current = current.leftChild;
if(current == null) // if end of the line,
{ // insert on left
parent.leftChild = newNode;
return;
} // end if go left
else // or go right?
current = current.rightChild;
if(current == null) // if end of the line
{ // insert on right
parent.rightChild = newNode;
return;
} // end else go right
} // end while
} // end else not root
} // end insert()
public Node betterinsert(int id, double dd)
// No duplicates allowed
Node return_val = null;
if(root==null) { // no node in root
Node newNode = new Node(); // make new node
newNode.iData = id; // insert data
newNode.dData = dd;
root = newNode;
return_val = root;
else // root occupied
Node current = root; // start at root
Node parent;
while(current != null)
parent = current;
if(id < current.iData) // go left?
current = current.leftChild;
if(current == null) // if end of the line,
{ // insert on left
Node newNode = new Node(); // make new node
newNode.iData = id; // insert data
newNode.dData = dd;
return_val = newNode;
parent.leftChild = newNode;
} // end if go left
else if (id > current.iData) // or go right?
current = current.rightChild;
if(current == null) // if end of the line
{ // insert on right
Node newNode = new Node(); // make new node
newNode.iData = id; // insert data
newNode.dData = dd;
return_val = newNode;
parent.rightChild = newNode;
} // end else go right
else current = null; // duplicate found
} // end while
} // end else not root
return return_val;
} // end insert()
public boolean delete(int key) // delete node with given key
if (root == null) return false;
Node current = root;
Node parent = root;
boolean isLeftChild = true;
while(current.iData != key) // search for node
parent = current;
if(key < current.iData) // go left?
isLeftChild = true;
current = current.leftChild;
else // or go right?
isLeftChild = false;
current = current.rightChild;
if(current == null)
return false; // didn't find it
} // end while
// found node to delete
// if no children, simply delete it
if(current.leftChild==null &&
current.rightChild==null)
if(current == root) // if root,
root = null; // tree is empty
else if(isLeftChild)
parent.leftChild = null; // disconnect
else // from parent
parent.rightChild = null;
// if no right child, replace with left subtree
else if(current.rightChild==null)
if(current == root)
root = current.leftChild;
else if(isLeftChild)
parent.leftChild = current.leftChild;
else
parent.rightChild = current.leftChild;
// if no left child, replace with right subtree
else if(current.leftChild==null)
if(current == root)
root = current.rightChild;
else if(isLeftChild)
parent.leftChild = current.rightChild;
else
parent.rightChild = current.rightChild;
else // two children, so replace with inorder successor
// get successor of node to delete (current)
Node successor = getSuccessor(current);
// connect parent of current to successor instead
if(current == root)
root = successor;
else if(isLeftChild)
parent.leftChild = successor;
else
parent.rightChild = successor;
// connect successor to current's left child
successor.leftChild = current.leftChild;
// successor.rightChild = current.rightChild; done in getSucessor
} // end else two children
return true;
} // end delete()
// returns node with next-highest value after delNode
// goes to right child, then right child's left descendents
private Node getSuccessor(Node delNode)
Node successorParent = delNode;
Node successor = delNode;
Node current = delNode.rightChild; // go to right child
while(current != null) // until no more
{ // left children,
successorParent = successor;
successor = current;
current = current.leftChild; // go to left child
// if successor not
if(successor != delNode.rightChild) // right child,
{ // make connections
successorParent.leftChild = successor.rightChild;
successor.rightChild = delNode.rightChild;
return successor;
public void traverse(int traverseType)
switch(traverseType)
case 1: System.out.print("\nPreorder traversal: ");
preOrder(root);
break;
case 2: System.out.print("\nInorder traversal: ");
inOrder(root);
break;
case 3: System.out.print("\nPostorder traversal: ");
postOrder(root);
break;
System.out.println();
private void preOrder(Node localRoot)
if(localRoot != null)
localRoot.displayNode();
preOrder(localRoot.leftChild);
preOrder(localRoot.rightChild);
private void inOrder(Node localRoot)
if(localRoot != null)
inOrder(localRoot.leftChild);
localRoot.displayNode();
inOrder(localRoot.rightChild);
private void postOrder(Node localRoot)
if(localRoot != null)
postOrder(localRoot.leftChild);
postOrder(localRoot.rightChild);
localRoot.displayNode();
public void displayTree()
Stack globalStack = new Stack();
globalStack.push(root);
int nBlanks = 32;
boolean isRowEmpty = false;
System.out.println(
while(isRowEmpty==false)
Stack localStack = new Stack();
isRowEmpty = true;
for(int j=0; j<nBlanks; j++)
System.out.print(' ');
while(globalStack.isEmpty()==false)
Node temp = (Node)globalStack.pop();
if(temp != null)
System.out.print(temp.iData);
localStack.push(temp.leftChild);
localStack.push(temp.rightChild);
if(temp.leftChild != null ||
temp.rightChild != null)
isRowEmpty = false;
else
System.out.print("--");
localStack.push(null);
localStack.push(null);
for(int j=0; j<nBlanks*2-2; j++)
System.out.print(' ');
} // end while globalStack not empty
System.out.println();
nBlanks /= 2;
while(localStack.isEmpty()==false)
globalStack.push( localStack.pop() );
} // end while isRowEmpty is false
System.out.println(
} // end displayTree()
} // end class Tree
class TreeApp
public static void main(String[] args) throws IOException
int value;
double val1;
String Line,Term;
BufferedReader input;
input = new BufferedReader (new FileReader ("one.txt"));
Tree theTree = new Tree();
val1=0.1;
while ((Line = input.readLine()) != null)
Term=Line;
//val1=Integer.parseInt{Term};
val1=val1+1;
//theTree.insert(Line, val1+0.1);
val1++;
System.out.println(Line);
System.out.println(val1);
theTree.insert(50, 1.5);
theTree.insert(25, 1.2);
theTree.insert(75, 1.7);
theTree.insert(12, 1.5);
theTree.insert(37, 1.2);
theTree.insert(43, 1.7);
theTree.insert(30, 1.5);
theTree.insert(33, 1.2);
theTree.insert(87, 1.7);
theTree.insert(93, 1.5);
theTree.insert(97, 1.5);
theTree.insert(50, 1.5);
theTree.insert(25, 1.2);
theTree.insert(75, 1.7);
theTree.insert(12, 1.5);
theTree.insert(37, 1.2);
theTree.insert(43, 1.7);
theTree.insert(30, 1.5);
theTree.insert(33, 1.2);
theTree.insert(87, 1.7);
theTree.insert(93, 1.5);
theTree.insert(97, 1.5);
while(true)
putText("Enter first letter of ");
putText("show, insert, find, delete, or traverse: ");
int choice = getChar();
switch(choice)
case 's':
theTree.displayTree();
break;
case 'i':
putText("Enter value to insert: ");
value = getInt();
theTree.insert(value, value + 0.9);
break;
case 'f':
putText("Enter value to find: ");
value = getInt();
Node found = theTree.find(value);
if(found != null)
putText("Found: ");
found.displayNode();
putText("\n");
else
putText("Could not find " + value + '\n');
break;
case 'd':
putText("Enter value to delete: ");
value = getInt();
boolean didDelete = theTree.delete(value);
if(didDelete)
putText("Deleted " + value + '\n');
else
putText("Could not delete " + value + '\n');
break;
case 't':
putText("Enter type 1, 2 or 3: ");
value = getInt();
theTree.traverse(value);
break;
default:
putText("Invalid entry\n");
} // end switch
} // end while
} // end main()
public static void putText(String s)
System.out.print(s);
System.out.flush();
public static String getString() throws IOException
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String s = br.readLine();
return s;
public static char getChar() throws IOException
String s = getString();
return s.charAt(0);
public static int getInt() throws IOException
String s = getString();
return Integer.parseInt(s);
} // end class TreeAppString str = "Hello";
int index = 0, len = 0;
len = str.length();
while(index < len) {
System.out.println(str.charAt(index));
index++;
} -
Need help with search function in my program
Hello all, some of you may remeber me from my previous inventory programs. Well I am finally on my last one and I need to add a search option to the code. Here is the class that will contain that option.
import java.util.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class Inventory2 extends JFrame implements ActionListener {
//Utility class for displaying the picture
//If we are going to use a class/method/variable inside that class only, we declare it private in that class
private class MyPanel extends JPanel {
ImageIcon image = new ImageIcon("Sample.jpg");
int width = image.getIconWidth();
int height = image.getIconHeight();
long angle = 30;
public MyPanel(){
super();
public void paintComponent(Graphics g){
super.paintComponent(g);
Graphics2D g2d = (Graphics2D)g;
g2d.rotate (Math.toRadians(angle), 60+width/2, 60+height/2);
g2d.drawImage(image.getImage(), 60, 60, this);
g2d.dispose();
}//end class MyPanel
int currentIndex; //Currently displayed Item
Product[] supplies = new Product[4];
JLabel name ;
JLabel number;
JLabel rating;
JLabel quantity;
JLabel price;
JLabel fee;
JLabel totalValue;
JTextField nameField = new JTextField(20);
JTextField numberField = new JTextField(20);
JTextField ratingField = new JTextField(20);
JTextField quantityField = new JTextField(20);
JTextField priceField = new JTextField(20);
JPanel display;
JPanel displayHolder;
JPanel panel;
boolean locked = false; //Notice how I've used this flag to keep the interface clean
public Inventory2() {
makeTheDataItems();
setSize(700, 500);
setTitle("Inventory Program");
//make the panels
display = new JPanel();
JPanel other = new JPanel();
other.setLayout(new GridLayout(2, 1));
JPanel picture = new MyPanel();
JPanel buttons = new JPanel();
JPanel centerPanel = new JPanel();
displayHolder = new JPanel();
display.setLayout(new GridLayout(7, 1));
//other.setLayout(new GridLayout(1, 1));
//make the labels
name = new JLabel("Name :");
number = new JLabel("Number :");
rating = new JLabel("Rating :");
quantity = new JLabel("Quantity :");
price = new JLabel("Price :");
fee = new JLabel("Restocking Fee (5%) :");
totalValue = new JLabel("Total Value :");
//Use the utility method to make the buttons
JButton first = makeButton("First");
JButton next = makeButton("Next");
JButton previous = makeButton("Previous");
JButton last = makeButton("Last");
JButton search = makeButton("Search");
//Other buttons
JButton add = makeButton("Add");
JButton modify = makeButton("Modify");
JButton delete = makeButton("Delete");
JButton save = makeButton("Save");
JButton exit = makeButton("Exit");
//Add the labels to the display panel
display.add(name);
display.add(number);
display.add(rating);
display.add(quantity);
display.add(price);
display.add(fee);
//add the buttons to the buttonPanel
buttons.add(first);
buttons.add(previous);
buttons.add(next);
buttons.add(last);
buttons.add(search);
//Add the picture panel and display to the centerPanel
displayHolder.add(display);
centerPanel.setLayout(new GridLayout(2, 1));
centerPanel.add(picture);
centerPanel.add(displayHolder);
other.add(buttons);
JPanel forAdd = new JPanel(); // add the other buttons to this panel
forAdd.add(add);
forAdd.add(modify);
forAdd.add(delete);
forAdd.add(save);
forAdd.add(exit);
other.add(forAdd);
//Add the panels to the frame
getContentPane().add(centerPanel, "Center");
getContentPane().add(other, "South");
this.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
setVisible(true);
private void makeTheDataItems () {
Product p1 = new DVD("The one", 001, 200, 100, "The one");
Product p2 = new DVD("Once upon a time in China V", 002, 500, 10000, "Once upon a time in China V");
Product p3 = new DVD("Rat Race", 003, 100, 3000, "Rat Race");
Product p4 = new DVD("The Man in the Iron Mask", 004, 3000, 9000, "The Man in the Iron Mask");
supplies[0] = p1;
supplies[1] = p2;
supplies[2] = p3;
supplies[3] = p4;
//Utility method for creating and dressing buttons
private JButton makeButton(String label) {
JButton button = new JButton(label);
button.setPreferredSize(new Dimension(100, 25));
button.setActionCommand(label);
button.addActionListener(this);
return button;
private void addItem() {
panel = new JPanel();
JPanel add = new JPanel();
add.setLayout(new GridLayout(7, 2));
JButton addIt = makeButton("Add Item");
JLabel name = new JLabel("Name :");
JLabel rating = new JLabel("Rating :");
JLabel quantity = new JLabel("Quantity :");
JLabel price = new JLabel("Price :");
add.add(name); add.add(nameField);
add.add(rating); add.add(ratingField);
add.add(quantity); add.add(quantityField);
add.add(price); add.add(priceField);
panel.add(add);
JPanel forAddIt = new JPanel();
forAddIt.add(addIt);
panel.add(forAddIt);
displayHolder.remove(display);
displayHolder.add(panel);
//display = panel;
this.setVisible(true);
public static void main( String args[]) {
new Inventory2().displayFirst(); //The main method should not have too much code
} // end main method
public void actionPerformed(ActionEvent event) {
String command = event.getActionCommand(); //This retrieves the command that we set for the button
//Always compare strings using the .equals method and not using ==
if(command.equals("First")) {
if(!locked) {
displayFirst();
else if(command.equals("Next")) {
if(!locked) {
displayNext();
else if(command.equals("Previous")) {
if(!locked) {
displayPrevious();
else if(command.equals("Last")) {
if(!locked) {
displayLast();
else if(command.equals("Exit")) {
this.dispose();
System.exit(0);
else if(command.equals("Add")) {
if(!locked) {
addItem();
locked = true;
else if(command.equals("Add Item")) {
addItemToArray();
else if(command.equals("Modify")) {
if(!locked) {
modify();
locked = true;
else if(command.equals("Update")) {
if(!locked) {
modifyItemInArray();
locked = true;
else if(command.equals("Delete")) {
if(!locked) {
DVD dvd = (DVD)supplies[currentIndex];
int confirm = JOptionPane.showConfirmDialog(this, "Are you sure you want to delete item "+dvd.getItemNumber());
if(confirm == JOptionPane.YES_OPTION) {
removeItemAt(currentIndex);
displayFirst();
private void modify() {
DVD dvd = (DVD)supplies[currentIndex];
panel = new JPanel();
JPanel add = new JPanel();
add.setLayout(new GridLayout(7, 2));
JButton update = makeButton("Update");
JLabel number = new JLabel("Number :");
JLabel name = new JLabel("Name :");
JLabel rating = new JLabel("Rating :");
JLabel quantity = new JLabel("Quantity :");
JLabel price = new JLabel("Price :");
add.add(number);
numberField.setText(""+dvd.getItemNumber()); numberField.setEditable(false); add.add(numberField);
add.add(name);
nameField.setText(dvd.getItemName()); add.add(nameField);
ratingField.setText(dvd.getRating()); ratingField.setEditable(false);
add.add(rating); add.add(ratingField);
add.add(quantity);
quantityField.setText(""+dvd.getStockQuantity());
add.add(quantityField);
add.add(price);
add.add(priceField); priceField.setText(""+dvd.getItemPrice());
panel.add(add);
JPanel forAddIt = new JPanel();
forAddIt.add(update);
panel.add(forAddIt);
displayHolder.remove(display);
displayHolder.add(panel);
//display = panel;
this.setVisible(true);
private void addItemToArray() {
Product p = new DVD(nameField.getText(), supplies.length + 1, Long.parseLong(quantityField.getText()),
Double.parseDouble(priceField.getText()), ratingField.getText());
//Extend size of array by one first
Product[] ps = new Product[supplies.length + 1];
for(int i = 0; i < ps.length-1; i++) {
ps[i] = supplies;
ps[supplies.length] = p;
supplies = ps;
displayHolder.remove(panel);
displayHolder.add(display);
displayLast();
this.setVisible(false);
this.setVisible(true);
//Utility method to ease the typing and reuse code
//This method reduces the number of lines of our code
private void displayItemAt(int index) {
DVD product = (DVD)supplies[index];
name.setText("Item Name: "+ product.getItemName());
number.setText("Item Number: "+ product.getItemNumber());
rating.setText("Rating: "+ product.getRating());
quantity.setText("Quantity In Stock: "+ product.getStockQuantity());
price.setText("Item Price: "+ product.getItemPrice());
totalValue.setText("Total: " + product.calculateInventoryValue());
fee.setText("Restocking Fee (5%) :"+product.calculateRestockFee());
locked = false;
this.repaint();
this.setVisible(true);
private void modifyItemInArray() {
Product p = new DVD(nameField.getText(), supplies.length + 1, Long.parseLong(quantityField.getText()),
Double.parseDouble(priceField.getText()), ratingField.getText());
supplies[currentIndex] = p;
displayHolder.remove(panel);
displayHolder.add(display);
displayItemAt(currentIndex);
this.setVisible(false);
this.setVisible(true);
private void removeItemAt(int index) {
Product[] temp = new Product[supplies.length-1];
int counter = 0;
for(int i = 0; i < supplies.length;i++) {
if(i == index) { //skip the item to delete
else {
temp[counter++] = supplies[i];
supplies = temp;
public void displayFirst() {
displayItemAt(0);
currentIndex = 0;
public void displayNext() {
if(currentIndex == supplies.length-1) {
displayFirst();
currentIndex = 0;
else {
displayItemAt(currentIndex + 1);
currentIndex++;
public void displayPrevious() {
if(currentIndex == 0) {
displayLast();
currentIndex = supplies.length-1;
else {
displayItemAt(currentIndex - 1);
currentIndex--;
public void displayLast() {
displayItemAt(supplies.length-1);
currentIndex = supplies.length-1;
}//end class Inventory2
I am not sure where to put it and how to set it up. If you guys need the other two classes let me know. Thanks in advanced.Here are the other two classes:
import java.util.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
class Product implements Comparable {
String name;
int number;
long stockQuantity;
double price;
public Product() {
name = "";
number = 0;
stockQuantity = 0L;
price = 0.0;
public Product(String name, int number, long stockQuantity, double price) {
this.name = name;
this.number = number;
this.stockQuantity = stockQuantity;
this.price = price;
public void setItemName(String name) {
this.name = name;
public String getItemName() {
return name;
public void setItemNumber(int number) {
this.number = number;
public int getItemNumber() {
return number;
public void setStockQuantity(long quantity) {
stockQuantity = quantity;
public long getStockQuantity() {
return stockQuantity;
public void setItemPrice(double price) {
this.price = price;
public double getItemPrice() {
return price;
public double calculateInventoryValue() {
return getItemPrice() * getStockQuantity();
public int compareTo (Object o) {
Product p = (Product)o;
return name.compareTo(p.getItemName());
public String toString() {
return "Name :"+getItemName() + "\nNumber"+number+"\nPrice"+price+"\nQuantity"+stockQuantity + "\nValue :"+calculateInventoryValue();
class DVD extends Product implements Comparable {
private String rating;
public DVD() {
super(); //Call the constructor in Product
rating = ""; //Add the additonal attribute
public DVD(String name, int number, long stockQuantity, double price, String rating) {
super(name, number, stockQuantity, price); //Call the constructor in Product
this.rating = rating; //Add the additonal attribute
public void setRating(String rating) {
this.rating = rating;
public String getRating() {
return rating;
public double calculateInventoryValue() {
return getItemPrice() * getStockQuantity() + getItemPrice()*getStockQuantity()*0.05;
public double calculateRestockFee() {
return getItemPrice() * 0.05;
public int compareTo (Object o) {
Product p = (Product)o;
return getItemName().compareTo(p.getItemName());
public String toString() {
return "Name :"+getItemName() + "\nNumber"+getItemNumber()+"\nPrice"+getItemPrice()+"\nQuantity"+getStockQuantity() +"\nRating :"+getRating()+"\nValue"+calculateInventoryValue();
}You should be able to search through these items, and any other items that have been added to the program. -
I am develping an JAVA application which will query the database and retrieve a text set. I need to know how i shld retrieve an exact line from it which i am sure will be present in the result set.
(eg) If my query returns the following text,
"Let us define some important terms related to Systems & software.
A system consists of people, machines or technology, and methods or processes, organized to accomplish a set of specific functions.The total man hours needed for this is 22hrs."
I want to get only the line "The total man hours needed for this is 22hrs" and display on screen.But the 22 hrs will change to anything depending upon the query . I need to take a sentence which starts like "The total man hours needed for this is ....."
I tried using 'like %'.............But it gives the entire text as the result which is not desired.
Help me out.Why do you want to do that in the database? You asked the question on a Java forum, so I will give you a Java answer. Use String.indexOf and String.substring or regular expressions to get the part that you want.
Kaj -
Need help on search help on selection screen field
Hi guyz,
Please tell me how to pass the parameter or restrict the below search help.
*s_bsart FOR ekko-bsart . " Doc. Type*
For the above selection screen field i need to display the data only for cat = F if i click search help.
Thanks,
Mohamed KaleelHi,
Use At selection-screen for value-request for s_bsart.
SELECT_OTPIONS: s_bsart FOR ekko-bsart.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_bsart.
CALL SCREEN 100 STARTING AT 10 5
ENDING AT 50 10.
MODULE value_list OUTPUT.
SUPPRESS DIALOG.
LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
SET PF-STATUS space.
NEW-PAGE NO-TITLE.
s_bsart-low = 'F' / 'CAT=F'.
write :/ s_bsart-low.
Hide: s_bsart-low
clear s_bsart-low.
ENDMODULE.
AT LINE-SELECTION.
LEAVE TO SCREEN 0.
This will resolve the issue.
Regards,
Gurpreet -
Still Need Help with this String Problem
basically, i need to create a program where I input 5 words and then the program outputs the number of unique words and the words themselves. for example, if i input the word hello 5 times, then the output is 1 unique word and the word "hello". i have been agonizing over this dumb problem for days, i know how to do it using hashmap, but this is an introductory course and we cannot use more complex java functions, does ANYONE know how to do this just using arrays, strings, for loops, if clauses, etc. really basic java stuff. i want the code to be able to do what the following program does:
import java.io.*; import java.util.ArrayList;
public class MoreUnique {
public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str[] = new String[5]; int uniqueEntries = 0; ArrayList<String> ue = new ArrayList<String>();
for (int i = 0; i < 5; i++) { System.out.print((i +1) + ": "); str[i] = br.readLine(); }
for (int j = 0; j < 5; j++) {
if (!ue.contains(str[j].toLowerCase())) { ue.add(str[j].toLowerCase()); } } uniqueEntries = ue.size(); System.out.print("Number of unique entries: " + uniqueEntries + " { ");
for (int q = 0; q < ue.size(); q++ ) { System.out.print(ue.get(q) + " "); } System.out.println("}"); } } but i need to find how to do it so all 5 words are put in at once on one line, and without all the advanced java functions that are in here, can anyone help out?you have to compare string 0 to strings 1-4, then
string 1 with strings 2-4, then string 2 with strings
3 and 4 then string 3 with string 4....right???Here's a way to do it:
public class MoreUnique {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
final int NUM_WORDS = 5;
String[] words = new String[NUM_WORDS];
int uniqueEntries = 0;
for(int i = 0; i < NUM_WORDS; i++) {
System.out.print((i+1)+": ");
String temp = br.readLine();
if(!contains(temp, words)) {
words[uniqueEntries++] = temp;
System.out.print("Number of unique entries: "+uniqueEntries+" { ");
for (int i = 0; i < uniqueEntries; i++ ) {
System.out.print(words[i]+" ");
System.out.println("}");
private static boolean contains(String word, String[] array) {
Your code here: just a simple for-statement to
loop through your array and to see if 'word'
is in your 'array'.
}Try to fill in the blanks.
Good luck. -
Need help with attributed string in NSMenuItem
I'm trying to implement a contextual menu for a view in one of my applications. I want it to be dynamic, based on where you click in the view. It works fine if I don't try to mess with the font size of the menu. If I try to make the menu font smaller, the menu will appear blank, and its action won't get triggered, but only if there's only one menu item. If there are two or more, they'll all show up.
I've done a bunch of searching, and found some code examples where they put in a dummy item, then remove it later, but so far, that hasn't helped me, either. I've posted an example project (~44KB) on my web site that illustrates this, if you'd like to see it in action (the example doesn't include the "dummy fix", by the way, but it's easy enough to add).
Here's the code where I customize the menu:
<pre class="command">-(NSMenu *)menuForEvent:(NSEvent *)theEvent
NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
NSLog(@"Raw Mouse Location: %2.1f, %2.1f", mouseLoc.x, mouseLoc.y);
// Get my blank menu:
NSMenu *tzMenu = [self defaultMenu];
// Set up my string attributes:
NSMutableDictionary *menuAttributes = [[NSMutableDictionary alloc] init];
[menuAttributes setObject:[NSFont fontWithName:@"Lucida Grande" size:11] forKey:NSFontAttributeName];
if (mouseLoc.x < 220) // Make just one menu item.
int i;
for (i=0; i<1; i++)
[tzMenu addItemWithTitle:@"Item" action:@selector(changeMapDot:) keyEquivalent:@""];
NSMenuItem *lastItem = [tzMenu itemAtIndex:[tzMenu numberOfItems] - 1];
NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:@"Item" attributes:menuAttributes];
// Comment out this next line and the menu item appears in the default font:
[lastItem setAttributedTitle:attrString];
[attrString release];
else
int i;
for (i=0; i<3; i++) //Make three items. These always appear.
[tzMenu addItemWithTitle:@"Item" action:@selector(changeMapDot:) keyEquivalent:@""];
NSMenuItem *lastItem = [tzMenu itemAtIndex:[tzMenu numberOfItems] - 1];
NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:@"Item" attributes:menuAttributes];
[lastItem setAttributedTitle:attrString];
[attrString release];
[menuAttributes release];
return tzMenu;
}</pre>Any tips that anyone has would be most apprecitated.
I'm not unalterably opposed to the regular system menu font if there's no way around this (the menus are pretty short: usually less then a dozen items), but aesthetically it looks nicer with a smaller font.
charlieHi,
You can use SUBSTR and INSTR
This should work in Oracle 9:
WITH cntr AS
SELECT LEVEL AS n
FROM dual
CONNECT BY LEVEL <= 3
, got_pos AS
SELECT x.txt
, c.n
, INSTR (x.txt, '[', 1, c.n) AS l_pos
, INSTR (x.txt, ']', 1, c.n) AS r_pos
FROM table_x x
CROSS JOIN cntr c
SELECT txt
, n
, SUBSTR ( txt
, l_pos + 1
, r_pos - (l_pos + 1)
) AS sub_txt
FROM got_pos
ORDER BY txt
, n
;Sorry, I don't have an Oracle 9 database available now; I had to test this in Oracle 10.
jimmy437 wrote:
... I have tried the "REGEXP_SUBSTR" but my database version is 9i, and it is available only from 10g.That's true. Regular expressions are very useful, but they're not available in Oracle 9 (or earlier).
Oracle 9 does have an Oracle-supplied package, OWA_PATTERN, that provides some regular expression functionality:
http://docs.oracle.com/cd/B12037_01/appdev.101/b10802/w_patt.htm
I know that's the Oracle 10, documentation, but it exists in Oracle 9, too.
Oracle 9 is very old. You should consider upgrading. -
Hi ppl,
i hav a code which has to do some actions on the strings retrieved from the database. The code is in java swings
I need to know, how do i check if there is a space between strings.
For eg Kevin Dcosta. (There is a space between Kevin Dcosta)
Please can someone provide me with the Java code for the same so tat i can append to my code. Or is there any readymade method in Java for the same??
Thanks
Divya..Hi,
Go thr StringTokenizer Class it will help u out!........place whatever string u r reading in pu those in stringtokenizer like
StringTokenizer str=new StringTokenizer(tmpmessage, " ");
while(readTokenizer.hasMoreTokens())
String name=readTokenizer.nextToken();
/****** do whatever the action u want to do*************8
} -
New to Fios - So confused how to find anything on!!! - Need help with search
Been with Comcast for years and years and just switched to Fios. With all the channels and various buttons on the remote I'm overwhelmed with trying to figure out what's actually on.
I understand how to use the search feature to find a show or theme, but what I can't figure out is how do you see a list of results for just programs that are currently on??
It seems the search results are listed in order of channel name and there is nothing on the list that I see that shows which ones are currently on. I find myself going thru the list, constantly pushing the right arrow key on the remote just to then find out the show is on later in the day or another day.
Please help!
Thanks,
VinceThe best way to see what's on now is simply to press Up on the remote to bring up the half-screen guide, then use the Ch + and - buttons to quickly scan through it.
Not the solution you wanted. Perhaps you should suggest it in the Ideas forum.
Maybe you are looking for
-
When I open Firefox, I can see the homepage. When I try to open a new tab, I can't neither by clicking the + on the Tab bar, nor by File>New Tab. However, if I press a link in my home page, it opens in a new tab. ???
-
Replica of oracle Application server.
Hi All, I want to create replica of our production server of oracle AS 10g using Tar command . Our Operating system is AIX 5.3 and Oracle Application server version *10.1.2.0.2*. Is this possible using tar command to create replica of OAS having same
-
Unable to set the column values in Standard alv settings
Hi, In the ALV displays settings screen, I can set any number as "number of columns displayed", press "apply" it remains 8 columns that are visible. Prevousely its working fine, last two days back i added two fields in that AlV table. after that i
-
How To Stop Bridge Rebuilding the Cache Unnecessarily
The Problem For me, this problem was manifest on a MacBook Pro with an external hard drive attached. The hard drive would be perpetually working and both it, and the laptop, would be getting extremely hot as a result. Bridge would keep rebuilding th
-
After clicking on tools,...it never shows me "create PDF"
After I open Adobe Reader,...click on tools,...it does NOT give me create PDF