User-defined object problem,why can't I use?
as follows:
UObject.java
package test1;
public class UObject
private String num;
public UObject()
public void setNum(String num)
this.num=num;
public String getNum()
return num;
Test.java
package test1;
public class Test
public static void main(String args[])
UObject U=new UObject();
U.setNum("Squall");
System.out.println(U.getNum());
UObject[] U=new UObject[5];
for(int i=0;i<U.length;i++)
U.setNum(String.valueOf(i));
for(int i=0;i<U.length;i++)
System.out.println(U[i].getNum());
error:
java.lang.NullPointerException
why can't I use?please tell me why?thanks.
ps:in Test.java's comments can run./**/.
Please use code formatting tags in future! http://forum.java.sun.com/features.jsp#Formatting
It would be easy to find the problem yourself if you printed out a stack trace e.g.
public static void main(String args[])
try
UObject U=new UObject();
U.setNum("Squall");
System.out.println(U.getNum());
UObject[] U=new UObject[5];
for(int i=0;i<U.length;i++)
U.setNum(String.valueOf(i));
for(int i=0;i<U.length;i++)
System.out.println(U.getNum());
catch( Exception e )
e.printStackTrace()
}Tho code doesnt look lke it compiles to me!
Similar Messages
-
User Defined Object Default Form - Can't add record
Hi,
I have created a user defined object on a Master Data Table with acccompanying Rows table.
For some reason I can't get any records in the Master table. SBO claims the operation (save) was succesfull however the table remains empty and the line I entered gets cleared!
I'm running SBO2005ASP01PL07 so I don't think I'm missing any updates.
Anyone have an idea as to what''s wrong?
Regards,
Ivo VinkFor those that encounter the same problem.
A tool from a third party had made a small change in the SBO_SP_TransactionNoticfication stored-procedure,
This change produced an error when a transaction was done on a UDO becuase the object type of an UDO is NOT numeric but contains the name of the UDO.
The adjustment made assumed Object_Type was allways numeric wich it is NOT.
An error occured, resulting in SBO rolling back the entire transaction.
Simple adjustment:
If isnumeric(@object_type) = 1
BEGIN
-- third party added code
END
Regards,
Ivo Vink -
I am Adding data of matrix using UDO
data is successfully entered.
but there is one problem that one extra blank row of matrix is also added into database.
I can check by code that last row of matrix is blank or not but i am unable to prevent to get added that blank row of matrix in database.
Is there any method to prevent that last blank row to get added.
Edited by: Rakeshbos on Apr 18, 2010 12:33 PMI get answer by myself
by deleting blank row -
Link button to User Defined Object in Grid
Hi,
I'm using SAP B1 8.81 with B1DE.
I have added a grid which is populated from a DataTable to a form.
One of the columns in the grid contains the DocEntry of a User Defined Object.
How can I display a link button on the grid ?
Regards,
BenHello Ben,
You need to set the column object type.
Dim oGrid As SAPbouiCOM.Grid = oForm.Items.Item("MyGrid").Specific
oGrid.Columns.Item("DocEntry").Type = BoGridColumnType.gct_EditText
Dim oEditCol As SAPbouiCOM.EditTextColumn = oGrid.Columns.Item("DocEntry")
oEditCol.LinkedObjectType = "2" 'The SDK documentation says you should use the value 0, but in previous versions it didn't work, so I recommend you user a value other than -1 or 0
You then need to catch the et_MATRIX_LINK_PRESSED event and other your user form...
From the SDK Help File regarding the BoLinkedObjectType enum
lf_None -1 No target object
lf_UserDefinedObject 0 User-defined object
lf_GLAccounts 1 G/L account object
lf_BusinessPartner 2 Business Partner object
lf_Items 4 Item object
lf_SalesEmployee 53 Sales employee object
Regards,
Vítor Vieira -
How to assign a query retrived value to a user defined object in a table
how to assign a query retrived value to a user defined object in a table
Rajeshwar,
If you use the "Search" feature in this forum, you should be able to find helpful links to similar questions. You could also look at the RecordSet and DoQuery documentation in the SAP Business One SDK Help Center documentation to assist you with your question.
HTH,
Eddy -
I developed our own Authentication, Identity Assertion & Authorization providers
for weblogic 8.1 SP1. In the authenticator MBean i have one method which takes
user defined object as a argument and returns a user defined object. i am able
to call all the methods which takes java objects(for example: String, int, ArrayList,
HashMap, Etc...) as a argument and returns also a java object but when i user
any user defined object then it gives exception. if in the argument i used user
defined object then it is not able to call that method telling NoSuchMethodException.
Is there any way to use user defined object as an argument to MBean method?
can anyone please help us as we r in the final stage of the project?
Thanks
Lakshmi"Lakshmi Padhy" <[email protected]> wrote in message
news:3fc2f50c$[email protected]..
>
I developed our own Authentication, Identity Assertion & Authorizationproviders
for weblogic 8.1 SP1. In the authenticator MBean i have one method whichtakes
user defined object as a argument and returns a user defined object. i amable
to call all the methods which takes java objects(for example: String, int,ArrayList,
HashMap, Etc...) as a argument and returns also a java object but when iuser
any user defined object then it gives exception. if in the argument i useduser
defined object then it is not able to call that method tellingNoSuchMethodException.
>
Is there any way to use user defined object as an argument to MBeanmethod?
>
I seem to remember that jmx only supports scalar datatypes. Ask in the
weblogic.developer.interest.management newsgroup. -
Crystal Report Templates for User-Defined Objects
Hello Experts,
I am running SAP B1 8.8 PL11. In the current patch SAP has default Crystal Reports that can be used as Layouts for Invoices, Credit Memo's so on. Is it possbile to have layouts for user defined objects ( say for instance i have a customized form under sales module, can i import a crystal template for this customized form?). In the report layout manager i don't see an option to import user-defind objects.
Any help would be appreciated.
Thanks,
PraneethIf this is still a problem please re-post to the SAP Integration Kit forum.
-
Add rows in User Defined Object
Hi all,
I've created a simple User Defined Object.
I have a Master Data table (with the fields code and name)
and a Master Data Line (with just on field itemCode)
I want to use my own form to fill the information. For that I created a form, with two edit text items (link to the field Code and Name) and a matrix with one column bounded to my table Master data Line
it works fine if I want to add data only in the master data table, witout related record in the master data line atble.
The probleme I have is to add more than one record in my matrix. When I try something like oMatrix.Addrow, it adds the rows in the matrix, but it doesn't update or add the data in the table
If I use the default form option for the UDO object, I can se that the related table is feeded in a second form, but I need to have the Master Data and the master data line in only one form.
I hope the explanation of my problem is understandable
Thanks for your help
SebastienI have the answer, the DBDatasources needs to be cleared :
oForm.DataSources.DBDataSources.Item("MyUserTable").Clear()
oMatrix.AddRow(1) -
how to use UDO--user defined object in sap b1????
Creating UDO in SAP B1
1. Create UDT, ( Create UDT as Document if want the code to be in auto increament form)
2. Create UDFs for created UDT,
3. Register Object using "Object Registration Wizard",
(a) Put UDT's unique name in "UNIQUE ID" field of UDO (Image - UDO01.jpg) ,
(b) Do further as per requirements,
4. After Registering the UDO, you can access it from where you have set it to access (@ UI Settings of "User - Defined Object Registration Wizard"),
5. If you wana change the field location / change the design of the form, Open screen painter as and click on "Open User Defined Object List " (Mostly 3rd icon from Left in screen painter),
6. Make required changes and save it by clicking "Save Form To Database" ( Mostly 2nd icon from Left in Screen Painter),
7. Now the UDO is ready and can be used by user. -
Transfer user defined object between 2 databaeses
i have created a user defined object in my local db.
i need to import it to the companies server.
what should i do ?If you are talking about the definition - you can use the Copy Express Add-On from SAP.
Regards -
Wanting to copy DOM element child value into user defined object in PL/SQL.
We have a DOM object and can retrieve the object elements. We are wanting to take the elements and map them to user defined object attributes. We want to then place the element child (the text portion of <item>Foo</item> into the object attribute. Is there a package or utility that is available where we can simply pass the DOM and user defined objects and "magic happens here"?
We have a DOM object and can retrieve the object elements. We are wanting to take the elements and map them to user defined object attributes. We want to then place the element child (the text portion of <item>Foo</item> into the object attribute. Is there a package or utility that is available where we can simply pass the DOM and user defined objects and "magic happens here"?
-
How to clone a user-defined object?
Hello,
I need to clone an Object[] array (propArray) that holds objects of Integer, Double, Boolean type, along with objects of user-defined ClassA, ClassB, ClassC type. The matter is that the ClassA object isn't being cloned, while the rest of the user-defined objects are cloned just fine.
In more detail, ClassA has two properties:
public class ClassA implements Cloneable{
private String penaltyFor;
private Penalty[] penaltyArray;
protected Object clone(){
try{
ClassA o = (ClassA)super.clone();
o.penaltyFor = this.penaltyFor;
// o.penaltyArray = (Penalty[])penaltyArray.clone(); //This ain't working.
//But neither does this :(.
int penCount = this.penaltyArray.length;
o.penaltyArray = new Penalty[penCount];
for(int i = 0; i < penCount; i++)
o.penaltyArray[i] = (Penalty)this.penaltyArray.clone();
return o;
} catch(CloneNotSupportedException e){ throw new InternalError(); }
The Penalty class contains properties of primitive type and here is its clone() method:
public class Penalty implements Cloneable{
private String penaltyDesc;
private int lowLimit, upperLimit, penaltyValue;
protected Object clone(){
try{
Penalty o = (Penalty)super.clone();
o.penaltyDesc = this.penaltyDesc;
o.lowLimit = this.lowLimit;
o.upperLimit = this.upperLimit;
o.penaltyValue = this.penaltyValue;
return o;
} catch(CloneNotSupportedException e){ throw new InternalError(); }
}I don't know what else to try. I suppose the problem is the Penalty[] array, but I may be wrong. An alternative would be to use Copy Constructors, but it will cause too many changes to the code, since the clone() method is used for the propArray copy in many places and the ClassA object is a late addition to the propArray (unfortunately it wasn't planned to exist from the beginning).
Thank's.class ClassA implements Cloneable{
private String penaltyFor;
private Penalty[] penaltyArray;
public Object clone(){
try{
ClassA o = (ClassA) super.clone();
if (penaltyArray!=null){
o.penaltyArray = (Penalty[]) penaltyArray.clone();
for(int i = 0; i < penaltyArray.length; i++) {
Penalty penalty = this.penaltyArray;
if (penalty!=null)
o.penaltyArray[i] = (Penalty) penalty.clone();
return o;
} catch(CloneNotSupportedException e){
throw new InternalError();
class Penalty implements Cloneable{
private String penaltyDesc;
private int lowLimit, upperLimit, penaltyValue;
public Object clone(){
try{
return super.clone();
} catch(CloneNotSupportedException e){
throw new InternalError();
If your Penalties are immutable, you don't need to clone them -- rather,
make then unclonable, like Strings. -
EJB : How to return user defined object
hi,
i am a newbie in EJB. i have the following simple problem:
public interface MyApp extends EJBObject
public String getResult() throws RemoteException;
}the above code will be ok because it is returning String object.
however, i need to return a user defined object like:
public interface MyApp extends EJBObject
public MyResult getResult() throws RemoteException;
}then i got java.lang.ClassCastException during runtime.
please tell me how to resolve this problem.
thank you very muchsince you are a newbie, let me explain something to you. Ask your question in the proper forum. In case, you still don't understand there is a forum for EJB questions.
-
Dispose a user-defined object in Java
Hello,
Suppose I have the following loop :
while ( some_condition) {
UserDefinedClass abc = new UserDefinedClass();
// do some work and exit loop.
Everytime, I enter this loop I instantiate a new object "abc". I am worrying that if I keep doing this, after a while, I will run out
of memory. Is there a way to dispose a user-defined object? Or is this scenario taken care of by Java garbage collection process?
Any advice is much appreciated.
Akino.Akino wrote:
Hello,
Thank you for your reply.
I wonder if you could tell me how often Java does its garbage collection?That's pretty unpredictable.
I ran a test and observed that
my program's memory usage kept going up and up.If you gave it it 64M, and the most it ever needs at one time is 10M, it can still ramp up to the full 64M, even if it's doing frequent GC. Running GC does NOT mean that the JVM gives the memory back to the OS. It can do that, and I think it does under some circumstances, but there's no guarantee if, when, or how much it will give back. GC only means that the JVM has reclaimed space that is no longer in use by objects. Whether it holds onto that memory for future use or gives it back to the OS is up to it. -
Howto use user defined object in where clausel
i create a user defined object adm_t
SQL> desc adm_t
Name Null? Type
USER_ID NUMBER(38)
STATUS NUMBER(38)
DATUM DATE
then i create a table test
create table test
admin adm_t;
There is no problem to insert or select the data, but i don't know howto use the object in the where clausel.
select * from test where test.admin = adm_t(1,1,sysdate); works fine
but i only want get data for user_id = 1 independend of status, datum like
select * from test where test.admin = adm_t(1,%,%);
Need helpThe solution is to use a synonyms for table test
select * from test a where a.adm.user_id = 1
Maybe you are looking for
-
My iPhone 5s began having a lot of issues this morning. It started when I first opened up a text message. The phone was silent until I actually opened up a conversation and then my text notification began going off over and over again until I closed
-
Portal30 Installation/configuration problems.
Subject: Portal30 Please share your solution in installing th Oracle Portal 3.0 (included in Oracle 9iAS installation.). I am facing problem in its installation on WINDOWS 2000 server. The first time I installed the Oracle 9iAS 1.0.2, the Portal30 an
-
I want to change it to my husbands so all of our information syncs on to my iphone and our ipad, but will this completely delete my iCloud account? and by doing this how will my phone change (such as contacts, photos etc.) ?
-
How do I assign keywords to groups of photos?
apologies in advance if this has been answered, I can't see how to search the forum first before posing the question. I recently bought a DSLR. my photography habit is exploding and I'm creating a lot more photos. I need to be more diligent about org
-
My Nano is being recognized on one computer but not on the other?
I bought a Nano last October. Connected to my HP Pavilion ze5700 laptop. Everything was working well. Some thing went wrong with the screen couple of months ago. Send the Nano back and got a new one. Loaded the latest software. Plugged the new Nano.