Initialize values in 1001
I want to initialize values in IT1001 thrue a measure. Is it possible with a BADI or a User_Exit?If yes, which one?
Hi,
I want to know how can I initialise values in dynpro 1001 when I execute a measure 26. I also search in the BADi HRBAS00INFTY, but we can access to the fields of the screen. Does it exist another solution like the exit ZXPADU01 for PA.
Thanks for you response.
Similar Messages
-
Hi all,
We reseted a company using :
-function "reset company code" ( line items only) (tcode OABL) for FIAA
-function "delete transaction date" (tcode OBR1) for FI and CO
We used AFAR to recalculate values for ANLC.
The problem is that some assets still have a value in ANLC.
Is there any way to initialize values in this table for all assets of a company code?
Thank you for your help,
Regards,
JulienHi Julien,
Did you the action behind the help from the field Delete Line Items?
When this field was not sellected all assets are deleted!!
Deletes only the transaction data in the company code, but not the asset master records.
Dependencies
The system deletes all transaction data of all fiscal years. From a technical perspective, this means the contents of the ANEK, ANEP and ANEA tables are deleted, but not the contents of table ANLC containing the master data.
After this, you have to recalculate depreciation. This requires that all fiscal years be open. If necessary, you have to reopen closed fiscal years.
If there are problems nonetheless afterward, delete all data in the company code, including master data, in order to avoid later errors due to data inconsistencies. -
Primary Classification field is showing Balance Initialization value
Dear Team,
I am facing problem in Element Screen, whenever i want to create an element i want to select Primary Classification but unfortunately when i click on the LOV of the Primary Classification to select the Earning or Deduction the LOV only show the "Balance Initialization Value"
I created my own responsiblity, i select the "GLB HRMS Navigator" Menu.
but when i switch responsibility to "Global HRMS Manager" or "Human Resource Vision Enterprise" then primary classification shows the complete seeded value list.
kindly guide me.
Thanks & Take Care.
Kamran J. ChaudhryDear Team,
The issue is resolved. Actually the problem in the "Legislation"... i created BG and select "Pakistan" in the Legislation for this many features become disabled and not able to access. i create new BG and only change the "Legislation"... and enter "United Kingdom" the problem resolved.
Thanks
Kamran J. Chaudhry -
H:inputText ; How To initialize value Property from back/bean method?
Hello Guys at Sun Forums.
I am a newbie at using JSF. and I'm having a bit of a Problem.
I don't know how to initialize the value property of a h:inputText from a method inside a backing bean that returns a String data type.
My Method inside the Backing bean is this:
public String getLastDate()
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
Date DateCapt = null;
String DateConv= null;
try{
Class.forName("com.sybase.jdbc2.jdbc.SybDrive").newInstance();
con = DriverManager.getConnection("jdbc:sybase:Tds:localhost/BAN_PRO_SNP", "xxxx", "xxxx");
if(!con.isClosed()){
stmt = con.createStatement();
stmt.executeQuery ("SELECT TOP 1 CONVERT(VARCHAR(10), fec_parametro, 103) fec_parametro FROM snp_sei_parametros" +
" WHERE cod_parametro = 'FECHA'" +
" ORDER BY fec_parametro DESC");
rs = stmt.getResultSet();
while (rs.next())
DateCapt = rs.getDate("fec_parametro");
rs.close();
stmt.close();
catch (Exception ex)
System.out.println("COULD NOT LOAD THE DRIVER!!!!");
System.out.println(ex);
DateConv = String.valueOf(DateCapt).toString();
return DateConv;
}As you can see the Method returns a String data type, and all I want to know is how put that returned String as the initial value of a h:inputText. when the jsf-jsp page loads.
Please Help Me.You should be able to do
<h:inputText value="#{bean.lastDate}"/>Where 'bean' is the managed bean name containing
the method getLastDate().
When the view is rendered, the getter (getLastDate())
will be called to display whatever value is returned. -
Button that initializes values then releases control of further booleans
I am attempting to create a button that turns on a series of other buttons but then releases control to allow individual switching. The problem is that for my project I must run the labview file continuously so when I change a control switch to true it keeps the value of the other booleans true. For example, I flick a switch to turn all the lights on at the same time but then later want to have the power to individually turn particular lights off. Then also have the ability to turn all the lights off again with a click of a button. I'm having trouble figuring this out. I don't have much so far, sorry for that.
Solved!
Go to Solution.
Attachments:
Switches.png 18 KBAttached are the 3 files necessary for running the Matrix Control VI. It's basically a solar tracking program.
Attachments:
MatrixControl.vi 38 KB
Building Location.vi 8 KB
angular placement compensation.vi 17 KB -
I want to display value of quantity field as blank if it contains vaue as 0.00
This is the query which i hav written.
select * from resb into corresponding fields of resb_itab_wa
where aufnr = itab_wa-aufnr AND WERKS = ITAB_WA-DWERK.
IF RESB_ITAB_WA-ENMNG = 0.
RESB_ITAB_WA-ENMNG = ' '.
ENDIF.
i.e. if the value of resb_itab_wa is 0.00 then it should display blank
So i wrote the above query. But there is no change . 0.00 is yet being displayed.
Do i hav to write something else since it is a quantity field.WHERE do you have your problem?
in SMARTFORMS? in SAP-Script? in a write statement?
in SMARTFORMS and in SAP-Script the solution is quite easy.
at your output variable in your form just add (I).
Example: &EKPO-NETWR(I)&
if EKPO-NETWR is initial (would be 0.00), then it wiont get printed.
if it differs from initial state, then it will be printed.
if you have that problem in a write statement, you should swap that value through a char field, and print (write) that char field.
Swap the value ONLY if your value is not initial. -
Obiee 11g - Master/detail : How to initialize details ?
Hi gurus,
I'm using the last version of obiee.
I have a dashboard with master/detail. The master/details are working great when I click on cells.
But I have some "initialization" problems.
- master/detail with a prompt list on the master table
a change on the list won't initialize the detail. I would like to have the detail refreshed with the first row of the master.
- master/detail with different order by on master and detail
the initialization value of the detail does not fit with the first row of the master.
Is it possible to achieve this ?
Thanks in advance for your help.
EmmanuelHi Dpka,
Thanks for sharing your view . I ,even observe the same 'error' message returining false value at the bottom-left of my browser when set up the Master detail even and clicked my table column to reflect the value in the graph .
But my situation is bit tricky . I can't expose two different views to see if separating the interaction works well or not . In my case I have only 1 report with 4 compound layout(with pivot table(master) and Graph(detail)) having view selector . So this is practically not separable as this incurs loss of other functionalities.
Do you have any suggestion in mind . I tried to see Supportweb and doesn't have any valid bug reported :(
Rgds,
DxP -
How to update fields in the target table in correspondance with the source file values
Environment: win7, SQL server 2008 R2
Application: Microsoft Management SQL Studio 2008 R2, Business Intelligence 2008 - SSIS
SSIS competency level: Novice
Problem: I have been trying to update some of the fields in the destination table,student table, in reference to data set in the staging table and ssn table. I was able to insert/load new data to the destination using look up transformation
while the driver is ssn (data mapping) but i couldn't know how to update some of the fields in the student table while keeping the orignal pn_id of both tables(ssn and student tables), because pn_id already exists in the SSN table and student table. There
are other records also associated with the pn_id so I am not allowed to update the pn_id in the destination tables. For example,
SSN Table (pn_id,ssn)
('000616850',288258466)
('002160790',176268917)
Staging Table (ssn, id, pn_id, name, subject, academic year, comments)
(288258466, 1001, '770616858',Sally Johnson, English,A, 2005,'great student')
(176268917, 1002, '192160792',Will Smith, Math,38000,C, 2014,'no comments')
(444718562, 1003, '260518681',Mike Lira, Math,38000,B, 2013,'no comments')
Student Table (destination table)(id,pn_id,subject,academic year, grade, comments):
(1001, '000616850', ' ',' ', ,'')
(1002, '002160790', ' ',' ', ,'')
Expected Results:
My goal is to have student table updated as the following:
Student Table
(1001, '000616850', 'English','A' ,2005 ,'great student')
(1002, '002160790', 'Math ',' C',2014 ,'no comments')
please adviseWhy can't you use simple UPDATE command in EXECUTE SQL Task as below,
DROP TABLE SSN
DROP TABLE STAGING
DROP TABLE STUDENT
CREATE TABLE SSN(pn_id VARCHAR(100),ssn BIGINT)
INSERT INTO SSN VALUES('000616850',288258466)
INSERT INTO SSN VALUES('002160790',176268917)
CREATE TABLE Staging (ssn BIGINT, id INT, pn_id BIGINT, name VARCHAR(100), subject VARCHAR(100),grade VARCHAR(10), [academic year] INT, comments VARCHAR(100))
INSERT INTO Staging VALUES(288258466, 1001, '770616858','Sally Johnson', 'English','A', 2005,'great student')
INSERT INTO Staging VALUES(176268917, 1002, '192160792','Will Smith', 'Math','C', 2014,'no comments')
INSERT INTO Staging VALUES(444718562, 1003, '260518681','Mike Lira', 'Math','B', 2013,'no comments')
CREATE TABLE Student(id INT,pn_id BIGINT,subject VARCHAR(100), [academic year] INT, grade VARCHAR(10), comments VARCHAR(100) )
INSERT INTO Student VALUES(1001, '000616850', NULL,NULL,NULL ,NULL)
INSERT INTO Student VALUES(1002, '002160790', NULL,NULL,NULL ,NULL)
UPDATE Student SET Subject = C.Subject, [academic year]=C.[academic year], grade=C.grade,comments=C.comments
FROM SSN A INNER JOIN Student B
ON A.pn_id=B.pn_id INNER JOIN Staging C
ON A.ssn = C.ssn
SELECT * FROM Student
Regards, RSingh -
How to generate unique values while initializing values
I am initializing values in my pl/sql program and want to use a sequence to set my unique ids but it errors out. Below is what I use.
ie. table_id := table_seq.nextval;
How can I use my sequence to initialize values or is this possible?The method suggested by user605919 will work. However, you don't need to initialize a variable like this. It is better and more performant to do it like the third example below:
SQL> create table mytable
2 ( id number(6)
3 , description varchar2(30)
4 )
5 /
Tabel is aangemaakt.
SQL> create sequence table_seq start with 1 increment by 1
2 /
Reeks is aangemaakt.
SQL> declare
2 table_id mytable.id%type := table_seq.nextval;
3 begin
4 insert into mytable
5 ( id
6 , description
7 )
8 values
9 ( table_id
10 , 'Some description'
11 );
12 end;
13 /
table_id mytable.id%type := table_seq.nextval;
FOUT in regel 2:
.ORA-06550: line 2, column 41:
PLS-00357: Table,View Or Sequence reference 'TABLE_SEQ.NEXTVAL' not allowed in this context
ORA-06550: line 2, column 12:
PL/SQL: Item ignored
ORA-06550: line 9, column 5:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 9, column 5:
PL/SQL: ORA-00904: "TABLE_ID": invalid identifier
ORA-06550: line 4, column 3:
PL/SQL: SQL Statement ignored
SQL> declare
2 table_id mytable.id%type;
3 begin
4 select table_seq.nextval
5 into table_id
6 from dual
7 ;
8 insert into mytable
9 ( id
10 , description
11 )
12 values
13 ( table_id
14 , 'Some description'
15 );
16 end;
17 /
PL/SQL-procedure is geslaagd.
SQL> begin
2 insert into mytable
3 ( id
4 , description
5 )
6 values
7 ( table_seq.nextval
8 , 'Some description'
9 );
10 end;
11 /
PL/SQL-procedure is geslaagd.And if you need the id value for some code after the insert, you use the RETURNING clause.
Regards,
Rob. -
Table will not show mutiple price values
I am unable to go beyond 152 for my property price. I want it to say 152000. This is what I put into Oracle:
SELECT *
FROM Property;
PROPERTY_NUM PROPERTY_ADDRESS PROPERTY_CITY PROPERTY_STATE PROPERTY_ZIP PROPERTY_PRICE PROPERTY_TYPE
0001 245 Benner St Philadelphia PA 19111 152 Townhome
0002 327 Silver Ave Willow Grove PA 19090 260 Duplex
0003 9243 Treaty Rd Philadelphia PA 19114 190 Single Family
0004 225 Chestnut St Philadelphia PA 19103 245 Condo
0005 511 Franklin Ave Cherry Hill NJ 08002 225 Single Family
This is my tables:
CREATE TABLE Property
(Property_Num CHAR (4) PRIMARY KEY,
Property_Address CHAR (25),
Property_City CHAR (15),
Property_State CHAR (2),
Property_Zip CHAR (5),
Property_Price DECIMAL (10,2),
Property_Type CHAR (15) );
CREATE TABLE Owner
(Owner_Num CHAR (3) PRIMARY KEY,
Property_Num CHAR (4),
Owner_Name CHAR (15),
Owner_Telephone CHAR (15) );
CREATE TABLE Inspection
(Inspection_Code CHAR (4) PRIMARY KEY,
Inspection_Type CHAR (20),
Inspection_Description CHAR (40),
Owner_Num CHAR (3),
Inspection_Date DATE );
CREATE TABLE Realtor
(Realtor_Num CHAR (2) PRIMARY KEY,
Inspection_Code CHAR (4),
Realtor_Name CHAR (30),
Realtor_Telephone CHAR (15) );
INSERT INTO Property
VALUES ('0001', '245 Benner St', 'Philadelphia', 'PA', '19111', 152000.99, 'Townhome');
INSERT INTO Property
VALUES ('0002', '327 Silver Ave', 'Willow Grove', 'PA', '19090', 260000.99, 'Duplex');
INSERT INTO Property
VALUES ('0003', '9243 Treaty Rd', 'Philadelphia', 'PA', '19114', 190000.99, 'Single Family');
INSERT INTO Property
VALUES ('0004', '225 Chestnut St', 'Philadelphia', 'PA', '19103', 245000.99, 'Condo');
INSERT INTO Property
VALUES ('0005', '511 Franklin Ave', 'Cherry Hill', 'NJ', '08002', 225000.99, 'Single Family');
INSERT INTO Owner
VALUES ('101', '0001', 'John Smith', '267-333-4667');
INSERT INTO Owner
VALUES ('102', '0002', 'Joe Taylor', '215-657-2200');
INSERT INTO Owner
VALUES ('103', '0003', 'Debra Jones', '215-745-9087');
INSERT INTO Owner
VALUES ('104', '0004', 'Frank Martin', '267-457-9300');
INSERT INTO Owner
VALUES ('105', '0005', 'Drew Hunt', '856-908-3200');
INSERT INTO Inspection
VALUES ('1001', 'Pre-Listing Check', 'Passed all eight tests', '101', to_Date('2/16/10','mm/dd/yyyy'));
INSERT INTO Inspection
VALUES ('1002', 'Walk-In', 'Property up to date on requirements', '102', to_Date('3/11/10','mm/dd/yyyy'));
INSERT INTO Inspection
VALUES ('1003', 'Appointment', 'All checks up to date', '103', to_Date('1/15/10','mm/dd/yyyy'));
INSERT INTO Inspection
VALUES ('1004', 'General Check', 'Property is in good shape to sell', '104', to_date('3/14/10','mm/dd/yyyy'));
INSERT INTO Inspection
VALUES ('1005', 'Request', 'Everything requested is up to date', '105', to_date('2/22/10','mm/dd/yyyy'));
INSERT INTO Realtor
VALUES ('01', '1001', 'Tim Simpson', '267-543-2267');
INSERT INTO Realtor
VALUES ('02', '1002', 'Bill Bradley', '215-754-2330');
INSERT INTO Realtor
VALUES ('03', '1003', 'Phil Harris', '215-742-6687');
INSERT INTO Realtor
VALUES ('04', '1004', 'Sam Brown', '267-277-5500');
INSERT INTO Realtor
VALUES ('05', '1005', 'April Young', '856-228-3550');
Can someone help me with this problem. Thank You.Probably more to do with how you inserted the records. Please run the following commands and share with us the results.
DELETE FROM property
WHERE property_num IN ('0001', '0002', '0003', '0004', '0005');
INSERT INTO Property
VALUES ('0001', '245 Benner St', 'Philadelphia', 'PA', '19111', 152000.99, 'Townhome');
INSERT INTO Property
VALUES ('0002', '327 Silver Ave', 'Willow Grove', 'PA', '19090', 260000.99, 'Duplex');
INSERT INTO Property
VALUES ('0003', '9243 Treaty Rd', 'Philadelphia', 'PA', '19114', 190000.99, 'Single Family');
INSERT INTO Property
VALUES ('0004', '225 Chestnut St', 'Philadelphia', 'PA', '19103', 245000.99, 'Condo');
INSERT INTO Property
VALUES ('0005', '511 Franklin Ave', 'Cherry Hill', 'NJ', '08002', 225000.99, 'Single Family');
SELECT *
FROM Property;Regards,
Phiri -
Error while fetching variable value from sqlserver database in 11g
Hi
We created a dynamic variable to fetch data from sqlserver database in 11g.But when we test it, it is erroring out as follows: "nqserror: 27024 the execute physical statement must specify a physical sql statement to execute".
Please help to overcome this issue.
Thanks.Hello,
First make sure that you're able to retreive data from the repository (right click on a table and view data?)
To create a session variable follow these steps:
From the Administration Tool menu bar, choose Manage > Variables.
In the Variable Manager dialog box, from the menu bar, choose Action > New > Session > Variable.
In the Session Variable dialog box, type a variable name.
Names for all variables should be unique. The names of system session variables are reserved and cannot be used for other types of variables.
For session variables, you can select the following check boxes:
Enable any user to set the value
Check box that allows you to set the session variables after the initialization block has populated the value (at user login) by calling the ODBC store procedure NQSSetSessionValue(). For example, this allows non-Oracle BI Administrators to set this variable for sampling.
Use the Initialization Block drop-down list to select an initialization block that will be used to refresh the value on a continuing basis.
To add a Default initializer value, perform one of the following steps:
To use the Expression Builder, click the ellipsis button to the right of the Default initializer work space.
Type the value into the Default initializer text box.
Click OK.
you can do the same for a repository variable except that you will have to specif a refresh interval.
Make sure the sql your are issuing is correct by running it first using a client.
Regards
PS: Please don't forget to close the thread and assign points when your question is answered -
Initializing values in an internal table
hi
how to initialize values in a internal table
according to my requirement i need to initialize (both character and currency) values present in the internal table based on certain conditions
vamsihi
As i understood you want to clear only selected fileds not the complet record..
create a Field symobl the loop at the table.. inside the loop check the condtion the just clear the filed.
example: you have itab type mara.
then
FIELD-SYMOBOLS <FS_WA_ITAB> TYPE MARA.
LOOP AT ITAB ASSIGNING <FS_WA_ITAB>.
IF X = XXX (YOUR CONDITION)
CLEAR: <FS_WA_ITAB>-FIELD2,
<FS_WA_ITAB>-FIELD3. (If u want to clear only filed2 and field3)
clear <FS_WA_ITAB>. (if you want to cleatr the complete record)
ENDIF.
ENDLOOP.
Why iam suggestin the filed-symobol is.. it is direcltly work on internal table body so u no need to update the table agian
Please Close this thread.. when u r problem is solved
Reward if Helpful
Regards
Naresh Reddy K -
How to initialize the variables in the subvi when the main vi running?
Hi, friends!
Now I am working on a project with labview. I make a main vi including many subvis.
When the main vi running, I want to reinnitialize the variables in the subvi to zero.
I know that I can realize that using the local variable when I enter the subvi,
but I want to keep the the values when I left the subvi and saw them when I
click in this subvi again. So, I do not reinitialize the subvi when it runs. But, I
don not know how to reinitialize the indicators in the subvi when I run the main
VI in the first instance. I try to use the global variables, but it seems do not work
well. Would you like to give me some advice? Thanks a lot!Hi dec,
If I understand your question, try using the "First Call?" node in your Sub-VI - to initialize values the first time the VI executes every time the top-level VI is Run.
If this doesn't work for you, just post again!
Cheers.
"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare) -
Numeric values longer than 32bit?
Greetings,
I'm an EE student currently working as a LV instrument driver developer
for a well-known T&M equipment manufacturer here in Munich.
My problem is the following: Is it possible to handle numeric values
longer than 32bit in LV? Specifically, one of my instrument driver VIs
needs to supply an initialization value to the Wideband CDMA "long code"
configuration menu of a versatile vector signal generator. This value
can range from 0x0 to 0x1FF,FFFF,FFFF (which accounts for 41 bits, if
I'm not mistaken). The instrument expects this value in hexadecimal
form.
A quick and dirty solution could be either to split up the control range
in 32+9 bits, i.e. place two controls on the front panel, or to use a
string control an
d have the user specify the hex value as a string. Both
solutions are not very desirable though, especially since instrument
driver VIs are meant to be used as sub-VIs in customer-specific programs
and for that reason aren't usually accessed from their front panels.
So, are there any other, more elegant solutions than the ones mentioned
above?
Thanks a lot in advance!
(c) Tobias HermannIn <[email protected]> Tobias Hermann writes:
>My problem is the following: Is it possible to handle numeric values
>longer than 32bit in LV? Specifically, one of my instrument driver VIs
>needs to supply an initialization value to the Wideband CDMA "long code"
>configuration menu of a versatile vector signal generator. This value
>can range from 0x0 to 0x1FF,FFFF,FFFF (which accounts for 41 bits, if
>I'm not mistaken). The instrument expects this value in hexadecimal
>form.
FORMING THE 41-bit STORAGE
You can create any arbitray numerical data length by using a binary
array. This is the best and most direct solution to your needs.
Just remember, LabView allocates binary arrays in multiples of bytes,
so a 41-bit array will be rounded up to a length of 6 bytes or
48-bits; however, LabView knows to return only the first 41-bits to
you upon request.
GENERATING AN ARRAY OF 41-bit VALUES
The next issue is that you need an array of 41-bit numbers. You simply
define this as a 2-dimensional array of binary values. When
initializing this array, be certain you order the dimension indices
such that the fastest moving index has a size value of 41. The slowest
moving index will then be for the actual numerical size of your array.
If you transpose the index definition, nothing will work right! Be
careful!
When your array (above) is defined, it should be shown in LabView as a
brown wire, which deplicts it as a binary 2-dimensional array. If it
is instead shown in a magenta color, then you instead defined and array
(cluster) of 41-bit binary numbers. That will work okay too (and will
even be easier the used), but it will take more storage and will take
LabView longer to handle. However, if you're more confortable will the
latter choice, I can understand that. It does have the feature of being
able to address each 41-bits number directly. With the 2-dim approach
I initially outlined, you'll need to slice out each 41-bit number from
the 2-dim array each time you access (read/write) it.
FORMATTING BINARY INTO HEX
Formatting your storged numbers is an entirely _separate_ issue and
your 41-bits numbers only need to worry about formatting when you
send them to an output device. For a LabView control panel, simply
open a binary array control, then select the appropriate options so
they are displayed in base-2, octal, or hex. LabView supports all
three display formats with any binary indicator.
If you need to format your numbers to a hex string (for an output
device), try the "To Hexadecimal" or "Format & Append" function.
Again, if you're using the 2-dim binary array apprach, you'll need to
slice out each 41-bit number indivdually. If you're using the cluster
(array) if 1-dim 41-bit array approach, you can skip that step.
Frankly, I'm not sure how well LabView's formatting functions work with
1-dim binary arrays, but in principal they should. If they don't work
directly, no big deal. Just cast the 41-bit arrays into U8 numbers
(bytes) and have the formatting function format those numbers into hex
strings; simply one more step.
One question: Why on earth do you want to format the data going
into your instrument in the first place? Almost all instruments will
take binary input _directly_ without formatting it into ASCII (octal,
hex, etc) first. This is much faster because the ASCII of all this
hex stuff requires many more bytes to transfer to your instrument.
Moreover, the instrument then needs to convert the ASCII (hex) back
into binary before it can use any of it. You should investigate
skipping the formatting step altogether. The exception might be
if you're using an RS-232 connection to your instrument where raw
binary isn't allowed. Newer interfaces like GPIB, 1394, etc will
allow binary transfer directly.
COMMENTS ON STRINGS
Don't use strings in LabView. By default, each string get a minimal
memory allocation of 2K. If you define a 100 element (array) string,
that's 200K of memory just to hold those strings. Not a big deal, but
when the memory manager starts doing garbage collection (which is
required with string manipulations), things will really slow down.
String are important, but data should always be stored in a binary
form within any computer, not in ASCII formatted form (hex included).
/\ Mark M Mehl, alias Superticker (Supertickler to some)
<><> Internet: [email protected]
\/ Preferred UUCP: uunet!iastate.edu!mehl
Disclaimer: You got to be kidding; who would want to claim anything I said? -
Inheritance - instance variable initialization
Hi all.
I have a question regarding inherited instance variables.
class Animal {
int weight;
int age = 10;
class Dog extends Animal {
String name;
class Test {
public static void main(String[] args) {
new Dog();
}This is just an arbitrary code example.
When new Dog() is invoked, I understand that it's instance variable "name" is give the default
type value of null before Dog's default constructor's call to super() is invoked.But Im a little perplexed about
Animals instance variables. I assume that like Dog, Animals instance variables are given their default type values
of 0 & 0 respectively, before Animals invocation of super(); What im unclear about is that at the point that weight and age are given their default type values, are Dog's inherited weight and age variables set to 0 aswell at that exact moment? Or are Dog's inherited weight and age variables only assigned their values after Animals constructor fully completes because initialization values are only assigned to a classes instance variables after it's call to super().
Many thanks & best regards.Boeing-737 wrote:
calvino_ind wrote:
Boeing-737 wrote:
newark wrote:
why not throw in some print statements and find out?Super() or this() have to be the very first statement in a constructor..
Also you cannot access any instance variables until after super or this.
:-S
Kind regardsbut if you add the "print" statement in animal constructor, you can easily see what happened to the attributes of Dog ; that s the trick to print "before" super()You can never add a print before super(). It's a rule of thumb, super() and this() must always be the first statements
in a constructor, whether added implicitly by the compiler or not. In this case there are 2 default constructors (inserted by the compiler), each with a super() invocation. Even if i added them myself and tried to print before super(), the compiler would complain.
Thanks for the help & regards.you didn't understand what i meant ; take a look at that:
class Animal {
int weight;
int age = 10;
public Animal() {
Dog thisAsADog = (Dog) this;
System.out.println(thisAsADog.name);
System.out.println(thisAsADog.x);
class Dog extends Animal {
String name;
int x = 10;
public class Test {
public static void main(String[] args) {
new Dog();
}this way you will know what really does happen
Maybe you are looking for
-
to cut a long story short. I was interested in an i-phone... got the details..checked them all.. on the phone and with the provider, VODAPHONE... told unlocked, not stolen etc etc. proceeded to buy the phone...new sim topped up £10 only to find it wo
-
Need help! White screen and hard drive
I have a MacBook Pro A1211 I got off Craigslist. It needed a new logic board and hard drive so I got both. My problem is I just found out the hard drive has windows on it and when I power on the MBP all I get is a white screen. My question is is the
-
How to add checkbox in ALV OO?
how to change editable mode and able to input??? REPORT ZZ_ALV_TEST. data: ispfli type table of spfli. data: gr_table type ref to cl_salv_table. data: gr_functions type ref to cl_salv_functions. data: gr_display type ref to cl_salv_display_set
-
i`ll already paid for my subscription but i can't export my documents from pdf to word or excel.
-
Hi, i have abap proxy class and i want to find the wsdl of it ? How can i find it? BR Michael