Regarding blocked customer table information
Hello,
I blocked some customers using xd05 tcode. Now i want to get the information the blocked customer information. Actually all the screen feilds are in one structure RF02D. So now from which table i could fetch data. based on that i need develop the collection report.
Thank you
Hi Ravi,
U can block the customer at various levels eg: Only for creating/changing Orders, Delivery, Billing etc.
Go to table KNA1. Here u have various fields for various reasons. Select the data based on ur requirement. If it is vendor then u can check in table LFA1.
Have a look at fields AUFSD,FAKSD, LIFSD, SPERR, SPERZ,CASSD, NODEL, J_3GBLSPER in KNA1 table.
If u want to display customer who is blocked for any one of the above reasons then u can write a select on kna1 with where clause having all the above fields NE space(Or condition).
Thanks,
Vinod.
Similar Messages
-
Regarding custom currency data element issue in custom Table.....
Hello,
I am currently working on creation of a Z custom table in SAP. There is data coming from
mainframe for amount field in the form -9999.9999.
To store data like this I am creating a custom Z data element with Z domain definition as follows:
Data type; Curr
No of characters: 5
Decimal places: 4
Sign box is checked.
Now when I use this Z data elemnt for a firle in custom table, while activating, it asks for table refernce and table field. What do I give it here ?
Please help.
Regards,
Jainam..Hi Jainam,
very basic ABAP knowledge: A field of type CURR isn used to store a currency amount. Every currency field must be connected to a currency key of type CUKY.
The same concept applies for quantities and units.
You can spare a lot of trouble if you look at standard tables and programs, copy or use data elements and/or structures from standard.
If you want to re-invent the world, you may need more than seven days.
Regards,
Clemens -
OAF Update of Custom Table causing ORA-600 with database block corruption?
Using OA Framework 12.1.3, running under EBusiness Suite 12.1.3
Created Custom Web page operating against Custom Tables
ISSUE
On about 2% of new records, when OAF is UPDATING a record in a certain table, it is failing with
java.sql.SQLException: ORA-00607: Internal error occurred while making a change to a data block
ORA-00600: internal error code, arguments: [kddummy_blkchk], [815], [26412], [6110], [], [], [], []
ORA-06512: at line 1
Before the DBA turned on 10.2.0.4.0 DB_BLOCK_CHECKING parameter, this actually
resulted in corrupted data blocks in the database and corrupted indexes that
eventually crashed the database and we had to do a full recovery with 2 days downtime.
Now that we have turned on DB_BLOCK_CHECKING, it simply errors out and puts things
in the alert log, but the records still fail to update as the writes are blocked.
Then oddly, a few days later.. the records become editable. And others fail.
This is ONLY happening on the one particular table being updated by OAF. Other custom pages
posting to other custom tables are having no problems. We've CTAS'd the table back and
forth and recreated the indexes, and that did not help.
Support says to post to the Forum ( So I am! ) or hire Oracle consulting.. which doesn't make
much sense given the error. The Recovery Team that helped us in a separate SR ( we had
to do db_repairs not just recovery ) felt it was an important problem the OAF team needed to
strongly review.
Anyone else encounter this already and know of a solution?
TIA
KarlAfter MANY hours of trial and error and research, we've identified ONE use case that seems to apply to 90% of the issue we have encountered.
YMMV.
The BC4J generated SQL which is generating the ORA-600 is
BEGIN UPDATE XXRETURNHEADER ReturnHeaderEO SET INTERNAL_TEXT=?,LAST_MOD_USERNAME=?,OBJECT_VERSION_NUMBER=?,LAST_UPDATE_DATE=?,LAST_UPDATED_BY=?,LAST_UPDATE_LOGIN=? WHERE RMA_NUMBER=? AND ORGANIZATION_ID=? RETURNING TROUBLESHOOT_DATE, FAA_TAG_DATE, FAILURE_ANALYSIS_DATE, LAST_MOD_DATE, FAA_REVISED_DATE, TTE_TECH_SEND_DATE, TTE_REP_RESPONSE_DATE, TTE_REP_APPROVED, TTE_RMA_RANDOM_KEY, OBJECT_VERSION_NUMBER, LAST_UPDATE_DATE, LAST_UPDATED_BY, LAST_UPDATE_LOGIN INTO ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?; END;".
We determined that if TTE_RMA_RANDOM_KEY was not a null value, we would get an ORA-600 error whenever we did an APPLY from the OAF Page to update the record.
If we set that table attribute to NULL for the record using SQL.. then used the OAF Page to APPLY.. it worked fine and the record saved without error.
We then modified the EO to NOT "Refresh After Update" ( thus removing it from the RETURNING clause generated )... and even if the TTE_RMA_RANDOM_KEY
had a value... the OAF Page APPLY worked and the record saved without error.
I cannot identify anything from the User programming side that is wrong ( and neither could Oracle ), and it REALLY should be in the RETURNING clause list of
attributes.. but this is the only workaround I've found that doesn't crash the Page and irritate the user to no end.
I have reported my findings via the SR back to Oracle to do with it what they may... but it looks strongly ,to me, to be an error in the BC4J/JDBC/Database
coordination and passing data between those black boxes. -
Regarding the Customer Proprietary Network Information Notice
>> Duplicate post removed to comply with Verizon Wireless Terms of Service. See Regarding the Customer Proprietary Network Information Notice <<
Message was edited by: Verizon ModeratorYou do realize you opted in the day you signed up for verizon, right? As for certain parts, you can opt out via your my verizon
-
How to update the merged customer information in custom tables?
The "Setup merge Dictionary" is provided only to register APIs that would be called to update the merged information for parties.
Is there a similar feature for the account merge?
If anyone has any ideas of how to update the columns like customer_id, cust_acct_site_id etc. in custom tables at the end of customer merge, please let me know. Any sample code would be of great help.
Please let me know ASAP.
Thanks in advance,There is one method which I have used. The crm side uses a file called jtf_hooks_data. There is no guarantee that it will work in the future and you will have to test it. The merge program uses this sql
'SELECT hook_package, hook_api,product_code ' ||
'FROM jtf_hooks_data '||
'WHERE package_name = ''ARP_CMERGE_MASTER'' ' ||
'AND api_name = ''MERGE_PRODUCTS'' ' ||
'AND execute_flag = ''Y'' ' ||
'ORDER BY execution_order ';
Your procedures have to have the same signature as the one being called. Issues the select statement on your system and see what is returned. -
Regarding Table Information in PO Shipment Form
Hi All,
I have small doubt for table information
in Purchase Order Form, In Line--> Shipment Details Form
we have Promised Date, Needed By and Original Promise Date.
I got the information of Promised Date and Needed By Date information in po_line_locations_all table.
but I am not able to find the Original Promise Date information.
Please anyone can share this information.
ThanksWelcome to the Oracle Forums. Please take a few minutes to review the following:
<ul>
<li>Before posting on this forum please read
<li>10 Commandments for the OTN Forums Member
<li>Announcement: Forums Etiquette / Reward Points
</ul>
Based on your question it sounds like you are working with the Oracle Enterprise Business Suite (EBS). If this is true, this forum is for general Forms questions. Please post your question in the General EBS Discussion forum. If you have a general Forms question, by all means, ask it here! ;-)
Hope this helps,
Craig B-)
If someone's response is helpful or correct, please mark it accordingly. -
Is Custom_authentication blocking me to retrieve password from custom tabl
Hi
All i am using custom authentication function which i got in forum and is as below:
/* Formatted on 2007/02/28 16:54 (Formatter Plus v4.8.0) */
CREATE OR REPLACE FUNCTION custom_auth (
p_username IN VARCHAR2,
p_password IN VARCHAR2
RETURN BOOLEAN
IS
l_password VARCHAR2 (4000);
l_stored_password VARCHAR2 (4000);
l_expires_on DATE;
l_count NUMBER;
BEGIN
-- First, check to see if the user is in the user table
--select count(*) into l_count from ap_users where login_id like p_username;
SELECT COUNT (*)
INTO l_count
FROM my_table
WHERE UPPER (user_name) = UPPER (p_username);
IF l_count > 0
THEN
-- First, we fetch the stored hashed password & expire date
SELECT PASSWORD, expires_on
INTO l_stored_password, l_expires_on
FROM my_table
WHERE UPPER (user_name) = UPPER (p_username);
-- Next, we check to see if the user's account is expired
-- If it is, return FALSE
IF l_expires_on > SYSDATE OR l_expires_on IS NULL
THEN
-- If the account is not expired, we have to apply the custom hash
-- function to the password
-- l_password := custom_hash (p_username, p_password);
-- Finally, we compare them to see if they are the same and return
-- either TRUE or FALSE
IF p_password = l_stored_password
THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
ELSE
RETURN FALSE;
END IF;
ELSE
-- The username provided is not in the DEMO_USERS table
RETURN FALSE;
END IF;
END;
I have created a user table my_table for managing user . I have created a from on table with report for creating,updating,deleting users .
Whenever i am trying to update the first name which is one column of my custom table then for each update asking for password but my client want that once he login as an employee without asking password he should update any column.
If he desire he can change the password also .
but when i am enetring as an employee and trying to update any user each time asking password . So is it due to Custom_Auth function or any other problem.
Please can any one tell me the reason.
Thanks in advance,
AmitHi all my problem get solved thanks i am allowing this report to admin so making password as text field working fine thanks
-
Regarding Multi Language Support in Oracle Custom Table
Hi All,
I have a requirement that i have to create Custom table to catch the data.
The custom table should support multi language.
Ex. PER_OBJECTIVES (seeded table) Suppose i select the language as Arabic then table should able to insert Arabic data. If English is selected English data should insert.
How i need to design the data base table(similar to PER_OBJECTIVES). What are the mandatory column to support multi language.
Thanks,
UMA.Uma,
You will need at least two custom tables. The typical way that Oracle supports MLS/NLS is to have two tables - the first to hold an id or code of the object and the second (table name is typically suffixed with TL) which holds the descriptive translations of the object in the needed languages. A good example to follow would be to look at FNDRESPONSIBILITY and FND_RESPONSIBILITY_TL tables. The first table stores the responsibility short_name or code and the second table stores the actual description of the responsibility in the various languages that are enabled in your instance. The tables are joined using the responsibility id or code. At run time, the appropriate description of the object is retrieved from the TL table based on the users session language. If an entry is not found, then the US translation is substituted. ML Doc 333785.1 describes how all of this is achieved.
Since your tables are custom tables, you will have to provide your own translations for your objects.
HTH
Srini -
How to find out the changes made to the customized table entries
Hi Team
i want to know the changes made to the customized table. i have a 'Z' table in my production system, in that table i would like to know whether any table entry is deleted or not. if at all there is any deletion happened, i want to know who had done it.
So i request you to please let me know the procedure for the same.
Thanks
RajHi Nagaraju,
Go to Table Maintenance (SM30)- Display mode-- Utilities-- change Logs. Give the Date range. before giving the date range click on display status , this will show you If the display is active or not. Kindly please let me know If you need any more information on this.
Regards
Ram Pedarla -
Query regarding creation of tables using AET
Hi Experts,
First of all is it advisable to create a assignment block (table view/ form view) using AET?
We are going to implement an upgrade project from CRM 5.0 to CRM 7.0. In CRM 5.0 there was a two custom tables which needs to implemented in CRM 7.0 as an assignment block. One view will be form view and the other table view. The custom tables has data. What is the best way to go about it?
If we create assignment block using AET by using the option 'CREATE TABLE' a new database table is created which has three fields 'RECORD_ID' 'OBJECT_ID' and 'PARENT_ID'. Object ID stores the External ID of the campaign as GUID (RAW 16). Parent ID stores the Campaign GUID value. How is the Record ID generated?
Now the challenge is to move the data from the custom table to the table created using AET. Is there a standard function module to take care of it or we have to write a one time report?
Thanks in advance.
Regards,
Sayan
Edited by: jana6586 on Nov 23, 2011 12:14 PMHi Sayan,
I had to do the same story with the aet and the data we need to transfer into the Z table.
I have been looking for a function that takes care of it, but unfortunately i didnt found one.
If you didnt found one until now, i higherly recommand you to right a report that handles the transfer between the two tables in a generic way, and mabye even to share it
The Recoed id is simply a guid that is generetad behind the scenes, in order to keep a PK for each and each row of the Z table.
I hope that the answer helped you !
Regards,
mapatz. -
hi
I AM TRYING TO CREATE A CUSTOM IN ABAP
I followed the following procedure
SE11
SPCIFIED THE CUSTOM TABLE NAME
CLICKED ON CREATE BUTTON
THEN SPECIFIED SHORT DESCRIPTION
For Delivery Class I specified as C
For DataBrowser and Table variant I specified as Display and Maintenance allowed
Once I click on save before specifying other properties I see the following error displayed
"RFC system error for destination GTADIR_SERVER"
Thanks in advanceHi,
once again try like this.
Steps to Creating domains, Data Elements, Tables
To give you the steps for creating table:.
There are two approach in creating a table.
1. Bottom-up approach
2. Top-down approach.
Both are valid and you can choose which approach is suitable for you. I always use the bottom-up approach. Here are the steps to create the tables with this approach.
1. SE11 will take you to the DDIC and enter the name of the new table to be created. Let us say Zname. Click create.
2. Enter the short discription of the table and enter the field of the table. If it is primary key and you have to check the box.
3. Enter the data element and double click it, you will be asked to save and will take you to data element discription page. Enter the short discription of the data element and enter the information of domain like the length of field and type of field.
4. If you wanted to use the existing domain then its fine, or else, you have to create one. Enter the domain name in the data element page and double click it. Page will ask to save and jump to domain creation page.
5. In the domain page, you have to save the information which you have already given in the data elements page and check it. Before going to data element page, you have to activate the domain.
6. Go to data element page and save, check and activate.
7. Go to main table page and save, check, and activate.
8. Also, you have to save the technical settings of the table.
The table is now ready for operation. You can use it in your program or you can use it to enter information.
Check table: It is the table which will have all the information about the Foreign keys which are the primary keys in the check table.
It can be created by creating the foreign key from the main table. Click foreign key in the main table and it will take you to a page which will ask for table name and field to which foreign key relation has to be associated. Enter the information and you can create the check table automatically.
SM30 is used for maintenance of the table, that is to realease the errors occured during the creation of the table.
Well, this is the information I have.
Regards,
satish. -
How to create an EIT in Oracle apps with custom table?
Hi,
I have a custom table in APPS schema where training information is loaded everyday by running a control file.
I've to pick the training end date and status of 5 particular trainings and create an EIT.
When I try to create an EIT which is basically a DFF, in value set I'm not able to find my table.
Please guide me through this as I'm doing this for the first time.Hi Rajesh,
You can do the below steps to achieve your requirement (Code may vary to suit your needs, these are just a hint to approach your solution) :
1. Extract the zip file payload from the incoming module data
Object obj = inputModuleData.getPrincipalData();
Message msg = (Message)obj;
Payload attachment = msg.getMainPayload();
2. Construct a new outgoing payload using DOM resembling the structure that you defined in your design.
XMLPayload xmlpayload = msg.getDocument();
DocumentBuilderFactory factory;
factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.newDocument();
<Create your xml structure using DOM APIs>
// Transforming the DOM object to Stream object.
TransformerFactory tfactory = TransformerFactory.newInstance();
Transformer transformer = tfactory.newTransformer();
Source src = new DOMSource(document);
ByteArrayOutputStream out = new ByteArrayOutputStream();
Result dest = new StreamResult(out);
transformer.transform(src, dest);
byte[] docContent = out.toByteArray();
3. Set the newly created xml structure as the new main payload
xmlpayload.setContent(docContent);
msg.setMainPayload(xmlpayload);
4. Add the original document (zip file) as an attachment to the main payload.
msg.addAttachment(attachment);
5. Set the modified message to the inputModuleData and return it to the messaging system
inputModuleData.setPrincipalData(msg);
return inputModuleData;
Regards
Bikash -
Updating Custom Table Only in Debug Mode
Hi All!
I have been encountering issues in updating a custom table. It would work successfully only in debug mode otherwise it won't update an entry in the table.
This is the piece of code that would update an entry in the table specifically used in a user exit. The functionality of this code is to automatically remove a transportation block:
SELECT SINGLE *
INTO wa_zblock
FROM zblock
WHERE zzblknum EQ c_tr01
AND vbeln EQ p_lvbeln
AND zzprocessed EQ space.
IF sy-subrc EQ 0.
DO.
CALL FUNCTION 'ENQUEUE_E_TABLES'
EXPORTING
MODE_RSTABLE = 'S'
TABNAME = c_lzblock
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
IF sy-subrc EQ 0.
wa_zblock-zzprocessed = c_x.
wa_zblock-zzapproveby = sy-uname.
wa_zblock-zzapproveon = sy-datum.
MODIFY zblock FROM wa_zblock.
if sy-subrc EQ 0.
COMMIT WORK AND WAIT.
endif.
EXIT.
ENDIF.
ENDDO.
CALL FUNCTION 'DEQUEUE_E_TABLES'
EXPORTING
MODE_RSTABLE = 'S'
TABNAME = c_lzblock.
ENDIF.
How can I make this update the custom table successful in undebugged mode? Please let me know your thoughts on this.
Thanks!I also suggest you to lock only the entry that will be updated (and not the whole table!) : you will have then far less problems of conflict with updating this table.
For that, you have to create a lock object on your table (via SE11 - for example EZ_MY_TABLE). This will create 2 function modules named ENQUEUE_E<name of your lock object> (in my example ENQUEUE_EZ_MY_TABLE) and DEQUEUE_E<...>.
You can then call those FM like this :
CALL FUNCTION 'ENQUEUE_EZ_MY_TABLE'
EXPORTING
MODE_RSTABLE = 'S'
KEYFIELD1 = ld_keyfield1 " Here are the key values for the entry that you have to update
KEYFIELD2 = ld_keyfield2
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
Best regards,
Samuel -
Please let me know to construct a custom table as per below requiremnt
Dear Friends
can any one please let me know hot to create a custom table as below
| outpatient |
|employeeno | class | startdate | enddate | spouse |1stchild | 2nchild| Rate | amount|
My FO wants to enter in the SM30 as above ......i.e he wants to have spouse ,1st child and 2nd child under one group........so he asking me to make as one group
and give a heading as outpatient.........similary i have to give for in patient.
Please could any one tell is it possible.
regards
syamala...Steps to Creating domains, Data Elements, Tables
To give you the steps for creating table:.
There are two approach in creating a table.
1. Bottom-up approach
2. Top-down approach.
Both are valid and you can choose which approach is suitable for you. I always use the bottom-up approach. Here are the steps to create the tables with this approach.
1. SE11 will take you to the DDIC and enter the name of the new table to be created. Let us say Zname. Click create.
2. Enter the short discription of the table and enter the field of the table. If it is primary key and you have to check the box.
3. Enter the data element and double click it, you will be asked to save and will take you to data element discription page. Enter the short discription of the data element and enter the information of domain like the length of field and type of field.
4. If you wanted to use the existing domain then its fine, or else, you have to create one. Enter the domain name in the data element page and double click it. Page will ask to save and jump to domain creation page.
5. In the domain page, you have to save the information which you have already given in the data elements page and check it. Before going to data element page, you have to activate the domain.
6. Go to data element page and save, check and activate.
7. Go to main table page and save, check, and activate.
8. Also, you have to save the technical settings of the table.
The table is now ready for operation. You can use it in your program or you can use it to enter information.
Check table: It is the table which will have all the information about the Foreign keys which are the primary keys in the check table.
It can be created by creating the foreign key from the main table. Click foreign key in the main table and it will take you to a page which will ask for table name and field to which foreign key relation has to be associated. Enter the information and you can create the check table automatically.
SM30 is used for maintenance of the table, that is to realease the errors occured during the creation of the table.
create 1 data element with Outpatient and its domain as Patient datatype Char DATA LENGTH 1. in the value table of the Domain enter as
1 SPouse .
2 1stChild .
3 2nd Child
so the table fields
Employeeno 8 digit (CHAR)
Class 10 digit (CHAR)
Startdate 10digit(DATUM)
endatate 10digit(DATUM)
outpatient 1digit (C)-> Domian as 3 vaules
Rate 4digit (CURY)
Amount 15digit(CURR) referrnce Rate.
Reward points if it is usefull .
Girish -
JTable: Custom Table Model (pII)
As was explained in pI, I'm creating a custom table model to overcome a few pitfalls I came across using the DefaultTableModel class, such as aligning cells, and getting certain columns to return only numeric type data. However, I've come upon a few roadblocks myself.
How do I create each of the following methods:
insertRow(int ow, int column)
remove row(int row)
addRow(Object[] rowData)Assuming that I decide to allow the user to add a column to the table, how would I create the methodaddColumn(Object columnName, Object[] columnData)And also, as I'm creating a custom table model, would I need to replicate DefaultTableModel's methods that inform the listeners that a change has been made to the table?
Thanks!Thanks!
I just got this response. Anyways, I found another solution that was, interestingly, from one of your threads written in 2005.
This is what I did:
// Letting the JTable know what each column stores and should return by
// overloading the getColumnClass() method
public Class getColumnClass(int column)
if(recordsTable.getColumnName(column) == "Ranking")
return Integer.class;
/* Why do I keep ketting an IllegalArgumentException here? *
* It keeps saying it cannot format given object as a Number */
else if(recordsTable.getColumnName(column) == "Price (�) ")
return Float.class;
else
return getValueAt(0, column).getClass();
}However, another problem has arisen.
The if method for the int column (Ranking column) works okay, and is even right-aligned. The else if arguments for the Price (�) column however is returning an IllegalArgumentException. This I just cannot figure out.
Here's the code:package Practice;
import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.Menu;
import java.awt.MenuBar;
import java.awt.MenuItem;
import java.awt.MenuShortcut;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent; // for MenuItem shortcuts
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane; // JTable added to it, aiding flexibility
import javax.swing.JTable; // The personally preferred GUI for this purpose
// Provides a basic implementation of TableModel
import javax.swing.table.DefaultTableModel;
// This class uses Vector to store the rows and columns of data, though
// programmer will be using LinkedLists
import java.util.LinkedList;
// User-defined classes
import Practice.MusicDatabase;
public class MusicBank extends Frame implements ActionListener
MusicDatabase mDBase;
Frame frame;
String title = "", // Frame's title
file = ""; // pathname of the file to be opened
// Declaring Menu and MenuItem variables
Menu recordM; // ...
// recordM
MenuItem newRecordR_MI, deleteRecordR_MI;
// Other irrelevant menus and sub items
DefaultTableModel recordDetails;
JTable recordsTable;
LinkedList musicList;
public MusicBank()
musicList = new LinkedList();
frame = new Frame(title);
frame.setMenuBar(menuSystem());
// Should user seek to close window externally
frame.addWindowListener(new WindowAdapter()
public void windowClosing(WindowEvent we)
frame.dispose();
System.exit(0);
recordDetails = new DefaultTableModel();
// Creating the relevant columns
recordDetails.addColumn("Title");
recordDetails.addColumn("Identity");
recordDetails.addColumn("Music Company");
recordDetails.addColumn("Ranking");
recordDetails.addColumn("Price (�) ");
// Ensuring the table has at least one visible record (empty)
recordDetails.addRow(populateRow("", "", "", 0, 0.00f));
// Creating the table to display the data files (music record details)
recordsTable = new JTable(recordDetails)
// Letting the JTable know what each column stores and should return by
// overloading the getColumnClass() method
public Class getColumnClass(int column)
if(recordsTable.getColumnName(column) == "Ranking")
return Integer.class;
/* Why do I keep ketting an IllegalArgumentException here? *
* It keeps saying it cannot format given object as a Number */
else if(recordsTable.getColumnName(column) == "Price (�) ")
return Float.class;
else
return getValueAt(0, column).getClass();
// Creating the menus
public MenuBar menuSystem()
MenuBar bar = new MenuBar();
// Record menu and related items
recordM = new Menu("Record");
recordM.setShortcut(new MenuShortcut(KeyEvent.VK_R, false));
newRecordR_MI = new MenuItem("New record");
newRecordR_MI.setShortcut(new MenuShortcut(KeyEvent.VK_N, false));
deleteRecordR_MI = new MenuItem("Delete record");
deleteRecordR_MI.setShortcut(new MenuShortcut(KeyEvent.VK_D, false));
recordM.add(newRecordR_MI);
recordM.addSeparator();
recordM.add(deleteRecordR_MI);
// Enabling menus with functionality
newRecordR_MI.addActionListener(this);
deleteRecordR_MI.addActionListener(this);
// Adding menus and items to menu bar
bar.add(recordM);
return bar;
public void actionPerformed(ActionEvent ae)
if(ae.getSource() == newRecordR_MI)
newRecord();
else if(ae.getSource() == deleteRecordR_MI)
deleteRecord();
// Object that will be used, in conjunction with MusicDatabase's, to
// populate the JTable
// A record in a JTable is equivalent to an element in a LinkedList
public Object[] populateRow(String title, String name, String comp, int rank, float price)
// First, update the LinkedList
mDBase = new MusicDatabase(title, name, comp, rank, price);
musicList.add(mDBase);
// Then, update the table
// As the parameters of Object tableDetails can only take a String or
// object, rank and price will have to be cast as a String and later
// parsed to their original form before use.
String rankPT = ""+rank, pricePT = ""+price;
Object rowDetails[] = {title, name, comp, rankPT, pricePT};
return rowDetails;
public static void main(String args[])
MusicBank app = new MusicBank();
// Using the platform's L&F (if Win32, Windows L&F; Mac OS, Mac OS L&F,
// Sun, CDE/Motif L&F)
// For more on this, refer to the WinHelp Java tutorial by F. Allimont
try
UIManager.getSystemLookAndFeelClassName();
catch(Exception e)
JOptionPane.showMessageDialog(app,
"Failed to create the Windows Look and Feel for this program",
"Look and Feel (L&F) error",
JOptionPane.ERROR_MESSAGE);
app.frame.setSize(500, 500);
app.frame.setVisible(true);
// Placing frame in the centre of the screen on-loading
app.frame.setLocationRelativeTo(null);
// action methods per menu items
// Also, why do I keep getting an ArrayIndexOutOfBoundsException
// here? I do know what this exception is, and how it works, but just cannot
// understand what is causing it
public void newRecord()
// Before adding a new record, check if previous record has complete
// entries. If not, either display a message (JOptionPane) or disallow
// request (simply do nothing)
// Proceed based on assesment
if(queryState() == true)
// Inform user that all entries need to be filled in before a new
// record can be created
JOptionPane.showMessageDialog(this, // current frame
"There are incomplete cells in the table."+
"\nPlease fill these in before proceeding", // Message to user
"Incomplete entries", // Title
JOptionPane.ERROR_MESSAGE); // Relevant icon
else
// To ensure that both the linked list & the table are simultaneously
// updated, JOptionPane's input dialogs are used to temporarily store
// the data which is then inputted into both (linked list and JTable)
String titleN, identityN, companyN; int rankN; float priceN;
titleN = JOptionPane.showInputDialog(this, "Enter song title");
identityN = JOptionPane.showInputDialog(this, "Enter name of singer/band");
companyN = JOptionPane.showInputDialog(this, "Enter signed/unsigned company");
rankN = Integer.parseInt( JOptionPane.showInputDialog(this,
"Enter rank (a number)") );
System.out.println("\n JTable rows = "+recordDetails.getRowCount());
// Ensuring that the chosen rank is not already entered
/* Problem lies here */
for(int row = 1; row <= recordDetails.getRowCount(); ++row)
if((recordDetails.getValueAt(row, 4)).equals(""+rankN))
rankN = Integer.parseInt( JOptionPane.showInputDialog(this,
"That number's already chosen.\nPlease enter a rank ") );
priceN = Float.parseFloat( JOptionPane.showInputDialog(this, "Finally, enter price �") );
mDBase = new MusicDatabase(titleN, identityN, companyN, rankN, priceN);
musicList.add(mDBase);
recordDetails.addRow(populateRow(titleN, identityN, companyN, rankN,
priceN));
System.out.println("JTable rows after creation = "+
recordDetails.getRowCount());
// Enabling the delete record menu item (as necessary)
if((recordsTable.getRowCount()) > 0)
deleteRecordR_MI.setEnabled(true);
} // newRecord()
public void deleteRecord()
int selectedRow = recordsTable.getSelectedRow();
recordDetails.removeRow(selectedRow);
// Removing the element from the LinkedList's corresponding index
musicList.remove(selectedRow);
System.out.println("Existing rows = "+recordsTable.getRowCount());
// If there are no more rows, disallow user from trying to delete rows
if(selectedRow <= 0)
deleteRecordR_MI.setEnabled(false);
} // deleteRecord()
// Method to query if all cells have changed their states (empty or not)
public boolean queryState()
// Obtaining number of rows
int rows = recordDetails.getRowCount();
int columns = recordDetails.getColumnCount();
boolean isEmpty = false; // cell
System.out.println("Rows = "+rows);
System.out.println("Columns = "+columns);
try{
// Assessing all cells for complete entries
// This approach is flexible, rather than hardcoding the rows available,
// making it more reusable (assuming it will always be 5 columns)
for (int rowIndex = 0; rowIndex<=rows; ++rowIndex)
if((recordDetails.getValueAt(rowIndex, 1)).equals(""))
isEmpty = true;
else if((recordDetails.getValueAt(rowIndex, 2)).equals(""))
isEmpty = true;
else if((recordDetails.getValueAt(rowIndex, 3)).equals(""))
isEmpty = true;
else if((recordDetails.getValueAt(rowIndex, 4)).equals("0"))
isEmpty = true;
else if((recordDetails.getValueAt(rowIndex, 5)).equals("0.00"))
isEmpty = true;
catch(Exception e)
System.out.println(e.getMessage());
return isEmpty;
Now here is the code for the MusicDatabase class
package Practice;
class MusicDatabase
private String songTitle, identity, musicCompany;
private int rank;
private float priceF;
// Defining the constructor
public MusicDatabase(String title, String name, String company, int rankingInt, float price)
songTitle = title;
identity = name;
musicCompany = company;
rank = rankingInt;
priceF = price;
} // constructor
// Other methods
} // class MusicDatabaseSorry, but am not sure if these codes are executable, as where I am (a general library), JVM is not on the machine I am using. (Remember, i don't have ready acess to the Internet, so I could not use my machine, nor the facilities that had the JVM - unavailable to me at the time).
Thanks!
Reformer...
PS I do hope the code pasted was not too much. Kind regards....
Maybe you are looking for
-
Installed Jam Pack but see no new loops in Garageband loop browser. Why not?
I successfully installed Jam Pack but don't see new loops in Garageband loop browser. Is there some extra step I'm supposed to do? Before, I had about 57 Rock/Blues loops, and I still have just that. I had 14 instruments under All Drums, and guess wh
-
I changed email addresses some time ago, and I thought that I had updated my Apple Account. When I tried to log in with the new email addy, I got a message that this emaill addy had not been set up as an account yet. So I cancelled that message, went
-
Hello, I am not able to export a movie in IMovie 10.0.1.
Everytime when I export a movie (for example as file, to I-Tunes or to the theatre) on my Mac Book Pro (from Februay 2013) I receive an error message. This Error Message is: "The Export of the Movie XY failed - Error during rendering of the video: -5
-
File associations in Photoshop/Photoshop Elements
Hi! I use Photoshop CS5 for all of my college classes but installed Photoshop Elements primarily to edit/clean up my photos. Now, every time I click on a class file, it opens in Photoshop Elements. How can I correct this so that they will open in Pho
-
Hover effect... made larger
Hi... not the biggest web genius but know a little. I've set up a hover effect on some links to show a blue background when you roll over. The 'blue' surrounds the type pretty tight... the highlight colour surrounds the text above and below but not