Help with OOP
In writing my first object and driver programs for object oriented programming I have several questions since my textbook and the java compiler seem to have different ideas of what constitutes correct code...
The errors I'm getting that I can't resolve are compile errors, I'm sure I also have many many logic errors that would prevent the program from executing correctly, but I need to address first things first.
I can't get the compiler to recognize my boolean deClawed variable in the driver program, whenever I use it I get a can't find symbol compile error (on a related note, is my boolean statement even correct? do I need to set it to something in the cat class like the rest of my variables?). I also get compile errors on my getName and getAge calls in my println statement, which is probably not the correct way to invoke that data either. This leads to my final question which is the biggest one: I don't really know what kind of approach I should be using on a program designed to collect data sets for 3 cats and respond with the name and age of each cat over 3 with claws . Should I be using a loop statement in the driver program to collect the data for each cat? Should I be using a printf statement to display the correct cat data? Am I even close with what I have? Any help would be much appreciated, even just saying what kind of statements you would use would be helpful since I can use examples and probably code them correctly and go from there.
public class HaeuserWeek6_7Cat
private String breed; //breed of cat
boolean deClawed; //T/F declawed value
private String name; //name of cat
private int age; //in years
private double weight; //in pounds
//This method sets the cat's name
public void setName(String name)
this.name = name;
public String getName()
return this.name;
}//end set name
//This method sets the cat's breed
public void setBreed(String newBreed)
this.breed = breed; //age and weight are unchanged.
public String getBreed()
return this.breed;
}//end set breed
//This method sets the cat's age
public void setAge(int age)
this.age = age;
public int getAge()
return this.age;
}//end set age
//This method sets the cat's weight
public void setWeight(double weight)
this.weight = weight;
public double getWeight()
return this.weight;
}//end set weight
//This method sets the cat's declawed T/F
public boolean deClawed()
if (deClawed = true)
return true;
else
return false;
}//end isDeClawed
these are not written in one file, they are seperate files included altogether in this post
import java.util.*;
public class HaeuserWeek6_7Prog
public static void main (String[] args)
HaeuserWeek6_7Cat myCat1 = new HaeuserWeek6_7Cat();
HaeuserWeek6_7Cat myCat2 = new HaeuserWeek6_7Cat();
HaeuserWeek6_7Cat myCat3 = new HaeuserWeek6_7Cat();
Scanner input = new Scanner(System.in);
System.out.println("Enter the name of Cat1:");
String name = input.next();
System.out.println("Enter the age of Cat1:");
int age = input.nextInt();
System.out.println("Enter the weight of Cat1:");
double weight = input.nextDouble();
System.out.println("Enter the breed of Cat1:");
String breed = input.next();
System.out.println("Is your cat declawed? True or False");
boolean deClawed = input.nextBoolean();
myCat1.setName(name);
myCat1.setAge(age);
myCat1.setWeight(weight);
myCat1.setBreed(breed);
myCat1.setdeClawed(deClawed);
System.out.println(myCat1.getName());
System.out.println(myCat1.getAge());
System.out.println(myCat1.getWeight());
System.out.println(myCat1.getBreed());
System.out.println(myCat1.getdeClawed());
if (deClawed = false && age >= 3)
System.out.println("The cats over 3 years with claws are: ");
System.out.println("Name: " + getName);
System.out.println("Age: " + getAge);
else
System.out.println("There are no cats over 3 years old with claws");
}//end if, else
}//end main
}//end class
I've changed some of the formatting to look better on the forums so if you cut and paste into a compiler program it might add extra spaces or something.
First off, there are code tags. Use them when you post code.
The errors I'm getting that I can't resolve are compile errors, I'm sure I also have many many logic errors that would prevent the program from executing correctly, but I need to address first things first.
I can't get the compiler to recognize my boolean deClawed variable in the driver program, whenever I use it I get a can't find symbol compile error (on a related note, is my boolean statement even correct? do I need to set it to something in the cat class like the rest of my variables?).You don't try to access the deClawed member from Driver, you try to call getDeClawed(), which doesn't exist. Either change your method signature or method call to the correct name.
I also get compile errors on my getName and getAge calls in my println statement, which is probably not the correct way to invoke that data either.And those errors are? When you have questions about errors, it is always a good idea to include them verbatim in your post, otherwise we'll just invent errors and have a good laugh at your expense.
This leads to my final question which is the biggest one: I don't really know what kind of approach I should be using on a program designed to collect data sets for 3 cats and respond with the name and age of each cat over 3 with claws . Should I be using a loop statement in the driver program to collect the data for each cat? Should I be using a printf statement to display the correct cat data? Am I even close with what I have? Any help would be much appreciated, even just saying what kind of statements you would use would be helpful since I can use examples and probably code them correctly and go from there.Those are pretty vague specifications. I can think of at least 3 or 4 different ways to do that. Yes, a good design would use a loop to read in the information for each cat. For displaying the information, a set of println's is one option, and at this point probably the one you should use.
Similar Messages
-
hello everyone
I'm tired of using global variables all the time.
I believe going OOP would help minimise them.
would anyone help me with some OOP in Lingo.
I would be very greateful if anyone could enlighten me with a
simple but
complete example of OOP.
I have gone thru the lingo group archives and found bits and
pieces. but for
a beginner in oop they are of very little help.
thanx
ahmedYou're asking for a mouthful. Director itself is based on OOP
so using
global variables can be part of any OOP approach to a
project. You can also
mix OOP with more linear based coding. The most significant
piece of
information that helped me to understand OOP was how one
script gives a
personality to the object it spawns and that each object
could have
independent values in each of its properties. It took me a
while to
understand this. The script though is not unlike a script
given to several
actors. The script is the same but each actor will use it
differently,
though words are the same.
Any child object you create in Lingo has to be stored
somewhere and that's
often in a global variable although as Sean pointed out there
are many
places it can go.
Also, if you're using OOP as a catch all and aren't just
referring to parent
scripts and the child objects they spawn the realize that
Director
implemented an object aproach to behaviors quite a few
versions ago so by
just creating a behavior that can be attached to any sprite
in itself is an
OOP approach.
Craig Wollman
Lingo Specialist
Word of Mouth Productions
212-928-9581
www.wordofmouthpros.com
"FotoArt" <[email protected]> wrote in message
news:f12ub3$e4i$[email protected]..
> hi Sean
> Is it possible for you to give me a working example. a
real code
> thank you
> ahmed
>
> "Sean Wilson" <[email protected]> wrote
in message
> news:f12t87$cts$[email protected]..
>>> but When and where do I create the objects? at
the start of the movie?
>>
>> That depends on when you need the objects to be
available.
>>
>>> would myobj will be another global variable.
>>
>> It could be. But it could also be a property of a
behavior script, or an
>> element in the actorList, or a property of a
"static" script, or...
>> It depends on how you need to access it. There are
no hard-and-fast rules
>
> -
Anyone help with linking a bank account to your apple id. The form wants a phone number I only have a UK mobile number and it doesnt sem to want to accept it keeps l;ooping me back to entering a phone number.
If you are trying to setup a charge card number on the Apple Store - make sure you are in the Correct country site - icon bottom right last time I saw it - where you can change country.
-
Help with encapsulation and a specific case of design
Hello all. I have been playing with Java (my first real language and first OOP language) for a couple months now. Right now I am trying to write my first real application, but I want to design it right and I am smashing my head against the wall with my data structure, specifically with encapsulation.
I go into detail about my app below, but it gets long so for those who don't want to read that far, let me just put these two questions up front:
1) How do principles of encapsulation change when members are complex objects rather than primitives? If the member objects themselves have only primitive members and show good encapsulation, does it make sense to pass a reference to them? Or does good encapsulation demand that I deep-clone all the way to the bottom of my data structure and pass only cloned objects through my top level accessors? Does the analysis change when the structure gets three or four levels deep? Don't DOM structures built of walkable nodes violate basic principles of encapsulation?
2) "Encapsulation" is sometimes used to mean no public members, othertimes to mean no public members AND no setter methods. The reasons for the first are obvious, but why go to the extreme of the latter? More importantly HOW do you go to the extreme of the latter? Would an "updatePrices" method that updates encapsulated member prices based on calculations, taking a single argument of say the time of year be considered a "setter" method that violates the stricter vision of encapsulation?
Even help with just those two questions would be great. For the masochistic, on to my app... The present code is at
http://www.immortalcoil.org/drake/Code.zip
The most basic form of the application is statistics driven flash card software for Japanese Kanji (Chinese characters). For those who do not know, these are ideographic characters that represent concepts rather than sounds. There are a few thousand. In abstract terms, my data structure needs to represent the following.
- There are a bunch of kanji.
Each kanji is defined by:
- a single character (the kanji itself); and
- multiple readings which fall into two categories of "on" and "kun".
Each reading is defined by:
- A string of hiragana or katakana (Japanese phoenetic characters); and
- Statistics that I keep to represent knowledge of that reading/kanji pair.Ideally the structure should be extensible. Later I might want to add statistics associated with the character itself rather than individual readings, for example. Right now I am thinking of building a data structure like so:
- A Vector that holds:
- custom KanjiEntry objects that each hold
- a kanji in a primitive char value; and
- two (on, kun) arrays or Vectors of custom Reading objects that hold
- the reading in a String; and
- statistics of some sort, probably in primitive valuesFirst of all, is this approach sensible in the rough outlines?
Now, I need to be able to do the obvious things... save to and load from file, generate tables and views, and edit values. The quesiton of editting values raises the questions I identified above as (1) and (2). Say I want to pull up a reading, quiz the user on it, and update its statistics based on whether the user got it right or wrong. I could do all this through the KanjiEntry object with a setter method that takes a zillion arguments like:
theKanjiEntry.setStatistic(
"on", // which set of readings
2, // which element in that array or Vector
"score", // which statistic
98); // the valueOr I could pass a clone of the Reading object out, work with that, then tell the KanjiEntry to replace the original with my modified clone.
My instincts balk at the first approach, and a little at the second. Doesn't it make more sense to work with a reference to the Reading object? Or is that bad encapsulation?
A second point. When running flash cards, I do not care about the subtlties of the structure, like whether a reading is an on or a kun (although this is important when browsing a table representing the entire structure). All I really care about is kanij/reading pairings. And I should be able to quickly poll the Reading objects to see which ones need quizzing the most, based on their statistics. I was thinking of making a nice neat Hashtable with the keys being the kanji characters in Strings (not the KanjiEntry objects) and the values being the Reading objects. The result would be two indeces to the Reading objects... the basic structure and my ad hoc hashtable for runninq quizzes. Then I would just make sure that they stay in sync in terms of the higher level structure (like if a whole new KanjiEntry got added). Is this bad form, or even downright dangerous?
Apart from good form, the other consideration bouncing around in my head is that if I get all crazy with deep cloning and filling the bottom level guys with instance methods then this puppy is going to get bloated or lag when there are several thousand kanji in memory at once.
Any help would be appreciated.
DrakeUsually by better design. Move methods that use the
getters inside the class that actually has the data....
As a basic rule of thumb:
The one who has the data is the one using it. If
another class needs that data, wonder what for and
consider moving that operation away from that class.
Or move from pull to push: instead of A getting
something from B, have B give it to A as a method
call argument.Thanks for the response. I think I see what you are saying.. in my case it is something like this.
Solution 1 (disfavored):
public class kanjiDrill{ // a chunk of Swing GUI or something
public void runDrill(Vector kanjiEntries){
KanjiEntry currentKanjiEntry = kanjiEntries.elementAt(0); // except really I will pick one randomly
char theKanji = currentKanjiEntry.getKanji();
String theReading = currentKanjiEntry.getReading();
// build and show a flashcard based on theKanji and theReading
// use a setter to change currentKanji's data based on whether the user answers correctly;
}Solution 2 (favored):
public class kanjiDrill{ // a chunk of Swing GUI or something
public void runDrill(Vector kanjiEntries){
KanjiEntry currentKanjiEntry = kanjiEntries.elementAt(0); // except really I will pick one randomly
currentKanji.buildAndShowFlashcard(); // method includes updating stats
}I can definitely see the advantages to this, but two potential reasons to think hard about it occur to me right away. First, if this process is carried out to a sufficient extreme the objects that hold my data end up sucking in all the functionality of my program and my objects stop resembling natural concepts.
In your shopping example, say you want to generate price tags for the items. The price tags can be generated with ONLY the raw price, because we do not want the VAT on them. They are simple GIF graphics that have the price printed on a an irregular polygon. Should all that graphics generating code really go into the item objects, or should we just get the price out of the object with a simple getter method and then make the tags?
My second concern is that the more instance methods I put into my bottom level data objects the bigger they get, and I intend to have thousands of these things in memory. Is there a balance to strike at some point?
It's not really a setter. Outsiders are not setting
the items price - it's rather updating its own price
given an argument. This is exactly how it should be,
see my above point. A breach of encapsulation would
be: another object gets the item price, re-calculates
it using a date it knows, and sets the price again.
You can see yourself that pushing the date into the
item's method is much beter than breaching
encapsulation and getting and setting the price.So the point is not "don't allow access to the members" (which after all you are still doing, albeit less directly) so much as "make sure that any functionality implicated in working with the members is handled within the object," right? Take your shopping example. Say we live in a country where there is no VAT and the app will never be used internationally. Then we would resort to a simple setter/getter scheme, right? Or is the answer that if the object really is pure data are almost so, then it should be turned into a standard java.util collection instead of a custom class?
Thanks for the help.
Drake -
when i am going from 1st detail list to basic list and choosing another sales order number i am geting the previous data instead of data according to new sales order number.
i have tried in ECC5.0 and also in 4.7EE.Plz Help me.
The code is as follows
*& Report ZAP_OOPS_ALV_2
*& Interactive alv with oops.
REPORT zap_oops_alv_2 MESSAGE-ID zapmsg.
*& Structure Declaration
Structure Declaration for sales order header data
TYPES: BEGIN OF ty_vbak,
vbeln TYPE vbeln_va, "Sales Ord Num
vkorg TYPE vkorg, "Sales Org
vkgrp TYPE vkgrp, "Sales Grp
kunnr TYPE kunnr, "Customer
END OF ty_vbak,
Structure Declaration for sales order item data
BEGIN OF ty_vbap,
vbeln TYPE vbeln_va, "Sales Ord Num
posnr TYPE posnr, "Sales item
matnr TYPE matnr, "Material Num
matkl TYPE matkl, "Material Grp
netwr TYPE netwr, "Net values
END OF ty_vbap,
Structure Declaration for customer data
BEGIN OF ty_kna1,
kunnr TYPE kunnr, "Customer
name1 TYPE name1, "Name
ort01 TYPE ort01, "City
pstlz TYPE pstlz, "Postal code
regio TYPE regio, "State
END OF ty_kna1,
Structure declaration for final output
BEGIN OF ty_output,
vbeln TYPE vbeln_va, "Sales Ord Num
vkorg TYPE vkorg, "Sales Org
vkgrp TYPE vkgrp, "Sales Grp
kunnr TYPE kunnr, "Customer
name1 TYPE name1, "Name
ort01 TYPE ort01, "City
pstlz TYPE pstlz, "Postal code
regio TYPE regio, "State
posnr TYPE posnr, "Sales item
matnr TYPE matnr, "Material Num
matkl TYPE matkl, "Material Grp
netwr TYPE netwr, "Net values
END OF ty_output.
*& Internal table Declaration
DATA: t_vbak TYPE STANDARD TABLE OF ty_vbak INITIAL SIZE 0,
t_vbap TYPE STANDARD TABLE OF ty_vbap INITIAL SIZE 0,
t_kna1 TYPE STANDARD TABLE OF ty_kna1 INITIAL SIZE 0,
t_output TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0,
t_vbep TYPE STANDARD TABLE OF vbep INITIAL SIZE 0,
*& Work Area Declaration
w_vbak TYPE ty_vbak,
w_vbap TYPE ty_vbap,
w_kna1 TYPE ty_kna1,
w_output TYPE ty_output,
w_vbep TYPE vbep,
g_flag TYPE char1,
g_vbeln TYPE vbak-vbeln.
Alv Declarations
DATA:g_custom_container1 TYPE REF TO cl_gui_custom_container,
g_custom_container2 TYPE REF TO cl_gui_custom_container,
g_grid1 TYPE REF TO cl_gui_alv_grid,
g_grid2 TYPE REF TO cl_gui_alv_grid,
w_fieldcat TYPE lvc_s_fcat,
t_fieldcat TYPE lvc_t_fcat.
*& Selection Screen Declaration
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
SELECT-OPTIONS:s_vbeln FOR g_vbeln.
SELECTION-SCREEN END OF BLOCK b1.
CLASS handle DEFINITION
CLASS handle DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row.
ENDCLASS. "handle DEFINITION
CLASS handle IMPLEMENTATION
CLASS handle IMPLEMENTATION.
METHOD click.
CLEAR w_output.
READ TABLE t_output INTO w_output INDEX e_row.
CLEAR e_row.
REFRESH t_vbep.
SELECT *
FROM vbep
INTO TABLE t_vbep
WHERE vbeln = w_output-vbeln.
CREATE OBJECT g_custom_container2
EXPORTING
container_name = 'GRID2'.
CREATE OBJECT g_grid2
EXPORTING
i_parent = g_custom_container2.
CALL SCREEN 200.
ENDMETHOD. "click
ENDCLASS. "handle IMPLEMENTATION
DATA: g_handle TYPE REF TO handle.
CLASS main DEFINITION
CLASS main DEFINITION.
PUBLIC SECTION.
METHODS:get_vbak,
get_vbap,
get_kna1,
disp_output,
validate_vbeln,
display_alv.
ENDCLASS. "main DEFINITION
CLASS main IMPLEMENTATION
CLASS main IMPLEMENTATION.
Method declaration for getting vbak data
METHOD get_vbak.
SELECT vbeln
vkorg
vkgrp
kunnr
FROM vbak
INTO TABLE t_vbak
WHERE vbeln IN s_vbeln.
ENDMETHOD. "get_vbak
Method Declaration for getting VBAP data
METHOD get_vbap.
SELECT vbeln
posnr
matnr
matkl
netwr
FROM vbap
INTO TABLE t_vbap
FOR ALL ENTRIES IN t_vbak
WHERE vbeln = t_vbak-vbeln.
ENDMETHOD. "get_vbap
Method Declaration for getting KNA1 data
METHOD get_kna1.
SELECT kunnr
name1
ort01
pstlz
regio
FROM kna1
INTO TABLE t_kna1
FOR ALL ENTRIES IN t_vbak
WHERE kunnr = t_vbak-kunnr.
ENDMETHOD. "get_kna1
Method Declaration for displaying the output
METHOD disp_output.
LOOP AT t_vbap INTO w_vbap.
w_output-vbeln = w_vbap-vbeln.
w_output-posnr = w_vbap-posnr.
w_output-matnr = w_vbap-matnr.
w_output-matkl = w_vbap-matkl.
w_output-netwr = w_vbap-netwr.
CLEAR w_vbak.
READ TABLE t_vbak INTO w_vbak WITH KEY vbeln = w_vbap-vbeln.
IF sy-subrc = 0.
w_output-vkorg = w_vbak-vkorg.
w_output-vkgrp = w_vbak-vkgrp.
w_output-kunnr = w_vbak-kunnr.
ENDIF.
CLEAR w_kna1.
READ TABLE t_kna1 INTO w_kna1 WITH KEY kunnr = w_vbak-kunnr.
IF sy-subrc = 0.
w_output-name1 = w_kna1-name1.
w_output-ort01 = w_kna1-ort01.
w_output-pstlz = w_kna1-pstlz.
w_output-regio = w_kna1-regio.
ENDIF.
APPEND w_output TO t_output.
CLEAR w_output.
ENDLOOP.
ENDMETHOD. "disp_output
METHOD validate_vbeln.
DATA:l_vbeln TYPE vbeln_va.
SELECT SINGLE vbeln
FROM vbak
INTO l_vbeln
WHERE vbeln IN s_vbeln.
IF sy-subrc <> 0.
MESSAGE e001.
ENDIF.
ENDMETHOD. "validate_vbeln
METHOD display_alv.
CREATE OBJECT g_custom_container1
EXPORTING
container_name = 'GRID1'.
CREATE OBJECT g_grid1
EXPORTING
i_parent = g_custom_container1.
SET HANDLER g_handle->click FOR g_grid1.
w_fieldcat-col_pos = 1.
w_fieldcat-fieldname = 'VBELN'.
w_fieldcat-scrtext_m = 'Sales Ord'.
APPEND w_fieldcat TO t_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-col_pos = 2.
w_fieldcat-fieldname = 'POSNR'.
w_fieldcat-scrtext_m = 'Sales Item'.
APPEND w_fieldcat TO t_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-col_pos = 3.
w_fieldcat-fieldname = 'MATNR'.
w_fieldcat-scrtext_m = 'Material'.
APPEND w_fieldcat TO t_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-col_pos = 4.
w_fieldcat-fieldname = 'VKORG'.
w_fieldcat-scrtext_m = 'Sale Org'.
APPEND w_fieldcat TO t_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-col_pos = 5.
w_fieldcat-fieldname = 'KUNNR'.
w_fieldcat-scrtext_m = 'Customer'.
APPEND w_fieldcat TO t_fieldcat.
CLEAR w_fieldcat.
CALL SCREEN 100.
ENDMETHOD. "display_alv
ENDCLASS. "main IMPLEMENTATION
DATA:g_main TYPE REF TO main.
Selection SELECTION EVENT
AT SELECTION-SCREEN.
*Create the object
CREATE OBJECT g_main.
CALL METHOD g_main->validate_vbeln.
Start of selection EVENT
START-OF-SELECTION.
CALL METHOD g_main->get_vbak .
CALL METHOD g_main->get_vbap.
CALL METHOD g_main->get_kna1.
CALL METHOD g_main->disp_output.
CALL METHOD g_main->display_alv.
*& Module STATUS_0100 OUTPUT
text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'MENU'.
SET TITLEBAR 'xxx'.
CALL METHOD g_grid1->set_table_for_first_display
CHANGING
it_outtab = t_output
it_fieldcatalog = t_fieldcat.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module STATUS_0200 OUTPUT
text
MODULE status_0200 OUTPUT.
SET PF-STATUS 'MENU1'.
SET TITLEBAR 'xxx'.
CALL METHOD g_grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'VBEP'
CHANGING
it_outtab = t_vbep.
ENDMODULE. " STATUS_0200 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module USER_COMMAND_0200 INPUT
text
MODULE user_command_0200 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
g_flag = 'X'.
REFRESH t_vbep.
SET HANDLER g_handle->click FOR g_grid1.
CALL METHOD g_main->display_alv.
CALL SCREEN 100.
LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 100.
LEAVE TO SCREEN 0 .
SET SCREEN 100. LEAVE SCREEN.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUTHi Srikar,
In OOPS ALV, we first define screen then we define container on screen. Container means area on screen where you'll be placing your ALV.
CREATE OBJECT r_cont
EXPORTING
container_name = 'CONTAINER_1' " Container name
EXCEPTIONS
OTHERS = 6
Now you assign reference of container to your grid. grid defines structure of your ALV.
CREATE OBJECT r_grid
EXPORTING
i_parent = r_cont
EXCEPTIONS
OTHERS = 5
Now you call the method set_table_for_first_display of class cl_gui_alv_grid to define fieldcatalog, internal table etc. to display ALV. The reason behind using MODULE is that screen logic is always defined in MODULES. If the user is interacting with screen then screen logic will be defined in PAI of screen.
One more thing is that in normal ALV you don't define screen and container. That means ALV will always be displayed at system defined place, but in OOP ALV, you define container(area) to define the place for your ALV.
The advantage which I found in OOP ALV is that it is more flexible to use.
Regards
Abhijeet -
Can anyone help me with the code of Heirarchical ALV with OOPS in module pool programming.
hi,
<i>link</i>
http://www.sap-img.com/abap/how-to-use-alv-for-hierarchical-lists.htm
<i>Check this example report :</i> BALVHD01
<i>chk a sample code.</i>
REPORT ZTEST_HIER LINE-COUNT 65
LINE-SIZE 200
NO STANDARD PAGE HEADING
MESSAGE-ID ZZ.
TYPE-POOLS: SLIS.
TYPES: BEGIN OF TY_HEAD,
VBELN LIKE VBAK-VBELN,
KUNNR LIKE VBAK-KUNNR,
NAME LIKE KNA1-NAME1,
END OF TY_HEAD.
TYPES: BEGIN OF TY_ITEM,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
MATNR LIKE VBAP-MATNR,
MAKTX LIKE MAKT-MAKTX,
CHECK(1),
END OF TY_ITEM.
DATA: IT_ITEM TYPE TABLE OF TY_ITEM.
DATA: IT_HEADER TYPE TABLE OF TY_HEAD,
IT_EVENTS TYPE SLIS_T_EVENT, "Events.
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: X_LAYOUT TYPE SLIS_LAYOUT_ALV,
X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
X_KEY TYPE SLIS_KEYINFO_ALV,
X_EVENTS TYPE SLIS_ALV_EVENT, "Event
X_VBELN LIKE VBAK-VBELN,
X_ITEM TYPE TY_ITEM.
CONSTANTS: C_S(1) VALUE '/'.
DATA: V_FLAG.
* SELECTION-SCREEN *
SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_VBELN FOR X_VBELN. "Sales order Number
SELECTION-SCREEN END OF BLOCK BLK.
AT SELECTION-SCREEN.
IF NOT S_VBELN[] IS INITIAL.
SELECT SINGLE VBELN
INTO X_VBELN
FROM VBAK
WHERE VBELN IN S_VBELN.
IF SY-SUBRC <> 0.
MESSAGE E002 WITH 'Please enter valid Sales Order'(020).
ENDIF.
ENDIF.
* CLASS lcl_bill_complete DEFINITION
CLASS LCL_BILL_COMPLETE DEFINITION.
PUBLIC SECTION.
METHODS:GET_HEADER_DATA,
GET_ITEM_DATA,
SHOW_DATA,
FILL_FIELDCAT,
FILL_EVENTS,
TOP_OF_PAGE.
ENDCLASS. "lcl_bill_complete DEFINITION
* CLASS lcl_bill_complete IMPLEMENTATION
CLASS LCL_BILL_COMPLETE IMPLEMENTATION.
METHOD GET_HEADER_DATA.
DATA:X_HEADER LIKE LINE OF IT_HEADER.
X_HEADER-VBELN = '12345'.
X_HEADER-KUNNR = '1234'.
X_HEADER-NAME = 'Test'.
APPEND X_HEADER TO IT_HEADER.
X_HEADER-VBELN = '12346'.
X_HEADER-KUNNR = '1236'.
X_HEADER-NAME = 'Test'.
APPEND X_HEADER TO IT_HEADER.
X_HEADER-VBELN = '12347'.
X_HEADER-KUNNR = '1235'.
X_HEADER-NAME = 'Test'.
APPEND X_HEADER TO IT_HEADER.
ENDMETHOD. "get_header_data
METHOD GET_ITEM_DATA.
DATA:X_ITEM LIKE LINE OF IT_ITEM.
X_ITEM-VBELN = '12345'.
X_ITEM-POSNR = '0010'.
X_ITEM-MATNR = 'TESTMATNR'.
X_ITEM-MAKTX = 'TESTMAT'.
APPEND X_ITEM TO IT_ITEM.
X_ITEM-VBELN = '12345'.
X_ITEM-POSNR = '0020'.
X_ITEM-MATNR = 'TESTMATNR'.
X_ITEM-MAKTX = 'TESTMAT'.
APPEND X_ITEM TO IT_ITEM.
X_ITEM-VBELN = '12346'.
X_ITEM-POSNR = '0010'.
X_ITEM-MATNR = 'TESTMATNR'.
X_ITEM-MAKTX = 'TESTMAT'.
APPEND X_ITEM TO IT_ITEM.
X_ITEM-VBELN = '12346'.
X_ITEM-POSNR = '0020'.
X_ITEM-MATNR = 'TESTMATNR'.
X_ITEM-MAKTX = 'TESTMAT'.
APPEND X_ITEM TO IT_ITEM.
X_ITEM-VBELN = '12347'.
X_ITEM-POSNR = '0010'.
X_ITEM-MATNR = 'TESTMATNR'.
X_ITEM-MAKTX = 'TESTMAT'.
APPEND X_ITEM TO IT_ITEM.
X_ITEM-VBELN = '12347'.
X_ITEM-POSNR = '0020'.
X_ITEM-MATNR = 'TESTMATNR'.
X_ITEM-MAKTX = 'TESTMAT'.
APPEND X_ITEM TO IT_ITEM.
ENDMETHOD. "get_item_data
METHOD SHOW_DATA.
X_KEY-HEADER01 = 'VBELN'.
X_KEY-ITEM01 = 'VBELN'.
X_KEY-ITEM02 = 'POSNR'.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = X_LAYOUT
IT_FIELDCAT = IT_FIELDCAT[]
I_TABNAME_HEADER = 'IT_HEADER'
I_TABNAME_ITEM = 'IT_ITEM'
IS_KEYINFO = X_KEY
IT_EVENTS = IT_EVENTS
TABLES
T_OUTTAB_HEADER = IT_HEADER
T_OUTTAB_ITEM = IT_ITEM
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDMETHOD. "show_data
METHOD FILL_FIELDCAT.
DATA: L_POS TYPE I.
X_LAYOUT-HEADER_TEXT = 'HEADER'.
X_LAYOUT-ITEM_TEXT = 'ITEM'.
X_LAYOUT-DEFAULT_ITEM = ' '.
X_LAYOUT-NO_KEYFIX = 'X'.
X_LAYOUT-BOX_TABNAME = 'IT_ITEM'.
L_POS = L_POS + 1.
*- Sales Order Number
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-TABNAME = 'IT_HEADER'.
X_FIELDCAT-SELTEXT_M = 'Sales Order'(017).
X_FIELDCAT-OUTPUTLEN = 11.
X_FIELDCAT-COL_POS = L_POS.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-FIELDNAME = 'KUNNR'.
X_FIELDCAT-TABNAME = 'IT_HEADER'.
X_FIELDCAT-SELTEXT_M = 'Sold-to Party'(010).
X_FIELDCAT-OUTPUTLEN = 13.
X_FIELDCAT-COL_POS = L_POS.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-FIELDNAME = 'NAME'.
X_FIELDCAT-TABNAME = 'IT_HEADER'.
X_FIELDCAT-OUTPUTLEN = 15.
X_FIELDCAT-SELTEXT_M = 'Sold-to name'(011).
X_FIELDCAT-COL_POS = L_POS.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-FIELDNAME = 'CHECK'.
X_FIELDCAT-TABNAME = 'IT_ITEM'.
X_FIELDCAT-CHECKBOX = 'X'.
X_FIELDCAT-INPUT = 'X'.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-SELTEXT_M = ' '.
X_FIELDCAT-OUTPUTLEN = 2.
X_FIELDCAT-COL_POS = L_POS.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-TABNAME = 'IT_ITEM'.
X_FIELDCAT-SELTEXT_M = 'Sales Order'(017).
X_FIELDCAT-OUTPUTLEN = 11.
X_FIELDCAT-TECH = 'X'.
X_FIELDCAT-COL_POS = L_POS.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
*- Sales Order Item
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-TABNAME = 'IT_ITEM'.
X_FIELDCAT-SELTEXT_M = 'SO Item'(018).
X_FIELDCAT-OUTPUTLEN = 7.
X_FIELDCAT-COL_POS = L_POS.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-FIELDNAME = 'MATNR'.
X_FIELDCAT-TABNAME = 'IT_ITEM'.
X_FIELDCAT-OUTPUTLEN = 18.
X_FIELDCAT-SELTEXT_M = 'Material number'(012).
X_FIELDCAT-COL_POS = L_POS.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-FIELDNAME = 'MAKTX'.
X_FIELDCAT-TABNAME = 'IT_ITEM'.
X_FIELDCAT-OUTPUTLEN = 40.
X_FIELDCAT-SELTEXT_M = 'Material Description'(013).
X_FIELDCAT-COL_POS = L_POS.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
ENDMETHOD. "fill_fieldcat
*--Fill the events table
METHOD FILL_EVENTS.
*- Top of page
X_EVENTS-NAME = 'TOP_OF_PAGE'.
X_EVENTS-FORM = 'TOP_OF_PAGE'.
APPEND X_EVENTS TO IT_EVENTS.
ENDMETHOD. "fill_events
"fill_events
METHOD TOP_OF_PAGE.
*- Call Steelcase Standard Header
WRITE 'top_of_page here'.
ENDMETHOD. "top_of_page
ENDCLASS. "lcl_bill_complete IMPLEMENTATION
START-OF-SELECTION.
DATA: OBJ TYPE REF TO LCL_BILL_COMPLETE.
CREATE OBJECT OBJ.
CALL METHOD OBJ->GET_HEADER_DATA.
CALL METHOD OBJ->GET_ITEM_DATA.
CALL METHOD OBJ->FILL_FIELDCAT.
CALL METHOD OBJ->FILL_EVENTS.
CALL METHOD OBJ->SHOW_DATA.
*& Form top_of_page
* TOP_OF_PAGE
FORM TOP_OF_PAGE.
*-To show the top of page
CALL METHOD OBJ->TOP_OF_PAGE.
ENDFORM. "top_of_page
if hlped plsmark points.
rgds
Anver -
Need help with custom event from Main class to an unrelated class.
Hey guys,
I'm new to Flash and not great with OOP. I've made it pretty far with google and lurking, but I've been pulling my hair out on this problem for a day and everything I try throws an error or simply doesn't hit the listener.
I'm trying to get my Main class to send a custom event to an unrelated class called BigIcon. The rest of the code works fine, it's just the addEventListener and dispatchEvent that isn't working.
I've put in the relevant code in below. Let me know if anything else is needed to troubleshoot. Thank you!
Main.as
package
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class Main extends MovieClip
var iconLayer_mc:MovieClip = new MovieClip();
public function Main()
Spin_btn.addEventListener(MouseEvent.CLICK,fl_MouseClickHandler);
addChildAt(iconLayer_mc,0);
placeIcons();
function placeIcons():void
var i:int;
var j:int;
for (i = 0; i < 4; i++)
for (j = 0; j < 5; j++)
//iconString_array has the names of illustrator objects that have been converted to MovieClips and are in the library.
var placedIcon_mc:BigIcon = new BigIcon(iconString_array[i][j],i,j);
iconLayer_mc.addChild(placedIcon_mc);
function fl_MouseClickHandler(event:MouseEvent):void
dispatchEvent(new Event("twitchupEvent",true));
BigIcon.as
package
import flash.display.MovieClip;
import flash.events.Event;
import flash.utils.getDefinitionByName;
public class BigIcon extends MovieClip
private var iconImage_str:String;
private var iconRow_int:int;
private var iconColumn_int:int;
public function BigIcon(iconImage_arg:String, iconRow_arg:int, iconColumn_arg:int)
iconImage_str = iconImage_arg;
iconRow_int = iconRow_arg;
iconColumn_int = iconColumn_arg;
this.addEventListener(Event.ADDED_TO_STAGE, Setup);
function Setup(e:Event)
this.y = iconRow_int;
this.x = iconColumn_int;
var ClassReference:Class = getDefinitionByName(iconImage_str) as Class;
var thisIcon_mc:MovieClip = new ClassReference;
this.addChild(thisIcon_mc);
addEventListener("twitchupEvent", twitchUp);
function twitchUp(e:Event)
this.y += 10;Ned Murphy wrote:
You should be getting an error for the Main.as class due to missing a line to import the Event class...
import flash.events.Event;
My apologies, I should attempt to compile my example code before I ask for help...
Alright, this compiles, gives me no errors, shows my 'book' and 'flowers' icons perfectly when ran, and prints 'addEventListener' to the output window as expected. I get no errors when I press the button, 'dispatchEvent' is output (good), but the 'twitchUp' function is never called and 'EventTriggered' is never output.
How do I get the 'twitchUp' event to trigger?
Main.as
package
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.*;
public class Main extends MovieClip
var iconLayer_mc:MovieClip = new MovieClip();
var iconString_array:Array = new Array(2);
public function Main()
Spin_btn.addEventListener(MouseEvent.CLICK,fl_MouseClickHandler);
addChildAt(iconLayer_mc,0);
buildStringArray();
placeIcons();
function buildStringArray():void
var i:int;
var j:int;
for (i = 0; i < 2; i++)
iconString_array[i] = new Array(3);
for (j = 0; j < 3; j++)
if (Math.random() > .5)
//'flowers' is the name of an illustrator object that has been converted to a MovieClip and is in the library
iconString_array[i][j] = "flowers";
else
//'book' is the name of an illustrator object that has been converted to a MovieClip and is in the library
iconString_array[i][j] = "book";
function placeIcons():void
var i:int;
var j:int;
for (i = 0; i < 2; i++)
for (j = 0; j < 3; j++)
//iconString_array has the names of illustrator objects that have been converted to MovieClips and are in the library.
var placedIcon_mc:BigIcon = new BigIcon(iconString_array[i][j],i*50,j*50);
iconLayer_mc.addChild(placedIcon_mc);
function fl_MouseClickHandler(event:MouseEvent):void
dispatchEvent(new Event("twitchupEvent",true));
trace("dispatchEvent");
BigIcon.as
package
import flash.display.MovieClip;
import flash.events.*;
import flash.utils.getDefinitionByName;
public class BigIcon extends MovieClip
private var iconImage_str:String;
private var iconRow_int:int;
private var iconColumn_int:int;
public function BigIcon(iconImage_arg:String, iconRow_arg:int, iconColumn_arg:int)
iconImage_str = iconImage_arg;
iconRow_int = iconRow_arg;
iconColumn_int = iconColumn_arg;
this.addEventListener(Event.ADDED_TO_STAGE, Setup);
function Setup(e:Event)
this.y = iconRow_int;
this.x = iconColumn_int;
var ClassReference:Class = getDefinitionByName(iconImage_str) as Class;
var thisIcon_mc:MovieClip = new ClassReference;
this.addChild(thisIcon_mc);
addEventListener("twitchupEvent", twitchUp);
trace("addEventListener");
function twitchUp(e:Event)
this.y += 10;
trace("EventTriggered");
Output:
[SWF] Untitled-1.swf - 40457 bytes after decompression
addEventListener
addEventListener
addEventListener
addEventListener
addEventListener
addEventListener
dispatchEvent
[UnloadSWF] Untitled-1.swf
Test Movie terminated. -
[8i] Need help with some workday calculations
At the beginning of the month, I got help with a workday calculation in: [8i] Help with function with parameters (for workday calculation)
Now, as it turns out, I was able to locate a function in the database that does what I want, however, it is much slower to use the function than to join two copies of the CALN table (Please see referenced thread for details. I can copy them to this thread if necessary.) I need to verify that the pre-existing function has 'DETERMINISTIC' in it, as I would guess that if it doesn't, it would be much slower than it could be.
But now, I've come across a situation where I have to do multiple workday calculations in the same query--enough that I have to join 6 copies of my CALN table. I can't imagine that is at all efficient. I believe it was Frank K. who said (in the original thread) that if the function was slow, I should consider alternatives. Can anyone help me identify some of those alternatives? I'm definitely at that point now. (This query is one I'm using as the base for a report in Oracle BI, and let's just say it doesn't like my query, even though my syntax appears to be correct, and I would guess that joining 6 copies of one table is at least partly to blame for this).
Note: I'm working with Oracle 8iOK, I finally have some sample data... I tried to make it thorough. I've included data in the CALN table YTD + tomorrow, so that any workday calculations using SYSDATE will work.
CREATE TABLE caln
( clndr_dt DATE NOT NULL
, clndr_yr NUMBER
, shop_day NUMBER
, shop_dt DATE
, shop_wk NUMBER
, shop_yr NUMBER
, shop_days NUMBER
, clndr_days NUMBER
CONSTRAINT caln_pk PRIMARY KEY (clndr_dt)
INSERT INTO caln
VALUES (To_Date('12/23/2009','mm/dd/yyyy'),2009,247,To_Date('12/23/2009','mm/dd/yyyy'),51,2009,7631,10950);
INSERT INTO caln
VALUES (To_Date('01/01/2010','mm/dd/yyyy'),2010,0,To_Date('12/23/2009','mm/dd/yyyy'),52,2009,7631,10959);
INSERT INTO caln
VALUES (To_Date('01/02/2010','mm/dd/yyyy'),2010,0,To_Date('12/23/2009','mm/dd/yyyy'),52,2009,7631,10960);
INSERT INTO caln
VALUES (To_Date('01/03/2010','mm/dd/yyyy'),2010,0,To_Date('12/23/2009','mm/dd/yyyy'),1,2010,7631,10961);
INSERT INTO caln
VALUES (To_Date('01/04/2010','mm/dd/yyyy'),2010,1,To_Date('01/04/2010','mm/dd/yyyy'),1,2010,7632,10962);
INSERT INTO caln
VALUES (To_Date('01/05/2010','mm/dd/yyyy'),2010,2,To_Date('01/05/2010','mm/dd/yyyy'),1,2010,7633,10963);
INSERT INTO caln
VALUES (To_Date('01/06/2010','mm/dd/yyyy'),2010,3,To_Date('01/06/2010','mm/dd/yyyy'),1,2010,7634,10964);
INSERT INTO caln
VALUES (To_Date('01/07/2010','mm/dd/yyyy'),2010,4,To_Date('01/07/2010','mm/dd/yyyy'),1,2010,7635,10965);
INSERT INTO caln
VALUES (To_Date('01/08/2010','mm/dd/yyyy'),2010,5,To_Date('01/08/2010','mm/dd/yyyy'),1,2010,7636,10966);
INSERT INTO caln
VALUES (To_Date('01/09/2010','mm/dd/yyyy'),2010,0,To_Date('01/08/2010','mm/dd/yyyy'),1,2010,7636,10967);
INSERT INTO caln
VALUES (To_Date('01/10/2010','mm/dd/yyyy'),2010,0,To_Date('01/08/2010','mm/dd/yyyy'),2,2010,7636,10968);
INSERT INTO caln
VALUES (To_Date('01/11/2010','mm/dd/yyyy'),2010,6,To_Date('01/11/2010','mm/dd/yyyy'),2,2010,7637,10969);
INSERT INTO caln
VALUES (To_Date('01/12/2010','mm/dd/yyyy'),2010,7,To_Date('01/12/2010','mm/dd/yyyy'),2,2010,7638,10970);
INSERT INTO caln
VALUES (To_Date('01/13/2010','mm/dd/yyyy'),2010,8,To_Date('01/13/2010','mm/dd/yyyy'),2,2010,7639,10971);
INSERT INTO caln
VALUES (To_Date('01/14/2010','mm/dd/yyyy'),2010,9,To_Date('01/14/2010','mm/dd/yyyy'),2,2010,7640,10972);
INSERT INTO caln
VALUES (To_Date('01/15/2010','mm/dd/yyyy'),2010,10,To_Date('01/15/2010','mm/dd/yyyy'),2,2010,7641,10973);
INSERT INTO caln
VALUES (To_Date('01/16/2010','mm/dd/yyyy'),2010,0,To_Date('01/15/2010','mm/dd/yyyy'),2,2010,7641,10974);
INSERT INTO caln
VALUES (To_Date('01/17/2010','mm/dd/yyyy'),2010,0,To_Date('01/15/2010','mm/dd/yyyy'),3,2010,7641,10975);
INSERT INTO caln
VALUES (To_Date('01/18/2010','mm/dd/yyyy'),2010,11,To_Date('01/18/2010','mm/dd/yyyy'),3,2010,7642,10976);
INSERT INTO caln
VALUES (To_Date('01/19/2010','mm/dd/yyyy'),2010,12,To_Date('01/19/2010','mm/dd/yyyy'),3,2010,7643,10977);
INSERT INTO caln
VALUES (To_Date('01/20/2010','mm/dd/yyyy'),2010,13,To_Date('01/20/2010','mm/dd/yyyy'),3,2010,7644,10978);
INSERT INTO caln
VALUES (To_Date('01/21/2010','mm/dd/yyyy'),2010,14,To_Date('01/21/2010','mm/dd/yyyy'),3,2010,7645,10979);
INSERT INTO caln
VALUES (To_Date('01/22/2010','mm/dd/yyyy'),2010,15,To_Date('01/22/2010','mm/dd/yyyy'),3,2010,7646,10980);
INSERT INTO caln
VALUES (To_Date('01/23/2010','mm/dd/yyyy'),2010,0,To_Date('01/22/2010','mm/dd/yyyy'),3,2010,7646,10981);
INSERT INTO caln
VALUES (To_Date('01/24/2010','mm/dd/yyyy'),2010,0,To_Date('01/22/2010','mm/dd/yyyy'),4,2010,7646,10982);
INSERT INTO caln
VALUES (To_Date('01/25/2010','mm/dd/yyyy'),2010,16,To_Date('01/25/2010','mm/dd/yyyy'),4,2010,7647,10983);
INSERT INTO caln
VALUES (To_Date('01/26/2010','mm/dd/yyyy'),2010,17,To_Date('01/26/2010','mm/dd/yyyy'),4,2010,7648,10984);
INSERT INTO caln
VALUES (To_Date('01/27/2010','mm/dd/yyyy'),2010,18,To_Date('01/27/2010','mm/dd/yyyy'),4,2010,7649,10985);
INSERT INTO caln
VALUES (To_Date('01/28/2010','mm/dd/yyyy'),2010,19,To_Date('01/28/2010','mm/dd/yyyy'),4,2010,7650,10986);
INSERT INTO caln
VALUES (To_Date('01/29/2010','mm/dd/yyyy'),2010,20,To_Date('01/29/2010','mm/dd/yyyy'),4,2010,7651,10987);
INSERT INTO caln
VALUES (To_Date('01/30/2010','mm/dd/yyyy'),2010,0,To_Date('01/29/2010','mm/dd/yyyy'),4,2010,7651,10988);
INSERT INTO caln
VALUES (To_Date('01/31/2010','mm/dd/yyyy'),2010,0,To_Date('01/29/2010','mm/dd/yyyy'),5,2010,7651,10989);
INSERT INTO caln
VALUES (To_Date('02/01/2010','mm/dd/yyyy'),2010,21,To_Date('02/01/2010','mm/dd/yyyy'),5,2010,7652,10990);
INSERT INTO caln
VALUES (To_Date('02/02/2010','mm/dd/yyyy'),2010,22,To_Date('02/02/2010','mm/dd/yyyy'),5,2010,7653,10991);
INSERT INTO caln
VALUES (To_Date('02/03/2010','mm/dd/yyyy'),2010,23,To_Date('02/03/2010','mm/dd/yyyy'),5,2010,7654,10992);
INSERT INTO caln
VALUES (To_Date('02/04/2010','mm/dd/yyyy'),2010,24,To_Date('02/04/2010','mm/dd/yyyy'),5,2010,7655,10993);
INSERT INTO caln
VALUES (To_Date('02/05/2010','mm/dd/yyyy'),2010,25,To_Date('02/05/2010','mm/dd/yyyy'),5,2010,7656,10994);
INSERT INTO caln
VALUES (To_Date('02/06/2010','mm/dd/yyyy'),2010,0,To_Date('02/05/2010','mm/dd/yyyy'),5,2010,7656,10995);
INSERT INTO caln
VALUES (To_Date('02/07/2010','mm/dd/yyyy'),2010,0,To_Date('02/05/2010','mm/dd/yyyy'),6,2010,7656,10996);
INSERT INTO caln
VALUES (To_Date('02/08/2010','mm/dd/yyyy'),2010,26,To_Date('02/08/2010','mm/dd/yyyy'),6,2010,7657,10997);
INSERT INTO caln
VALUES (To_Date('02/09/2010','mm/dd/yyyy'),2010,27,To_Date('02/09/2010','mm/dd/yyyy'),6,2010,7658,10998);
INSERT INTO caln
VALUES (To_Date('02/10/2010','mm/dd/yyyy'),2010,28,To_Date('02/10/2010','mm/dd/yyyy'),6,2010,7659,10999);
INSERT INTO caln
VALUES (To_Date('02/11/2010','mm/dd/yyyy'),2010,29,To_Date('02/11/2010','mm/dd/yyyy'),6,2010,7660,11000);
INSERT INTO caln
VALUES (To_Date('02/12/2010','mm/dd/yyyy'),2010,30,To_Date('02/12/2010','mm/dd/yyyy'),6,2010,7661,11001);
INSERT INTO caln
VALUES (To_Date('02/13/2010','mm/dd/yyyy'),2010,0,To_Date('02/12/2010','mm/dd/yyyy'),6,2010,7661,11002);
INSERT INTO caln
VALUES (To_Date('02/14/2010','mm/dd/yyyy'),2010,0,To_Date('02/12/2010','mm/dd/yyyy'),7,2010,7661,11003);
INSERT INTO caln
VALUES (To_Date('02/15/2010','mm/dd/yyyy'),2010,31,To_Date('02/15/2010','mm/dd/yyyy'),7,2010,7662,11004);
INSERT INTO caln
VALUES (To_Date('02/16/2010','mm/dd/yyyy'),2010,32,To_Date('02/16/2010','mm/dd/yyyy'),7,2010,7663,11005);
INSERT INTO caln
VALUES (To_Date('02/17/2010','mm/dd/yyyy'),2010,33,To_Date('02/17/2010','mm/dd/yyyy'),7,2010,7664,11006);
INSERT INTO caln
VALUES (To_Date('02/18/2010','mm/dd/yyyy'),2010,34,To_Date('02/18/2010','mm/dd/yyyy'),7,2010,7665,11007);
INSERT INTO caln
VALUES (To_Date('02/19/2010','mm/dd/yyyy'),2010,35,To_Date('02/19/2010','mm/dd/yyyy'),7,2010,7666,11008);
INSERT INTO caln
VALUES (To_Date('02/20/2010','mm/dd/yyyy'),2010,0,To_Date('02/19/2010','mm/dd/yyyy'),7,2010,7666,11009);
CREATE TABLE ords
( ord_nbr NUMBER NOT NULL
, sub_nbr NUMBER NOT NULL
, ord_stat VARCHAR2(2)
, ord_qty NUMBER
, part_nbr VARCHAR2(5)
CONSTRAINT ords_pk PRIMARY KEY (ord_nbr, sub_nbr)
INSERT INTO ords
VALUES (1,1,'CL',10,'PART1');
INSERT INTO ords
VALUES (1,2,'CL',5,'PART1');
INSERT INTO ords
VALUES (25,1,'CL',15,'PART2');
INSERT INTO ords
VALUES (14,1,'OP',12,'PART3');
INSERT INTO ords
VALUES (33,1,'CL',25,'PART1');
INSERT INTO ords
VALUES (33,2,'CL',15,'PART1');
INSERT INTO ords
VALUES (33,3,'OP',10,'PART1');
INSERT INTO ords
VALUES (7,1,'PL',18,'PART2');
INSERT INTO ords
VALUES (96,1,'PL',10,'PART3');
INSERT INTO ords
VALUES (31,1,'CL',20,'PART2');
CREATE TABLE oops
( ord_nbr NUMBER NOT NULL
, sub_nbr NUMBER NOT NULL
, op_nbr VARCHAR2(4) NOT NULL
, mach_id VARCHAR2(4)
, oper_stat VARCHAR2(2)
, plan_start_dt DATE
, plsu NUMBER
, plrn NUMBER
CONSTRAINT ords_pk PRIMARY KEY (ord_nbr, sub_nbr, op_nbr)
-- NOTE:
-- for the orders with a status of 'CL' or 'PL' in the 'ords' table, I'm not bothering to put
-- in more than two operations (though in reality more would be there) since they should be
-- ignored in the final result anyway
INSERT INTO oops
VALUES (1,1,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.2);
INSERT INTO oops
VALUES (1,1,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.15);
INSERT INTO oops
VALUES (1,2,'0010','123A','CP',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.2);
INSERT INTO oops
VALUES (1,2,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.15);
INSERT INTO oops
VALUES (25,1,'0005','123A','CP',TO_DATE('01/18/2010','mm/dd/yyyy'),2,0.25);
INSERT INTO oops
VALUES (25,1,'0030','110C','CL',TO_DATE('01/19/2010','mm/dd/yyyy'),4,0.1);
INSERT INTO oops
VALUES (14,1,'0010','127A','CP',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.25);
INSERT INTO oops
VALUES (14,1,'0025','110C','CL',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
INSERT INTO oops
VALUES (14,1,'0040','050C','CP',TO_DATE('01/13/2010','mm/dd/yyyy'),1.3,0.15);
INSERT INTO oops
VALUES (14,1,'0050','220B','WK',TO_DATE('01/14/2010','mm/dd/yyyy'),4,0.25);
INSERT INTO oops
VALUES (14,1,'0065','242B','AV',TO_DATE('01/18/2010','mm/dd/yyyy'),1.5,0.1);
INSERT INTO oops
VALUES (14,1,'0067','150G','NA',TO_DATE('01/19/2010','mm/dd/yyyy'),2,0.1);
INSERT INTO oops
VALUES (14,1,'0100','250G','NA',TO_DATE('01/20/2010','mm/dd/yyyy'),2.1,0.2);
INSERT INTO oops
VALUES (33,1,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
INSERT INTO oops
VALUES (33,1,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
INSERT INTO oops
VALUES (33,2,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
INSERT INTO oops
VALUES (33,2,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
INSERT INTO oops
VALUES (33,3,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
INSERT INTO oops
VALUES (33,3,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
INSERT INTO oops
VALUES (33,3,'0020','220B','NA',TO_DATE('01/12/2010','mm/dd/yyyy'),1.7,0.15);
INSERT INTO oops
VALUES (33,3,'0030','150G','NA',TO_DATE('01/13/2010','mm/dd/yyyy'),1.3,0.05);
INSERT INTO oops
VALUES (33,3,'0055','150G','NA',TO_DATE('01/15/2010','mm/dd/yyyy'),2.1.,0.1);
INSERT INTO oops
VALUES (7,1,'0005','123A','NA',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.2);
INSERT INTO oops
VALUES (7,1,'0030','110C','NA',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.15);
INSERT INTO oops
VALUES (96,1,'0010','127A','NA',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.25);
INSERT INTO oops
VALUES (96,1,'0025','110C','NA',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
INSERT INTO oops
VALUES (31,1,'0005','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
INSERT INTO oops
VALUES (31,1,'0030','110C','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
CREATE TABLE mach
( mach_id VARCHAR2(4) NOT NULL
, desc_short VARCHAR2(9)
, group VARCHAR2(7)
CONSTRAINT ords_pk PRIMARY KEY (mach_id)
INSERT INTO mach
VALUES ('123A','desc here','GROUPH1');
INSERT INTO mach
VALUES ('259B','desc here','GROUPH2');
INSERT INTO mach
VALUES ('110C','desc here','GROUPJ1');
INSERT INTO mach
VALUES ('050C','desc here','GROUPK2');
INSERT INTO mach
VALUES ('220B','desc here','GROUPH2');
INSERT INTO mach
VALUES ('242B','desc here','GROUPH2');
INSERT INTO mach
VALUES ('150G','desc here','GROUPL1');
INSERT INTO mach
VALUES ('250G','desc here','GROUPL2');
INSERT INTO mach
VALUES ('242B','desc here','GROUPH2'); -
Hi friends,
am working on module pool program i want to use oops concept in moduel pool.can any body give me an example in
module pool with oops .
Thanks in advance,
sai.Hello,
we have uses ABAP OO and Classic Dypros in our current projekt a lot.
It turned out to be the best way to it like this:
1. Create your Dynpro
2. Create an Interface that corresponds only to that Dynpro.
3. In the Modules of the dynpro you only call Methods from that interface created above, also all checks of Dynprofields etc should be handled in the Implelmentation of the methods. so you do like that:
Module set_vbeln.
gi_dynp_class->set_vbeln( gs_sd-vbeln ).
endmodul.
gi_dynp_class is from type of your interface.
4. Create an application class that implements all the methods of the interface with the logic needed. Using inheritance you can easily reuse the the Dynpro in different contexts with different Application classes behind it.
5. In PBO of the dynpro you have to make sure that the the variable gi_dynp_class is bound. So you will cast your application class instance to it:
gi_dynp_class ?= gi_app_class.
The application class must be instanciates at the beginning of the program before the dynpro is used.
As a class can implement several interface you can enable you application class for as many dynpros as you want to.
Hope that helps a bit ...
Greetings from Hamburg -
Can u explain me how to work with OOPs ABAP
Hi,
Can u explain me how to work with OOPS Abap, If possible pls send me some sample programs regarding OOps concept used in Realtime.
Thanks.hii,
Please check this online document (starting page 1291).
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf
Also check this links as well.
http://help.sap.com/saphelp_nw2004s/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
http://www.sapgenie.com/abap/OO/
http://www.futureobjects.de/content/intro_oo_e.html
http://www.sap-img.com/abap/business-add-in-you-need-to-understand-abap-oo-interface-concept.htm
/people/ravikumar.allampallam/blog/2005/02/11/abap-oo-in-action
What is Object Orientation?
Object orientation (OO), or to be more precise, object-oriented programming, is a problem-solving method in which the software solution reflects objects in the real world.
A comprehensive introduction to object orientation as a whole would go far beyond the limits of this introduction to ABAP Objects. This documentation introduces a selection of terms that are used universally in object orientation and also occur in ABAP Objects. In subsequent sections, it goes on to discuss in more detail how these terms are used in ABAP Objects. The end of this section contains a list of further reading, with a selection of titles about object orientation.
Objects
An object is a section of source code that contains data and provides services. The data forms the attributes of the object. The services are known as methods (also known as operations or functions). Typically, methods operate on private data (the attributes, or state of the object), which is only visible to the methods of the object. Thus the attributes of an object cannot be changed directly by the user, but only by the methods of the object. This guarantees the internal consistency of the object.
Classes
Classes describe objects. From a technical point of view, objects are runtime instances of a class. In theory, you can create any number of objects based on a single class. Each instance (object) of a class has a unique identity and its own set of values for its attributes.
Object References
In a program, you identify and address objects using unique object references. Object references allow you to access the attributes and methods of an object.
In object-oriented programming, objects usually have the following properties:
Encapsulation
Objects restrict the visibility of their resources (attributes and methods) to other users. Every object has an interface, which determines how other objects can interact with it. The implementation of the object is encapsulated, that is, invisible outside the object itself.
Polymorphism
Identical (identically-named) methods behave differently in different classes. Object-oriented programming contains constructions called interfaces. They enable you to address methods with the same name in different objects. Although the form of address is always the same, the implementation of the method is specific to a particular class.
Inheritance
You can use an existing class to derive a new class. Derived classes inherit the data and methods of the superclass. However, they can overwrite existing methods, and also add new ones.
Uses of Object Orientation
Below are some of the advantages of object-oriented programming:
Complex software systems become easier to understand, since object-oriented structuring provides a closer representation of reality than other programming techniques.
In a well-designed object-oriented system, it should be possible to implement changes at class level, without having to make alterations at other points in the system. This reduces the overall amount of maintenance required.
Through polymorphism and inheritance, object-oriented programming allows you to reuse individual components.
In an object-oriented system, the amount of work involved in revising and maintaining the system is reduced, since many problems can be detected and corrected in the design phase.
Achieving these goals requires:
Object-oriented programming languages
Object-oriented programming techniques do not necessarily depend on object-oriented programming languages. However, the efficiency of object-oriented programming depends directly on how object-oriented language techniques are implemented in the system kernel.
Object-oriented tools
Object-oriented tools allow you to create object-oriented programs in object-oriented languages. They allow you to model and store development objects and the relationships between them.
Object-oriented modeling
The object-orientation modeling of a software system is the most important, most time-consuming, and most difficult requirement for attaining the above goals. Object-oriented design involves more than just object-oriented programming, and provides logical advantages that are independent of the actual implementation
http://www.sapgenie.com/abap/OO/index.htm
http://www.geocities.com/victorav15/sapr3/abap_ood.html
http://www.brabandt.de/html/abap_oo.html
Check this cool weblog:
/people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
/people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
/people/sap.user72/blog/2005/05/10/a-small-tip-for-the-beginners-in-oo-abap
/people/ravikumar.allampallam/blog/2005/02/11/abap-oo-in-action
/people/thomas.jung3/blog/2005/09/08/oo-abap-dynpro-programming
http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
http://www.sapgenie.com/abap/OO/
http://www.sapgenie.com/abap/OO/index.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
http://www.allsaplinks.com/
http://www.sap-img.com/
http://www.sapgenie.com/
http://help.sap.com
http://www.sapgenie.com/abap/OO/
http://www.sapgenie.com/abap/OO/index.htm
http://www.sapgenie.com/abap/controls/index.htm
http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
http://www.sapgenie.com/abap/OO/index.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
http://www.sapgenie.com/abap/OO/
these links
http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
For funtion module to class
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
for classes
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
for methods
http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
for inheritance
http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
for interfaces
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
For basic stuff......
abap oops
http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/frameset.htm
ABAP Business Development and Service Provisioning/ABAP Objects
General information
What is Object Orientation?
some blogs
A small tip for the beginners in OO ABAP
Object Oriented ABAP (OO-ABAP)
and others wiki OO Abap
cheers,
sharad
Edited by: sharad narayan on Apr 29, 2008 12:19 PM -
Help with production jvm issues at customer site
Following is a brief overview of two production issues experienced by an Oracle customer. Customer is currently running 32 bit Java 1.5_20 on Solaris 64 bit OS.
1) OOM heap issues – SR #3-2611053901 – Recently we have been seeing OOM errors due to heap space. What we have seen is that some of the instances are not able to free up any memory space even after full GC, which results into a series of full GC’s back to back and eventually leads to OOM. During this time when continuous full GC is going on, we have seen the TCP connections and active JDBC connections shoot up and also lots of stuck threads. This error occurs during peak hours.
This is the output just before OOM. Just to be clear, this line is printed as last line of Full GC which meant that OOM happened right after Full GC:
[PSYoungGen: 111616K->82323K(172544K)] [PSOldGen: 1865727K->1865727K(1865728K)] 1977343K->1948051K(2038272K) [PSPermGen: 209111K->209061K(210944K)] GC time is exceeding GCTimeLimit of 98%, 13.3644395 secs]
2) OOM swap space- SR: #3-1724941721 – From time to time, we get Exception in thread "CompilerThread0" java.lang.OutOfMemoryError: requested 32756 bytes for ChunkPool::allocate. Out of swap space?’ error in our production. Mostly this error occurs during off hours or off-peak hours. When this happen, there is plenty of heap and perm memory available which indicates that this is a native memory error. We already put two workarounds suggested by Oracle i.e. -XX:CodeCacheMinimumFreeSpace=8m -XX:ReservedCodeCacheSize=128m but still running into this problem.
What we are looking for:
1) Recommendations on tuning our config parameters -
These are some recommendations we discussed internally. Please validate these recommendations and provide us the recommended values. We would also welcome any new recommendation on updating other parameters if that will help with our issues.
• Change Xmx to 2048m and MaxPermSize to 512m
• Specify ratio of young generation to old generation (-XX:NewRatio), and possibly survivor spaces.
• Use Concurrent old generation collector (-XX:+UseConcMarkSweepGC), with a compatible parallel young generation collector (-XX:+UseParNewGC)
Our current config settings are:
JAVA Memory arguments: -Did=chaserels-cm21 -Xms1024m -Xmx2048m -XX:MaxPermSize=1024m -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:CodeCacheMinimumFreeSpace=8m -XX:ReservedCodeCacheSize=128m -verbose:gc -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=1641 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.awt.headless=true -Dfile.encoding=ISO646-US
In a subset of servers, the settings are same as above but for MaxPermSIze, which is set to -XX:MaxPermSize=512m
2) Diagnostic help in how to further narrow down to the problem and what tool to use to gather heap dumps
We have tried to take heap dump using jmap on our production servers when OOM occurs due to heap but most of the time, we run into an exception (attached - which is probably an unresolved jvm bug). While we researched some alternatives to jmap for taking heap dumps, most of these require changing the start-up scripts or installing the tool on production system which may have a performance overhead. What we want is a least intrusive tool which could provide us heap dumps/snapshots without much overhead and could be preferably used remotely. If there are other ways of collecting data than heap dump, we could also use them.
Let me know if you have any questions or need any data.
Thanks for your help.
Error from heap dump :
Exception in thread "main" sun.jvm.hotspot.debugger.UnalignedAddressException: Trying to read at address: 0xfec080a7 with alignment: 4
at sun.jvm.hotspot.debugger.DebuggerUtilities.checkAlignment(DebuggerUtilities.java:40)
at sun.jvm.hotspot.debugger.proc.ProcDebuggerLocal.readCInteger(ProcDebuggerLocal.java:309)
at sun.jvm.hotspot.debugger.DebuggerBase.readAddressValue(DebuggerBase.java:425)
at sun.jvm.hotspot.debugger.proc.ProcDebuggerLocal.readOopHandle(ProcDebuggerLocal.java:326)
at sun.jvm.hotspot.debugger.proc.ProcAddress.getOopHandleAt(ProcAddress.java:96)
at sun.jvm.hotspot.oops.Oop.getKlassForOopHandle(Oop.java:198)
at sun.jvm.hotspot.oops.ObjectHeap.newOop(ObjectHeap.java:346)
at sun.jvm.hotspot.runtime.JavaThread.getThreadObj(JavaThread.java:333)
at sun.jvm.hotspot.utilities.AbstractHeapGraphWriter.writeJavaThreads(AbstractHeapGraphWriter.java:113)
at sun.jvm.hotspot.utilities.AbstractHeapGraphWriter.write(AbstractHeapGraphWriter.java:98)
at sun.jvm.hotspot.utilities.HeapHprofBinWriter.write(HeapHprofBinWriter.java:399)
at sun.jvm.hotspot.tools.JMap.writeHeapHprofBin(JMap.java:133)
at sun.jvm.hotspot.tools.JMap.writeHeapHprofBin(JMap.java:143)
at sun.jvm.hotspot.tools.JMap.run(JMap.java:71)
at sun.jvm.hotspot.tools.Tool.start(Tool.java:204)
at sun.jvm.hotspot.tools.JMap.main(JMap.java:126)1) OOM heap issues – SR #3-2611053901 – Recently we have been seeing OOM errors due to heap space. What we have seen is that some of the instances are not able to free up any memory space even after full GC, which results into a series of full GC’s back to back and eventually leads to OOM. Which would be exactly what would happen if there were many objects which were not eligible for collection.
Causes would be either a bug (something not releasing something it should) or because the server is overloaded.
If there were no code changes it could still be a bug that has now only become apparent due to changes in usage patterns.
If that is the case then such bugs can usually be made more apparent by reducing the maximum heap. Doing that will cause it to occur faster. -
Hi iam new to abap objects. I was interested in bdc with oops. If any one knows the procedure send me, if possible with any sample code.................
this can be helpful.
OOPs ABAP uses Classes and Interfaces which uses Methods and events.
If you have Java skills it is advantage for you.
There are Local classes as well as Global Classes.
Local classes we can work in SE38 straight away.
But mostly it is better to use the Global classes.
Global Classes or Interfaces are to be created in SE24.
SAP already given some predefined classes and Interfaces.
This OOPS concepts very useful for writing BADI's also.
So first create a class in SE 24.
Define attributes, Methods for that class.
Define parameters for that Method.
You can define event handlers also to handle the messages.
After creation in each method write the code.
Methods are similar to ABAP PERFORM -FORM statements.
After the creation of CLass and methods come to SE38 and create the program.
In the program create a object type ref to that class and with the help of that Object call the methods of that Class and display the data.
Example:
REPORT sapmz_hf_alv_grid .
Type pool for icons - used in the toolbar
TYPE-POOLS: icon.
TABLES: zsflight.
To allow the declaration of o_event_receiver before the
lcl_event_receiver class is defined, decale it as deferred in the
start of the program
CLASS lcl_event_receiver DEFINITION DEFERRED.
G L O B A L I N T E R N A L T A B L E S
*DATA: gi_sflight TYPE STANDARD TABLE OF sflight.
To include a traffic light and/or color a line the structure of the
table must include fields for the traffic light and/or the color
TYPES: BEGIN OF st_sflight.
INCLUDE STRUCTURE zsflight.
Field for traffic light
TYPES: traffic_light TYPE c.
Field for line color
types: line_color(4) type c.
TYPES: END OF st_sflight.
TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
DATA: gi_sflight TYPE tt_sflight.
G L O B A L D A T A
DATA: ok_code LIKE sy-ucomm,
Work area for internal table
g_wa_sflight TYPE st_sflight,
ALV control: Layout structure
gs_layout TYPE lvc_s_layo.
Declare reference variables to the ALV grid and the container
DATA:
go_grid TYPE REF TO cl_gui_alv_grid,
go_custom_container TYPE REF TO cl_gui_custom_container,
o_event_receiver TYPE REF TO lcl_event_receiver.
DATA:
Work area for screen 200
g_screen200 LIKE zsflight.
Data for storing information about selected rows in the grid
DATA:
Internal table
gi_index_rows TYPE lvc_t_row,
Information about 1 row
g_selected_row LIKE lvc_s_row.
C L A S S E S
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING
e_object e_interactive,
handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
Event handler method for event toolbar.
CONSTANTS:
Constants for button type
c_button_normal TYPE i VALUE 0,
c_menu_and_default_button TYPE i VALUE 1,
c_menu TYPE i VALUE 2,
c_separator TYPE i VALUE 3,
c_radio_button TYPE i VALUE 4,
c_checkbox TYPE i VALUE 5,
c_menu_entry TYPE i VALUE 6.
DATA:
ls_toolbar TYPE stb_button.
Append seperator to the normal toolbar
CLEAR ls_toolbar.
MOVE c_separator TO ls_toolbar-butn_type..
APPEND ls_toolbar TO e_object->mt_toolbar.
Append a new button that to the toolbar. Use E_OBJECT of
event toolbar. E_OBJECT is of type CL_ALV_EVENT_TOOLBAR_SET.
This class has one attribute MT_TOOLBAR which is of table type
TTB_BUTTON. The structure is STB_BUTTON
CLEAR ls_toolbar.
MOVE 'CHANGE' TO ls_toolbar-function.
MOVE icon_change TO ls_toolbar-icon.
MOVE 'Change flight' TO ls_toolbar-quickinfo.
MOVE 'Change' TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD.
METHOD handle_user_command.
Handle own functions defined in the toolbar
CASE e_ucomm.
WHEN 'CHANGE'.
PERFORM change_flight.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMETHOD.
ENDCLASS.
S T A R T - O F - S E L E C T I O N.
START-OF-SELECTION.
SET SCREEN '100'.
*& Module USER_COMMAND_0100 INPUT
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0100 OUTPUT
MODULE status_0100 OUTPUT.
DATA:
For parameter IS_VARIANT that is sued to set up options for storing
the grid layout as a variant in method set_table_for_first_display
l_layout TYPE disvariant,
Utillity field
l_lines TYPE i.
After returning from screen 200 the line that was selected before
going to screen 200, should be selected again. The table gi_index_rows
was the output table from the GET_SELECTED_ROWS method in form
CHANGE_FLIGHT
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines > 0.
CALL METHOD go_grid->set_selected_rows
EXPORTING
it_index_rows = gi_index_rows.
CALL METHOD cl_gui_cfw=>flush.
REFRESH gi_index_rows.
ENDIF.
Read data and create objects
IF go_custom_container IS INITIAL.
Read data from datbase table
PERFORM get_data.
Create objects for container and ALV grid
CREATE OBJECT go_custom_container
EXPORTING container_name = 'ALV_CONTAINER'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_custom_container.
Create object for event_receiver class
and set handlers
CREATE OBJECT o_event_receiver.
SET HANDLER o_event_receiver->handle_user_command FOR go_grid.
SET HANDLER o_event_receiver->handle_toolbar FOR go_grid.
Layout (Variant) for ALV grid
l_layout-report = sy-repid. "Layout fo report
Setup the grid layout using a variable of structure lvc_s_layo
Set grid title
gs_layout-grid_title = 'Flights'.
Selection mode - Single row without buttons
(This is the default mode
gs_layout-sel_mode = 'B'.
Name of the exception field (Traffic light field) and the color
field + set the exception and color field of the table
gs_layout-excp_fname = 'TRAFFIC_LIGHT'.
gs_layout-info_fname = 'LINE_COLOR'.
LOOP AT gi_sflight INTO g_wa_sflight.
IF g_wa_sflight-paymentsum < 100000.
Value of traffic light field
g_wa_sflight-traffic_light = '1'.
Value of color field:
C = Color, 6=Color 1=Intesified on, 0: Inverse display off
g_wa_sflight-line_color = 'C610'.
ELSEIF g_wa_sflight-paymentsum => 100000 AND
g_wa_sflight-paymentsum < 1000000.
g_wa_sflight-traffic_light = '2'.
ELSE.
g_wa_sflight-traffic_light = '3'.
ENDIF.
MODIFY gi_sflight FROM g_wa_sflight.
ENDLOOP.
Grid setup for first display
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_variant = l_layout
i_save = 'A'
is_layout = gs_layout
CHANGING it_outtab = gi_sflight.
*-- End of grid setup -
Raise event toolbar to show the modified toolbar
CALL METHOD go_grid->set_toolbar_interactive.
Set focus to the grid. This is not necessary in this
example as there is only one control on the screen
CALL METHOD cl_gui_control=>set_focus EXPORTING control = go_grid.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0200 INPUT
MODULE user_command_0200 INPUT.
CASE ok_code.
WHEN 'EXIT200'.
LEAVE TO SCREEN 100.
WHEN'SAVE'.
PERFORM save_changes.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
*& Form get_data
FORM get_data.
Read data from table SFLIGHT
SELECT *
FROM zsflight
INTO TABLE gi_sflight.
ENDFORM. " load_data_into_grid
*& Form change_flight
Reads the contents of the selected row in the grid, ans transfers
the data to screen 200, where it can be changed and saved.
FORM change_flight.
DATA:l_lines TYPE i.
REFRESH gi_index_rows.
CLEAR g_selected_row.
Read index of selected rows
CALL METHOD go_grid->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.
Check if any row are selected at all. If not
table gi_index_rows will be empty
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines = 0.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
textline1 = 'You must choose a line'.
EXIT.
ENDIF.
Read indexes of selected rows. In this example only one
row can be selected as we are using gs_layout-sel_mode = 'B',
so it is only ncessary to read the first entry in
table gi_index_rows
LOOP AT gi_index_rows INTO g_selected_row.
IF sy-tabix = 1.
READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
ENDIF.
ENDLOOP.
Transfer data from the selected row to screenm 200 and show
screen 200
CLEAR g_screen200.
MOVE-CORRESPONDING g_wa_sflight TO g_screen200.
LEAVE TO SCREEN '200'.
ENDFORM. " change_flight
*& Form save_changes
Changes made in screen 200 are written to the datbase table
zsflight, and to the grid table gi_sflight, and the grid is
updated with method refresh_table_display to display the changes
FORM save_changes.
DATA: l_traffic_light TYPE c.
Update traffic light field
Update database table
MODIFY zsflight FROM g_screen200.
Update grid table , traffic light field and color field.
Note that it is necessary to use structure g_wa_sflight
for the update, as the screen structure does not have a
traffic light field
MOVE-CORRESPONDING g_screen200 TO g_wa_sflight.
IF g_wa_sflight-paymentsum < 100000.
g_wa_sflight-traffic_light = '1'.
C = Color, 6=Color 1=Intesified on, 0: Inverse display off
g_wa_sflight-line_color = 'C610'.
ELSEIF g_wa_sflight-paymentsum => 100000 AND
g_wa_sflight-paymentsum < 1000000.
g_wa_sflight-traffic_light = '2'.
clear g_wa_sflight-line_color.
ELSE.
g_wa_sflight-traffic_light = '3'.
clear g_wa_sflight-line_color.
ENDIF.
MODIFY gi_sflight INDEX g_selected_row-index FROM g_wa_sflight.
Refresh grid
CALL METHOD go_grid->refresh_table_display.
CALL METHOD cl_gui_cfw=>flush.
LEAVE TO SCREEN '100'.
ENDFORM. " save_changes
chk this blog
/people/vijaybabu.dudla/blog/2006/07/21/topofpage-in-alv-using-clguialvgrid
with regards,
Hema SUndara. -
I still need help with the Dictionary for my Nokia...
I still need help with the Dictionary for my Nokia 6680...
Here's the error message I get when trying to open dictionary...
"Dictionary word information missing. Install word database."
Can someone please provide me a link the where I could download this dictionary for free?
Thanks!
DON'T HIT KIDS... THEY HAVE GUNS NOW.oops, im sorry, i didnt realised i've already submitted it
DON'T HIT KIDS... THEY HAVE GUNS NOW. -
Help with if statement in cursor and for loop to get output
I have the following cursor and and want to use if else statement to get the output. The cursor is working fine. What i need help with is how to use and if else statement to only get the folderrsn that have not been updated in the last 30 days. If you look at the talbe below my select statement is showing folderrs 291631 was updated only 4 days ago and folderrsn 322160 was also updated 4 days ago.
I do not want these two to appear in my result set. So i need to use if else so that my result only shows all folderrsn that havenot been updated in the last 30 days.
Here is my cursor:
/*Cursor for Email procedure. It is working Shows userid and the string
You need to update these folders*/
DECLARE
a_user varchar2(200) := null;
v_assigneduser varchar2(20);
v_folderrsn varchar2(200);
v_emailaddress varchar2(60);
v_subject varchar2(200);
Cursor c IS
SELECT assigneduser, vu.emailaddress, f.folderrsn, trunc(f.indate) AS "IN DATE",
MAX (trunc(fpa.attemptdate)) AS "LAST UPDATE",
trunc(sysdate) - MAX (trunc(fpa.attemptdate)) AS "DAYS PAST"
--MAX (TRUNC (fpa.attemptdate)) - TRUNC (f.indate) AS "NUMBER OF DAYS"
FROM folder f, folderprocess fp, validuser vu, folderprocessattempt fpa
WHERE f.foldertype = 'HJ'
AND f.statuscode NOT IN (20, 40)
AND f.folderrsn = fp.folderrsn
AND fp.processrsn = fpa.processrsn
AND vu.userid = fp.assigneduser
AND vu.statuscode = 1
GROUP BY assigneduser, vu.emailaddress, f.folderrsn, f.indate
ORDER BY fp.assigneduser;
BEGIN
FOR c1 IN c LOOP
IF (c1.assigneduser = v_assigneduser) THEN
dbms_output.put_line(' ' || c1.folderrsn);
else
dbms_output.put(c1.assigneduser ||': ' || 'Overdue Folders:You need to update these folders: Folderrsn: '||c1.folderrsn);
END IF;
a_user := c1.assigneduser;
v_assigneduser := c1.assigneduser;
v_folderrsn := c1.folderrsn;
v_emailaddress := c1.emailaddress;
v_subject := 'Subject: Project for';
END LOOP;
END;
The reason I have included the folowing table is that I want you to see the output from the select statement. that way you can help me do the if statement in the above cursor so that the result will look like this:
emailaddress
Subject: 'Project for ' || V_email || 'not updated in the last 30 days'
v_folderrsn
v_folderrsn
etc
[email protected]......
Subject: 'Project for: ' Jim...'not updated in the last 30 days'
284087
292709
[email protected].....
Subject: 'Project for: ' Kim...'not updated in the last 30 days'
185083
190121
190132
190133
190159
190237
284109
286647
294631
322922
[email protected]....
Subject: 'Project for: Joe...'not updated in the last 30 days'
183332
183336
[email protected]......
Subject: 'Project for: Sam...'not updated in the last 30 days'
183876
183877
183879
183880
183881
183882
183883
183884
183886
183887
183888
This table is to shwo you the select statement output. I want to eliminnate the two days that that are less than 30 days since the last update in the last column.
Assigneduser....Email.........Folderrsn...........indate.............maxattemptdate...days past since last update
JIM......... jim@ aol.com.... 284087............. 9/28/2006.......10/5/2006...........690
JIM......... jim@ aol.com.... 292709............. 3/20/2007.......3/28/2007............516
KIM......... kim@ aol.com.... 185083............. 8/31/2004.......2/9/2006............. 928
KIM...........kim@ aol.com.... 190121............. 2/9/2006.........2/9/2006.............928
KIM...........kim@ aol.com.... 190132............. 2/9/2006.........2/9/2006.............928
KIM...........kim@ aol.com.... 190133............. 2/9/2006.........2/9/2006.............928
KIM...........kim@ aol.com.... 190159............. 2/13/2006.......2/14/2006............923
KIM...........kim@ aol.com.... 190237............. 2/23/2006.......2/23/2006............914
KIM...........kim@ aol.com.... 284109............. 9/28/2006.......9/28/2006............697
KIM...........kim@ aol.com.... 286647............. 11/7/2006.......12/5/2006............629
KIM...........kim@ aol.com.... 294631............. 4/2/2007.........3/4/2008.............174
KIM...........kim@ aol.com.... 322922............. 7/29/2008.......7/29/2008............27
JOE...........joe@ aol.com.... 183332............. 1/28/2004.......4/23/2004............1585
JOE...........joe@ aol.com.... 183336............. 1/28/2004.......3/9/2004.............1630
SAM...........sam@ aol.com....183876.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183877.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183879.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183880.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183881.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183882.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183883.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183884.............3/5/2004.........3/8/2004............ 1631
SAM...........sam@ aol.com....183886.............3/5/2004.........3/8/2004............ 1631
SAM...........sam@ aol.com....183887.............3/5/2004.........3/8/2004............ 1631
SAM...........sam@ aol.com....183888.............3/5/2004.........3/8/2004............ 1631
PAT...........pat@ aol.com.....291630.............2/23/2007.......7/8/2008............ 48
PAT...........pat@ aol.com.....313990.............2/27/2008.......7/28/2008............28
NED...........ned@ aol.com.....190681.............4/4/2006........8/10/2006............746
NED...........ned@ aol.com......95467.............6/14/2006.......11/6/2006............658
NED...........ned@ aol.com......286688.............11/8/2006.......10/3/2007............327
NED...........ned@ aol.com.....291631.............2/23/2007.......8/21/2008............4
NED...........ned@ aol.com.....292111.............3/7/2007.........2/26/2008............181
NED...........ned@ aol.com.....292410.............3/15/2007.......7/22/2008............34
NED...........ned@ aol.com.....299410.............6/27/2007.......2/27/2008............180
NED...........ned@ aol.com.....303790.............9/19/2007.......9/19/2007............341
NED...........ned@ aol.com.....304268.............9/24/2007.......3/3/2008............ 175
NED...........ned@ aol.com.....308228.............12/6/2007.......12/6/2007............263
NED...........ned@ aol.com.....316689.............3/19/2008.......3/19/2008............159
NED...........ned@ aol.com.....316789.............3/20/2008.......3/20/2008............158
NED...........ned@ aol.com.....317528.............3/25/2008.......3/25/2008............153
NED...........ned@ aol.com.....321476.............6/4/2008.........6/17/2008............69
NED...........ned@ aol.com.....322160.............7/3/2008.........8/21/2008............4
MOE...........moe@ aol.com.....184169.............4/5/2004.......12/5/2006............629
[email protected]/27/2004.......3/8/2004............1631
How do I incorporate a if else statement in the above cursor so the two days less than 30 days since last update are not returned. I do not want to send email if the project have been updated within the last 30 days.
Edited by: user4653174 on Aug 25, 2008 2:40 PManalytical functions: http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/functions2a.htm#81409
CASE
http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/02_funds.htm#36899
http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/04_struc.htm#5997
Incorporating either of these into your query should assist you in returning the desired results. -
I installed Sunbird in one computer and my calendar has all my infos, events, and task that i would like to see on another computer that i just downloaded Sunbird into. Also, is it possible I can access Sunbird on my iphone?
Thank you in advance,Try the forum here - http://forums.mozillazine.org/viewforum.php?f=46 - for help with Sunbird, this forum is for Firefox support.
Maybe you are looking for
-
Toshiba 55TL515U vs. Vizio M550NV vs. LG 55LW6500 Which one should I buy?
They are all passive 3D TVs. I'm kind of leaning towards LG Cinema 3D since it seems like the most popular one but I want to make sure that I'm not biased towards anything. If you own any of these TVs, can you please help me out and tell me what your
-
HTTP_GET unicode blues?
I am using HTTP_GET to contact the HTTP port of the message server to get it to return the hostname of an available application server. When using HTTP_GET from a 4.6C system to the message server of a Unicode 6.40 system everything works OK. (Messag
-
LMS 3.2 DFM-all devices QUESTIONED-SNMP Timeout
I imported 26 devices to DFM. All devices became QUESTIONED, error is SNMP timeout. Here are the troubleshooting steps that I tried: 1. rediscovered devices 2. deleted and rediscovered devices 3. increase snmp timeout settings 4.re-entered snmp strin
-
Enhance button in CNR_VIEW
Hi Experts, I have a req that i have to add one custom button in CNR_VIEW in component FPM_OIF_COMPONENT,but am unable to find cnr_view in any coponent please help me where i have to check and add button
-
ColdFusion startup script?
I'm running CF8 Server under Windows. I have an application, MyApplication, in which, for a variety of reasons, I refresh some application-scope arrays on a schedule. To simplify just a bit, there is a ColdFusion script that runs each hour, and in th