DOMConfiguration object and setShema() method
// Create XML DOM document (Memory consuming).
DocumentBuilderFactory docFact = DocumentBuilderFactory
.newInstance();
DocumentBuilder builder = null;
try {
builder = docFact.newDocumentBuilder();
} catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
DOMImplementation impl = builder.getDOMImplementation();
// Document.
Document xmlDoc = impl.createDocument(
"tns=http://www.example.org/report", "tns:report", null);
DOMConfiguration config = xmlDoc.getDomConfig();
DOMErrorHandler sh = new DOMErrorHandler() {
public boolean handleError(DOMError e) {
// TODO Auto-generated method stub
System.out.println("Error " + e.getMessage());
System.out.println("LineNr "
+ e.getLocation().getLineNumber());
System.out.println("Node "
+ e.getLocation().getRelatedNode());
return false;
config.setParameter("error-handler", sh);
SchemaFactory schemaFact = SchemaFactory
.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
File schemaFile = new File(EBankingUtil
.absoluteReportSchemaFilename());
Schema schema = null;
try {
schema = schemaFact.newSchema(schemaFile);
} catch (SAXException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
docFact.setSchema(schema);
docFact.setValidating(true);
The code above "crash" (in fact the debug thread stop but no error message appears) at the instruction :
DOMConfiguration config = xmlDoc.getDomConfig();
I don't understand why. I have put this code (a domerrorhandler) because, my code crashes at the further instruction :
docFact.setSchema(schema);
and I don't know why to. Can you help me, I'am completely into trouble I don't understand (no error message appears).
Thanks.
DocumentBuilderFactory docFact = DocumentBuilderFactory
.newInstance();
DocumentBuilder builder = null;
try {
builder = docFact.newDocumentBuilder();
} catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
DOMImplementation impl = builder.getDOMImplementation();
// Document.
Document xmlDoc = impl.createDocument(
"tns=http://www.example.org/report", "tns:report", null);
DOMConfiguration config = xmlDoc.getDomConfig();
DOMErrorHandler sh = new DOMErrorHandler() {
public boolean handleError(DOMError e) {
// TODO Auto-generated method stub
System.out.println("Error " + e.getMessage());
System.out.println("LineNr "
+ e.getLocation().getLineNumber());
System.out.println("Node "
+ e.getLocation().getRelatedNode());
return false;
config.setParameter("error-handler", sh);
SchemaFactory schemaFact = SchemaFactory
.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
File schemaFile = new File(EBankingUtil
.absoluteReportSchemaFilename());
Schema schema = null;
try {
schema = schemaFact.newSchema(schemaFile);
} catch (SAXException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
docFact.setSchema(schema);
docFact.setValidating(true);Edited by: kokorico on Sep 25, 2007 7:12 AM
Similar Messages
-
OLE objects and OO methods - Error using OLE automation
Hi,
I'm developing an class to read/write excel sheets and i'm getting an error on the OLE method that is:
on this instruction
call method of l_obj_excel 'WORKBOOKS' = l_workb_col.
i got a dump that give me the following error UC_OBJECTS_NOT_CONVERTIBLE
The strange is that i've got the same code running on reports and it works fine only when passing it to a oo method i get that dump.
Thzs in advanced to all
Best regards
Jaimehi check this..
Report ZMULTICOLOR_TEST no standard page heading.
this report demonstrates how to send some ABAP data to an
EXCEL sheet using OLE automation.
include ole2incl.
handles for OLE objects
data: h_excel type ole2_object, " Excel object
h_mapl type ole2_object, " list of workbooks
h_map type ole2_object, " workbook
h_zl type ole2_object, " cell
h_f type ole2_object, " font
h_c type ole2_object. " color
DATA: FILENAME LIKE RLGRAP-FILENAME.
tables: spfli.
data h type i.
table of flights
data: it_spfli like spfli occurs 10 with header line.
*& Event START-OF-SELECTION
start-of-selection.
read flights
select * from spfli into table it_spfli.
display header
uline (61).
write: / sy-vline no-gap,
(3) 'Flg'(001) color col_heading no-gap, sy-vline no-gap,
(4) 'Nr'(002) color col_heading no-gap, sy-vline no-gap,
(20) 'Von'(003) color col_heading no-gap, sy-vline no-gap,
(20) 'Nach'(004) color col_heading no-gap, sy-vline no-gap,
(8) 'Zeit'(005) color col_heading no-gap, sy-vline no-gap.
uline /(61).
display flights
loop at it_spfli.
write: / sy-vline no-gap,
it_spfli-carrid color col_key no-gap, sy-vline no-gap,
it_spfli-connid color col_normal no-gap, sy-vline no-gap,
it_spfli-cityfrom color col_normal no-gap, sy-vline no-gap,
it_spfli-cityto color col_normal no-gap, sy-vline no-gap,
it_spfli-deptime color col_normal no-gap, sy-vline no-gap.
endloop.
uline /(61).
tell user what is going on
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
PERCENTAGE = 0
text = text-007
exceptions
others = 1.
start Excel
create object h_excel 'EXCEL.APPLICATION'.
PERFORM ERR_HDL.
set property of h_excel 'Visible' = 1.
CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:\kis_excel.xls' .
PERFORM ERR_HDL.
tell user what is going on
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
PERCENTAGE = 0
text = text-008
exceptions
others = 1.
get list of workbooks, initially empty
call method of h_excel 'Workbooks' = h_mapl.
perform err_hdl.
add a new workbook
call method of h_mapl 'Add' = h_map.
perform err_hdl.
tell user what is going on
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
PERCENTAGE = 0
text = text-009
exceptions
others = 1.
output column headings to active Excel sheet
perform fill_cell using 1 1 1 200 'Carrier id'(001).
perform fill_cell using 1 2 1 200 'Connection id'(002).
perform fill_cell using 1 3 1 200 'City from'(003).
perform fill_cell using 1 4 1 200 'City to'(004).
perform fill_cell using 1 5 1 200 'Dep. Time'(005).
loop at it_spfli.
copy flights to active EXCEL sheet
h = sy-tabix + 1.
if it_spfli-carrid cs 'AA'.
perform fill_cell using h 1 0 000255000 it_spfli-carrid.
elseif it_spfli-carrid cs 'AZ'.
perform fill_cell using h 1 0 168000000 it_spfli-carrid.
elseif it_spfli-carrid cs 'JL'.
perform fill_cell using h 1 0 168168000 it_spfli-carrid.
elseif it_spfli-carrid cs 'LH'.
perform fill_cell using h 1 0 111111111 it_spfli-carrid.
elseif it_spfli-carrid cs 'SQ'.
perform fill_cell using h 1 0 100100100 it_spfli-carrid.
else.
perform fill_cell using h 1 0 000145000 it_spfli-carrid.
endif.
if it_spfli-connid lt 400.
perform fill_cell using h 2 0 255000255 it_spfli-connid.
elseif it_spfli-connid lt 800.
perform fill_cell using h 2 0 077099088 it_spfli-connid.
else.
perform fill_cell using h 2 0 246156138 it_spfli-connid.
endif.
if it_spfli-cityfrom cp 'S*'.
perform fill_cell using h 3 0 155155155 it_spfli-cityfrom.
elseif it_spfli-cityfrom cp 'N*'.
perform fill_cell using h 3 0 189111222 it_spfli-cityfrom.
else.
perform fill_cell using h 3 0 111230222 it_spfli-cityfrom.
endif.
if it_spfli-cityto cp 'S*'.
perform fill_cell using h 4 0 200200200 it_spfli-cityto.
elseif it_spfli-cityto cp 'N*'.
perform fill_cell using h 4 0 000111222 it_spfli-cityto.
else.
perform fill_cell using h 4 0 130230230 it_spfli-cityto.
endif.
if it_spfli-deptime lt '020000'.
perform fill_cell using h 5 0 145145145 it_spfli-deptime.
elseif it_spfli-deptime lt '120000' .
perform fill_cell using h 5 0 015215205 it_spfli-deptime.
elseif it_spfli-deptime lt '180000' .
perform fill_cell using h 5 0 000215205 it_spfli-deptime.
else.
perform fill_cell using h 5 0 115115105 it_spfli-deptime.
endif.
endloop.
EXCEL FILENAME
CONCATENATE SY-REPID '_' SY-DATUM6(2) '_' SY-DATUM4(2) '_'
SY-DATUM(4) '_' SY-UZEIT '.XLS' INTO FILENAME.
CALL METHOD OF H_MAP 'SAVEAS' EXPORTING #1 = FILENAME.
free object h_excel.
perform err_hdl.
FORM FILL_CELL *
sets cell at coordinates i,j to value val boldtype bold *
form fill_cell using i j bold col val.
call method of h_excel 'Cells' = h_zl
exporting
#1 = i
#2 = j.
perform err_hdl.
set property of h_zl 'Value' = val .
perform err_hdl.
get property of h_zl 'Font' = h_f.
perform err_hdl.
set property of h_f 'Bold' = bold .
perform err_hdl.
set property of h_f 'Color' = col.
perform err_hdl.
endform. "FILL_CELL
*& Form ERR_HDL
outputs OLE error if any *
--> p1 text
<-- p2 text
form err_hdl.
if sy-subrc <> 0.
write: / 'OLE-Automation Error:'(010), sy-subrc.
stop.
endif.
endform. " ERR_HDL
regards,
venkat -
Objects and instance methods for JSP?
I've been looking through the JSP 2.0 specification and, while I'm extremely impressed with the improvements in this version, I'm also disappointed to see that everything still boils down to statically bound methods.
What I mean by this is that the template part of a JSP is like an anonomously named static method associated with the JSP class. The new tag-files in JSP 2.0 are terrific, but they also have this same kind of static binding.
As far as I know, only JPlates (www.jplates.com) allows you to develop web applications using actual instances of classes that have instance methods for expressing the template parts. Are there any other template processing systems that support real object-oriented development of dynamic content-generation applications?By an amazing coincidence, the domain name jplates.com is registered to a Daniel Jacobs and your user name is djacobs. What are the odds of that?
If you're going to plant commercials, you need to disguise them better than this. -
Reading colour image using raster object and getsample() method
Hello all,
I am trying to read a grey image using this code below and it perfectly works:
File filename = new File("myimage.jpg");
BufferedImage inputimage = ImageIO.read(filename);
Raster input = inputimage.getRaster();
double pixelvalue = input.getSample(xx, yy, 0) ; // to read pixel colour.
Now:
what modifications should i do to read a colour image using getsample() method.
any help, by example if y would.
ThanksThe code below
double pixelvalue = input.getSample(xx, yy, 0) ; // to read pixel colour.actually doesn't obtain the pixel color. It reads a band of the specified pixel. If you are reading a tripple band image (24-bit colored image RGB ) then you have to invoke this method three times for band 0, 1 and 2. The arrangment of them depends on the BufferedImage type.
In reply of your question, you can use getSamples method, refer to the java API documentation of the BufferedImage class for more info.
you can also check methods getRGB and setRGB, they used to get/set the entire pixel in range of 0x00000000 to 0x00FFFFFF ( 0x00RRGGBB of image type TYPE_INT_RGB )
Regards,
Mohammed M Saleem -
Regarding Business Objects and Methods
Hi ,
I need to create LSMW with BAPO for to create PO.
Where shoud I found Business Objects and their method.
Could you please suggest abt this.
Regards,
Sai.sai,
"BAPI_PO_CREATE " ( OR ) "BAPI_PO_CREATE1 "
Goto SE37>Enter above bapi name>select where used list>it will show list>
select prog RBUS2012
or directly se38>RBUS2012>Press F7 or Display.
Pls. reward if useful -
Hi Every body,
Please this is very argent I'm searching for this problem sine a week with no success
how can I update a user field (single and multi) using ListItemFormUpdateValue object and ValidateUpdateListItem method
Thanks in Advance
khatib7Hi,
Seems there are already replies in your another similar thread about this issue:
https://social.technet.microsoft.com/Forums/en-US/5e67dc3d-c808-49ee-9aab-383a5cea5bce/sharepoint-angulr-rest-api-update-file-item-userd-field-property?forum=sharepointdevelopment
Please check whether they are helpful to you.
Thanks
Patrick Liang
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
How to create new java objects in native methods?
Hello,
Is it possible to create java objects and return the same to the java code from a native method?
Also is it possible to pass java objects other than String objects (for example, Vector objects) as parameters to native methods and is it possible to return such objects back to the java code?
If so how can I access those objects (say for example, accessing Vector elements) inside the native code?
What should I do in order to achieve them?
Regards,
Satishbschauwe is correct in that constructing Java objects and calling methods on Java objects from native code is tough and takes some study. While you're at it, you might want to check out Jace, http://jace.reyelts.com/jace. It's a free open-source toolkit that really takes the nastiness out of doing this sort of stuff. For example,/**
* A C++ function that takes a java.util.Vector and plays around with it.
public void useVector( java::util::Vector& vector ) {
// Print out all the contents of the vector
for ( Iterator it = vector.iterator(); it.hasNext(); ) {
cout << it.next();
// Add some new elements to the vector
vector.addElement( "Hello" );
vector.addElement( "world" );
} All this code just results in calls to standard JNI functions like FindClass, NewObject, GetMethodID, NewStringUTF, CallObjectMethod, etc...
God bless,
-Toby Reyelts -
Guys,
Not even sure if this is possible...
How do I find BOR calls in an ABAP program.
Example: BUS2088 or BUS2008 in program SAPLCOIH - for PM/CS orders).
PeteAHi Peter,
Specify your business object and the method of the BOR object in the BASIC data tab in PFTC transaction.
If you want to trigger the Workflow through and event then you will have to first link your event of the Business Object to the WorkFlow Task in Workflow Builder (TCODE PFTC) and then you can do the following :
Please refer the code below to for your information.
Data for workflow trigger
DATA: objtype LIKE swetypecou-objtype,
objkey LIKE sweinstcou-objkey,
event LIKE swetypecou-event,
event_container LIKE swcont OCCURS 0 WITH HEADER LINE.
objtype = 'ZBUS1001'. "Material [sub object of BUS1001]
MOVE v_wfmatnr TO objkey. "V_WFMATNR is material number
event = 'CreatePLMMaterial'."Custom Event defined in
ZBUS1001 [Tcode SWO1]
REFRESH event_container.
*Following are the Event parameters required in the *Workflow
swc_set_element event_container 'Attachment' v_wfattachment.
swc_set_element event_container 'Material' v_wfmatnr.
swc_set_element event_container 'TisGroup' v_wftisgroup.
swc_set_element event_container 'SchDate' v_schdate.
CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
objtype = objtype
objkey = objkey
event = event
TABLES
event_container = event_container
EXCEPTIONS
objtype_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
COMMIT WORK.
Please reward some points if it helps you.
Regards,
Amit M. Mishra -
Passing object references via methods
Why is the JFrame object not being created in the following code:
public class Main {
public static void main(String[] args) {
Main main = new Main();
JFrame frame = null;
main.createFrame(frame); // <-- does not create the "frame" object
frame.pack();
frame.setVisible(true);
private void createFrame(JFrame frame) {
frame = new JFrame("createFrame");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}Thanks.These explanations are great; real eye openers.
OK. This could be a "way out in left field" question. I am just starting out with Java. But I want to ask:
Objects are stored in the heap?
Object references and primitives are stored on the stack?
Adjusting heap size is straight-forward. A larger heap can store more/larger objects. What about stack sizes?
C:\Dev\java -Xss1024k Main
I assume this refers to method's stacks. But, what about object scoped, and class scoped, object references?
public class Main {
private static List list = new ArrayList(); // class scoped
private JFrame frame = new JFrame(); // object scoped
public static void main(String[] args) { ...... }
private void createFrame() { .... }
}How is the reference to list and frame stored, with regard to memory management?
Do objects have stacks?
Do classes have stacks?
If not, how are the list and frame references stored (which helps me understand reference scoping).
Would the overflow of a method stack (ex. via recurssion) also overflow the method's object and the method's class stacks?
If these questions are stupid, "out of left field", don't matter, etc. Just ignore them.
But the knowledge could help me avoid future memory related mistakes, and maybe pass a "Java Certified Developer" exam?
My original question is already answered, so thanks to all. -
Hi Experts,
I have a workflow, in this workflow header tab there is no triggering event is mentioned .
no business object no triggering event .
when i checked the workflow the first task is created by business Object system and its method genericinstantiate.
now i am not able to understand what is the role of BO system and this method.
Also i am not able to understand how this workflow is getting triggered is this method is helping this workflow to get triggered.
thanks in Advance
Thanks & Regards
Anit Gautamwhen i checked the workflow the first task is created by business
Object system and its method genericinstantiate.
now i am not able to understand what is the role of BO system and this method.
If you are not able to trace from where this event is getting triggered, the simple way to find how the task is receving the event is
1.Switch on the event trace by using the txn SWELS.
2. Trigger the workflow by using the same event either from SWUE txn or directly stsrting the process which raises this event.
3. Onc the event is triggered , go to SWEL txn and check what are the workflow templates and tasks are receiving the event which you have triggered. -
The method creates a new object and initializes it...
Hello there,
I just started learn the Java, and can't understand the method declaration in "Parameter Types" example at "[Passing Information to a Method or a Constructor|http://download.oracle.com/javase/tutorial/java/javaOO/arguments.html] " tutorial section.
public Polygon polygonFrom(Point[] corners) {
// method body goes here
Can you explain me please the example above, what does "Polygon polygonFrom" means?
And can it be " the method creates a new Polygon object and initializes it", isn't it Constructor's and the new operator job?
Thanks a lot!869857 wrote:
public Polygon polygonFrom(Point[] corners) {
// method body goes here
}Can you explain me please the example above, what does "Polygon polygonFrom" means?
Polygon is the return type of the method polygonForm
And can it be " the method creates a new Polygon object and initializes it", isn't it Constructor's and the new operator job?We can't say that it is a constructor and new operator job. Because, As the return type is Polygon, the method should return an object of Polygon or null. For that purpose only the method needs to create a new Polygon object and initialize with some values. -
Comparing dynamic fields of objects using equals and hashCode methods
To compare the different objects of the same class with their contents like jobTitleId, classificationId, deptId & classificationId was to be done and do some manipulations later using Set and Map. I was able to do that by simply overriding the equals and hashCode methods of Object class and was able to fetch the information (like in the following Map).
Map<LocationData, List<LocationData>>
The following is the class I used (its been shown to you so that it can be referred for my problem statement):
LocationData class
package com.astreait.bulkloader;
public class LocationData {
String locId, deptId, jobTitleId, classificationId;
@Override
public boolean equals(Object obj) {
LocationData ld = (LocationData)obj;
return this.deptId.equals(ld.deptId) && this.jobTitleId.equals(ld.jobTitleId) && this.classificationId.equals(ld.classificationId) &&
this.locId.equals(ld.locId);
@Override
public int hashCode() {
return deptId.hashCode() + jobTitleId.hashCode() + classificationId.hashCode() +locId.hashCode();
Problem:
I'm already known to which all fields of this object I need to make the comparison.
i.e I'm bound to use the variables named classificationId, deptId, jobTitleId & locId etc.
Need:
I need to customize this logic such that the fields Names (classificationId, deptId, jobTitleId & locId etc) can be pulled dynamically along with their values. So, as far as my understanding I made use of 2 classes (TableClass and ColWithData) such that the List of ColWithData is there in TableClass object.
I'm thinking what if I override the same two methods `equals() & hashCode();`
such that the same can be achieved.
TableClass class #1
class TableClass{
List<ColWithData> cwdList;
@Override
public boolean equals(Object obj) {
boolean returnVal = false;
// I need to have the logic to be defined such that
// all of the dynamic fields can be compared
return returnVal;
@Override
public int hashCode() {
int returnVal = 0;
// I need to have the logic to be defined such that
// all of the dynamic fields can be found for their individual hashCodes
return returnVal;
ColWithData class #2
class ColWithData{
String col; // here the jobTitleId, classificationId, deptId, locId or any other more fields info can come.
String data; // The corresponding data or value for each jobTitleId, classificationId, deptId, locId or any other more fields.
Please let me know if I'm proceeding in the right direction or I should make some any other approach. If it is ok to use the current approach then what should be performed in the equals and hashCode methods?
Finally I need to make the map as: (Its not the concern how I will make, but can be considered as my desired result from this logic)
Map<TableClass, List<TableClass>> finalMap;Hello,
What is the relation with the Oracle Forms tool ?
Francois -
ServerMBean start and kill methods return unserializable objects
The ServerMBean start and kill methods both return unserializable
objects which makes them unusable from a JVM other than that on which
the server runs.
This is unfortunate, as one would expect these things to be fairly
standard tasks for a JMX client.
I noticed in 7.0 they have been deprecated along with stop() - is
there a known workaround for the time being?
Thanks,
Andrew Rosenfeld.I can't really answer you final question yet, but I will add what I know at this time, and look into it later next week.
The JNLPClassLoader extends SecureClassLoader, so as the doc you refer to implys (in it's chapter on SecureClassLoader), the PermissionCollection it grants to code is statically bound at the time a class's defineClass() is called. The JNLPClassLoader's getPermissions() method starts with super.getPermissions, so the current policy permissions are added to those granted by the jnlp client, but it is still unmodifyable after that.
For local intrenet applications several configuration options have been added in 1.5.0 (J2SE 5.0) that may help.
You can implement an enterprise wide system configuration that includes system or user level policy files.
You can also configure pre-accepted certificates so all code signed by your company can be trusted without the users seeing a security warning dialog.
/Dietz -
Difference between abap object and function
hi all,
i read the book on abap object of the difference between abap object and classical abap.
i know that there is only 1 instance of a specific function group but somehow i still not so clear why subsequent vehicle cannot use the same function. i also can use the do and loop to call the function? if cannot then why?
hope can get the advice.
thanks
using function *********
function-pool vehicle.
data speed type i value 0.
function accelerate.
speed = speed + 1.
endfunction.
function show_speed.
write speed.
endfunction.
report xx.
start-of-selection.
*vehicle 1
call function 'accelerate'.
call function 'accelerate'.
call function 'show_speed'.
*vehicle 2
*vehicle 3
*****abap object*******
report xx.
data: ov type ref to vehicle,
ov_tab type table of ref to vehicle.
start-of-selection.
do 5 times.
create object ov.
append ov to ov_tab.
enddo.
loop at ov_tab into ov.
do sy-tabix times.
call method ov->accelerate.
enddo.
call method ov->show_speed.
endloop.Hi
Now try this:
REPORT ZTEST_VEHICLEOO .
PARAMETERS: P_CAR TYPE I,
P_READ TYPE I.
* CLASS vehicle DEFINITION
CLASS VEHICLE DEFINITION.
PUBLIC SECTION.
CLASS-DATA: MAX_SPEED TYPE I,
MAX_VEHICLE TYPE I,
NR_VEHICLES TYPE I.
CLASS-METHODS CLASS_CONSTRUCTOR.
METHODS CONSTRUCTOR.
METHODS ACCELERATE.
METHODS SHOW_SPEED.
METHODS GET_SPEED EXPORTING E_SPEED TYPE I.
PRIVATE SECTION.
DATA: SPEED TYPE I,
NR_VEHICLE TYPE I..
ENDCLASS.
* CLASS vehicle IMPLEMENTATION
CLASS VEHICLE IMPLEMENTATION.
METHOD CLASS_CONSTRUCTOR.
NR_VEHICLES = 0.
ENDMETHOD.
METHOD CONSTRUCTOR.
NR_VEHICLES = NR_VEHICLES + 1.
NR_VEHICLE = NR_VEHICLES.
ENDMETHOD.
METHOD ACCELERATE.
SPEED = SPEED + 1.
IF MAX_SPEED < SPEED.
MAX_SPEED = SPEED.
MAX_VEHICLE = NR_VEHICLE.
ENDIF.
ENDMETHOD.
METHOD SHOW_SPEED.
WRITE: / 'Speed of vehicle nr.', NR_VEHICLE, ':', SPEED.
ENDMETHOD.
METHOD GET_SPEED.
E_SPEED = SPEED.
ENDMETHOD.
ENDCLASS.
DATA: OV TYPE REF TO VEHICLE,
OV_TAB TYPE TABLE OF REF TO VEHICLE.
DATA: V_TIMES TYPE I,
FL_ACTION.
DATA: V_SPEED TYPE I.
START-OF-SELECTION.
DO P_CAR TIMES.
CREATE OBJECT OV.
APPEND OV TO OV_TAB.
ENDDO.
LOOP AT OV_TAB INTO OV.
IF FL_ACTION = SPACE.
FL_ACTION = 'X'.
V_TIMES = SY-TABIX * 2.
ELSE.
FL_ACTION = SPACE.
V_TIMES = SY-TABIX - 2.
ENDIF.
DO V_TIMES TIMES.
CALL METHOD OV->ACCELERATE.
ENDDO.
CALL METHOD OV->SHOW_SPEED.
ENDLOOP.
SKIP.
WRITE: / 'Higher speed', VEHICLE=>MAX_SPEED, 'for vehicle nr.',
VEHICLE=>MAX_VEHICLE.
SKIP.
READ TABLE OV_TAB INTO OV INDEX P_READ.
IF SY-SUBRC <> 0.
WRITE: 'No vehicle', P_READ.
ELSE.
CALL METHOD OV->GET_SPEED IMPORTING E_SPEED = V_SPEED.
WRITE: 'Speed of vehicle', P_READ, V_SPEED.
ENDIF.
Try to repeat this using a function group and I think you'll undestand because it'll be very hard to do it.
By only one function group how can u read the data of a certain vehicle?
Yes you can create in the function group an internal table where u store the data of every car: in this way u use the internal table like it was an instance, but you should consider here the example is very simple. Here we have only the speed as characteristic, but really we can have many complex characteristics.
Max -
How to create dynamic View Object and Dynamic Table
Dear ll
I want to create a dynamic view object and display the output in a dynamic table on the page.
I am using Jdeveloper 12c "Studio Edition Version 12.1.2.0.0"
This what I did:
1- I created a read only view object with this query "Select sysdate from dual"
2- I added this View object to the application module
3- I created a new method that change the query of this View object at runtime
public void changeVoQuery(String dbViewName) {
String sqlstm = "Select * From " + dbViewName;
ViewObject dynamicVo = this.findViewObject("DynamicVo");
if (dynamicVo != null) {
dynamicVo.remove();
dynamicVo = this.createViewObjectFromQueryStmt("DynamicVo", sqlstm);
dynamicVo.executeQuery();
4- I run the application module for testing the method and I passed "Scott.Emp" as a parameter and the result was Success
5- Now I want to show the result of the view on the page, so I draged and dropped the method from the data control as a parameter form
6- I dragged and dropped the view Object "DynamicVo" as a table and I choose "generate Column Dynamically at runtime". This is the page source
<af:panelHeader text="#{viewcontrollerBundle.SELECT_DOCUMTN_TYPE}" id="ph1">
<af:panelFormLayout id="pfl1">
<af:inputText value="#{bindings.dbViewName.inputValue}" label="#{bindings.dbViewName.hints.label}"
required="#{bindings.dbViewName.hints.mandatory}"
columns="#{bindings.dbViewName.hints.displayWidth}"
maximumLength="#{bindings.dbViewName.hints.precision}"
shortDesc="#{bindings.dbViewName.hints.tooltip}" id="it1">
<f:validator binding="#{bindings.dbViewName.validator}"/>
</af:inputText>
<af:button actionListener="#{bindings.changeVoQuery.execute}" text="changeVoQuery"
disabled="#{!bindings.changeVoQuery.enabled}" id="b1"/>
</af:panelFormLayout>
</af:panelHeader>
<af:table value="#{bindings.DynamicVo.collectionModel}" var="row" rows="#{bindings.DynamicVo.rangeSize}"
emptyText="#{bindings.DynamicVo.viewable ? 'No data to display.' : 'Access Denied.'}"
rowBandingInterval="0" selectedRowKeys="#{bindings.DynamicVo.collectionModel.selectedRow}"
selectionListener="#{bindings.DynamicVo.collectionModel.makeCurrent}" rowSelection="single"
fetchSize="#{bindings.DynamicVo.rangeSize}" filterModel="#{bindings.DynamicVoQuery.queryDescriptor}"
queryListener="#{bindings.DynamicVoQuery.processQuery}" filterVisible="true" varStatus="vs" id="t1"
partialTriggers="::b1">
<af:iterator id="i1" value="#{bindings.DynamicVo.attributesModel.attributes}" var="column">
<af:column headerText="#{column.label}" sortProperty="#{column.name}" sortable="true" filterable="true"
id="c1">
<af:dynamicComponent id="d1" attributeModel="#{column}"
value="#{row.bindings[column.name].inputValue}"/>
</af:column>
</af:iterator>
</af:table>
when I run the page this error is occured
<Nov 13, 2013 2:51:58 PM AST> <Error> <oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter> <BEA-000000> <ADF_FACES-60096:Server Exception during PPR, #1
javax.el.ELException: java.lang.NullPointerException
Caused By: java.lang.NullPointerException
Can any body help me please
thanksHave you seen Shay's video https://blogs.oracle.com/shay/entry/adf_faces_dynamic_tags_-_for_a
All you have to do is to use the dynamic table to get your result.
Timo
Maybe you are looking for
-
How do I delete this add add for Android mobile?
On start-up, a second tab opens with an advertisement for an Android mobile phone app. I don't need this and want to stop this advertisement from opening up every time I use FireFox. How do I delete this?'''12.'''
-
I have a lot of contacts in my phone that are not mine. In addition, my contacts are showing up on peoples devices that I do not associate with. Why is this happening?
-
HP Pavilion Touchsmart 23 processor constantly running in the background
I have an HP TouchSmart 23 All-in-One PC. Received it 12-25-13. For the last few months it has steadily slowed down. It sounds likes programs running in the background all of the time. I went into the Task Manager and disabled nearly all of the s
-
Icreasing maximum number of Simultaneous requests
Hello I am working on running a web based application , dployed on SunONE app server on a Windows 2000 machine. The goal is to test the application under stress condition. The test client sends 500 simultaneous requests, but I see the number of threa
-
[SOLVED]cannot compile amarok2 beta1
i get this error when compiling amarok 2 beta 1 and same error while compiling amarok2 svn (at 89 %) i'm using KDE 4.1 Scanning dependencies of target amarok_collection-mtpcollection [ 94%] Building CXX object src/collection/mtpcollection/CMakeFiles