Simple import statement

Hi, I'm new to java and am having, what I believe is a simple error. Any help from a java guru would be much appriciated!
Heres the problem.
Say I have an EXTREMELY simple java class:
public class printer
     public void print()
          System.out.println("Hello!");
that lives in a file named: printer.java
next I have another class that uses the class above (after compiling of course):
import printer;
public class app
     public static void main(String[] args)
          (new printer()).print();
in a file named: app.java
Now, both files ARE in the same directory and even my classpath variable is set for the directory that the two files live in, but every time I try and run javac on the second java file I get the following:
C:\Compu\JAVA\test\Object\app.java:1: '.' expected
import printer;
1 error
Any help would be great! And thanks!

You don't need the import statement, only if the printer class is in another package.

Similar Messages

  • Import statement clashes

    Hi,
    If 2 import statements happen to import the same class implicitly (as opposed to naming the exact class in the import statement), then how does the compiler decide which one is used? Apparently the order of the import statements doesn't matter... already tried that.
    For example:
    //class Test.java
    import java.lang.*; /redundant, but shows that we're importing Object
    import org.omg.CORBA.Object;
    public class Test {
    public static void main(String[] args) {
    Object obj = new String();
    ... here, the compiler complains about "found: java.lang.String" and "required: org.omg.CORBA.Object". Switching the order of the import statements had no effect... same issue. How are name clashes handled with import statements?

    The conflict is not resolved -- if there is any ambiguity the compiler complains. In these cases you need to use the fully qualified class name; e.g. java.lang.Object or org.omg.CORBA.Object -- it's not allowed to use the simple name "Object" because there's no way to know which of the two is meant.

  • Using wildcards in import statement

    I typically use wildcards in my import statements. For example:
    import javax.swing.*;
    Are there any advantages, though, in specifying exactly which classes I am importing?
    For example,
    import javax.swing.JPanel;
    import javax.swing.JLabel;
    import javax.swing.JEditorPane;
    import java.swing.JProgressBar;
    // etc.
    Specigically, is the resulting class file any smaller if I specify exactly which classes to use and does the Java runtime engine load faster if I specify exactly which classes I use in the import statemetents?
    Thanks,

    Import has precisely zero runtime impact. I believe it is used to help locate the specified class at runtime. Take the following 2 simple source files:
    import java.util.Vector;
    //import java.util.*;
    public class VectorTest
         public static void main( String[] args )
              Vector v = new Vector();
              v.add("Item 1");
              v.add("Item 2");
              System.out.println( v.get(1) );
    public class Vector
         public boolean add(Object o)
              return true;
         public Object get(int index)
              return "doh!";
    }1) Run the code as is and "Item 2" is displayed
    2) Recompile the code using the generic import and "doh!" is displayed.
    The point is that by fully qualifying the import statement you are sure you are executing the correct class and not just some class that happens to be lying around somewhere in your classpath.

  • Import statement *not* required?

    Can someone explain this to me? I was following along a
    simple AS3 example (in the design video workshop) where a "Power
    Button" has some MouseEven CLICK event handling applied to it with
    a trace statement as the resulting handled function. Really simple
    basic example. The import statement is import
    flash.events.MouseEvent.
    How come removing the import statement does not produce an
    error?
    Reference:
    import flash.events.MouseEvent;
    myButton.addEventListener(MouseEvent.CLICK, myButtonClicked);
    function myButtonClicked(event:MouseEvent):void {
    trace('do Something');
    }

    midimidi,
    > So to be clear...if the AS is on the main timeline,
    import statements
    > are not needed, and if the AS is external and imported,
    import
    > statements are needed.
    That's a general rule of thumb, but not 100% applicable.
    > Are there any other exceptions to that, or does that go
    for all AS3
    > classes?
    There are exceptions, and the easiest way to find them is to
    leave out
    your import statements and plug away ... sooner or later,
    you'll get a
    compiler error, and then you'll know. :)
    >> It did strike me *** odd though, an imported .as
    file uses the same
    >> publish settings as code on the timeline. So why
    treat them differently?
    FLA files have publish settings, but AS files don't. They're
    just text
    files. I hear what you're saying ... they end up getting
    compiled along
    with / into the some FLA anyway -- and that FLA does have
    classpaths
    listed -- but those same AS files might be compiled in Flex
    Builder 2 or
    some 3rd party compiler. It would probably make good sense to
    require the
    import statement for inline FLA code, but not everyone is a
    hardcore
    programmer, and Adobe knows it. Nothing is *hurt* by using
    import in FLAs,
    but for folks who just want to do light programming, the
    convenience of not
    having to use it is nice.
    David Stiller
    Adobe Community Expert
    Dev blog,
    http://www.quip.net/blog/
    "Luck is the residue of good design."

  • What is import statement for ?

    Hi all,
    Sorry for asking a silly question. Since it is a new to java forum I am asking this.
    What is happening when an import statement is triggered at compile time and at runtime.
    What is the difference/advantages/disadvantages between importing an entire package and importing required classes only.
    Is there any size limit on the generated class file.
    rgds
    Antony Paul

    looks like we are both beguinners
    i just received a newsletter from sun and in it has this
    MONITORING CLASS LOADING AND GARBAGE COLLECTION
    Have you ever wondered what classes are loaded when you launch an application or from where the classes are loaded? Have you ever wondered when garbage collection runs or how long it takes? The java command line tool offers several different command line options that you can use to get answers to those questions.
    You might already be familiar with a number of command line options available with the java command line tool, such as -cp, -Xms, and -Xmx. The -cp option is used for specifying the classpath. The -Xms and -Xmx options are used to specify the heap size. For example, instead of setting the CLASSPATH environment variable, you can use the -cp option to tell the system to look in a specific directory for necessary class files:
    java -cp ExampleDir MyExample
    Here, the system will look in the ExampleDir subdirectory for the MyExample.class file and anything else needed besides the system classes. The ExampleDir in the command line tells the system to look only in the ExampleDir directory (assume that it's the parent directory). If MyExample.class is located in the current working directory, the system would not find it.
    Two less frequently used command line features report on class loading and garbage collection. The -verbose:class option reports when a class is loaded into the Java virtual machine and from where it came. For instance, if you use the -verbose:class option when loading the SwingSet2 demo that comes with the J2SE 1.4.2 SDK, you get a report on the many different classes that are loaded as part of the demo, such the following two:
    java -verbose:class -jar
    C:\j2sdk1.4.2\demo\jfc\SwingSet2\SwingSet2.jar
    [Loaded FilePreviewer]
    [Loaded javax.swing.plaf.TableUI from
         C:\j2sdk1.4.2\jre\lib\rt.jar]
    The first line indicates that the class came from the main JAR for the demo (assuming it was started with java -jar SwingSet2.jar). The second line indicates that the TableUI class was loaded from the rt.jar file that comes with the runtime located in the c:\j2sdk1.4.2\jre directory. (From there, the rt.jar file is located in the lib subdirectory.) Different implementations of the Java platform can have different formats here. The only requirement is that -verbose:class displays messages as classes get loaded and unloaded.
    Let's see when classes are loaded, and how many classes are needed for the following simple program:
    public class Sample {
    public static void main(String args[]) {
    System.out.println("Hello, World");
    Compile the Sample class. Then run it with the -verbose:class option enabled:
    java -verbose:class Sample
    When you run the command, you'll see that this simple program requires the opening of five jar files (such as rt.jar) and the loading of almost 250 classes.
    To see an example of a class unloading message, try the -verbose:class command line option with the RunItReload class shown in the August 19, 2003 Tech Tip titled Unloading and Reloading Classes.
    The -verbose:gc option reports on each garbage collection event. This includes the time for garbage collection to run, and the before and after heap sizes. This is demonstrated in the following lines:
    [GC 27872K->26296K(42216K), 0.0069590 secs]
    [GC 28973K->26455K(42216K), 0.0036812 secs]
    [GC 29134K->26474K(42216K), 0.0016388 secs]
    [GC 29117K->26487K(42216K), 0.0008859 secs]
    [GC 29134K->26498K(42216K), 0.0009197 secs]
    [GC 29180K->26479K(42216K), 0.0008711 secs]
    [GC 29149K->26484K(42216K), 0.0008716 secs]
    Like the output for -verbose:class, there is no requirement for output format, and it is subject to change without notice. The "GC" at the beginning indicates what kind of collection occurred. The number before the "->" is the heap occupancy before the collection. The number after the "->" is the heap occupancy after the collection. The number in parentheses is the currently allocated size of the heap. The seconds are the duration of the collection.
    This information can be useful in debugging. For example, it could help you determine if garbage collection happened at a critical point in time, and might have caused a program to crash. This sometimes happens when mixing Java and C/C++ code with JNI, especially when there is an underlying bug on the C/C++ code side.
    If you're ever curious about why it takes so long for an application to start, or if garbage collection in the middle of an operation appears to cause a problem, be sure to try out these command line options.
    hope it helps

  • How to find export statement for Import statement ?

    hi experts,
    I am having an IMPORT....from memory ID  statement in my program.
    how could i find the location of EXPORT ...to memory ID statement for the IMPORT statement.
    Pls help
    saravanan.

    Not possible if you are just trying to find it without knowing the links between your program and the other programs. You have to know all the objects that relate to the process that your program is automating and then you can probably dig into those related programs to see if there is an EXPORT statement there. But it is not as simple as double clicking on the IMPORT statement or doing a WHERE-USED on the memory ID.

  • Pls help!  How to put JSP import statement...

    Hi, I just created a simple iView JSP that imports htmlb classes and now I'd like to import my own java classes onto it.  For example, in my other projects, my JSP's have <%@ page import="project28.practice.contextClass" %> on top of the page.  I currently have a file called practice.jar 
    If I want to put this import statement into my simple iView JSP and use it, what would I have to do/configure?, do I have to transform it into a .par file?  Or can I  transport the jar file to the portal?  Any changes on NetWeaver?
    I am new to this so any detailed help or suggestions are greatly appreciated!
    Thanks again,
    Baggett

    Hi Detlev, thank you for your response!  I'd like to include more details of my situation right now:  I have 2 projects on NetWeaver:
    Project#1: Java Web application Project. (jar files, WEB-INF, WEB-INF/web.xml, JSP's...)
    Project#2: Portal Application Project. (JSPDynPage, sap plugins, PORTAL-INF/portalapp.xml, JSP)
    I'd want my JSP file in Project#2 to call some classes from the jar files of Project#1. 
    From my understanding, to do this I need to make a .par file out of Project #1 and then upload the par file to my SAP EP6.0 so that my future JSP's can import classes from it.  Am I correct?
    I am confused right now as to how to really do this.  On Netweaver, I am getting a Error when I try to do: File --> New --> Project --> Portal Application --> Create a Portal Application Project > I then enterProject Name: TestProject28, Project root folder: c:\TestProject\webapps\project1 
    --> "ERROR: Invalid project description, Reason:An error has occured while trying to create the project structure"
    If possible can you please provide detailed instructions on how to configure or build a par file out of my java web application stated above?
    Thank you so much for your time and help!
    Baggett

  • Why the need of "import" statements for Java base code?

    If for documentation purposes, a compiler option to produce an "import list" would have been sufficient.

    import statements act as really simple namespaces.
    Instead of the programer having to specify:
    java.io.File f = new java.io.File("c:\\");
    the code can have a 'namespace' added to do the following:
    import java.io.file;
    File f = new File("c:\\);
    it's a way of getting around similiarly named classes, but still have the ability to drop the 'java.io.' part.

  • Cannot resolve import statements

    I recently decided to start messing around with some Java3d. I tried to get an example program to try to dissect but I can't even get past compilation. The main problem is the fact that the import statements cannot be resolved. I thought maybe I was using an outdated example program but upon further inspection of Oracle's own Java3d tutorials I saw the same import statements. I downloaded java3d 1.5.1 because I thought perhaps it wasn't included in the java core classes. This did not help me at all. So maybe it is a problem with the IDE (eclipse) not recognizing them. However, I have had no such success with Google thus far. I realize that this is more than likely a horribly simple mistake that anyone over a novice understanding of Java would be able to spot. But if anyone could help me figure out why I can't compile it would be much appreciated.
    Regards,
    Corey
    Import statements that would not resolve
    import com.sun.j3d.utils.geometry.GeometryInfo;
    import com.sun.j3d.utils.geometry.NormalGenerator;
    import com.sun.j3d.utils.universe.SimpleUniverse;
    import javax.media.j3d.*;
    import javax.vecmath.*;Full program
    import java.awt.Color;
    import com.sun.j3d.utils.geometry.GeometryInfo;
    import com.sun.j3d.utils.geometry.NormalGenerator;
    import com.sun.j3d.utils.universe.SimpleUniverse;
    import javax.media.j3d.*;
    import javax.vecmath.*;
    // An Egyptian pyramid
    // Base divided into two triangles
    public class PyramidExample {
         public static void main(String[] args) {
              SimpleUniverse universe = new SimpleUniverse();
              BranchGroup group = new BranchGroup();
              Point3f e = new Point3f(1.0f, 0.0f, 0.0f); // east
              Point3f s = new Point3f(0.0f, 0.0f, 1.0f); // south
              Point3f w = new Point3f(-1.0f, 0.0f, 0.0f); // west
              Point3f n = new Point3f(0.0f, 0.0f, -1.0f); // north
              Point3f t = new Point3f(0.0f, 0.721f, 0.0f); // top
              TriangleArray pyramidGeometry = new TriangleArray(18,
                        TriangleArray.COORDINATES);
              pyramidGeometry.setCoordinate(0, e);
              pyramidGeometry.setCoordinate(1, t);
              pyramidGeometry.setCoordinate(2, s);
              pyramidGeometry.setCoordinate(3, s);
              pyramidGeometry.setCoordinate(4, t);
              pyramidGeometry.setCoordinate(5, w);
              pyramidGeometry.setCoordinate(6, w);
              pyramidGeometry.setCoordinate(7, t);
              pyramidGeometry.setCoordinate(8, n);
              pyramidGeometry.setCoordinate(9, n);
              pyramidGeometry.setCoordinate(10, t);
              pyramidGeometry.setCoordinate(11, e);
              pyramidGeometry.setCoordinate(12, e);
              pyramidGeometry.setCoordinate(13, s);
              pyramidGeometry.setCoordinate(14, w);
              pyramidGeometry.setCoordinate(15, w);
              pyramidGeometry.setCoordinate(16, n);
              pyramidGeometry.setCoordinate(17, e);
              GeometryInfo geometryInfo = new GeometryInfo(pyramidGeometry);
              NormalGenerator ng = new NormalGenerator();
              ng.generateNormals(geometryInfo);
              GeometryArray result = geometryInfo.getGeometryArray();
              // yellow appearance
              Appearance appearance = new Appearance();
              Color3f color = new Color3f(Color.yellow);
              Color3f black = new Color3f(0.0f, 0.0f, 0.0f);
              Color3f white = new Color3f(1.0f, 1.0f, 1.0f);
              Texture texture = new Texture2D();
              TextureAttributes texAttr = new TextureAttributes();
              texAttr.setTextureMode(TextureAttributes.MODULATE);
              texture.setBoundaryModeS(Texture.WRAP);
              texture.setBoundaryModeT(Texture.WRAP);
              texture.setBoundaryColor(new Color4f(0.0f, 1.0f, 0.0f, 0.0f));
              Material mat = new Material(color, black, color, white, 70f);
              appearance.setTextureAttributes(texAttr);
              appearance.setMaterial(mat);
              appearance.setTexture(texture);
              Shape3D shape = new Shape3D(result, appearance);
              group.addChild(shape);
              // above pyramid
              Vector3f viewTranslation = new Vector3f();
              viewTranslation.z = 3;
              viewTranslation.x = 0f;
              viewTranslation.y = .3f;
              Transform3D viewTransform = new Transform3D();
              viewTransform.setTranslation(viewTranslation);
              Transform3D rotation = new Transform3D();
              rotation.rotX(-Math.PI / 12.0d);
              rotation.mul(viewTransform);
              universe.getViewingPlatform().getViewPlatformTransform().setTransform(
                        rotation);
              universe.getViewingPlatform().getViewPlatformTransform().getTransform(
                        viewTransform);
              // lights
              BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0),
                        1000.0);
              Color3f light1Color = new Color3f(.7f, .7f, .7f);
              Vector3f light1Direction = new Vector3f(4.0f, -7.0f, -12.0f);
              DirectionalLight light1 = new DirectionalLight(light1Color, light1Direction);
              light1.setInfluencingBounds(bounds);
              group.addChild(light1);
              Color3f ambientColor = new Color3f(.4f, .4f, .4f);
              AmbientLight ambientLightNode = new AmbientLight(ambientColor);
              ambientLightNode.setInfluencingBounds(bounds);
              group.addChild(ambientLightNode);
              universe.addBranchGraph(group);
    }

    Hi,
    - The latest Java 3D release is *1.5.2*. Uninstall older versions.
    - Java 3D home: http://java3d.java.net/
    - Java 3D project: http://java.net/projects/java3d
    - Java 3D downloads: http://java3d.java.net/binary-builds.html
    - Start with one of the Java 3D examples from "j3d-examples-1_5_2-src.zip"
    - Use eclipse *3.6.2*, it should recognize Java 3D's jars if they are installed in '..\jre\lib\ext\'. See also Java3D + Newer Eclipse Version -> Access Restriction (solution + question)
    August

  • Filename in import statement

    Hi srinivas bobbala,
    Thank you for your response.But I think my quesition was not clear.My ques... is for suppose there is one datafile for importing like.. "datafile_21" Here my intention is it takes file from datafile_21 only but it appears in import statement like datafile_21<<curmon>>.
    import database sample.sample data from data_file "c:\\ABC\datafile_21_AUG.txt" using server rules_file datafile on error abort;
    In this it takes datafile from datafile_21.But it appears like datafile_21_AUG in import statement.This AUG coming from batch file.
    Essmsh c:\\ABC\loadmxl.mxl %curmon%

    No it is not possible.
    I assume the data file "datafile_21" is first renamed to datafile_21_${CurrMth} in the batchscript.
    After that this data file *datafile_21_${CurrMth}* is pointed in the import statement.
    In the logs you will see this file as datafile_21_Aug.

  • Import Statement Different ways to refer ???

    Dear Friends,
    Can any one help me the difference between the usage of import statement....
    1. using import statement
    2. using the class directly
    that is,
    for example ;
    1. import java.util.Date;
    Date dt = new Date();
    2. java.util.Date dt = new java.util.Date();
    what's the difference between two reference of Date class...is there any meaning beyond this ?????
    Regards,
    V.Prasanna

    what's the difference between two reference of Date
    class...is there any meaning beyond this ?????there is no difference once the code is compiled - the compiler resolves single class names to their fully-qualified names (ie with the package prefix) and that appears in the .class file constant pool
    before compilation then my opinion is that having all the imports at the top of the file is good practice because you can see what is being used easily

  • Import Statement Error

    Does anyone know what is wrong with these import statement?
    import Reduction;
    import Mapper;
    import ApplyObj;
    import ApplyObjUnary;
    import java.lang.String;
    public class Driver{
    public static Driver me = new Driver();
    public static void main(String[] args){
    int i;
    I places all my *.java file in the same directory as Driver.java
    But when i try to compile Driver.java, it says :-
    C:\assignment1>javac Driver.java
    Driver.java:10: '.' expected
    import Reduction;
    ^
    Driver.java:11: '.' expected
    import Mapper;
    ^
    Driver.java:12: '.' expected
    import ApplyObj;
    ^
    Driver.java:13: '.' expected
    import ApplyObjUnary;
    ^
    4 errors
    I set my class path as
    C:\>SET CLASSPATH = .;C:\j2sdk1.4.0_01;c:\assignment1
    Apparently, the current directory has been set and my assignment1 directory has been set.
    Did i miss out anything? Why does it can't recognize the existence of other class file in the same directory?
    thanks.

    You don't need to import classes that are in the default package (i.e. you didn't put them in a package). And in Java 1.4, you can't import them. Just remove the import statements, you shouldn't need them.

  • IMPORT Statement Issue (Internal Table)

    Hi All,
    I am using an IMPORT statement to get all the data from other report's internal table. Now whenever this (the other report's internal table) is changed (for field addition, etc), my report throws a dump. Hence, everytime I have to add these fields in my program as well.
    Is there any way by which I can include the whole internal table of that report in my program just like
    'INCLUDE STRUCTURE VBRK'.
    Thanks in advance

    Hi, CHeck this code related to your problem..This will helpful to you...
    I have done this program earlier..I hope it will helpful to u..
    This programa calling the other program to import the data..
    Check it out...
    *" Tables declarations.................................................
    TABLES:
      spfli.
    *" Type declarations...................................................
    Type declaration of the structure to hold data from table SPFLI     *
    TYPES:
      BEGIN OF type_s_spfli,
        carrid LIKE spfli-carrid,          " Carrier Id
        connid LIKE spfli-connid,          " Connection Number
        cityfrom LIKE spfli-cityfrom,      " City from
        cityto LIKE spfli-cityto,          " City to
        airpfrom LIKE spfli-airpfrom,      " Airport from
        airpto LIKE spfli-airpto,          " Airport to
        countryfr LIKE spfli-countryfr,    " Country from
        countryto LIKE spfli-countryto,    " Country to
      END OF type_s_spfli.
    Data Declaration...................................................*
         Field String To Hold Flight Details Record from SPFLI          *
    DATA
      fs_spfli TYPE type_s_spfli.
    Data Declaration...................................................*
         Internal Table To Hold Flight Details Records from SPFLI       *
    DATA
      t_spfli LIKE STANDARD TABLE OF fs_spfli.
    TYPES:
      BEGIN OF types_s_itab,
        carrid LIKE sflight-carrid,        " Carrier id
        connid LIKE sflight-connid,        " Connection number
        fldate LIKE sflight-fldate,        " Flight date
      END OF types_s_itab.
    Data Declaration...................................................*
         Field String To Hold Flight Details Record from SFLIGHT        *
    DATA
      fs_itab TYPE types_s_itab.
    Data Declaration...................................................*
         Internal Table To Hold Flight Details Records from SFLIGHT     *
    DATA
      t_itab LIKE STANDARD TABLE OF fs_itab.
    *" Type declarations...................................................
    Type declaration of the structure to hold data from table SBOOK     *
    TYPES:
    BEGIN OF type_s_sbook,
       carrid LIKE sbook-carrid,           " Carrier Id
       connid LIKE sbook-connid,           " Connection Number
       fldate LIKE sbook-fldate,           " Flight date
       bookid LIKE sbook-bookid,           " Booking number
       loccuram LIKE sbook-loccuram,       " Local currency
       loccurkey LIKE sbook-loccurkey,
       order_date LIKE sbook-order_date,   " Booking date
    END OF type_s_sbook.
    Data Declaration...................................................*
         Field String To Hold Flight Details Record from BOOK           *
    DATA
      fs_sbook TYPE type_s_sbook.
    Data Declaration...................................................*
         Internal Table To Hold Flight Details Records from SBOOK       *
    DATA
      t_sbook LIKE STANDARD TABLE OF fs_sbook.
    DATA
      w_checkbox.                          " Checkbox
    SELECT-OPTIONS:
      s_carr FOR spfli-carrid.             " Carrier id range
                          START-OF-SELECTION EVENT                      *
    START-OF-SELECTION.
      PERFORM selectq.
                          END-OF-SELECTION EVENT                        *
    END-OF-SELECTION.
      SET PF-STATUS 'YH1314_030502'.
      PERFORM display_basic.
    AT USER-COMMAND.
      PERFORM ucomm.
    *&    Form  selectq
        This subroutine retreive data from SPFLI table
      There are no interface parameters to be passed to this subroutine.
    FORM selectq .
      SELECT carrid                        " Carrier id
             connid                        " Connection number
             cityfrom                      " City from
             cityto                        " City to
             airpfrom                      " Airport from
             airpto                        " Airport to
             countryfr                     " Country from
             countryto                     " Country to
             INTO CORRESPONDING FIELDS OF TABLE t_spfli
             FROM spfli
             WHERE carrid IN s_carr.
    ENDFORM.                               " Selectq
    *&      Form  display_basic
        This subroutine displays data from internal table
      There are no interface parameters to be passed to this subroutine.
    FORM display_basic .
      LOOP AT t_spfli INTO fs_spfli.
        WRITE:
          / w_checkbox AS CHECKBOX,
            fs_spfli-carrid,
            fs_spfli-connid,
            fs_spfli-cityfrom,
            fs_spfli-cityto,
            fs_spfli-airpfrom,
            fs_spfli-airpto,
            fs_spfli-countryfr,
            fs_spfli-countryto.
      ENDLOOP.                             " LOOP AT T-SPFLI INTO...
    ENDFORM.                               " Display_basic
    *&      Form  UCOMM
      This subroutine for at user-command event
      There are no interface parameters to be passed to this subroutine.
    FORM ucomm .
      RANGES :
        r_carr FOR spfli-carrid,
        r_conn FOR spfli-connid,
        r_carrid FOR sflight-carrid,
        r_connid FOR sflight-connid,
        r_fldate FOR sflight-fldate.
      CASE sy-ucomm.
        WHEN 'DISPLAY'.
          DATA:
            lw_lines TYPE i,
            lw_lineno TYPE i VALUE 3.
          DESCRIBE TABLE t_spfli LINES lw_lines.
          DO lw_lines TIMES.
            READ LINE lw_lineno FIELD
                 VALUE w_checkbox   INTO w_checkbox
                       fs_spfli-carrid INTO  fs_spfli-carrid
                       fs_spfli-connid INTO  fs_spfli-connid.
            IF sy-subrc = 0.
              IF w_checkbox = 'X'.
                r_carr-sign = 'I'.
                r_carr-option = 'EQ'.
                r_carr-low = fs_spfli-carrid.
                APPEND r_carr.
                r_conn-sign = 'I'.
                r_conn-option = 'EQ'.
                r_conn-low = fs_spfli-connid.
                APPEND r_conn.
              ENDIF.                       " IF W_CHECKBOX = 'X'
            ENDIF.                         " IF SY-SUBRC = 0
            ADD 1 TO lw_lineno.
          ENDDO.                           " DO LW_LINES TIMES
          SUBMIT yh1314_030502_call
            WITH s_carr IN r_carr
            WITH s_conn IN r_conn
             AND RETURN.
          IMPORT t_itab FROM MEMORY ID 'YH1314'.
          LOOP AT t_itab INTO fs_itab.
            r_carrid-sign = 'I'.
            r_carrid-option = 'EQ'.
            r_carrid-low = fs_itab-carrid.
            APPEND r_carrid.
            r_connid-sign = 'I'.
            r_connid-option = 'EQ'.
            r_connid-low = fs_itab-connid.
            APPEND r_connid.
            r_fldate-sign = 'I'.
            r_fldate-option = 'EQ'.
            r_fldate-low = fs_itab-fldate.
            APPEND r_fldate.
          ENDLOOP.                         " LOOP AT T_ITAB INTO.....
          SELECT carrid                    " Carriee Id
                 connid                    " Connection number
                 fldate                    " Flight date
                 bookid                    " Booking number
                 loccuram                  " Local Currency
                 order_date                " Booking date
             INTO CORRESPONDING FIELDS OF TABLE t_sbook
             FROM sbook
             WHERE carrid IN r_carrid AND
                   connid IN r_connid AND
                   fldate IN r_fldate.
          IF SY-SUBRC NE 0.
            MESSAGE 'NO RECORDS FOUND'(006) TYPE 'S'.
          ENDIF.                           " IF SY-SUBRC NE 0
          LOOP AT t_sbook INTO fs_sbook.
            AT FIRST.
              WRITE: /5 'Carrier Id'(001),
                     20 'Conn Id'(002),
                     35 'Flight date'(003),
                     50 'Book Id'(004),
                     65 'Local Currency'(005).
            ENDAT.                         " AT FIRST
            WRITE: /5 fs_sbook-carrid,
                   20 fs_sbook-connid,
                   35 fs_sbook-fldate,
                   50 fs_sbook-bookid,
                   65 fs_sbook-loccuram CURRENCY fs_sbook-loccurkey.
          ENDLOOP.                         " LOOP AT T_SBOOK INTO.....
      ENDCASE.                             " CASE SY-UCOMM
    ENDFORM.                               " UCOMM
    Regards
    Kiran

  • Import statement is not working

    hi everybody,
    I have a directory under which I have a number of sub-directories. Lets call this directory "parent_directory". under this directory I have another directory called "child_1". Under "child_1" I have another subdirectory called "child_2". Now I have a code in child_2 that has the following statement:
    import program_1;
    //this is a program present in the parent directory. lets call it
    //program_1.java
    when I am compiling I am getting an error saying:
    program_2.java:28: '.' expected
    import program_1;
    ^
    1 error
    program_2.java is the program present in child_2 in which I have included the import statement.
    If I change the ";" to "." then again error appears as the import statement only needs the name of the class and doesnot need the extension.
    I will be very grateful to you if you could please suggest me a way around this.

    This questions belongs in the "New to Java" forum ...
    sigh
    Anyways, import works on package names with trailing * or full qualified class names, e.g.import mypackage1.*; // imports all classes in mypackage1
    import mypackage2.MyClass2; // imports MyClass2 from mypackage2So instead of import program_1; you need to do
    1. ensure that program_1 is in some package
    2. ensure that your directory structure mirrors your package structure (same names!)
    3. ensure that your CLASSPATH is either not set at all or points to the parent dir of your topmost package
    Example:
    Directory structure:C:\tmp\java\top\
    C:\tmp\java\top\MyClass1.java
    C:\tmp\java\top\bottom\
    C:\tmp\java\top\bottom\MyClass2.java
    CLASSPATH=".;<java install dir>\jre\lib\rt.jar;C:\tmp\java"Source for MyClass1.java:package top;
    public class MyClass1 {
    }Source for MyClass2.java:package top.bottom;
    import top.MyClass1;
    public class MyClass2 {
      private MyClass1 myClass1;
    }

  • Import Statement without ID Specification

    There is an import statement
    IMPORT tab g_acc_tab FROM MEMORY.
    While UCChecking it.. it saying that
    import statement without id specification is only used for the sake of r/2 ......
    Can i Comment it ? If so won't my application  go into dump while running on 6.0cc???

    It has to do with packages. Most java classes are in a package, the name of which must conform to its place on the filesystem relative to the classpath. By that I mean that if you have com.mystuff.One.java, it must be in a folder com/mystuff where com is located somewhere in the classpath.
    What you've done is a little different. I'm assuming a couple of things:
    1. you have no package declaration at the top of one.java or two.java
    2. you have the current directory "." in your classpath.
    Java has the concept of the "default package", which covers classes without a declared package, and in your case is the current directory.
    So when you're in c:\sourcefolder and run the compiler, then "."="c:\sourcefolder", and that directory is part of the default package. No import statements are necessary for classes that are in the same package. This is why two.java can call methods in one.java without an import statement.
    When you run your jsp, the "current directory" part of your classpath is not c:\sourcefolder, but some other value (probably the directory you start your jsp engine from) You will have to import all non-java-library classes because the jsp itself becomes a java class, with a package that is determined by the jsp engine.

Maybe you are looking for

  • Iweb not opening at all

    The application Iweb quit unexpectedly, Mac OS X and other applicatioms are not affected. Click Relaunch to launch the application again. I was working on a new website and downloaded and was testing out a bunch of new fonts, when i tried to open Iwe

  • Error during Goods receipt posting

    Hi all I'm getting  the following error message when trying to do a goods receipt (101 mvmt)... Account determination for entry COA BSX ____ ___ 7900 not possible Diagnosis The system did not find an account for this transaction. This means that the

  • How to Rebuild OS X Server

    I need to rebuild my OS X Server, and I'd like to do this from scratch without resorting to migration assistant tools. Briefly, my server crashes every 3-5 days, whether booting from an internal HD or an external CCC clone. Getting it to work after t

  • Almost there - Java 1-1 mapping - but no binding

    Hi I am trying to create a 1-1 mapping for the latest event for a service, and am able to create a new OneToOneMapping in an amendment event for the service descriptor. This generates almost the correct SQL. OneToOneMapping latestEventMapping = new O

  • Firefox always opens in offline mode. OS is Ubuntu 10.04 LTS

    I have a laptop Dell Vostro where Ubuntu 10.04 LTS desktop version is loaded. I am facing this problem since day before y'day.