Declaring variables or constants at the start of a class
Hi, I have a question. I am in an introductory java course and my instructor says that anything that is declared outside of a method (ie. very beginning of a class) must be a final constant.
She says that I must use
public static final int EXAMPLE_CONSTANT;
and that it can not be changed (I know this, it is declared as a constant)
What I do not understand, is she says that I could not do say
int ExampleVariable;
in any way outside of a method because the methods would not be able to access it.
Is this true? I have made programs before with declarations like that just at the beginning of a class, and they have worked fine and I have been able to change the variable and access it inside my methods. Why does she say that will not work and that it can only be a constant? Can someone explain to me, is it maybe bad practice?
I will make an example of what we are doing and and what she says I can not do.
This is what we start with:public class OddCount{
public static final int MAX_ODD=21;
public static void main(String[] args){
outputOdds();
MAX_ODD=11; // I realize this does not work
outputOdds();
public static void outputOdds(){
for(int i=1;i<=MAX_ODD;i+=2){
System.out.print(i+" ");
}Obviously we can not assign the value of 11 to MAX_ODD because it is a constant and already initialized. This is what she wanted us to realize. That's all fine and I understand that.
My question is obviously "Why don't we just make a variable instead of a constant and use that in the same place? Replace 'public static final int' with just 'public static int'. "
Her answer is that it is not possible because we would not be able to use the variable within the method, she said because it would be "outside of the scope of the variable."
She has me very confused haha, mainly because I tried what I proposed and it works but she says it will not.
Similar Messages
-
How to acess a value of variable(calling prg) inside the methods of a class
Hi SapAll.
i wrote a program where i need to acess a value of a variable inside the class method.
for eg:
CALL METHOD gcl_utl_app_log->display_log
EXPORTING
it_edidc = lt_edidc
it_msg = lt_msg.
while debugging under the method 'DISPLAY_LOG' when i want to acess a value of a variable (calling program) i cont get that value but i can acess the value of the variable just before the CALL METHOD statement.
so can any body help me in finding the solution for this.
regards.
VarmaHi jhings.
i have delcared the variable in the main program like below
main program
PERFORM populate_z1edrmdseqnr01.
FORM populate_z1edrmdseqnr01 .
other code
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = gv_number_nr
object = lv_obj
IMPORTING
number = gv_nextno
move gv_nextno to gv_seqno.
EXPORT gv_seqno to memory ID 'MEM1'.
PERFORM FORM application_log.
FORM application_log.
CALL METHOD gcl_utl_app_log->display_log
EXPORTING
it_edidc = lt_edidc
it_msg = lt_msg.
ENDFORM
METHOD display_log.
IMPORT gv_seqno from MEMORY ID 'MEM1'.
*********when i save and check the above code iam getting the error as 'FiledGV_SEQNO is unknown,it is neither in one of specified tables not defined by 'DATA ' statement.**********
regards.
Varma -
Create variables in TestStand with the PropertyLoader
Hello,
I whant to read several csv-files with the property loader of TestStand 3.1 (all FileGlobals or StationGlobals). The problem is, if the variable doen'st already exists the property loader doesn't work.
The variable I am ready in the CSV-file are alway different and I can't create manually the variable at first in TestStand or in the sequence file, before I can load them with the property loader.
Is there a possibility to create dynamically variables (Globals or Locals) with the PropertyLoader? If not, what can I do?
Cheers,
RisottoAntonio,
Thank you for your answer. I read and understood the post http://forums.ni.com/board/message?borad.id=330&message.id=8395#M8395.
Anyway, this still not really helps me. I will try to explain my problem:
We are actually upgrading from TestExec to Teststand/Labview. For our products (embedded electronic), we write for each SW release about 20 testplans in TestExec (which would be 20 sequences with Teststand). Each testplan use the same 2 symbol tables (where are defined about 100 variables definition and constants). From product to product and from SW release to SW release, there is always new/changed/deleted variables and constants. The name of the symbol table is always the same, only the contents is changing. TestExec reads this symbol tables at load-time of a test plan, so that you don't have to define the variables and constants separately and you can directly use them. Usually this variables and constants are related to voltages, currents, PWM duty cycle and so on....
Now we are trying to do almost the same thing with Teststand. We create 2 CSV-files which contains our variables and constants and we whant to link them in all the 20 sequences. We tried to use the property loader, but you need to define in each of the sequence files all the variables and constants, which is a bit unconfortable. Please see the attached file for a more graphical explanation.
What is the best was in Teststand to do something like with TestExec?
Regards,
Risotto
Attachments:
TestExec_Teststand.doc 29 KB -
How to declare variable in the scipt
data is coming from standard program .
rf140-stida key entry date.
bsik-bldat posting date
i want to display difference between rf140-stida and bsik-bldat in scipt form it will give number of days.
how can i declare variables for this.
how to write code in my form.Hi
U need to create a routine to calculate the difference:
/: DEFINE &DELTA& = SPACE
/: PERFORM <FORM NAME> IN PROGRAM <PROGRAN NAME>
/: USING &RF140-STIDA&
/: USING &BSIK-BLDAT&
/: CHANGING &DELTA&
&DELTA&
The routine has to be defined in your Z-PROGRAM and to have these interface:
FORM <FORM NAME> TABLES IN_TAB_EM STRUCTURE ITCSY
OUT_TAB_EM STRUCTURE ITCSY.
DATA: DELTA TYPE I.
DATA: DATE1 LIKE SY-DATUM,
DATE2 LIKE SY-DATUM.
* ---> Rembember the date has the ouput format, so it has to be converted in the
* input format
READ TABLE IN_TAB_EM WITH KEY NAME = 'RF140-STIDA'.
IF SY-SUBRC = 0.
DATE1(4) = IN_TAB_EM-VALUE+6(4).
DATE1+4(2) = IN_TAB_EM-VALUE+3(2).
DATE1+6(2) = IN_TAB_EM-VALUE(2).
ENDIF.
READ TABLE IN_TAB_EM WITH KEY NAME = 'BSIK-BLDAT'.
IF SY-SUBRC = 0.
DATE2(4) = IN_TAB_EM-VALUE+6(4).
DATE2+4(2) = IN_TAB_EM-VALUE+3(2).
DATE2+6(2) = IN_TAB_EM-VALUE(2).
ENDIF.
DELTA = DATE1 - DATE2.
READ TABLE OUT_TAB_EM WITH KEY NAME = 'DELTA'.
IF SY-SUBRC = 0.
WRITE DELTA TO OUT_TAB_EM-VALUE.
MODIFY OUT_TAB_EM INDEX SY-TABIX.
ENDIF.
ENDFORM.
Max -
why does adobe premier elements render my video everytime i change something in it even when i have lots more of the video to edit? other editing software only seems to render at the start then lets you edit until your ready to save at the end. Constant rendering means its almost impossible to edit anything. Please help.
H TheGamer
What version of Premiere Elements and on what computer operating system is it running? It will not influence my answer but will give me information in case I need to get into version specifics to detail my answer further.
Timeline rendering is a preview matter. It does not fix anything, but it is your window of opportunity to catch of problem sooner than latter. If the Timeline rendering indicator displays orange (11 or higher) for the line above the Timeline content, that is the project telling you that you are not getting the best possible preview of the playback of that content in the Edit area monitor. And, every time you edit a file, you have altered the file from the time before. So, if you want to see the best possible for what you now have, you Timeline render. This is particularly helpful when you are dealing with titles, effects, transitions, and non native formats. You cannot turn off the Timeline render indicator system, at least none that I have ever found nor seen reported. You can do selective Timeline rendering by having the gray tabs of the Work Area Bar span only the Timeline segment that you want Timeline rendered.
Consequently, you either ignore the Timeline render indicator system, move on in the project, and take your chances in the outcome or you Timeline render to get your best possible preview if the Timeline render indicator is suggesting that you do so.
I am not approving or disapproving of this project feature, just commenting on the what is.
This is not Adobe. Rather user to user. If you want to have your voice heard at Adobe, you might consider filing an Adobe Feature Request Bug Report Form.
https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
Please consider.
ATR
Add On...it is also possible to do Timeline rendering in a project, save close the project, and reopen it to find your previously "green" lined content now "orange", indicating unrendered. Yet the preview files generated originally by Timeline rendering are still existing in their hard drive save location. That is another story for other time. -
"XML declaration allowed only at the start document "on Safari Iphone3G
Hi
I get the following error message on my Iphone3G with Vodaphone Hong Kong:
"The following page contains the following errors:
error on line 4 at column 6; XML declaration allowed only at the start document
Below is a rendering of the page up to the first error"
Moreover I see nothing in the page its empty.
the corresponding URL is "http://smartone-vodafone.m-finance.net"(only avaible to vodaphone suscriber i guess
with APN:Smartone-Vodaphone)
does anyone get same problem? how to solve it?
thx very muchHi,
I am not sure if you can access it because its for Vodaphone suscriber only, I access first to "SmartIn" service via http://wap.smartone-vodafone.com so thereafter I enter to an other payed financial page "PLUS" via "http://plus.smartone-vodafone.com" and then the "Quote" menu afterwards I cannot open the page to see the price of Gold/Silver which gave me the previous error message and blank page at this adress on my Iphone3G
"http://smartone-vodafone.m-finance.net/PLUSGS_ST/EN/index.jsp"
But when I surf on my Laptop I found it seems to be a service provide by this other company "http://smartone-vodafone.m-finance.net"
I tried different setting (console off/on) javascript/plug-ins/block pop up/accept cookies all On or Off but no succes. Its a pity because I bought Iphone3G only for that
Maybe Apple should discuss between Vodaphone and this company how to solve the problem. It maybe only one error line code because every other page are fine?? my
thank you very much again, -
What happens to dynamically declared variables when I'm not using them?
Hello, I'm making a game using Flash Pro cc. But I wonder what happens to aTile, which is dynamically declared MovieClip variable through a loop. And each aTile gets the 2 EventListener's.
for(var i:Number=0; i<pVector.length;i++){
var aTile:ATile=new ATile();
aTile.x=pVector[i].x;
aTile.y=pVector[i].y;
aTile.gotoAndStop(Math.ceil(Math.random()*Color));
nVector.push(aTile);
Spr.addChild(aTile);
aTile.addEventListener(MouseEvent.CLICK,Clicked,false,0,true);
aTile.addEventListener(Event.COMPLETE, stop,false,0,true);
// the current function ends here. what happens to aTile now ?? Is it going to be garbage collected? By the way, this piece of code runs whenever a player starts a new level of my game. And I don't make use of the aTile variable in other functions. I use only the nVector variable. And does declaring a dynamic variable in a loop mean a multiple of them are created? For example, if I loop the piece of code above 5 times, does it mean 5 aTile variables are created? Or each time you declare
var aTile:ATile=new ATile(); again, does it replace the 'old' aTile with the 'new' aTile and therefore only 1 aTile exists after the loop????I feel there is a gap in understanding of using variables by reference vs. by value. You should look it up.
1. new instructs Flash to create a distinct instance that per se has absolutely nothing to do with aTile variable.
2. REFERENCE to this new instance is assigned to variable aTile. aTile var is a temporary pointer to instance.
3. It does not replace old tile - it replaces reference.
4. If reference to the instance is not stored elsewhere - upon exiting of function this instance will be gced.
5. By creating another reference to the instance you prevent it from GC. One of the ways you preserve instance is by adding it to display list when using addChild.
You can look at this this way (it is a lame example but still it illustrates parts of the concept)
Say you have
1. basket;
2. basket is small and can hold only one apple;
3. table;
4. an apple;
5. apple can be placed into the basket or table;
6. dog who love apples.
7. Dog is trained not to take apples from baskets but table but is free to eat apples that are on the ground.
So, once apple is in the basket or on the table - it is safe.
If you move these entities into the realm of AS3, basket and table become declared variables, apple an instance and dog garbage collector.
What this example demonstrates is that apple exists independently of basket or table. You can put apple to the basket OR on the table OR you can put apple into basket and place basket onto the table.
1. Find apple instance (if you know whether apple is in the basket, on the table or in the basket on the table)
2. Prevent dog from eating apple.
3. Allow dog to eat it (destroy it when garbage collector kicks in) by assuring that apple is in neither basket or on the table. -
Error declarations for error reporting to the Client
Hi,
I am trying to standardize the error reporting from PL/SQL for our project.
I created a package to define these errors and want to declare them as constants.
Unfortunately i'm running into some restrictions.
Option1:
Declare the ErrCd as a constant (-20000 To -20999) and then use an associative array with the ErrCd as index and the text as the value.
Option 2:
Declare a Record type with the ErrCd and ErrText as fields. Associate the errormessage with a position eg errIdx := 1; This will then be the position in the nested table. The procedures will then reference the correct errorRec through the ErrIdx.
The problem is that i want to do all this in the package spec. I don't want to work through a function to first build up the table and then return the correct error record etc.
I cannot build the associative array in the declaration since it doesn't have a constructor.
Nested tables seemed like the one to use since i could build up its content through its constructor. But i cannot construct the errRecord in a similar way.
SUBTYPE ErrIdxType IS INTEGER;
SUBTYPE ErrCdType IS INTEGER;
SUBTYPE ErrTxtType IS VARCHAR2(300);
ERR_CD_BASE CONSTANT ErrCdType := -19999;
ERR_CD_MAX CONSTANT ErrCdType := -20999;
TYPE ERR_REC IS RECORD
errCd ErrCdType,
errTxt ErrTxtType
-- Error 1 tester
ERR_ERR1_IDX CONSTANT ErrIdxType := 1;
ERR_ERR1_CD CONSTANT ErrCdType := ERR_CD_BASE - ERR_ERR1_IDX;
ERR_ERR1_TXT CONSTANT ErrTxtType := 'Error ERR1 occured.';
-- Error 2 tester
ERR_ERR2_IDX CONSTANT ErrIdxType := 2;
ERR_ERR2_CD CONSTANT ErrCdType := ERR_CD_BASE - ERR_ERR2_IDX;
ERR_ERR2_TXT CONSTANT ErrTxtType := 'Error ERR2 occured.';
TYPE ErrTableType IS TABLE OF ERR_REC;
errTable ErrTableType :=
ErrTableType
ERR_REC(ERR_ERR1_CD, ERR_ERR1_TXT),
ERR_REC(ERR_ERR2_CD, ERR_ERR2_TXT)
);I suppose the java still has a strong grip on me here.
What is the correct way to manage these error definitions?
Since i am trying to establish the error/exception handling strategy for the project i would also greatly appreciate a couple of pointers to examples/packages/docs on the error /exception reporting mechanisms available.
Thanks
BuksThat looks like data to me. Now if only PL/SQL had some kind of a database that came with it so you put that data in a table ;)
Error messages change and so are not good candidates for constants. What you could find useful to declare in a package is some exceptions. You will find more about them in the PL/SQL Guide.
You should also check this series of Oracle Magazine articles written by Steven Feuerstein (Whom God Preserve).
Cheers, APC -
The field "SOURCE_PACKAGE" is unknown IN THE START ROUTINE?
Hi all,
i am trying to create a start routine in the DTP FROM THE CUBE TO THE OPEN HUB.
But when i check the syntax : it throws me an error message stating.
The field "SOURCE_PACKAGE" is unknown IN THE START ROUTINE?
how come the source package is unknow in the start routine can anyone pls advise me on this!!
DATA: l_tabix TYPE sy-tabix, wa_source_package TYPE tys_sc_1.
LOOP AT SOURCE_PACKAGE INTO wa_source_package.
l_tabix = sy-tabix.
IF wa_source_package-SALES EMP EQ ' '.
DELETE SOURCE_PACKAGE
WHERE SALESEMP EQ ' '.
INDEX l_tabix.
ENDIF.
ENDLOOP.Hi Pooja,
I think that the error comes from the delete statement.
As you already said, the SOURCE_PACKAGE is from BI7.0. That means that the LOOP AT statement cannot be wrong (although I prefer field-symbols)
I would restate you code like below:
DATA: l_tabix TYPE sy-tabix,
wa_source_package TYPE _ty_s_sc_1.
LOOP AT SOURCE_PACKAGE ASSIGNING <source_fields>. "<source_fields> is declared as line from source_package
* l_tabix = sy-tabix.
IF <source_fields>-SALES_EMP IS INITIAL.
DELETE <source_fields> FROM SOURCE_PACKAGE.
* If this line does not work, try to add TABLE after the FROM-statement
*WHERE SALESEMP EQ ' '.
*INDEX l_tabix.
ENDIF.
ENDLOOP.
Hopefully this will help.
Alternatively you can try a single statement, because it is not necessary to do a loop.
DELETE SOURCE_PACKAGE WHERE sales_emp IS INITIAL.
Good luck!
Steven Groot
Edited by: S. Groot on Aug 11, 2010 7:50 AM -
Help with copying files into the the Start Menu
I am trying to copy my application which tracks system usage, such as reboots, temps, etc, I want it when it first runs, to copy it self into the the programs folder and the start up folder. However I get the error ""FileCopy: destination file is unwriteable: ""......Anyone have an idea why I get this error? Is there away around it? Thanks for any and all help
*Copying on a Mac works fine
*I am currently Testing it on a copy of Windows Xp
*I havenot Tested Vista or 7 Yet.
Hers the class which I call to copy my program
class FileCopy {
String OS="";
String username;
String dir;
String name="Test.jar";
String MAC="Mac OS X";
String WinXp="Windows XP";
String WinVista="Windows Vista";
String Win7="Windows 7";
JFrame errorWin;
FileCopy(){
System.out.println("Enter Copy");
OS= ManagementFactory.getOperatingSystemMXBean().getName();
username = System.getProperty("user.name");
if(MAC.compareTo(OS)==0){
copyMac();
else if(WinXp.compareTo(OS)==0){
copyWinXp();
else if(WinVista.compareTo(OS)==0){
copyWinVista();
else if(Win7.compareTo(OS)==0){
copyWin7();
else
return;
private void copyMac(){
System.out.println("Enter Mac Copy");
System.out.println("OS:"+OS);
String s="/Applications/Solitaire.Jar";
try {
copy(name, s);
} catch (IOException e) {
System.out.println("Failed at Mac Copy new");
errorWin=new JFrame("Error: Failed at Mac Copy new ");
e.printStackTrace();
} //Moves Jar File to Application Folder
private void copyWin7(){
String dir1="C:\\Documents and Settings\\All Users\\Start Menu\\Programs\\SolitaireWin7.Jar";
String dir2="C:\\Documents and Settings\\All Users\\Start Menu\\Programs\\Startup\\SolitaireWin7.Jar";
try {
copy(name, dir1);
} catch (IOException e) {
System.out.println("Failed at Win7 Copy 1");
errorWin=new JFrame("Failed at Win7 Copy 1");
e.printStackTrace();
} //Moves Jar File to Application Folder
try {
copy(name, dir2);
} catch (IOException e) {
System.out.println("Failed at Win7 Copy 2");
errorWin=new JFrame("Failed at Win7 Copy 2");
e.printStackTrace();
} //Moves Jar File to Application Folder
private void copyWinVista(){
String dir1="C:\\Documents and Settings\\All Users\\Start Menu\\Programs\\SolitaireVista.Jar";
String dir2="C:\\Documents and Settings\\All Users\\Start Menu\\Programs\\Startup\\SolitaireVista.Jar";
try {
copy(name, dir1);
} catch (IOException e) {
errorWin=new JFrame("Failed at Winista Copy 1");
System.out.println("Failed at WinVista Copy 1");
e.printStackTrace();
} //Moves Jar File to Application Folder
try {
copy(name, dir2);
} catch (IOException e) {
errorWin=new JFrame("Failed at WinVista Copy 2");
System.out.println("Failed at WinVista Copy 2");
e.printStackTrace();
} //Moves Jar File to Application Folder
private void copyWinXp(){
String dir1="C:\\Documents and Settings\\"+username+"\\Start Menu\\Programs\\Solitaire.Jar";
String dir2="C:\\Documents and Settings\\"+username+"\\Start Menu\\Programs\\Startup\\Solitaire.Jar";
try {
copy(name, dir1);
} catch (IOException e) {
errorWin=new JFrame("Failed at WinXp Copy 1");
errorWin.setVisible(true);
errorWin.repaint();
System.out.println("Failed at WinXP Copy 1");
e.printStackTrace();
} //Moves Jar File to Application Folder
try {
copy(name, dir2);
} catch (IOException e) {
errorWin=new JFrame("Failed at WinXp Copy 2");
errorWin.setVisible(true);
errorWin.repaint();
System.out.println("Failed at WinXP Copy 2");
e.printStackTrace();
} //Moves Jar File to Application Folder
public void copy(String fromFileName, String toFileName) throws IOException {
File fromFile = new File(fromFileName);
File toFile = new File(toFileName);
if (!fromFile.exists()){
errorWin=new JFrame("FileCopy: " + "no such source file: " + fromFileName);
errorWin.setVisible(true);
errorWin.repaint();
throw new IOException("FileCopy: " + "no such source file: " + fromFileName);
if (!fromFile.isFile()){
errorWin=new JFrame("FileCopy: " + "can't copy directory: "
+ fromFileName);
errorWin.setVisible(true);
errorWin.repaint();
throw new IOException("FileCopy: " + "can't copy directory: "
+ fromFileName);
if (!fromFile.canRead()){
errorWin=new JFrame("FileCopy: " + "source file is unreadable: "
+ fromFileName);
errorWin.setVisible(true);
errorWin.repaint();
throw new IOException("FileCopy: " + "source file is unreadable: "
+ fromFileName);
if (toFile.isDirectory())
toFile = new File(toFile, fromFile.getName());
if (toFile.exists()) {
if (!toFile.canWrite()){
errorWin=new JFrame("FileCopy: destination file is unwriteable: " + toFileName);
errorWin.setVisible(true);
errorWin.repaint();
throw new IOException("FileCopy: destination file is unwriteable: " + toFileName);
System.out.print("Overwrite existing file " + toFile.getName()
+ "? (Y/N): ");
System.out.flush();
BufferedReader in = new BufferedReader(new InputStreamReader(
System.in));
String response = in.readLine();
if (!response.equals("Y") && !response.equals("y")){
errorWin=new JFrame("FileCopy: existing file was not overwritten.");
errorWin.setVisible(true);
errorWin.repaint();
throw new IOException("FileCopy: existing file was not overwritten.");
} else {
String parent = toFile.getParent();
if (parent == null)
parent = System.getProperty("user.dir");
File dir = new File(parent);
if (!dir.exists()){
errorWin=new JFrame("FileCopy: destination directory doesn't exist: " + parent);
errorWin.setVisible(true);
errorWin.repaint();
throw new IOException("FileCopy: destination directory doesn't exist: " + parent);
if (dir.isFile()){
errorWin=new JFrame("FileCopy: destination is not a directory: " + parent);
errorWin.setVisible(true);
errorWin.repaint();
throw new IOException("FileCopy: destination is not a directory: " + parent);
if (!dir.canWrite()){
errorWin=new JFrame("FileCopy: destination directory is unwriteable: " + parent);
errorWin.setVisible(true);
errorWin.repaint();
throw new IOException("FileCopy: destination directory is unwriteable: " + parent);
FileInputStream from = null;
FileOutputStream to = null;
try {
from = new FileInputStream(fromFile);
to = new FileOutputStream(toFile);
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = from.read(buffer)) != -1)
to.write(buffer, 0, bytesRead); // write
} finally {
if (from != null)
try {
from.close();
} catch (IOException e) {
if (to != null)
try {
to.close();
} catch (IOException e) {
}That's clearly a security restriction then. You need to assign the JVM's user account enough rights to do so, or to configure any firewall/virusscanner which has possibly blocked it.
Apart from this, are you aware of the fact that the OS root disk is not per se labeled "C:", that the location of documents is not per se "Documents and Settings", that there exist System#getenv() and System#getProperty() methods to find default system and environment variables and that there is the java.util.prefs API to access the registry? Your application is likely not going to run on any environment. -
What is the logic behind the start routine
Dear One's,
Kindly take a moment and explain the logic behind this start routine written in update rules of ODS.
PROGRAM UPDATE_ROUTINE.
$$ begin of global - insert your declaration only below this line -
$$ end of global - insert your declaration only before this line -
The follow definition is new in the BW3.x
TYPES:
BEGIN OF DATA_PACKAGE_STRUCTURE.
INCLUDE STRUCTURE /BIC/CST_T07_O006.
TYPES:
RECNO LIKE sy-tabix,
END OF DATA_PACKAGE_STRUCTURE.
DATA:
DATA_PACKAGE TYPE STANDARD TABLE OF DATA_PACKAGE_STRUCTURE
WITH HEADER LINE
WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
FORM startup
TABLES MONITOR STRUCTURE RSMONITOR "user defined monitoring
MONITOR_RECNO STRUCTURE RSMONITORS " monitoring with record n
DATA_PACKAGE STRUCTURE DATA_PACKAGE
USING RECORD_ALL LIKE SY-TABIX
SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS
CHANGING ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update
$$ begin of routine - insert your code only below this line -
fill the internal tables "MONITOR" and/or "MONITOR_RECNO",
to make monitor entries.
DATA: ITAB_/BIC/AT07_O00600 TYPE SORTED TABLE OF /BIC/AT07_O00600
WITH HEADER LINE
WITH UNIQUE DEFAULT KEY INITIAL SIZE 0,
DATA_PACKAGE_NEW TYPE STANDARD TABLE OF DATA_PACKAGE_STRUCTURE
WITH HEADER LINE
WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
sort the datapackage based on lead number and lead program definition
SORT DATA_PACKAGE BY /BIC/TLDNR /BIC/TLDPRGFTE.
from the resources ODS read all lead values based on the values those
SELECT * FROM /BIC/AT07_O00600 INTO TABLE
ITAB_/BIC/AT07_O00600
FOR ALL ENTRIES IN DATA_PACKAGE
WHERE /BIC/TLDNR = DATA_PACKAGE-/BIC/TLDNR.
FIELD-SYMBOLS: <LS_DATA_PACKAGE> TYPE DATA_PACKAGE_STRUCTURE.
FIELD-SYMBOLS: <LS_/BIC/AT07_O00600> TYPE /BIC/AT07_O00600.
loop at internal table of ODS to check if there are lead program defin
from the source which mean the values of lead program definition in OD
values of lead program definition in datapackage.
LOOP AT ITAB_/BIC/AT07_O00600 ASSIGNING <LS_/bic/at07_o00600>.
READ TABLE DATA_PACKAGE
TRANSPORTING NO FIELDS
WITH KEY
/BIC/TLDNR = <LS_/bic/at07_o00600>-/BIC/TLDNR
/BIC/TLDPRGFTE = <LS_/bic/at07_o00600>-/BIC/TLDPRGFTE
BINARY SEARCH.
IF SY-SUBRC <> 0.
new lines with zero values are inserted because there are no correspon
DATA_PACKAGE_NEW-/BIC/TLDNR = <LS_/BIC/AT07_O00600>-/BIC/TLDNR.
DATA_PACKAGE_NEW-/BIC/TLDPRGFTE = <LS_/BIC/AT07_O00600>-/BIC/TLDPRGFTE.
DATA_PACKAGE_NEW-/BIC/TLDFTE = 0.
APPEND DATA_PACKAGE_NEW.
ENDIF.
ENDLOOP.
append the new records which are created for the leads in the datapack
APPEND LINES OF DATA_PACKAGE_NEW TO DATA_PACKAGE.
reset the sorting of the datapackage back to its original state
SORT DATA_PACKAGE.
if abort is not equal zero, the update process will be canceled
ABORT = 0.
$$ end of routine - insert your code only before this line -
ENDFORM.
Thanks in advancehi,
it's retrieve data from table /BIC/AT07_O00600
and add to data package, so your records will be more than from source
hope this helps. -
Value of the start in the Select with in a Hierarchical Query
Exist any way for put in the select the value of the start with in a Hierarchical Query?
An example:
I'll need sth like
CTH@> select n code, level, np code_parent, 1 code_first_parent
2 from demo
3 start with n=1
4 connect by np = prior n
5 ;
CODE LEVEL CODE_PARENT CODE_FIRST_PARENT
1 1 1
2 2 1 1
3 3 2 1
4 4 3 1
5 5 4 1
6 6 5 1
7 7 6 1
8 8 7 1
9 9 8 1
10 10 9 1
-- Naturally it couldn´t be a constant value
The query
select n,d, level nivel
, np, prior n
from demo
start with n=1
connect by np = prior n
--Table and inserts
create table demo
( n number,
d varchar2(5),
np number);
insert into demo values (1,'A', null);
insert into demo values (2,'B',1);
insert into demo values (3,'C',2);
insert into demo values (4,'D',3);
insert into demo values (5,'E',4);
insert into demo values (6,'F',5);
insert into demo values (7,'G',6);
insert into demo values (8,'H',7);
insert into demo values (9,'I',8);
insert into demo values (10,'J',9);
insert into demo values (11,'K', null);
insert into demo values (12,'L',11);
insert into demo values (13,'M',12);
insert into demo values (14,'N',13);
insert into demo values (15,'O',14);
insert into demo values (16,'P',15);
Message was edited by:
cthOn 10g
connect_by_root(n)Best regards
Maxim -
Declaring Variable in Web dynpro ABAP
Hi all
I want to know how to declare variables globally and how to use internal tables from one method to another method without declaring each and every time in methods?
Please suggest me to do this
Appreciated your solution
Regards
IndiranjithnHi
This code in onselct method. For example
DATA lt_node_am_detl1 TYPE wd_this->Elements_node_am_detl1.
logic to move the data to internal table.
lo_nd_node_am_detl1->bind_table( lt_node_am_detl1 ).
Now the filterd data in internal table and
I declared this internal table in componentcontroller attributes tab like
lt_node_am_detl1 and Elements_node_am_detl1 (Associate column ) and i tick the pulic check box.
i am using another method onclick() .
As you said the internal table declaration is not required if declared already in componentcontroller attributes tab .
data wa_itab like line of lt_node_am_detl1 .
Loop at lt_node_am_detl1 to wa_itab.
endloop.
while debugging i am not getting data in internal table .. Should I declared correctly in componentcontroller attributes tab .
Tlhanks
Indiranjithn -
Hi,
I have been hunting down a NullPointerException for half a day to come to
the following conclusion.
My constructor calls a method which uses static variables. Since an intance
of my class is created in the static block when the class is loaded, those
statics are probably not fully initialized yet and the constructor called
from the static block has those null pointer problems.
I've considered moving the initialization of the static variables from the
declaration to the static block. But your code is inserted BEFORE any other
code. Therefore not solving my problem.
Two questions:
1) what would be a solution to my problem? How can I make sure my static
variables are initialized before the enhancer generated code in the static
block calls my constructor? Short of decompiling, changing the code and
recompiling.
2) Why is the enhancing code inserted at the beginning of the static block
and not at the end? The enhancements would be more transparent that way if
the static variables are initialized in the static block.
Thanks,
EricHi Eric,
JDO calls the no-args constructor. Your application should regard this constructor as belonging
primarily to JDO. For example, you would not want to initialize persistent fields to nondefault
values since that effort is wasted by JDO's later initilization to persistent values. Typically all
you want to initialize in the no-args constructor are the transactional and unmanaged fields. This
rule means that you need initialization after construction if your application uses the no-args
constructor and wants persistent fields initialized. On the other hand, if your application really
uses constructors with arguments, and you're initializing persistent fields in the no-args
constructor either unintentionally through field initializers or intentionally as a matter of
consistency, you will find treating the no-args constructor differently helpful.
On the other hand, if Kodo puts its static initializer code first as you report, then it is a bug.
Spec Section 20.16: "The generated static initialization code is placed after any user-defined
static initialization code."
David Ezzio
Eric Borremans wrote:
>
Hi,
I have been hunting down a NullPointerException for half a day to come to
the following conclusion.
My constructor calls a method which uses static variables. Since an intance
of my class is created in the static block when the class is loaded, those
statics are probably not fully initialized yet and the constructor called
from the static block has those null pointer problems.
I've considered moving the initialization of the static variables from the
declaration to the static block. But your code is inserted BEFORE any other
code. Therefore not solving my problem.
Two questions:
1) what would be a solution to my problem? How can I make sure my static
variables are initialized before the enhancer generated code in the static
block calls my constructor? Short of decompiling, changing the code and
recompiling.
2) Why is the enhancing code inserted at the beginning of the static block
and not at the end? The enhancements would be more transparent that way if
the static variables are initialized in the static block.
Thanks,
Eric -
Declare variables in an MDX query
Is it possible to declare variables in an MDX query like transact sql? something like this:
DECLARE @date1 date
DECLARE @month1 int
set @date1 = '12-12-2012'
set @month1=DATEPART(m, @date1)-1
select @date1 as dt1, @mesreferencia as mt1Hi ,
In MDX , you will not be able to put variables in MDX. But Query scoped calculated measures can be used for such cases. The equivalent MDX for the above is
WITH MEMBER [MEASURES].Dt
As
CDATE('12-12-2012')
MEMBER MEASURES.DTPart
As
DATEPART("M", MEASURES.Dt)-1
SELECT {MEASURES.Dt,MEASURES.DTPart} ON 0
FROM [Adventure Works]
Best Regards Sorna
Maybe you are looking for
-
How do I deactivate a copy on a computer that no longer exists
I am trying to use the program, and the last time I used it, must have been on my old computer. It is telling me to deactivate the other copy but I no longer have the computer. Help please!
-
hi folks i got this ipad for christmas. i have tried in vain to get the code so i can hook up netflix. i pay for acct. i see the serial inscribed on back but i do not think that is the code. i have roku and the code can change over &over. help plea
-
Desktop Themes on Windows 7 Starter Edition
Can somebody tell me where i can select or change desktop themes for windows 7 starter edition. Thanks. Solved! Go to Solution.
-
Hi: I have a question regarding a query. I have a multicube created from the Sales Overview cube and a cube which holds plan data. I have a a charactrisitcs 0CUST_SALES__0CUST_GROUP (master data) in Identification checked for the both cubes. When I r
-
Where is the right path to deploy third party DLL? "Support Files"?
Hi, After Effetcs developers:-) Here is question about install path of DLL for After Effects plug-in. I'm developing Effects plug-in run with CUDA, so I have to deploy third party DLL to client PC. So where is the right path to put DLL such as cudart