Importing classes with unnamed namespace
Hi,
I'm currently assigned to a class assignment that requires me to build a calculator bean using a class that was provided. Problem was, we were expected to import the provided class in an unnamed namespace - something that was possible in SDK 1.3 but not in 1.4. Recompiling the source for the class is out of the question, since the source code wasn't provided and the lecturer refused to do so - instead, he told my class to go back to SDK 1.3. But I already have the latest SDK(1.4.1_01) installed, and I do not intend to go back to an older version of the SDK or have both SDK installed side-by-side. Is there any known workaround to make the compiler ignore unnamed namespaces? Please help.
since the source code wasn't provided
and the lecturer refused to do so - instead, he told
my class to go back to SDK 1.3. And you might also keep in mind that the lecturer might be incompetent since he refused to provide and updated version and could not provide a suggestion on how to do it with 1.4. So be careful about everything he tells you.
Similar Messages
-
Importing classes with embedded java
I have the following line of code:
Element input = (Element)getVariableData("sourceString");
I'm trying to get the value the the variable 'sourceString' from the bpel process. When I try and compile I get the error:
class bpel.testmq.Element not found.
testmq is the name of my bpel process.
I have tried using javax.lang.model.Element, and org.jdom.Element with no success.
cheers
JamesFinally, I think I have figured out all my java issues.
to import java classes all you need to do is enter the following in the source code of your bpel process. This is places after the last line of the process and before the partner links.
<bpelx:exec import="java.util.*"/>
<bpelx:exec import="java.lang.*"/>
<bpelx:exec import="java.rmi.RemoteException"/>
<bpelx:exec import="javax.naming.NamingException"/>
<bpelx:exec import="org.w3c.dom.Element"/>
<bpelx:exec import="java.math.*"/>
cheers
James -
Import CLASS with no package name in VAJ
IMport statement in VAJ for .class (no source and No package specified in the class) goes always to the "default package". Is there any way how to:
1. change package in existing class wihout source
2. do the "package naming" when the class is imported ?
3. refer this "default package" by import statement ?(it has no valid name , of course)
I have tried whatever, but ...? I know, this question was already here in forum at 2001, but, nobody responded ... tks //petrThere is no way of doing it to the class file. Class files cannot be compiled and therefore cannot be changed.
You could download a decompiler which gives decompiles the class into a .java file. Then edit that java file to move the class.
Will -
How to import class in JAVA ?????
from the website
http://java.sun.com/j2se/1.4/compatibility.html
SAYS :
To summarize, the syntax
import SimpleName;
is no longer legal.
which would import a nested class from the unnamed namespace. To fix such problems in your code, move all of the classes from the unnamed namespace into a named namespace.
But i don't know what is the meaning of move all of the classes from the unnamed namespace into a named namespace.
Would anyone give me a help ?But i don't know what is the meaning of move all of
the classes from the unnamed namespace into a named
namespace. You need to put the classes in a package: <http://java.sun.com/docs/books/tutorial/java/interpack/packages.html>
Basically creating a directory, placing all the classes in there, and adding a package statement at the start of the source files.
Bhav -
How do I write an external class with global constants?
Hi you all !
First I want to explain what exactly I want to do:
I have an application that should run in different resolutions. The app runs fullscreen, and I don't use Layouts or something, just a single Frame with a Graphics Object.
Now to handle the different resolutions, I want to write an external class with some constants to use. The usage in my main Class should be something like this:
public
class blah
private Constants myConstants;
public blah()
if (highResolution)
myConstants = new hiResConstants();
else
myConstants = new loResConstants();
System.println(String.valueOf(myConstants.SCREEN_WIDTH);
}or somthing like that. The important fact is that I can choose the constants at runtime and that I am NOT forced to use methods to get the values, cause something like
System.println(String.valueOf(myConstants.getScreenWidth());sux if you have methods using 5 or more parameters.
Anybody out there who understood my problem and can help me??? PLEASE?
best regards,
SkippyFirst, what's so much worse about
System.println(myConstants.getScreenWidth());
than
System.println(myConstants.ScreenWidth);
Is the extra five characters really that bad? (Note
you don't need the String.valueOf method call.)Well actually it was a wrong example I gave here, but it's not the call that makes me shake but the implementation:
public int screenWidth = 1024;vs.
public
int getScreenWidth()
return 1024;
}Here it makes a bigger difference, even when you think of managing about 100 or even more constants.
Second, why do you have methods that take five or more
parameters!?Well, maybe this example show up what I mean:
if (cursorIsInArea(100,100,200,200,areaId))
doSomeStuff();Ok, I could use Rectangles here, but if you think of the timing here (I draw 30 frames / sec and this check comes about every frame or the animation would be choppy) I refuse to create an Object everytime I make this call.
Btw: Is it worth thinking about the time of execution like I did in this example? OO is a neat thing, but is it that fast?
I don't think isCursorInArea(new Rectangle(100,100,200,200),areaId) is such a great idea, but I might be wrong.
It sounds like you're trying to compound a bad design
with an even worse design for no good reason!Well, I'm not that experienced Java programmer to judge about that, but I (and my profs at university too) found my codes well structured and designed so far.
Skippy
PS: the string.valueOf(123) call came from cut&paste:
system.out.println(string.valueOf(number1)+string.valueOf(number2));Try this without the function.... ;-) -
Having problems in creating a class with name File.
I want to compile a new class with class name as File, i have made it part of a new package also but still i am getting this error
"File.java:2: CustomFile.File is already defined in this compilation unit
import java.io.File;
^
File.java:6: cannot resolve symbol
symbol : constructor File ()
location: class java.io.File
inFile = new java.io.File();
^
2 errors"
Here is the source code of the file:
package CustomFile;
import java.io.File;
public class File {
private java.io.File inFile;
public File(){
inFile = new java.io.File();
System.out.println("hi file");
}Any help is appreciated.
I want to compile a new class with class name as File,
i have made it part of a new package also but still i
am getting this error
"File.java:2: CustomFile.File is already defined in
this compilation unit
import java.io.File;
^
File.java:6: cannot resolve symbol
symbol : constructor File ()
location: class java.io.File
inFile = new java.io.File();
^
2 errors"
Here is the source code of the file:
package CustomFile;
import java.io.File;
public class File {
private java.io.File inFile;
public File(){
inFile = new java.io.File();
System.out.println("hi file"); -
I was reading the tutorial on importing class's. This is what
I read
Importing classes
To reference a class in another script, you must prefix the
class name with the class's package path. The combination of a
class's name and its package path is the class's fully qualified
class name. If a class resides in a top-level classpath
directory--not in a subdirectory in the classpath directory--then
its fully qualified class name is its class name.
To specify package paths, use dot (.) notation to separate
package directory names. Package paths are hierarchical, where each
dot represents a nested directory. For example, suppose you create
a class named Data that resides in a com/xyzzycorporation/ package
in your classpath. To create an instance of that class, you could
specify the fully qualified class name, as shown in the following
example:
var dataInstance = new com.xyzzycorporation.Data();
My Question is about com/xyzzycorporation/ . would the full
class parth be c:/com/xyzzycorporation/ . Why do they never state
the drive letter when teaching about directories.Because there is no need. you don't need to reference the
drive letter.
Here's the basic jist of what they are saying....
Single Class File...
If you create your own custom class and want to use it in
your flash file, save it into the same directory as the fla file
and call the classes constructor. By default flash will look inside
the folder where the fla resides in for the class files if it
cannot find it inside the default directory.
Multiple Class Files - 1 Project (often referred to as
packages)
Use your qualified domain name but backwards.....
my domain is www.sd-dezign.com so if I was going to include a
package of utility class files in my document I would do the
following
Create a folder in the same folder with my fla name it com
and inside that a folder called sddezign and inside that utils and
all my as files would be in there...the folder structure might look
like this....
myfile.fla
com
>sddezign
>>utils
>>>box.as
>>>circle.as
To call the constructor for each class, I have two options.
The first which is by far the easiest looks like this
In whatever frame you need to call that class constructor
include "com.sddezign.utils.*";
var myBox:Box = new Box();
The second method requires more typing and can get tedious
var myBox = new com.sddezign.utils.Box();
Hope this helps you a bit better. -
Not allowed to import classes without package names?
Hi,
I have a few questions on Packages and importing?
1. Is the following true that it is illegal to import classes in the same package as the current class, will this cause a comilation error? If this is the case where in the Java Language specification is this actually written as I could not find it?
2. This has probably been answered by question 1 but if I have 2 classes in the same package and if I import 1 of the classes into the other class, is it illegal to import it by just using the class name and not the package name as well, ie
if the package name is ie.tcd
and the 2 class names are exp1.class and exp2.class, can I do this in class 2
package ie.tcd;
import exp1;
public class exp2 {
3. Is it illegal to import classes that are not explicitly part of any package or must a class be part of a package to be imported. I read somewhere that while this was always illegal it is only after jdk 1.4.2 that this is being enforced? If this is the case where in the Java Language specification is this actually written as I could not find it either?
Thanks very much for any help,
JohnWas just also wondering, 1 other thing, I am looking
at someone elses code they have 2 classes (Class A
and Class B) in the same package (pkg). The person
imports class A into B:
package pkg;
import A;
public class B {
Is this legal code (or was it ever)?Not if A is really in pkg.A. If there is an A in the unnamed package it was legal, or at least it was understood by the compiler, and now it isn't (to both).
Can you import or is there a point in importing a class in the same
package?Only by naming the package in the import statement. If the current and the import statement are in the same package the import is redundant.
If there is a point would you import just be
using the class name (this would be illegal after jdk
1.4) or should you use the whole package name even
though it is in the package anyways?As I understand it you must always use the whole package name in imports. -
Does alias exist to differentiate between 2 classes with same name?
I have 2 classes (a domainmodel-class and a webpage-class) with the same name. Of course I get a naming-conflict when I want to reference the domainmodel-class from the webpage-class (because they have the same name).
I was wondering if there's a language construct in java to import my domainmodel-class under a different name / alias in the webpage-class.
Of course I could simply rename my webpage-class, but that has some impact which I'd rather avoid.
Thanks,
Geert-Jangbrits wrote:
I have 2 classes (a domainmodel-class and a webpage-class) with the same name. Of course I get a naming-conflict when I want to reference the domainmodel-class from the webpage-class (because they have the same name).
I was wondering if there's a language construct in java to import my domainmodel-class under a different name / alias in the webpage-class.
Of course I could simply rename my webpage-class, but that has some impact which I'd rather avoid.
Thanks,
Geert-JanNo, you can't do that. But one class can be imported, and the other one be used with fully qualified name all of the time. -
Compilation Error for import classes not found in generated Proxy Class
Hi,
We are generating java classes for the COM dll using JCOM com2java compiler.
We are getting a compilation error for import class not found when compiling the
generated Proxy java source code. It can't find the com.bea.jcom.Dispatch class that
the generated Proxy java source code extends. It also can't find com.bea.jcom.Variant
or com.bea.jcom.Param. These are interfaces or data types or classes used by COM
library.
I added weblogic.jar to my class path and the only Dispatch class i found inside
the weblogic.jar is com.linar.jintegra.Dispatch;
We have com objects for which we want to develop an EJB client to interface with
the COM object using JCOM with Native Mode disabled.
Any help on the compilation error..I tried changing the extends for Dispatch to com.linar.jintegra.Dispatch
but the other errors are still there.
To begin with, I think the generated code should not refer to any of the COM data
types.
Any help please.
Thank you in advance,
Regards,
Rahul Srivastava
[email protected]Hi,
I resolved the other errors by changing all references from com.bea.jcom.Variant
etc to com.linar.jintegra.class name..all were present under the com.linar.jintegra
package.
Thank you all anyways,
Regards,
rahul
"Rahul Srivastava" <[email protected]> wrote:
>
Hi,
We are generating java classes for the COM dll using JCOM com2java compiler.
We are getting a compilation error for import class not found when compiling
the
generated Proxy java source code. It can't find the com.bea.jcom.Dispatch
class that
the generated Proxy java source code extends. It also can't find com.bea.jcom.Variant
or com.bea.jcom.Param. These are interfaces or data types or classes used
by COM
library.
I added weblogic.jar to my class path and the only Dispatch class i found
inside
the weblogic.jar is com.linar.jintegra.Dispatch;
We have com objects for which we want to develop an EJB client to interface
with
the COM object using JCOM with Native Mode disabled.
Any help on the compilation error..I tried changing the extends for Dispatch
to com.linar.jintegra.Dispatch
but the other errors are still there.
To begin with, I think the generated code should not refer to any of the
COM data
types.
Any help please.
Thank you in advance,
Regards,
Rahul Srivastava
[email protected] -
Can't enhance classes with Apache Commons Logging?
For some reason enhancer blows on class with
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
private static final Log LOG = LogFactory.getLog(GaoParticipant.class);
With following exception:
java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:219)
at serp.util.MultiClassLoader.findClass(MultiClassLoader.java:224)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:219)
at
com.solarmetric.meta.CFMetaDataParser.classForName(CFMetaDataParser.java:213
at
com.solarmetric.meta.CFMetaDataParser.classForName(CFMetaDataParser.java:188
at kodo.meta.JDOMetaDataParser.startCollection(JDOMetaDataParser.java:321)
at
kodo.meta.JDOMetaDataParser.startClassElement(JDOMetaDataParser.java:194)
at
com.solarmetric.meta.CFMetaDataParser.startElement(CFMetaDataParser.java:69)
at
com.solarmetric.meta.XMLMetaDataParser.startElement(XMLMetaDataParser.java:3
54)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown
Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unkno
wn Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc
her.dispatch(Unknown Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
at com.solarmetric.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:309)
at com.solarmetric.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:254)
at com.solarmetric.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:234)
at
kodo.meta.JDOMetaDataRepositoryImpl.getMetaDataInternal(JDOMetaDataRepositor
yImpl.java:175)
at
kodo.meta.JDOMetaDataRepositoryImpl.getMetaData(JDOMetaDataRepositoryImpl.ja
va:129)
at kodo.enhance.JDOEnhancer.<init>(JDOEnhancer.java:110)
at kodo.enhance.JDOEnhancer.run(JDOEnhancer.java:2175)
at kodo.enhance.JDOEnhancer.run(JDOEnhancer.java:2116)
at kodo.enhance.JDOEnhancer.main(JDOEnhancer.java:2088)
at peacetech.gao.ccs.tools.Enhance.main(Enhance.java:14)
Caused by: org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException: Class
org.apache.commons.logging.impl.Log4JLogger does not implement Log
at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.ja
va:532)
at
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.ja
va:272)
at
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.ja
va:246)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:395)
at peacetech.gao.ccs.jdo.GaoParticipant.<clinit>(GaoParticipant.java:14)
... 35 more
Caused by: org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException: Class
org.apache.commons.logging.impl.Log4JLogger does not implement Log
at
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryI
mpl.java:416)
at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.ja
va:525)
... 39 more
Caused by: org.apache.commons.logging.LogConfigurationException: Class
org.apache.commons.logging.impl.Log4JLogger does not implement Log
at
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryI
mpl.java:412)
... 40 more
Exception in thread "main" Process terminated with exit code 1Have not tried Ant but running main() runs when LOG is not initialized at
all and blows in both cases below
1.
private static Log LOG ;
static {
LOG = LogFactory.getLog(Contact.class);
2
private static Log LOG = getLog();
private static Log getLog() {
return LogFactory.getLog(Contact.class);
"Marc Prud'hommeaux" <[email protected]> wrote in message
news:[email protected]...
Alex-
Do you see the problem if you just enhance the class from the
command-line "jdoc" tool?
Also, if you just don't initialize the log, do you still see the
problem (e.g., making it a lazy initialization via some static
getLog() method)?
In article <[email protected]>, Alex Roytman wrote:
It is not even ant just a class which I run from under Intellij IDEA
package peacetech.gao.ccs.tools;
import kodo.enhance.JDOEnhancer;
public class Enhance {
String arr[];
public static void main(String[] args) throws Exception {
String root = "D:/projects/gao/ccs/main/java/jdo/classes/";
System.getProperties().put("kodo.properties", "ccs-jdo.properties");
JDOEnhancer.main(new String[]{"-te", "true", root +
"/peacetech/gao/ccs/jdo/package.jdo"});
"Marc Prud'hommeaux" <[email protected]> wrote in message
news:[email protected]...
Alex-
This seems to be a problem that happens under some classloader
circumstances.
Do you have a special <classloader> element for your <enhance> target?
If so, does it still occur if you remove it (conversely, does it still
happen if you add in a <classloader> element?
In article <[email protected]>, Alex Roytman wrote:
For some reason enhancer blows on class with
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
private static final Log LOG =
LogFactory.getLog(GaoParticipant.class);
>>>>
With following exception:
java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:219)
at serp.util.MultiClassLoader.findClass(MultiClassLoader.java:224)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:219)
at
com.solarmetric.meta.CFMetaDataParser.classForName(CFMetaDataParser.java:213
at
com.solarmetric.meta.CFMetaDataParser.classForName(CFMetaDataParser.java:188
atkodo.meta.JDOMetaDataParser.startCollection(JDOMetaDataParser.java:321)
at
kodo.meta.JDOMetaDataParser.startClassElement(JDOMetaDataParser.java:194)
at
com.solarmetric.meta.CFMetaDataParser.startElement(CFMetaDataParser.java:69)
at
com.solarmetric.meta.XMLMetaDataParser.startElement(XMLMetaDataParser.java:3
54)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(UnknownSource)
atorg.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown
Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(UnknownSource)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unkno
wn Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc
her.dispatch(Unknown Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
atcom.solarmetric.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:309)
atcom.solarmetric.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:254)
atcom.solarmetric.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:234)
at
kodo.meta.JDOMetaDataRepositoryImpl.getMetaDataInternal(JDOMetaDataRepositor
yImpl.java:175)
at
kodo.meta.JDOMetaDataRepositoryImpl.getMetaData(JDOMetaDataRepositoryImpl.ja
va:129)
at kodo.enhance.JDOEnhancer.<init>(JDOEnhancer.java:110)
at kodo.enhance.JDOEnhancer.run(JDOEnhancer.java:2175)
at kodo.enhance.JDOEnhancer.run(JDOEnhancer.java:2116)
at kodo.enhance.JDOEnhancer.main(JDOEnhancer.java:2088)
at peacetech.gao.ccs.tools.Enhance.main(Enhance.java:14)
Caused by: org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException: Class
org.apache.commons.logging.impl.Log4JLogger does not implement Log
at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.ja
va:532)
at
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.ja
va:272)
at
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.ja
va:246)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:395)
atpeacetech.gao.ccs.jdo.GaoParticipant.<clinit>(GaoParticipant.java:14)
... 35 more
Caused by: org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException: Class
org.apache.commons.logging.impl.Log4JLogger does not implement Log
at
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryI
mpl.java:416)
at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.ja
va:525)
... 39 more
Caused by: org.apache.commons.logging.LogConfigurationException:Class
org.apache.commons.logging.impl.Log4JLogger does not implement Log
at
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryI
mpl.java:412)
... 40 more
Exception in thread "main" Process terminated with exit code 1
Marc Prud'hommeaux [email protected]
SolarMetric Inc. http://www.solarmetric.com
Marc Prud'hommeaux [email protected]
SolarMetric Inc. http://www.solarmetric.com -
Could not find the main class (with every jar)
This isn't a developer question. I get the error Could not find the main class with every jar I try to open (for example the jar downloaded from https://gjar.dev.java.net/ gives the same problems - and I don't think there is something wrong with that JAR). It isn't a problem with the jar or MANIFEST because the same jar works fine on my laptop. So there is something wrong with my JRE installation, but what?
I tried to remove and reinstall the JRE 6 Update 18 but that didn't work. When I run the JAR with command line java -jar "file.jar" it works fine, but if I dubbelclick on it I get the error message (and it's irritating me).
I'm a bit desperate so I hope that someone here can help me ;)
Thanks in advancedhai T.B.M ... Sorry to post here... I know that i posted my question in wrong thread..but i dont have another solution to contact with you.. I had seen your answers which are really excellent and helped to do my project..
Now i am having very less time to complete my project and i am very new to JMF.. I am not getting output in JMF video capture ..please check the code and guide me where i gone wrong.......please pardon me once again to post here.. Heres my code
import javax.media.*;
import java.awt.*;
import javax.swing.*;
import java.util.*;
import java.awt.event.*;
import javax.media.protocol.*;
import java.io.*;
import javax.media.control.StreamWriterControl;
public class webcam implements ActionListener,ControllerListener
boolean eomReached = false;
boolean realized = false;
JFrame f;
BorderLayout bd1;
CaptureDeviceInfo device;
MediaLocator m1;
Player player;
Component videoScreen;
JButton b1,b2;
Processor processor;
DataSource ds=null;
DataSink fileWriter=null;
JLabel status=new JLabel("");
public webcam()
try
JFrame f=new JFrame();
JPanel p =new JPanel();
JPanel p1=new JPanel();
device=CaptureDeviceManager.getDevice("vfw:Microsoft WDM Image Capture (Win32):0");
m1=device.getLocator();
System.out.println("1");
processor.configure();
processor = Manager.createProcessor(m1);
processor.setContentDescriptor(new
FileTypeDescriptor(FileTypeDescriptor.MSVIDEO));
ds=processor.getDataOutput();
player.addControllerListener(this);
MediaLocator dest = new MediaLocator("file://foo.avi");
fileWriter = Manager.createDataSink(ds, dest);
fileWriter.open();
ds.connect();
ds.start();
player=Manager.createPlayer(m1);
player.addControllerListener(this);
blockingRealize();
videoScreen=player.getVisualComponent();
b1=new JButton("START");
b2=new JButton("STOP");
bd1=new BorderLayout();
p.setLayout(bd1);
p1.add(b1);
p1.add(b2);
p.add("South",p1);
p.add("East",videoScreen);
f.getContentPane().add(p);
f.setVisible(true);
f.setSize(500,500);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
b1.addActionListener(this);
b2.addActionListener(this);
catch(Exception e){}
public void actionPerformed(ActionEvent e)
if(e.getSource()==b1)
try{
processor.start();
player.start();
fileWriter.start();
catch(Exception e1){}
if(e.getSource()==b2)
try{
player.stop();
processor.stop();
processor.close();
fileWriter.close();
catch(Exception e2){}
public static void main(String args[])
webcam obj=new webcam();
public synchronized void blockingRealize() {
player.realize();
while (!realized) {
try {
wait();
} catch (java.lang.InterruptedException e) {
status.setText("Interrupted while waiting on realize...exiting.");
System.exit(1);
public synchronized void controllerUpdate (ControllerEvent event) {
System.out.println("myPlayer generated "+event.toString());
if (event instanceof RealizeCompleteEvent) {
realized = true;
notify();
} else if (event instanceof EndOfMediaEvent) {
eomReached = true;
} -
Problem importing classes and beans
Hey there. Im having one major fustrating problem! When I code supporting classes and beans for my JSPs I get a code 500 internal server error when trying to import (via <%@ page import="class" %> and <jsp:useBean/>) Im storing my classes and beans in the WEB-INF folder and the calling JSPs are located in /ROOT/tests/8/jsp.jsp. Im using the following to import a class or bean:
<%@ import="aClass" %>
Seen as tho its in the WEB-INF folder I won't have to explicitly refer to where the class is located, just the class name.
I never had this problem when I was using my hosting service. Its only on my localhost server in which I get the Internal Server error.
Help appreciated, thx.
PS: Im quite new to JSP/Java Servlet.import (via <%@ page import="class" %> and
<jsp:useBean/>) Im storing my classes and beans in the
WEB-INF folder try put your class file in WEB-INF/classes.
or first put bean in the package, like WEB-INF/classes/packagename/beanclass
in jsp page:
<jsp:useBean id="Mybean" class="packagename.beanclass" scope="request" />
Question: is /ROOT a context entry in your server.xml?
Which JSP Container (version) you use? Maybe your localhost server's set up is different with your hosting. -
Reflection Classes with the same name
Hi!
I have a big problem with reflection. I want to reflect lots of stuff (methods, variables...) in a lot of classes with the same name immediately one after the other. It's like
copy the file for the analysis to the right place
do reflection and get results
copy next file for analysis
Important to note is, that all of the files that should be reflected have the same name.
When I run the programm, he always only reflects the first file I gave for analysis, although I know the copying-stuff works and the new file would be there for analysis (but he does not seem to load/use it).
Any ideas what i could do?
Thanks!
ETI'm not sure if i'm authorised to tell too much
details, but i have to do some automated software
analysis and therefore I need to know whats inside of
a class and string search would not be appropriate.Why not ? What aspects of the class are you trying to examine ?
They have the same name, because they are delivered in
that form from a third party and it would be too much
effort (and to much risk of errors) to rename them.Sure, if they're delivered as class files, you're unable to rename them. Without knowing more I can't advise you further.
Why are you interested that much in that topic? Do you
have to perform a similar task?No, I'm trying to determine if reflection is the right tool for the job. Frankly it doesn't sound like it is. But since you're not authorised to tell me more, I can't help you more.
Dave. -
How to implement classes with alv's
hi
how to implement classes with alv'sHi Jyotsna,
check this example codes.
*"Table declarations...................................................
TABLES:
EKKO, " Purchasing Document Header
CDHDR, " Change document header
SSCRFIELDS. " Fields on selection screens
*"Selection screen elements............................................
SELECT-OPTIONS:
S_EBELN FOR EKKO-EBELN, " Purchasing Document Number
S_LIFNR FOR EKKO-LIFNR, " Vendor's account number
S_EKGRP FOR EKKO-EKGRP, " Purchasing group
S_BEDAT FOR EKKO-BEDAT, " Purchasing Document Date
S_UDATE FOR CDHDR-UDATE. " Creation date of the change
" document
*" Data declarations...................................................
Field String to hold Purchase Document Number *
DATA:
BEGIN OF FS_EBELN,
EBELN(90) TYPE C, " Purchase Document Number
ERNAM TYPE EKKO-ERNAM, " Name of Person who Created
" the Object
LIFNR TYPE EKKO-LIFNR, " Vendor's account number
EKGRP TYPE EKKO-EKGRP, " Purchasing group
BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
END OF FS_EBELN,
Field String to hold Purchase Document Header *
BEGIN OF FS_EKKO,
EBELN TYPE EKKO-EBELN, " Purchasing Document Number
ERNAM TYPE EKKO-ERNAM, " Name of Person who Created the
" Object
LIFNR TYPE EKKO-LIFNR, " Vendor's account number
EKGRP TYPE EKKO-EKGRP, " Purchasing group
BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
END OF FS_EKKO,
Field String to hold Account Number and name of the Vendor *
BEGIN OF FS_LFA1,
LIFNR TYPE LFA1-LIFNR, " Account Number of Vendor
NAME1 TYPE LFA1-NAME1, " Name1
END OF FS_LFA1,
Field String to hold Change date and the name of the user *
BEGIN OF FS_CDHDR,
OBJECTCLAS TYPE CDHDR-OBJECTCLAS, " Object Class
OBJECTID TYPE CDHDR-OBJECTID, " Object value
CHANGENR TYPE CDHDR-CHANGENR, " Document change number
USERNAME TYPE CDHDR-USERNAME, " User name
UDATE TYPE CDHDR-UDATE, " Creation date of the change
" document
END OF FS_CDHDR,
Field String to hold Change document items *
BEGIN OF FS_CDPOS,
OBJECTCLAS TYPE CDPOS-OBJECTCLAS," Object class
OBJECTID(10) TYPE C, " Object Value
CHANGENR TYPE CDPOS-CHANGENR, " Document change number
TABNAME TYPE CDPOS-TABNAME, " Table Name
FNAME TYPE CDPOS-FNAME, " Field Name
VALUE_NEW TYPE CDPOS-VALUE_NEW, " New contents of changed field
VALUE_OLD TYPE CDPOS-VALUE_OLD, " Old contents of changed field
END OF FS_CDPOS,
Field String to hold Date Element Name *
BEGIN OF FS_DATAELE,
TABNAME TYPE DD03L-TABNAME, " Table Name
FIELDNAME TYPE DD03L-FIELDNAME, " Field Name
ROLLNAME TYPE DD03L-ROLLNAME, " Data element (semantic domain)
END OF FS_DATAELE,
Field String to hold Short Text of the Date Element *
BEGIN OF FS_TEXT,
ROLLNAME TYPE DD04T-ROLLNAME, " Data element (semantic domain)
DDTEXT TYPE DD04T-DDTEXT, " Short Text Describing R/3
" Repository Objects
END OF FS_TEXT,
Field String to hold data to be displayed on the ALV grid *
BEGIN OF FS_OUTTAB,
EBELN TYPE EKKO-EBELN, " Purchasing Document Number
ERNAM TYPE EKKO-ERNAM, " Name of Person who Created the
" Object
LIFNR TYPE EKKO-LIFNR, " Vendor's account number
EKGRP TYPE EKKO-EKGRP, " Purchasing group
BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
WERKS TYPE LFA1-WERKS, " Plant
NAME1 TYPE LFA1-NAME1, " Name1
USERNAME TYPE CDHDR-USERNAME, " User name
UDATE TYPE CDHDR-UDATE, " Creation date of the change
" document
DDTEXT TYPE DD04T-DDTEXT, " Short Text Describing R/3
" Repository Objects
VALUE_NEW TYPE CDPOS-VALUE_NEW, " New contents of changed field
VALUE_OLD TYPE CDPOS-VALUE_OLD, " Old contents of changed field
END OF FS_OUTTAB,
Internal table to hold Purchase Document Number *
T_EBELN LIKE STANDARD TABLE
OF FS_EBELN,
Internal table to hold Purchase Document Header *
T_EKKO LIKE STANDARD TABLE
OF FS_EKKO,
Temp Internal table to hold Purchase Document Header *
T_EKKO_TEMP LIKE STANDARD TABLE
OF FS_EKKO,
Internal table to hold Account number and Name of the Vendor *
T_LFA1 LIKE STANDARD TABLE
OF FS_LFA1,
Internal Table to hold Change date and the name of the user *
T_CDHDR LIKE STANDARD TABLE
OF FS_CDHDR,
Internal Table to hold Change document items *
T_CDPOS LIKE STANDARD TABLE
OF FS_CDPOS,
Temp. Internal Table to hold Change document items *
T_CDPOS_TEMP LIKE STANDARD TABLE
OF FS_CDPOS,
Internal Table to hold Data Element Name *
T_DATAELE LIKE STANDARD TABLE
OF FS_DATAELE,
Temp. Internal Table to hold Data Element Name *
T_DATAELE_TEMP LIKE STANDARD TABLE
OF FS_DATAELE,
Internal Table to hold Short Text of the Date Element *
T_TEXT LIKE STANDARD TABLE
OF FS_TEXT,
Internal Table to hold data to be displayed on the ALV grid *
T_OUTTAB LIKE STANDARD TABLE
OF FS_OUTTAB.
C L A S S D E F I N I T I O N *
CLASS LCL_EVENT_HANDLER DEFINITION DEFERRED.
*" Data declarations...................................................
Work variables *
DATA:
W_EBELN TYPE EKKO-EBELN, " Purchasing Document Number
W_LIFNR TYPE EKKO-LIFNR, " Vendor's account number
W_EKGRP TYPE EKKO-EKGRP, " Purchasing group
W_VALUE TYPE EKKO-EBELN, " Reflected Value
W_SPACE VALUE ' ', " Space
W_FLAG TYPE I, " Flag Variable
W_VARIANT TYPE DISVARIANT, " Variant
ALV Grid
W_GRID TYPE REF TO CL_GUI_ALV_GRID,
Event Handler
W_EVENT_CLICK TYPE REF TO LCL_EVENT_HANDLER,
Field catalog table
T_FIELDCAT TYPE LVC_T_FCAT.
AT SELECTION-SCREEN EVENT *
AT SELECTION-SCREEN ON S_EBELN.
Subroutine to validate Purchase Document Number.
PERFORM VALIDATE_PD_NUM.
AT SELECTION-SCREEN ON S_LIFNR.
Subroutine to validate Vendor Number.
PERFORM VALIDATE_VEN_NUM.
AT SELECTION-SCREEN ON S_EKGRP.
Subroutine to validate Purchase Group.
PERFORM VALIDATE_PUR_GRP.
START-OF-SELECTION EVENT *
START-OF-SELECTION.
Subroutine to select all Purchase orders.
PERFORM SELECT_PO.
CHECK W_FLAG EQ 0.
Subroutine to select Object values.
PERFORM SELECT_OBJ_ID.
CHECK W_FLAG EQ 0.
Subroutine to select Changed values.
PERFORM SELECT_CHANGED_VALUE.
CHECK W_FLAG EQ 0.
Subroutine to Select Purchase Orders.
PERFORM SELECT_PUR_DOC.
Subroutine to select Vendor Details.
PERFORM SELECT_VENDOR.
Subroutine to select Text for the Changed values.
PERFORM DESCRIPTION.
END-OF-SELECTION EVENT *
END-OF-SELECTION.
IF NOT T_EKKO IS INITIAL.
Subroutine to populate the Output Table.
PERFORM FILL_OUTTAB.
Subroutine to build Field Catalog.
PERFORM PREPARE_FIELD_CATALOG CHANGING T_FIELDCAT.
CALL SCREEN 100.
ENDIF. " IF NOT T_EKKO...
CLASS LCL_EVENT_HANDLER DEFINITION
Defining Class which handles events
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS:
HANDLE_HOTSPOT_CLICK
FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID E_COLUMN_ID.
ENDCLASS. " LCL_EVENT_HANDLER DEFINITION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION
Implementing the Class which can handle events
CLASS LCL_EVENT_HANDLER IMPLEMENTATION .
*---Handle Double Click
METHOD HANDLE_HOTSPOT_CLICK .
Subroutine to get the HotSpot Cell information.
PERFORM GET_CELL_INFO.
SET PARAMETER ID 'BES' FIELD W_VALUE.
CALL TRANSACTION 'ME23N'.
ENDMETHOD. " HANDLE_HOTSPOT_CLICK
ENDCLASS. " LCL_EVENT_HANDLER
*& Module STATUS_0100 OUTPUT
PBO Event
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'OOPS'.
SET TITLEBAR 'TIT'.
Subroutine to fill the Variant Structure
PERFORM FILL_VARIANT.
IF W_GRID IS INITIAL.
CREATE OBJECT W_GRID
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
I_PARENT = CL_GUI_CONTAINER=>SCREEN0
I_APPL_EVENTS =
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
I_FCAT_COMPLETE = SPACE
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. " IF SY-SUBRC 0
CALL METHOD W_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT = W_VARIANT
I_SAVE = 'A'
I_DEFAULT = 'X'
IS_LAYOUT =
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
IR_SALV_ADAPTER =
CHANGING
IT_OUTTAB = T_OUTTAB
IT_FIELDCATALOG = T_FIELDCAT
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. " IF SY-SUBRC 0.
ENDIF. " IF W_GRID IS INITIAL
CREATE OBJECT W_EVENT_CLICK.
SET HANDLER W_EVENT_CLICK->HANDLE_HOTSPOT_CLICK FOR W_GRID.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
PAI Event
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form PREPARE_FIELD_CATALOG
Subroutine to build the Field catalog
<--P_T_FIELDCAT Field Catalog Table
FORM PREPARE_FIELD_CATALOG CHANGING PT_FIELDCAT TYPE LVC_T_FCAT .
DATA LS_FCAT TYPE LVC_S_FCAT.
Purchasing group...
LS_FCAT-FIELDNAME = 'EKGRP'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Purchasing Document Number...
LS_FCAT-FIELDNAME = 'EBELN'.
LS_FCAT-REF_TABLE = 'EKKO' .
LS_FCAT-EMPHASIZE = 'C411'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-HOTSPOT = 'X'.
APPEND LS_FCAT TO PT_FIELDCAT .
CLEAR LS_FCAT .
Name of Person who Created the Object...
LS_FCAT-FIELDNAME = 'ERNAM'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-OUTPUTLEN = '15' .
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Purchasing Document Date...
LS_FCAT-FIELDNAME = 'BEDAT'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Vendor's account number...
LS_FCAT-FIELDNAME = 'LIFNR'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Account Number of Vendor or Creditor...
LS_FCAT-FIELDNAME = 'NAME1'.
LS_FCAT-REF_TABLE = 'LFA1'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-COLTEXT = 'Vendor Name'(001).
LS_FCAT-SELTEXT = 'Vendor Name'(001).
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Creation date of the change document...
LS_FCAT-FIELDNAME = 'UDATE'.
LS_FCAT-REF_TABLE = 'CDHDR'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-COLTEXT = 'Change Date'(002).
LS_FCAT-SELTEXT = 'Change Date'(002).
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
User name of the person responsible in change document...
LS_FCAT-FIELDNAME = 'USERNAME'.
LS_FCAT-REF_TABLE = 'CDHDR'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-COLTEXT = 'Modified by'(003).
LS_FCAT-SELTEXT = 'Modified by'(003).
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Short Text Describing R/3 Repository Objects...
LS_FCAT-FIELDNAME = 'DDTEXT'.
LS_FCAT-REF_TABLE = 'DD04T'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '15'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Old contents of changed field...
LS_FCAT-FIELDNAME = 'VALUE_OLD'.
LS_FCAT-REF_TABLE = 'CDPOS'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '12'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
New contents of changed field...
LS_FCAT-FIELDNAME = 'VALUE_NEW'.
LS_FCAT-REF_TABLE = 'CDPOS'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '12'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
ENDFORM. " PREPARE_FIELD_CATALOG
*& Form SELECT_PO
Subroutine to select all the Purchase Orders
There are no interface parameters to be passed to this subroutine.
FORM SELECT_PO .
SELECT EBELN " Purchasing Document Number
ERNAM " Name of Person who Created
" the Object
LIFNR " Vendor's account number
EKGRP " Purchasing group
BEDAT " Purchasing Document Date
FROM EKKO
PACKAGE SIZE 10000
APPENDING TABLE T_EBELN
WHERE EBELN IN S_EBELN
AND BEDAT IN S_BEDAT.
ENDSELECT.
IF SY-SUBRC NE 0.
W_FLAG = 1.
MESSAGE S401(M8).
ENDIF. " IF SY-SUBRC NE 0
ENDFORM. " SELECT_PO
*& Form SELECT_OBJ_ID
Subroutine to select Object ID
There are no interface parameters to be passed to this subroutine.
FORM SELECT_OBJ_ID .
IF NOT T_EBELN IS INITIAL.
SELECT OBJECTCLAS " Object Class
OBJECTID " Object value
CHANGENR " Document change number
USERNAME " User name
UDATE " Creation date
FROM CDHDR
INTO TABLE T_CDHDR
FOR ALL ENTRIES IN T_EBELN
WHERE OBJECTID EQ T_EBELN-EBELN
AND UDATE IN S_UDATE
AND TCODE IN ('ME21N','ME22N','ME23N').
ENDSELECT.
IF SY-SUBRC NE 0.
W_FLAG = 1.
MESSAGE S833(M8) WITH 'Header Not Found'(031).
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_EBELN IS INITIAL
ENDFORM. " SELECT_OBJ_ID
*& Form SELECT_CHANGED_VALUE
Subroutine to select Changed Values
There are no interface parameters to be passed to this subroutine.
FORM SELECT_CHANGED_VALUE .
IF NOT T_CDHDR IS INITIAL.
SELECT OBJECTCLAS " Object class
OBJECTID " Object value
CHANGENR " Document change number
TABNAME " Table Name
FNAME " Field Name
VALUE_NEW " New contents of changed field
VALUE_OLD " Old contents of changed field
FROM CDPOS
PACKAGE SIZE 10000
APPENDING TABLE T_CDPOS
FOR ALL ENTRIES IN T_CDHDR
WHERE OBJECTCLAS EQ T_CDHDR-OBJECTCLAS
AND OBJECTID EQ T_CDHDR-OBJECTID
AND CHANGENR EQ T_CDHDR-CHANGENR.
ENDSELECT.
IF SY-SUBRC NE 0.
W_FLAG = 1.
MESSAGE S833(M8) WITH 'Item Not Found'(032).
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_CDHDR IS INITIAL
T_CDPOS_TEMP] = T_CDPOS[.
ENDFORM. " SELECT_CHANGED_VALUE
*& Form SELECT_PUR_DOC
Subroutine to select Purchase Order Details
There are no interface parameters to be passed to this subroutine.
FORM SELECT_PUR_DOC .
IF NOT T_CDPOS IS INITIAL.
SORT T_EBELN BY EBELN.
LOOP AT T_CDPOS INTO FS_CDPOS.
READ TABLE T_EBELN INTO FS_EBELN WITH KEY EBELN =
FS_CDPOS-OBJECTID BINARY SEARCH.
IF SY-SUBRC NE 0.
DELETE TABLE T_EBELN FROM FS_EBELN.
ENDIF. " IF SY-SUBRC NE 0.
ENDLOOP. " LOOP AT T_CDPOS...
LOOP AT T_EBELN INTO FS_EBELN.
MOVE FS_EBELN-EBELN TO FS_EKKO-EBELN.
MOVE FS_EBELN-ERNAM TO FS_EKKO-ERNAM.
MOVE FS_EBELN-LIFNR TO FS_EKKO-LIFNR.
MOVE FS_EBELN-EKGRP TO FS_EKKO-EKGRP.
MOVE FS_EBELN-BEDAT TO FS_EKKO-BEDAT.
APPEND FS_EKKO TO T_EKKO.
ENDLOOP. " LOOP AT T_EBELN...
T_EKKO_TEMP] = T_EKKO[.
ENDIF. " IF NOT T_CDPOS IS INITIAL
ENDFORM. " SELECT_PUR_DOC
*& Form SELECT_VENDOR
Subroutine to select Vendor details
There are no interface parameters to be passed to this subroutine.
FORM SELECT_VENDOR .
IF NOT T_EKKO IS INITIAL.
SORT T_EKKO_TEMP BY LIFNR.
DELETE ADJACENT DUPLICATES FROM T_EKKO_TEMP COMPARING LIFNR.
SELECT LIFNR " Account Number of Vendor or
" Creditor
NAME1 " Name 1
FROM LFA1
INTO TABLE T_LFA1
FOR ALL ENTRIES IN T_EKKO_TEMP
WHERE LIFNR EQ T_EKKO_TEMP-LIFNR.
IF SY-SUBRC NE 0.
MESSAGE S002(M8) WITH 'Master Details'(033).
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_EKKO IS INITIAL
ENDFORM. " SELECT_VENDOR
*& Form DESCRIPTION
Subroutine to get the description
There are no interface parameters to be passed to this subroutine.
FORM DESCRIPTION .
IF NOT T_CDPOS IS INITIAL.
SORT T_CDPOS_TEMP BY TABNAME FNAME.
DELETE ADJACENT DUPLICATES FROM T_CDPOS_TEMP COMPARING TABNAME FNAME
SELECT TABNAME " Table Name
FIELDNAME " Field Name
ROLLNAME " Data element
FROM DD03L
INTO TABLE T_DATAELE
FOR ALL ENTRIES IN T_CDPOS_TEMP
WHERE TABNAME EQ T_CDPOS_TEMP-TABNAME
AND FIELDNAME EQ T_CDPOS_TEMP-FNAME.
IF NOT T_DATAELE IS INITIAL.
T_DATAELE_TEMP] = T_DATAELE[.
SORT T_DATAELE_TEMP BY ROLLNAME.
DELETE ADJACENT DUPLICATES FROM T_DATAELE_TEMP COMPARING ROLLNAME.
SELECT ROLLNAME " Data element
DDTEXT " Short Text Describing R/3
" Repository Objects
FROM DD04T
INTO TABLE T_TEXT
FOR ALL ENTRIES IN T_DATAELE_TEMP
WHERE ROLLNAME EQ T_DATAELE_TEMP-ROLLNAME
AND DDLANGUAGE EQ SY-LANGU.
IF SY-SUBRC NE 0.
EXIT.
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_DATAELE IS INITIAL.
ENDIF. " IF NOT T_CDPOS IS INITIAL.
ENDFORM. " DESCRIPTION
*& Form FILL_OUTTAB
Subroutine to populate the Outtab
There are no interface parameters to be passed to this subroutine.
FORM FILL_OUTTAB .
SORT T_CDHDR BY OBJECTCLAS OBJECTID CHANGENR.
SORT T_EKKO BY EBELN.
SORT T_LFA1 BY LIFNR.
SORT T_DATAELE BY TABNAME FIELDNAME.
SORT T_TEXT BY ROLLNAME.
LOOP AT T_CDPOS INTO FS_CDPOS.
READ TABLE T_CDHDR INTO FS_CDHDR WITH KEY
OBJECTCLAS = FS_CDPOS-OBJECTCLAS
OBJECTID = FS_CDPOS-OBJECTID
CHANGENR = FS_CDPOS-CHANGENR
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_CDHDR-USERNAME TO FS_OUTTAB-USERNAME.
MOVE FS_CDHDR-UDATE TO FS_OUTTAB-UDATE.
READ TABLE T_EKKO INTO FS_EKKO WITH KEY
EBELN = FS_CDHDR-OBJECTID
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_EKKO-EBELN TO FS_OUTTAB-EBELN.
MOVE FS_EKKO-ERNAM TO FS_OUTTAB-ERNAM.
MOVE FS_EKKO-LIFNR TO FS_OUTTAB-LIFNR.
MOVE FS_EKKO-EKGRP TO FS_OUTTAB-EKGRP.
MOVE FS_EKKO-BEDAT TO FS_OUTTAB-BEDAT.
READ TABLE T_LFA1 INTO FS_LFA1 WITH KEY
LIFNR = FS_EKKO-LIFNR
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_LFA1-NAME1 TO FS_OUTTAB-NAME1.
ENDIF. " IF SY-SUBRC EQ 0.
ENDIF. " IF SY-SUBRC EQ 0.
ENDIF. " IF SY-SUBRC EQ 0.
MOVE FS_CDPOS-VALUE_NEW TO FS_OUTTAB-VALUE_NEW.
MOVE FS_CDPOS-VALUE_OLD TO FS_OUTTAB-VALUE_OLD.
READ TABLE T_DATAELE INTO FS_DATAELE WITH KEY
TABNAME = FS_CDPOS-TABNAME
FIELDNAME = FS_CDPOS-FNAME
BINARY SEARCH.
IF SY-SUBRC EQ 0.
READ TABLE T_TEXT INTO FS_TEXT WITH KEY
ROLLNAME = FS_DATAELE-ROLLNAME
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_TEXT-DDTEXT TO FS_OUTTAB-DDTEXT.
ENDIF. " IF SY-SUBRC EQ 0.
ENDIF. " IF SY-SUBRC EQ 0.
APPEND FS_OUTTAB TO T_OUTTAB.
CLEAR FS_OUTTAB.
ENDLOOP.
ENDFORM. " FILL_OUTTAB
*& Form GET_CELL_INFO
Subroutine to get the Cell Information
--> W_VALUE Holds the value of Hotspot clicked
FORM GET_CELL_INFO .
CALL METHOD W_GRID->GET_CURRENT_CELL
IMPORTING
E_ROW =
E_VALUE = W_VALUE
E_COL =
ES_ROW_ID =
ES_COL_ID =
ES_ROW_NO =
ENDFORM. " GET_CELL_INFO
*& Form VALIDATE_PD_NUM
Subroutine to validate Purchase Document Number
There are no interface parameters to be passed to this subroutine.
FORM VALIDATE_PD_NUM .
IF NOT S_EBELN[] IS INITIAL.
SELECT EBELN " Purchase Document Number
FROM EKKO
INTO W_EBELN
UP TO 1 ROWS
WHERE EBELN IN S_EBELN.
ENDSELECT.
IF SY-SUBRC NE 0.
CLEAR SSCRFIELDS-UCOMM.
MESSAGE E717(M8).
ENDIF. " IF SY-SUBRC NE 0
ENDIF. " IF NOT S_EBELN[]...
ENDFORM. " VALIDATE_PD_NUM
*& Form VALIDATE_VEN_NUM
Subroutine to validate Vendor Number
There are no interface parameters to be passed to this subroutine.
FORM VALIDATE_VEN_NUM .
IF NOT S_LIFNR[] IS INITIAL.
SELECT LIFNR " Vendor Number
FROM LFA1
INTO W_LIFNR
UP TO 1 ROWS
WHERE LIFNR IN S_LIFNR.
ENDSELECT.
IF SY-SUBRC NE 0.
CLEAR SSCRFIELDS-UCOMM.
MESSAGE E002(M8) WITH W_SPACE.
ENDIF. " IF SY-SUBRC NE 0
ENDIF. " IF NOT S_LIFNR[]...
ENDFORM. " VALIDATE_VEN_NUM
*& Form VALIDATE_PUR_GRP
Subroutine to validate the Purchase Group
There are no interface parameters to be passed to this subroutine.
FORM VALIDATE_PUR_GRP .
IF NOT S_EKGRP[] IS INITIAL.
SELECT EKGRP " Purchase Group
FROM T024
INTO W_EKGRP
UP TO 1 ROWS
WHERE EKGRP IN S_EKGRP.
ENDSELECT.
IF SY-SUBRC NE 0.
CLEAR SSCRFIELDS-UCOMM.
MESSAGE E622(M8) WITH W_SPACE.
ENDIF. " IF SY-SUBRC NE 0
ENDIF. " IF NOT S_EKFRP[]...
ENDFORM. " VALIDATE_PUR_GRP
*& Form FILL_VARIANT
Subroutine to fill the Variant Structure
There are no interface parameters to be passed to this subroutine
FORM FILL_VARIANT .
Filling the Variant structure
W_VARIANT-REPORT = SY-REPID.
W_VARIANT-USERNAME = SY-UNAME.
ENDFORM. " FILL_VARIANT
REPORT YMS_HIERSEQLISTDISPLAY .
Program with FM REUSE_ALV_HIERSEQ_LIST_DISPLAY *
Author : Michel PIOUD *
Email : mpioudyahoo.fr HomePage : http://www.geocities.com/mpioud *
TYPE-POOLS: slis. " ALV Global types
CONSTANTS :
c_x VALUE 'X',
c_gt_vbap TYPE SLIS_TABNAME VALUE 'GT_VBAP',
c_gt_vbak TYPE SLIS_TABNAME VALUE 'GT_VBAK'.
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max. "#EC NEEDED
PARAMETERS p_max(02) TYPE n DEFAULT '10' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_2 FOR FIELD p_expand. "#EC NEEDED
PARAMETERS p_expand AS CHECKBOX DEFAULT c_x.
SELECTION-SCREEN END OF LINE.
TYPES :
1st Table
BEGIN OF ty_vbak,
vbeln TYPE vbak-vbeln, " Sales document
kunnr TYPE vbak-kunnr, " Sold-to party
netwr TYPE vbak-netwr, " Net Value of the Sales Order
erdat TYPE vbak-erdat, " Creation date
waerk TYPE vbak-waerk, " SD document currency
expand TYPE xfeld,
END OF ty_vbak,
2nd Table
BEGIN OF ty_vbap,
vbeln TYPE vbap-vbeln, " Sales document
posnr TYPE vbap-posnr, " Sales document
matnr TYPE vbap-matnr, " Material number
netwr TYPE vbap-netwr, " Net Value of the Sales Order
waerk TYPE vbap-waerk, " SD document currency
END OF ty_vbap.
DATA :
1st Table
gt_vbak TYPE TABLE OF ty_vbak,
2nd Table
gt_vbap TYPE TABLE OF ty_vbap.
INITIALIZATION.
v_1 = 'Maximum of records to read'.
v_2 = 'With ''EXPAND'' field'.
START-OF-SELECTION.
Read Sales Document: Header Data
SELECT vbeln kunnr netwr waerk erdat
FROM vbak
UP TO p_max ROWS
INTO CORRESPONDING FIELDS OF TABLE gt_vbak.
IF NOT gt_vbak[] IS INITIAL.
Read Sales Document: Item Data
SELECT vbeln posnr matnr netwr waerk
FROM vbap
INTO CORRESPONDING FIELDS OF TABLE gt_vbap
FOR ALL ENTRIES IN gt_vbak
WHERE vbeln = gt_vbak-vbeln.
ENDIF.
PERFORM f_display.
Form F_DISPLAY
FORM f_display.
Macro definition
DEFINE m_fieldcat.
ls_fieldcat-tabname = &1.
ls_fieldcat-fieldname = &2.
ls_fieldcat-ref_tabname = &3.
ls_fieldcat-cfieldname = &4. " Field with currency unit
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_sort.
ls_sort-tabname = &1.
ls_sort-fieldname = &2.
ls_sort-up = c_x.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA:
ls_layout TYPE slis_layout_alv,
ls_keyinfo TYPE slis_keyinfo_alv,
ls_sort TYPE slis_sortinfo_alv,
lt_sort TYPE slis_t_sortinfo_alv," Sort table
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv." Field catalog
ls_layout-group_change_edit = c_x.
ls_layout-colwidth_optimize = c_x.
ls_layout-zebra = c_x.
ls_layout-detail_popup = c_x.
ls_layout-get_selinfos = c_x.
IF p_expand = c_x.
ls_layout-expand_fieldname = 'EXPAND'.
ENDIF.
Build field catalog and sort table
m_fieldcat c_gt_vbak 'VBELN' 'VBAK' ''.
m_fieldcat c_gt_vbak 'KUNNR' 'VBAK' ''.
m_fieldcat c_gt_vbak 'NETWR' 'VBAK' 'WAERK'.
m_fieldcat c_gt_vbak 'WAERK' 'VBAK' ''.
m_fieldcat c_gt_vbak 'ERDAT' 'VBAK' ''.
m_fieldcat c_gt_vbap 'POSNR' 'VBAP' ''.
m_fieldcat c_gt_vbap 'MATNR' 'VBAP' ''.
m_fieldcat c_gt_vbap 'NETWR' 'VBAP' 'WAERK'.
m_fieldcat c_gt_vbap 'WAERK' 'VBAP' ''.
m_sort c_gt_vbak 'KUNNR'.
m_sort c_gt_vbap 'NETWR'.
ls_keyinfo-header01 = 'VBELN'.
ls_keyinfo-item01 = 'VBELN'.
ls_keyinfo-item02 = 'POSNR'.
Dipslay Hierarchical list
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND'
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_sort = lt_sort
i_tabname_header = c_gt_vbak
i_tabname_item = c_gt_vbap
is_keyinfo = ls_keyinfo
TABLES
t_outtab_header = gt_vbak
t_outtab_item = gt_vbap
EXCEPTIONS
program_error = 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.
ENDFORM. " F_LIST_DISPLAY
Form USER_COMMAND *
FORM user_command USING i_ucomm TYPE sy-ucomm
is_selfield TYPE slis_selfield. "#EC CALLED
DATA ls_vbak TYPE ty_vbak.
CASE i_ucomm.
WHEN '&IC1'. " Pick
CASE is_selfield-tabname.
WHEN c_gt_vbap.
WHEN c_gt_vbak.
READ TABLE gt_vbak INDEX is_selfield-tabindex INTO ls_vbak.
IF sy-subrc EQ 0.
Sales order number
SET PARAMETER ID 'AUN' FIELD ls_vbak-vbeln.
Display Sales Order
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDCASE.
ENDFORM. " USER_COMMAND
Kindly Reward Points If You Found The Reply Helpful,
Cheers,
Chaitanya.
Maybe you are looking for
-
How do i add blackberry contacts to i phone 5
I am about to cross from Blackberry Torch 9800 to I-phone 5 but do not know how to move calandar & contacts
-
Book Module format issue with Blurb
I uploaded a book to Blurb with two separate 2 page spreads filled with one photo across the two pages. This first photo appears mismatched with the right side being slightly smaller than the left side. The second photo appears with properly matched
-
Hi Experts, I am facing one problem. I have created one LSMW for upload data in Logistc view for Article master in MM42. I have to upload around 30,000 article, but the LSMW is taking very much time ..more than 18 hrs. Is there any method to fine tun
-
Pre-Paid SMS alerts and confirmations
Depending on the device being used, Pre-Paid services can receive the following alerts and confirmations: Pre-Paid service activation alerts Low credit alerts Main balance expiry alerts (four days before expiry) Bonus and Plus Pack low balance alerts
-
Is it possible to copy a DVD into iTunes and then upload it to my iPad? Is there any way of doing this?