DrawOval with thread example needed
Hi,
Can anyone give me an example of drawing circle from small to large using thread (so that it has an animating effect), thanx !
how bout this
http://www.leepoint.net/notes-java/45examples/40animation/40BouncingBall/bouncingball.html
google is your friend
Similar Messages
-
Need help with threads?.. please check my approach!!
Hello frnds,
I am trying to write a program.. who monitors my external tool.. please check my way of doing it.. as whenever i write programs having thread.. i end up goosy.. :(
first let me tell.. what I want from program.. I have to start an external tool.. on separate thread.. (as it takes some time).. then it takes some arguments(3 arguments).. from file.. so i read the file.. and have to run tool.. continously.. until there are arguments left.. in file.. or.. user has stopped it by pressing STOP button..
I have to put a marker in file too.. so that.. if program started again.. file is read from marker postion.. !!
Hope I make clear.. what am trying to do!!
My approach is like..
1. Have two buttons.. START and STOP on Frame..
START--> pressed
2. check marker("$" sign.. placed in beginning of file during start).. on file..
read File from marker.. got 3 arg.. pass it to tool.. and run it.. (on separate thread).. put marker.. (for next reading)
Step 2.. continously..
3. STOP--> pressed
until last thread.. stops.. keep running the tool.. and when last thread stops.. stop reading any more arguments..
Question is:
1. Should i read file again and again.. ?.. or read it once after "$" sign.. store data in array.. and once stopped pressed.. read file again.. and put marker ("$" sign) at last read line..
2. how should i know when my thread has stopped.. so I start tool again??.. am totally confused.. !!
please modify my approach.. if u find anything odd..
Thanks a lot in advance
gerviniHello,
I have no experience with threads or with having more than run "program" in a single java file. All my java files have the same structure. This master.java looks something like this:
---master.java---------------------------------------------------
import java.sql.*;
import...
public class Master {
public static void main(String args []) throws SQLException, IOException {
//create connection pool here
while (true) { // start loop here (each loop takes about five minutes)
// set values of variables
// select a slave process to run (from a list of slave programs)
execute selected slave program
// check for loop exit value
} // end while loop
System.out.println("Program Complete");
} catch (Exception e) {
System.out.println("Error: " + e);
} finally {
if (rSet1 != null)
try { rSet1.close(); } catch( SQLException ignore ) { /* ignored */ }
connection.close();
-------end master.java--------------------------------------------------------
This master.java program will run continuously for days or weeks, each time through the loop starting another slave process which runs for five minutes to up to an hour, which means there may be ten to twenty of these slave processes running simultaneously.
I believe threads is the best way to do this, but I don't know where to locate these slave programs: either inside the master.java program or separate slave.java files? I will need help with either method.
Your help is greatly appreciated. Thank you.
Logan -
Design issue with threads ...
Hello,
I need your thoughts in how to proper use java threads in solving this issue:
* I have an application that query a database for a list of users, and for each row retrieved from the database as a result the application should process that user and send him an email.
Now the procdural approach for looping each user and send him an email at a time is not convinient as the number of users is big (20,000 users or more) so I thought of why not to use threads to send say every 300 user at a time (i.e, creating 300 threads), but the problem is that I cannot really figure how to manage those threads, to make sure that there are 300 threads are running all the time, and what if a thread was taking more time that the others ... etc.
So, is this approach is the right one, and can you guide more more for how to control the threads this way, if not what do you suggest?
Your guidance is highly appreciated,
tamerI'm not sure that threads will help your cause. But they could. Let me explain:
Threads have several purposes. Two instantly spring to mind:
1. to make things faster.
2. to (make it seem like you) do two (or more things) at once.
First #2. This is often a usability issue. For example, a web server has to server multiple clients at the "same time". This is often done with threads - it gives the illusion that many concurrent users are supported. In reality the CPU/JVM is swapping beween the different requests. More CPUs allow for "realer" concurrency. Speed is only a by-product here.
Now #1: Make things faster. Threading works well for speed when the tasks being done differ.
For example, consider human multithreading: ask me to whistle for 5 seconds, and 5 seconds later I'll be done. Then ask me to scratch my head with both hands for 5 seconds, and 5 seconds later I'll be done. Total: 10 seconds. Ask me to do both at the same time. Result: 5 seconds later I'll have scratched my head and whistled for 5 seconds. 50% time saving.
However, ask me to touch type for 5 seconds, and scratch my head for 5 seconds, it'll take 10 seconds or more. If you ask me to do one, then the other, I can spend 5 seconds at one then the other - total 10 seconds. Ask me to do both concurrently, and I'll take more than 10 seconds, as I'll be moving my hands back and forth from the keyboard to my head, and vice-versa.
I have a feeling that running multiple threads in your case would be like asking you to scratch your head and scratch your head all at the same time. But this may not strictly hold true for several reasons:
1. your DB should scale, i.e. handle two simultaneous requests faster than two concurrent requests. However, this will probably not be true of 300 simultaneous requests being faster than 300 concurrent (or 50 * 6-concurrent requests).
2. if you are in a multi-CPU environment then some concurrentcy improvements would be expected (more hands for head scratching).
3. your application does two things: reads a DB and sends a mail. While sending one mail, you should be albe to concurrently read the next record. i.e. concurrency is supported here, as you don't have resource contention here.
So, you will probably get some benefit from threads. Adding too many will only slow you down, as there'll be too much time spend task switching, as you'll suffer resource contenion on the DB/mail server.
I suggest that you run your program with several configurations, i.e. number of threads, and see what one gives the best results. For fast results, I'd suggests trying the following number of threads:
1, 2, 4, 8, 16, 32, 64, 128, 256, ...
when things start to slow down, you know where to search for your optimum thread number. You could also do with profiling your application if speed is a very pressing issue.
Finally, one clarification: this is not OO. You could do multi-threading in a procedural environment.
Good luck.
if you are running on a multi-CPU environment, then the DB -
Can anyone explain A2A & B2B AND BPM & ccBPM with an example..
Hi All..
Can anyone explain me <b>A2A & B2B</b>
and <b>BPM & ccBPM</b> with an example....
<b>NOTE: i dont need definitions but examples..</b>
i am bit confused with this stuff....
Thanks in advance....
Cheers,
raghaveshHi ,
<i>A2A & B2B</i>
This thread explains you the difference between A2A and B2B.
Re: A2A Vs B2B
<i>BPM & ccBPM</i> both are same....
BPM is used to implement work-flow spanning across multiple application system against embedding the parts of work-flow in application system. Apart from this it also help achive other scenarios like, bridging synch and asynch systems, alert mechanism, multi mapping etc. Check the BPM overview document in SDN download section.
Check out the use cases discussed at http://help.sap.com/saphelp_nw04s/helpdata/en/de/766840bf0cbf49e10000000a1550b0/content.htm
BPM is mainly used in senarios where extra functionalities are to be done with the source message which cannot be done using the normal mapping and user-defined functions, like
-->Collecting of messages till a certain count or for a specific criteria.
-->Merging messages
-->Spliting messages
-->Processing of error files and sending to specific location and sending alerts.
-->Parallel processing of two criterias at the same time can also be done using BPM.
some weblogs on BPM...
/people/udo.martens/blog/2005/09/30/one-logical-system-name-for-serveral-bpm-acknowledgements
/people/sudharshan.aravamudan/blog/2005/12/01/illustration-of-multi-mapping-and-message-split-using-bpm-in-sap-exchange-infrastructure
/people/kannan.kailas/blog/2005/12/07/posting-multiple-idocs-with-acknowledgement
/people/krishna.moorthyp/blog/2005/06/09/walkthrough-with-bpm
/people/michal.krawczyk2/blog/2005/06/11/xi-how-to-retrieve-messageid-from-a-bpm
/people/arpit.seth/blog/2005/06/27/rfc-scenario-using-bpm--starter-kit
Sekhar -
Problems with the examples in NWDS
Hi All,
Running the Welcome example project in NWDS i have the included error.
I have problems with other examples too.
I did all the step by step tutorials.
I have NWDS 2.0.3
J2EE 6.40 SP15
EP 2004
I am new in NWDS and i have not still successed to run any application.
What is wrong with my systems?
I did all the configurations start J2EE /sdm etc.
Do i have to install other versions? I read that maybe i have to install the same SP 15.
Please if anybody can help me .
Thanks,
Ari
Error Summary
While processing the current request, an exception occured which could not be handled by the application or the framework.
If the information contained on this page doesn't help you to find and correct the cause of the problem, please contact your system administrator. To facilitate analysis of the problem, keep a copy of this error page. Hint: Most browsers allow to select all content, copy it and then paste it into an empty document (e.g. email or simple text file).
Root Cause
The initial exception that caused the request to fail, was:
com.sap.tc.webdynpro.services.sal.deployment.api.WDClassLoaderException: Classloader of 'local/Welcome' is null, even though application is started.
at com.sap.tc.webdynpro.serverimpl.wdc.deployment.DeployableObject.getClassLoader(DeployableObject.java:81)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:588)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:248)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)
... 18 more
AriThank you for your help,
I have NWDS 2.0.3 and Web AS 6.40 SP15 and EP 04.
How can i be sure if are compatible? Maybe i have to install NWDS SP15?
I did "Rebuild" and then "Deploy new archive and run" Deploying i was asking for the sdm password , then the application opened in a new browser and we can see this message below.
The Deploy Output View is empty. There is no eny successful deploy message.
I appreciate your help.
Thanks,
Ari
500 Internal Server Error
Web Dynpro Container/SAP J2EE Engine/6.40
Failed to process request. Please contact your system administrator.
[Details...]
Error Summary
While processing the current request, an exception occured which could not be handled by the application or the framework.
If the information contained on this page doesn't help you to find and correct the cause of the problem, please contact your system administrator. To facilitate analysis of the problem, keep a copy of this error page. Hint: Most browsers allow to select all content, copy it and then paste it into an empty document (e.g. email or simple text file).
Root Cause
The initial exception that caused the request to fail, was:
java.lang.InstantiationError: com.sap.tc.webdynpro.progmodel.context.NodeInfo
at com.sap.examples.welcome.wdp.InternalWelcomeComponent.<init>(InternalWelcomeComponent.java:41)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
... 27 more
See full exception chain for details.
Correction Hints
The currently executed application, or one of the components it depends on, has been compiled against class file versions that are different from the ones that are available at runtime.
If the exception message indicates, that the modified class is part of the Web Dynpro Runtime (package com.sap.tc.webdynpro.*) then the running Web Dynpro Runtime is of a version that is not compatible with the Web Dynpro Designtime (Developer Studio or Component Build Server) which has been used to build + compile the application.
Note: the above hints are only a guess. They are automatically derived from the exception that occurred and therefore can't be guaranteed to address the original problem in all cases.
System Environment
Client
Web Dynpro Client Type HTML Client
User agent Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Version
DOM version
Client Type msie6
Client Type Profile ie6
ActiveX enabled
Cookies enabled
Frames enabled
Java Applets enabled
JavaScript enabled
Tables enabled
VB Script enabled
Server
Web Dynpro Runtime Vendor: SAP, Build ID: 6.4015.00.0000.20051123162612.0000 (release=630_VAL_REL, buildtime=2005-12-14:21:51:22[UTC], changelist=377533, host=PWDFM026)
J2EE Engine No information available
Java VM Java HotSpot(TM) Server VM, version:1.4.2_07-b05, vendor: Sun Microsystems Inc.
Operating system Windows 2003, version: 5.2, architecture: x86
Other
Session Locale en_US
Time of Failure Fri Jan 26 14:29:31 EET 2007 (Java Time: 1169814571353)
Web Dynpro Code Generation Infos
local/Welcome
No information available
sap.com/tcwddispwda
No information available
sap.com/tcwdcorecomp
No information available
Detailed Error Information
Detailed Exception Chain
com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Failed to create delegate for component com.sap.examples.welcome.WelcomeComponent. (Hint: Is the corresponding DC deployed correctly? Does the DC contain the component?)
at com.sap.tc.webdynpro.progmodel.generation.ControllerHelper.createDelegate(ControllerHelper.java:110)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingComponent.<init>(DelegatingComponent.java:38)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.doInit(ClientComponent.java:776)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.init(ClientComponent.java:330)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:370)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:608)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:248)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:48)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at com.sap.tc.webdynpro.progmodel.generation.ControllerHelper.createDelegate(ControllerHelper.java:74)
... 26 more
Caused by: java.lang.InstantiationError: com.sap.tc.webdynpro.progmodel.context.NodeInfo
at com.sap.examples.welcome.wdp.InternalWelcomeComponent.<init>(InternalWelcomeComponent.java:41)
... 31 more -
Vector Replacement in Java 1.4 - Is Thread Safety Needed In This Scenario?
I have a Java 1.4 application that queries Database # 1, and builds custom strings used to create records that are inserted into Database # 2.
Right now Vectors are used as a container to temporarily hold query output from Database # 1 while building records going into Database # 2, but I want to convert away from this legacy collection type.
This application does this with a single "worker" thread that is started and monitored by the application main thread. If the main thread detects any exceptions, i.e. a network or any database problem, the application main thread will stop the single worker thread and restart a new single worker thread.
There are several instances of this application running simultaneously on the same server but accessing different test databases. When put into the production environment this application will run on a separate server and there will be only 1 instance of the application running.
I have reviewed numerous forums here and Google results and have not found much specific info that would closely apply to my exact design situation. I did not post any code since this is more of a design question than issue with a specific code snippet.
My question is: In the scenario I described, does thread safety need to be a factor in choosing a new collection type (to replace Vectors) and in building code that accesses this new collection type?The several instances of the application are all independent JVMs and can't interact with each other directly at all. So there's no thread safety issue there and there never was. So what does that leave you? You've got a single worker thread using the Vector? There's no thread safety issue there either. The only time you have to think about thread safety is when two threads are trying to use the same object.
-
External/Exec event example needed
I'm using Acrobat 7. I have a form with interactive fields and scripts that loads from a web server. Using the FDF URL extension it also loads some data into the form. For example:
http://192.168.30.106:8080/qforms/pdfs/30799_Appraisal_Form_Template.pdf#FDF=http://192.16 8.30.106:8080/qforms/QFormsServlet?FormID=UJ9538R2WGKXWA3GQMEH&Action=load
I need to run a JavaScript after the FDF is loaded.
The documentation mentions event External/Exec and says:
"This event is the result of an external access, for example, through OLE, AppleScript, or loading an FDF."
Sounds like what I need.
Where should my JavaScript be put so that it can be triggered by that event?
Has anyone got this to work? One example is worth 1000 pages of documentation with no examples.
I have searched the interned for clues but everyone seems to be as clueless as me.
Any help greatly appreciated.
TerryIf the FDF has the associated PDF form file as an internal reference, then you only need to use a URL to open the FDF file and the FDF internal refernce will use that form.
Web Hosting PDFs
How to populate a PDF file's form with data from a web server -
How does FDS Data syncronization and change tracking works? example needed
Hi All,
I found the FDS feature of detecting the change in data and
only updating that particular change to the server-side data.
Could you point out some good implemented examples or
tutorial. I am not able to find one...........
Also point out some references/examples on how data
syncronization works with an example..........
Thanks in Advance,
Vijay KarthikHi HustLiliAn,
Thank you very much for you quick reply. I have to say sorry that my code is only partially belonging to me so I cannot distribute all of them, beg your understanding
To overcome the delay, I open both Tx and Rx session at the beginning of the code so I don't need to initial and abort session before and after using respectively. It could save a lot of time (I measure the same delay as you shown). I read from WBX application notes (http://files.ettus.com/uhd_docs/manual/html/dboards.html) that if the system is working in the duplex mode, then antenna TX/RX is using for transmission and RX2 is using for reception. I simply tested it and it seems true.
Since two antennas are working concurrently, the receiving antenna (RX2) can receive packet even it is sent by TX/RX. My problem is, in software level I have used the if structure to make transmission and reception work successively, RX2 can still receive signal sent by TX/RX. That is the real problem. Probably we can write some compensation VI which we can remove it by using the transmitted signal, but I still want to know is there any official solution for it.
BTW, I use the modulation toolkit. Its demodulation VI is also quite slow.
Thank you for your reading. I am not a native English speaker, so if my post make you confuse, please let me know and I would like to elaborate it again. -
Multiple level packing with an example
hi,
sap gurus,
how we will configure multi-level packing.
for eg: packing of colour television.
plz do the need ful
regards,
balaji.tDear Balaji,
Multiple packing is femiliar with single level packing but here more that one packing materials will be involved.
I will explain with your example Colour TeleVision.
Packing materials are :- Carton box,Pallet and container.
Step 1.You create material masters for Colour Tele Vision,Carton Box,Pallet and Container.
Step 2.You do the packing related settings to the carton box,Pallet and container in the IMG path is
SPRO>IMG>Logistics execution>Shipping>Packing
-->Define Packaging Material Type
-->Define Material Group for Packaging Materials
-->Define Allowed Packaging Materials
Step 3.Assign the packing material type in the respective masters.
1.Assign carton Box packing material type to Tele Vision master >Basic data 1>Under packing material data.
2.Assign Pallet packing material type to Carton Box master >Basic data 1>Under packing material data.
3.Assign Container packing material type to Pallet master >Basic data 1>Under packing material data.
Now you create delivery for the colour television in the delivery you can able to pack the TV in to carton boxes then in to Pallets then in to Container.This called multilevel packing.
I hope this will help you,
Regards,
Murali. -
Explain User exit concept with simple example
Hi friends
I am new member of this forum & i am learning ABAP.
Kindly send me user exit concept with simple example to my mail ID so i can able to use it.
mail ID [email protected]
thanks in advance
Thanks & RegardsCode SE18 is used to Identify the BADI available.
Look for the string 'CL_EXITHANDLER' in the standard program. This is a class which has a method 'GET_INSTANCE' which is used to trigger BADI's from the Standard Program. The interface parameter for this static method 'EXIT_NAME' is used to pass the BADI to the method.
Open Standard Program and do a global search 'CL_EXITHANDLER'.
SE18 > give the BADI name found through above search.
CUSTOMER_ADD_DATA > which has a method SAVE_DATA.
T.Code SE19 is used to Implement BADI.
SE19 > give the implementation name > Give the Definition name as CUSTOMER_ADD_DATA and the Short Text.
Intro.....
http://help.sap.com/saphelp_nw04/helpdata/en/e6/d54d3c596f0b26e10000000a11402f/content.htm
Check these links for info about badi..
BADI's
http://support.sas.com/rnd/papers/sugi30/SAP.ppt
BADI's
http://help.sap.com/saphelp_erp2005/helpdata/en/73/7e7941601b1d09e10000000a155106/frameset.htm
http://support.sas.com/rnd/papers/sugi30/SAP.ppt
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/abapindx.htm
http://members.aol.com/_ht_a/skarkada/sap/
http://www.ct-software.com/reportpool_frame.htm
http://www.saphelp.com/SAP_Technical.htm
http://www.kabai.com/abaps/q.htm
http://www.guidancetech.com/people/holland/sap/abap/
http://www.planetsap.com/download_abap_programs.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c8/1975cc43b111d1896f0000e8322d00/content.htm
/people/thomas.weiss/blog/2006/04/03/how-to-define-a-new-badi-within-the-enhancement-framework--part-3-of-the-series
/people/thomas.weiss/blog/2006/04/18/how-to-implement-a-badi-and-how-to-use-a-filter--part-4-of-the-series-on-the-new-enhancement-framework
http://www.esnips.com/web/BAdI
http://www.allsaplinks.com/badi.html
New to Badi
check any fo the below links. this will def help u.
http://www.allsaplinks.com/badi.html
And also download this file....
http://www.savefile.com/files.php?fid=8913854
There are other tutorials on this site...
http://sapbrain.com/Tutorials/tuto_download.html
What are BAdIs?
-> is an anticipated point of extension these points act like sockets and exist in the original source code
-> based on ABAP Objects. BAdI defines an interface that can be implemented by BAdI-implementations that are transport objects of their own
->Important! There are 2 roles: Enhancement Option-provider & Implementer.
-> In the above context, Enhancement Implementation can be done only if option (hook) is provided by the Option-provider. In simple words there are no implicit BAdIs.
Note: In the following slides, Definitions are created so as to understand the method of BAdI definition & for example purpose. As stated above this is the role of Enhancement Option-Provider.
Classic BAdIs already exist since SAP Release 4.6
BAdIs have been Re-implemented in ECC7.0 under the new Enhancement Framework & Switch Framework
Classic BAdIs
To understand what a powerful pattern a BAdI is, we will now define & then implement a BAdI
BADI Class is created automatically.
The various options are described below in detail:
1. Enhanceable: Enhanceability of filter types can only be specified for filter-dependent BADI definitions under very special conditions. For example, the domain belonging to the filter type must be linked with a value table that is of the type E or G. A BADI implementation can then be created in one step by creating a new filter value that is automatically entered into the value table at save and also copied into the transport order of the BADI implementation. In addition, it is also possible to create a new filter value and, at the same time, a BADI implementation with the same name. Naturally, you can also specify existing filter values.
You should select this feature if there is a prerequisite that a new filter value is created together with a new BADI implementation - that is, that BADI implementations are not created solely with existing filter values, although this, too, is possible.
2. Multiple-Use
3. Filter-Dependent
Instance Methods can access all of the attributes of a class and can trigger all events of a class. Static Methods can only access static attributes and static events.
Exceptions:
Events:
Events can be defined in classes or in interfaces. Corresponding methods can trigger these events with the RAISE EVENT statement. Each class (or interface) that is going to handle the corresponding event must implement a relevant handler method, and register it using the SET HANDLER statement. When an event occurs, the system calls all of the handler methods registered for that event.
Like method definitions, events have a parameter interface. The only difference is that events may only have EXPORTING parameters.
BADI : Businees Add IN's
Business Add-Ins are SAP enhancement technique based on ABAP Objects.
Where the SAP standard program is not going to fullfill the client requirement , we are going to add our own program to SAP standard program, without changing the standard prog.
Each Business Add-In has
at least one Business Add-In definition
a Business Add-In interface
a Business Add-In class that implements the interface
Each BADI has two different Views.
1.Definition view
2.Implementation view
T.C for BADI Definition is SE18.
T.C for BADI Implementation is SE19.
There are multiple ways of searching for BADI.
Finding BADI Using CL_EXITHANDLER=>GET_INSTANCE
Finding BADI Using SQL Trace (TCODE-ST05).
Finding BADI Using Repository Information System (TCODE- SE84).
1. Go to the Transaction, for which we want to find the BADI, take the example of Transaction VD02. Click on System->Status. Double click on the program name. Once inside the program search for CL_EXITHANDLER=>GET_INSTANCE.
Make sure the radio button In main program is checked. A list of all the programs with call to the BADIs will be listed.
The export parameter EXIT_NAME for the method GET_INSTANCE of class CL_EXITHANDLER will have the user exit assigned to it. The changing parameter INSTANCE will have the interface assigned to it. Double click on the method to enter the source code.Definition of Instance would give you the Interface name.
2. Start transaction ST05 (Performance Analysis).
Set flag field "Buffer trace"
Remark: We need to trace also the buffer calls, because BADI database tables are buffered. (Especially view V_EXT_IMP and V_EXT_ACT)
Push the button "Activate Trace". Start transaction VA02 in a new GUI session. Go back to the Performance trace session.
Push the button "Deactivate Trace".
Push the button "Display Trace".
The popup screen "Set Restrictions for Displaying Trace" appears.
Now, filter the trace on Objects:
V_EXT_IMP
V_EXT_ACT
Push button "Multiple selections" button behind field Objects
Fill: V_EXT_IMP and V_EXT_ACT
All the interface class names of view V_EXT_IMP start with IF_EX_. This is the standard SAP prefix for BADI class interfaces. The BADI name is after the IF_EX_.
So the BADI name of IF_EX_CUSTOMER_ADD_DATA is CUSTOMER_ADD_DATA
3. Go to Maintain Transaction (TCODE- SE93).
Enter the Transaction VD02 for which you want to find BADI.
Click on the Display push buttons.
Get the Package Name. (Package VS in this case)
Go to TCode: SE84->Enhancements->Business Add-inns->Definition
Enter the Package Name and Execute.
Here you get a list of all the Enhancement BADIs for the given package MB.
Have a look at http://help.sap.com/saphelp_nw04/helpdata/en/04/f3683c05ea4464e10000000a114084/content.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/73/7e7941601b1d09e10000000a155106/frameset.htm
http://support.sas.com/rnd/papers/sugi30/SAP.ppt
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/abapindx.htm
http://members.aol.com/_ht_a/skarkada/sap/
http://www.ct-software.com/reportpool_frame.htm
http://www.saphelp.com/SAP_Technical.htm
http://www.kabai.com/abaps/q.htm
http://www.guidancetech.com/people/holland/sap/abap/
http://www.planetsap.com/download_abap_programs.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c8/1975cc43b111d1896f0000e8322d00/content.htm
/people/thomas.weiss/blog/2006/04/03/how-to-define-a-new-badi-within-the-enhancement-framework--part-3-of-the-series
/people/thomas.weiss/blog/2006/04/18/how-to-implement-a-badi-and-how-to-use-a-filter--part-4-of-the-series-on-the-new-enhancement-framework
How to develop BADI
Rewards if useful. -
hello all.
I find some program that will help me in my work.
but know i don't know how to change it that it will fit my project. i just want to work with thread pool. i find some code that can do this.
mu problem is that i don't know how to change the task and the run functions in that program because they are interface. and when i do change them I get all the code errors.
can you give me an example how can i change this code to do some, like that the task will print something or do something else.
the code is:
thanks alot!
* To change this template, choose Tools | Templates
* and open the template in the editor.
package work2;
import java.util.ArrayList;
import java.util.List;
* @author vitaly87
public class ThreadPool {
/** Simple thread pool. A task is executed by obtaining a thread from
* the pool
/** The thread pool contains instances of {@link ThreadPool.Task}.
public interface Task {
/** Performs the task.
* @throws Throwable The task failed, and the worker thread won't be used again.
void run() throws Throwable{}
/** A task, which may be interrupted, if the pool is shutting down.
public interface InterruptableTask extends Task {
/** Interrupts the task.
* @throws Throwable Shutting down the task failed.
void shutdown() throws Throwable;
private class Poolable {
private boolean shuttingDown;
private Task task;
private Thread thread;
Poolable(ThreadGroup pGroup, int pNum) {
thread = new Thread(pGroup, pGroup.getName() + "-" + pNum){
public void run() {
while (!isShuttingDown()) {
final Task t = getTask();
if (t == null) {
try {
synchronized (this) {
if (!isShuttingDown() && getTask() == null) {
wait();
} catch (InterruptedException e) {
// Do nothing
} else {
try {
t.run();
resetTask();
repool(Poolable.this);
} catch (Throwable e) {
discard(Poolable.this);
resetTask();
thread.start();
synchronized void shutdown() {
shuttingDown = true;
final Task t = getTask();
if (t != null && t instanceof InterruptableTask) {
try {
((InterruptableTask) t).shutdown();
} catch (Throwable th) {
// Ignore me
task = null;
synchronized (thread) {
thread.notify();
private synchronized boolean isShuttingDown() { return shuttingDown; }
String getName() { return thread.getName(); }
private synchronized Task getTask() {
return task;
private synchronized void resetTask() {
task = null;
synchronized void start(Task pTask) {
task = pTask;
synchronized (thread) {
thread.notify();
private final ThreadGroup threadGroup;
private final int maxSize;
private final List waitingThreads = new ArrayList();
private final List runningThreads = new ArrayList();
private final List waitingTasks = new ArrayList();
private int num;
/** Creates a new instance.
* @param pMaxSize Maximum number of concurrent threads.
* @param pName Thread group name.
public ThreadPool(int pMaxSize, String pName) {
maxSize = pMaxSize;
threadGroup = new ThreadGroup(pName);
synchronized void discard(Poolable pPoolable) {
pPoolable.shutdown();
runningThreads.remove(pPoolable);
waitingThreads.remove(pPoolable);
synchronized void repool(Poolable pPoolable) {
if (runningThreads.remove(pPoolable)) {
if (maxSize != 0 && runningThreads.size() + waitingThreads.size() >= maxSize) {
discard(pPoolable);
} else {
waitingThreads.add(pPoolable);
if (waitingTasks.size() > 0) {
Task task = (Task) waitingTasks.remove(waitingTasks.size() - 1);
startTask(task);
} else {
discard(pPoolable);
/** Starts a task immediately.
* @param pTask The task being started.
* @return True, if the task could be started immediately. False, if
* the maxmimum number of concurrent tasks was exceeded. If so, you
* might consider to use the {@link #addTask(ThreadPool.Task)} method instead.
public synchronized boolean startTask(Task pTask) {
if (maxSize != 0 && runningThreads.size() >= maxSize) {
return false;
Poolable poolable;
if (waitingThreads.size() > 0) {
poolable = (Poolable) waitingThreads.remove(waitingThreads.size()-1);
} else {
poolable = new Poolable(threadGroup, num++);
runningThreads.add(poolable);
poolable.start(pTask);
return true;
/** Adds a task for immediate or deferred execution.
* @param pTask The task being added.
* @return True, if the task was started immediately. False, if
* the task will be executed later.
public synchronized boolean addTask(Task pTask) {
if (startTask(pTask)) {
return true;
waitingTasks.add(pTask);
return false;
/** Closes the pool.
public synchronized void shutdown() {
while (!waitingThreads.isEmpty()) {
Poolable poolable = (Poolable) waitingThreads.remove(waitingThreads.size()-1);
poolable.shutdown();
while (!runningThreads.isEmpty()) {
Poolable poolable = (Poolable) runningThreads.remove(runningThreads.size()-1);
poolable.shutdown();
/** Returns the maximum number of concurrent threads.
* @return Maximum number of threads.
public int getMaxThreads() { return maxSize; }
/** Returns the number of threads, which have actually been created,
* as opposed to the number of currently running threads.
public synchronized int getNumThreads() { return num; }
}Sounds like you should read up on the [java tutorials |http://java.sun.com/docs/books/tutorial/essential/concurrency/] on threading.
I found some car parts that will help me drive. And no, I don't know how to put them together to make a car. But I want to drive on the highway! I found some car parts that can do this. -
I need help with threads. How can I break this code into teo threads without chaning the data objects at all? Producer will produce string line by line and consumer will take the line and search for the word. Help me please.
Thank you
public class WordFinder
* Main program opens the file given by the user as an argument and
* searches for the word given by the user. If the word is found,
* the line number on which the word occurs is displayed.
* @param args[0] Word to search for
* @param args[1] Name of file to search
public static void main(String[] args) throws IOException
// To keep track of how long the program runs we'll set the startTime
// variable to the current time in milliseconds and use that at
// the end of the program to find out how long we ran.
long startTime = System.currentTimeMillis();
String wordToFind;
String currentLine;
int lineCount = 0; // Keep track of line numbers
BufferedReader inputFile = null; // Needed to get compiler to quit
// complaining about uninitialized
// variables.
// Make sure we have 2 arguments passed to us
if (args.length < 2)
// Nope. Show user how to run and then exit with an error (1)
System.out.println("usage: java WordFinder <word> <file pathname>");
System.exit(1);
// So far, so good. Now try to open the file the user gave us as
// a parameter. We'll use a BufferedReader object to read the file
// so we can read one line at a time from the input. If opening the
// file fails, print an error message and exit with an error (1).
try
inputFile = new BufferedReader(new FileReader(args[1]));
catch (FileNotFoundException e)
System.out.println(args[1] + ": File not found or is not readable");
System.exit(1);
// Set the wordToFind variable to refer to args[0]. We don't
// really need to do this, but it makes our code more readable
wordToFind = args[0];
// We're going to read the file one line at a time. For each
// line, we'll create a StringTokenizer object to break the line
// into distinct words, checking each word to see if it's the same
// as the given search word.
// Read first line from the file
currentLine = inputFile.readLine();
while (currentLine != null) // Repeat until we reach EOF
// Have a valid input line, increment the counter
lineCount++;
// Create a StringTokenizer object over the current line
StringTokenizer tokens = new StringTokenizer(currentLine);
// Check each word in the string by accessing each token
while (tokens.hasMoreTokens())
// See if the next word is the one we're looking for and
// advance the token iterator to the next token
if (wordToFind.equals(tokens.nextToken()))
// Yes, display the current line number
System.out.println(wordToFind + " found on line " + lineCount);
// Read next line from the file
currentLine = inputFile.readLine();
} // while
// Done with the input file
inputFile.close();
// Display the running time of this program in milliseconds by
// subtracting the start time from the current time
System.out.println((System.currentTimeMillis() - startTime) + " milliseconds");
} // main
} // WordFinderYou may create Queue object. (I guess that you're already know QUEUE)
Then ... use producer thread to load input file into queue. (Enqueue)
Consumer ... dequeue
Queue can be empty because of
- Input file was read to EOF and Consumer had produced all queue.
or
- Cunsumer works too fast... So the queue is empty.
So, you may have to use ... wait() in Consumer in case of the queue is empty.
And use notify() in Producer to wake up consumer ...
Is this right ? -
I am having same problem with apple tv need 4.4 version and can not find solution this a brand new product out of box yesterday why would it not already have updated version. I am getting frustrated that I can not get this mirroring icon to work. I have tried all suggestions in this thread and nothing works. I also hooked up to laptop through iTunes with micro USB nothing!!!
The new appletv software came out 2 or 3 days ago, how would Apple get it on the device in the box in a store?
Why don't ou update the appletv software? -
Hi All;
I have been programming a j2me game. I have 2 core threads. One of them is for clock, another is for game logic. I want to make a pause state in the game. When the player presses the related key, I want to wait these two threads. When the user presses the resume key, I want the threads to notify. But I have a illegalMonitorState exception.
How I can success this pause-resume logic with threads?
I am waiting for your replies...You could need a thread thread, which just listens for pause/restart .... from that thread you can set wait condition for clock or game thread .....
You can add trace line in the code ... then you will find out that you are syn the game thread or click thread to whom you have syn ... and pausing it .. that is the reason why you are getting IllegalMonitorStateException -
Hi experts,could any one explain with an example of images
hi SAP experts,could any one explain with an example of images Reverse image,update image,Delete image and Add image.
Hi,
Go thru below thread it has already discussed
Re: selection from scratch: full VS (intialize delta + delta) update bi 7.0
Assign points if it helps you
thanks
Maybe you are looking for
-
can't open iTunes on my pc in windows. I keep getting a Problem event: BEX error. How can i fix this? need very detailed step by step instructions on how to fix. thx
-
When I open email in my inbox, they continually load and flash. I often have to use the "back" arrow several times to make it stop. Sometimes the message just won't open at all. Also, I can't open "sent" mail at all.
-
Doubt in Joins - 1Z0-051 Preparation
Hi, In Chapter 7, p.no 317 of 'OCA Oracle Databse 11g, SQL Fundametals I Exam Guide' regarding the joins, there is below lines. If no joins are N-1 joins are specified in the WHERE clause conditions, where N refers to the number of tables in the quer
-
Position of CONSTANT in "IF" statement
Hi, I get an ORA-06502: PL/SQL: numeric or value error: character string buffer too small on the following statement: IF MY_CONSTANTS = myVar THEN which goes away when i change the order of the vars getting compared.: IFmyVar = MY_CONSTANTS THEN I am
-
How can I Scan into CS5.5photoshop via file import command
I recently bought a new 27" iMac running OSX 10.8.2 (Mountain Lion). I brought over all my files, including applications from my backup disk. I had no trouble running Photoshop CS5.5 and printing any pictures I had imported from my cameras. The Twain