Create Global Class Definition using Local Class Source Code

I would like to be able to automate the creation of global class definitions using source code that is defined in a text file (one example: convert a local class def to a global class def).
Does SAP deliver this functionality?  (I'm already aware of the various classes that can be used to create global classes and how those classes can be implemented in a program to generate new classes.  I'm hoping to avoid having to create a custom solution.)
Thanks in advance!

We have a winner!
Thanks Rich!
It's not a 100% solution - I was hoping to be able to generate global classes/interfaces using source code alone, without requiring user intervention.
It <i>is</i> however, a 90-95% solution because debugging SE24 reveals that by using a combination of the FM's SCAN_ABAP_OBJECTS_CLASSES & SEO_CLIF_MULTI_IMPORT, I should be able to <u>quickly</u> put together that custom application that I was trying to avoid.
I knew about the existance of SEO_CLIF_MULTI_IMPORT but I did not know about SCAN_ABAP_OBJECTS_CLASSES.  I'm very happy to learn that I'm not going to have to write a parser!

Similar Messages

  • When is it best to use Local Classes..?

    Hi All,
           We all know that a global class creation is very helpful wherein the class can be reused by multiple programs.In contrast when is it best to use a local class within the program...?
    Can anyone please share the sample scenarios where we need to make use of a local class...?
    Cheers
    Nishanth

    Hi Nishanth,
    First of all, there will be a few cases when creating a local class in your program is mandatory. For example,
    if you're using an ALV Grid on your screen using the OO Approach, then you <b>must</b> declare a class locally in
    your program if you want to handle the events. You cannot use a subroutine in this case.
    Secondly, if you are looking for an explanation that is more introductory in nature, then the ABAP Programming
    help has got some good documentation. Here are the links which explain the concepts with an example as a
    transition from function groups to classes -
    http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    Regards,
    Anand Mandalika.

  • Is there a way to create a structure or a local class inside of another?

    In VB you can create a private type I believe in C++ it's called a struct I was wondering is there a way with Java to create a local class or structure to store variables in a group inside of another class. I'd rather have them in an structure for readability.

    you can do something like this.
    public class MyStruct {
    public String name;
    public int number;
    public double value;
    public class Test {
    private MyStruct struct = new MyStruct();
    private void setValue() {
    struct.name = "my name";
    struct.number = 1;
    struct.value = 20.0;
    public void setStruct(MyStruct newStruct)
    struct = newStruct;
    };

  • Create frozen alv grid using salv* classes

    Hi Experts,
    I want to create a frozen alv grid i.e the row selections are defined in the code and should not be able to modify on the screen . Please let me know if it is possible ? I am using salv* class for alv.
    Thanks,
    Kiran A.

    Hi,
    You mean "preventing" the user to change the selection set or just not allowing him to change some rows content?
    If you speak about selection only, I don't think this is feasible... (or a silly idea: highlight the rows instead of selecting them
    Kr,
    Manu.

  • Help! - JRE can't find classes that use inner classes!

    Whenever I try to launch an app using the JRE, if the class was built with an inner class definition, the JRE says it can't find the class.
    For instance:
    I created a class called GUI, which contains anonymous inner class definitions for the button handlers: addActionListener(new ActionListener()){, etc. 
    When I compile this class I get GUI.class and GUI$1.class
    When I try to launch this using the JRE:
    jre -cp c:\progra~1\myApps GUI
    The JRE spits out
    'Class not found: GUI'
    BUT if I go back and remove the action handlers so that the only compiled class file is GUI.class (not GUI$1.class) then the JRE can find the class no problem.
    What in the good Lord's name is going on here?

    Thanks for the response. Got the 1.2.2 version of the JRE, where I guess you no longer invoke jre.exe (no such file exists) but java.exe instead (not well documented).
    Also, the newer version of the JRE has no problems locating classes, so I guess I'm OK.

  • Custom class loader and local class accessing local variable

    I have written my own class loader to solve a specific problem. It
    seemed to work very well, but then I started noticing strange errors in
    the log output. Here is an example. Some of the names are in Norwegian,
    but they are not important to this discussion. JavaNotis.Oppstart is the
    name of my class loader class.
    java.lang.ClassFormatError: JavaNotis/SendMeldingDialog$1 (Illegal
    variable name " val$indeks")
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:431)
    at JavaNotis.Oppstart.findClass(Oppstart.java:193)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
    at JavaNotis.SendMeldingDialog.init(SendMeldingDialog.java:78)
    at JavaNotis.SendMeldingDialog.<init>(SendMeldingDialog.java:54)
    at JavaNotis.Notistavle.sendMelding(Notistavle.java:542)
    at JavaNotis.Notistavle.access$900(Notistavle.java:59)
    at JavaNotis.Notistavle$27.actionPerformed(Notistavle.java:427)
    JavaNotis/SendMeldingDialog$1 is a local class in the method
    JavaNotis.SendMeldingDialog.init, and it's accessing a final local
    variable named indeks. The compiler automatically turns this into a
    variable in the inner class called val$indeks. But look at the error
    message, there is an extra space in front of the variable name.
    This error doesn't occur when I don't use my custom class loader and
    instead load the classes through the default class loader in the JVM.
    Here is my class loading code. Is there something wrong with it?
    Again some Norwegian words, but it should still be understandable I hope.
         protected Class findClass(String name) throws ClassNotFoundException
             byte[] b = loadClassData(name);
             return defineClass(name, b, 0, b.length);
         private byte[] loadClassData(String name) throws ClassNotFoundException
             ByteArrayOutputStream ut = null;
             InputStream inn = null;
             try
                 JarEntry klasse = arkiv.getJarEntry(name.replace('.', '/')
    + ".class");
                 if (klasse == null)
                    throw new ClassNotFoundException("Finner ikke klassen "
    + NOTISKLASSE);
                 inn = arkiv.getInputStream(klasse);
                 ut = new ByteArrayOutputStream(inn.available());
                 byte[] kode = new byte[4096];
                 int antall = inn.read(kode);
                 while (antall > 0)
                     ut.write(kode, 0, antall);
                     antall = inn.read(kode);
                 return ut.toByteArray();
             catch (IOException ioe)
                 throw new RuntimeException(ioe.getMessage());
             finally
                 try
                    if (inn != null)
                       inn.close();
                    if (ut != null)
                       ut.close();
                 catch (IOException ioe)
         }I hope somebody can help. :-)
    Regards,
    Knut St�re

    I'm not quite sure how Java handles local classes defined within a method, but from this example it seems as if the local class isn't loaded until it is actually needed, that is when the method is called, which seems like a good thing to me.
    The parent class is already loaded as you can see. It is the loading of the inner class that fails.
    But maybe there is something I've forgotten in my loading code? I know in the "early days" you had to do a lot more to load a class, but I think all that is taken care of by the superclass of my classloader now. All I have to do is provide the raw data of the class. Isn't it so?

  • Jars and .class files - security of the source code

    Hi,
    I have an app that is in a jar file with the .class files (so no source code).
    I'm wondering how difficult it is to attain the source code from these .class files in my jar? Looking through the contents of the .class files it seems there is a large amount of readable text. For example I see method names, variables, etc.
    This leads me to believe these jars are not secure. What is a better way?
    Thanks!
    Edit:
    Looking around, I've noticed many java decompilers and Sun even supports a dissembler - javap. I think this is not cool, haha.
    What way can I protect my code? To me, the value of java just went way down due to the ease at attaining source code (based on what I read in the past hour or so. I have yet to try it myself). I wonder if this impacts companies reasons not to use java?
    Edit 2:
    I heard that there may be a way to make the jar closed, so you can't say, use winrar, to extract the class files. Does anyone know anything about this?
    Message was edited by:
    dayrinni
    Message was edited by:
    dayrinni

    Hi,
    I have an app that is in a jar file with the .class
    files (so no source code).
    I'm wondering how difficult it is to attain the
    source code from these .class files in my jar?
    Looking through the contents of the .class files it
    seems there is a large amount of readable text. For
    example I see method names, variables, etc.
    This leads me to believe these jars are not secure.
    What is a better way?
    Thanks!
    Edit:
    Looking around, I've noticed many java decompilers
    and Sun even supports a dissembler - javap. I think
    this is not cool, haha.
    What way can I protect my code? To me, the value of
    java just went way down due to the ease at attaining
    source code (based on what I read in the past hour or
    so. I have yet to try it myself). I wonder if this
    impacts companies reasons not to use java?All intellectual property stored in electronic form is vulnerable. Not just Java bytecode. You can use tools called obfuscators to make decompiling more difficult, which is usually good enough. The truth is, no matter how great you think your code is, it's of a lot less interest to others than you actually think. Unless you've got a particularly sexy argorithm or something, it's not really worth worrying too much about
    All you can do is make it more difficult for people to crack things, never prevent it. True of all languages, all electronic media

  • What is the syntax for creating global temporary table using a select query

    hii
    I'm creating a global temporary table using a select query ..how to mention 'on commit preserve rows' that?
    create global temporary table t1 as select * from trn_ordbase on commit preserve rows;
    but this is invalid syntax,so how to mention on commit preserve rows in this???if i dont mention it ,by default its considering as on commit delete rows.
    Please help me out of this problem.

    create global temporary table t1 as select * from trn_ordbase on commit preserve rows;You CANNOT use this syntax.
    http://download-east.oracle.com/docs/cd/B19188_01/doc/B15917/sqcmd.htm
    http://download-east.oracle.com/docs/cd/B19188_01/doc/B15917/glob_tab.gif
    http://download-east.oracle.com/docs/cd/B19188_01/doc/B15917/cre_tabl.gif

  • Default implementations of JPDK V2 classes and interfaces - is the source code?

    Hi
    Is the source code for all the default implementations of the JPDK interfaces, renderers etc. available somewhere?
    Regards
    Harry

    Please find jpdk samples sources for jpdk implementation under src.zip inside PDK.zip
    In addition, one can many articles related to PDK under articles folder.

  • Problem in creating EJB and WebService using complex class structure

    Hi All,
    My requirement is like :
    I have a class with very complex structure.
    I have also used external .jars.
    Now when I have created an EJB with a method's return parameter as above class.
    But when I am creating a Webservice, it doesnot allow me to select this method.
    Not able to configure why ?
    Please Help.
    Thanks.

    Hi,
    I have gone through your code and the problem is that when you create jar it takes a complete path address (which is called using getAbsolutePath ) (when you extract you see the path; C:\..\...\..\ )
    You need to truncate this complete path and take only the path address where your files are stored and the problem must be solved.

  • How to create global Contact list using OSX Server Contacts Service?

    My goal is to create a global contact list for the use of my department at work. We currently have 5 MBP's and a Mac Mini Server running OSX Server.
    I have read so many forum posts and so called "solutions" that my head is completly spinning... like a record... right round... you get the idea.
    I talked with Apple Support, and they are going to walk me through the process of changing our network from "local" to a legitimate internet network. Enabling DNS and setting up open directory are some of the steps, and all in all i was impressed with the support i received. We did a complete walkthough of all the steps it would take to change everything, without actually making any changes (because I could not shut down the company server at the time I called).
    All that being said, I have been reading that actually creating and sharing a global contact list (and enabling specific user access for read/write for said list) is not as simple as Apple is telling me. I have read so many horror stories about not being able to edit the list, having duplicate lists and entries, and many other problems. It seems that this "Contact Service" is not really what its billed as.
    Im just looking for someone who has this already setup to shine some light on my questions/concerns. I have scoured the internet for information, and either i'm looking in the wrong place or I just happen to have the WORST possible combination of OS X versions, server versions and so on. I would expect a company who charges such high prices for its products to design them to ACTUALLY WORK how they are advertised to work!
    Thanks in advance and a thousand kudos to anybody that can help!!!
    -John

    That sounds like one viable option...
    The only problem is that I'm not sure how that would behave once the client MBP's are taken off site and connect to the network over a VPN or something of that sort.
    I figure since we have purchased the Server App and it contains the Contacts Service, I should try and get it to work that way (through that specific service on the server app).
    I would really prefer to not have to install yet another piece of software just to do something that should already work (or have the ability to be configured to work). None of us here are "Power Users", and we are all learning as we go and I got the role of the "IT Guy" when it comes to setting everything up. I'm dealing with lifetime Windows users here, and I feel there is a need to keep everything literally as easy as possible to use.
    I will keep your solution in the front of my mind though, as it sounds like that may work. I am not exactly 100% familiar with the OSX Server or the Mac OS yet, and I'm not positive where you would add the users (I couldn't just sit down and do what you suggested, i unfortunately would need a step by step solution so I don't fuss up our entire system).
    If you feel like giving a step by step, that would be awesome just for future reference or for anyone else having similar problems. If not, I don't blame you at all.
    Thanks for your reply, and if I find a clear-cut solution I will post it here!
    Thanks,
    J_Semp

  • Using Open Dental source code

    I am currently building a site in Muse for a dentist. They would like to have new patients use the website to fill out registration forms. They are planning to use Open Dental internally and if the patients can fill the forms out online, it will import right into their internal systems. Does anyone have any experience with this? I know very little about code, which is why I love Muse so much.
    I didn't find the website very helpful, since it talks a lot about code.
    http://www.opendental.com/
    Help, please!
    Sarah

    Hi Sarah,
    I am not familiar with Open Dental but generally any third party system that provides you with embed code will most likely work no problem.
    I am not sure if Open Dental is run by the same people that have Open Table Dining Reservation system ... the systems seem fairly similiar and Open Table can easily be added to a Muse site.

  • Policy regarding creating global or local classes?

    Hi!
    What policy do you have regarding creating local or global classes in your company? We have decided to mostly use local classes since there is a risk of reusing global classes (when changing something in the global class after it has been used by several programs etc.) . But on the other side it is much easier to use transaction SE24 than creating all the includes by hand.  Have anyone else made thoughts about this issue?
    Regards, Tine

    Hi,
    The policy is
    <b>Create global class</b> if you want the class to be <b>reused</b>.
    And<b> to avoid problems</b> when you change the class, make sure you change class in such a way that it does not effect the existing user's of the class.
    Like <b>use OPTIONAL parameters</b> when you change method signature, <b>avoid changing method names</b>, <b>instead add new methods</b>.
    You should use local classes only when you are sure that the code there is needed only by your program and nobody else.
    If you keep creating local class's and <b>if two programs need the same class it is redundant to create local class's</b> and if you want a change in the class you have to change in all the places.
    I hope it is clear.
    Regards,
    Sesh

  • Create web service using java class

    Hi,
    I created the web service using java class then i deployed this web service in to the weblogic admin server.when i tested this process it is working fine.
    when I tested The generated WSDL to this process in browser(IE). it is not working.
    I need to to invoke this webservice from another BPEL but this WSDL is not working.

    Hi,
    when i created the webservice in jdeveloper by default it is connected to integrated weblogic server and generates this wsdl.
    http://localhost:7101/helloApplication-javaexcel-context-root/MyWebService1Soap12HttpPort?WSDL
    then I deployed this webservice in to the Adminserver.it gives the following URL.
    http://192.168.56.1:7001/extracExcelToCSV-extractExcelToCSV-context-root/ExtractExcelToCSVSoap12HttpPort?wsdl
    This URL is not working but when i tested this process it is working fine.
    It is giving below error when i try to invoke from jdeveloper
    Error while reading wsdl file
    caused by:java.net.connectExcepption :Connection timed out:connect

  • Problem with local class, static private attribute and public method

    Hello SDN,
    Consider the following situation:
    1) I have defined a LOCAL class airplane.
    2) This class has a private static attribute "type table of ref to" airplane (array of airplanes)
    3) A public method should return the private static table attribute
    Problems:
    a) The table cannot be given as an EXPORTING parameter in the method because TYPE TABLE OF... is not supported and I get syntax errors. I also cannot define a dictionary table type because it is a local class.
    b) The table cannot be given as a TABLES parameter in the method because TABLES is not supported in the OO context.
    c) The table cannot be given as an EXPORTING parameter in the method defined as LIKE myStaticAttribute because my method is PUBLIC and my attribute is PRIVATE. ABAP syntax requires that all PUBLIC statements are defined before PRIVATE ones, therefore it cannot find the attribute to reference to with LIKE.
    I see only 2 solutions:
    a) Never ever use local classes and always use global classes so that I might define a dictionary table type of my class which I can then use in my class.
    b) Make the attribute public, but this goes against OO principles, and isn't really an option.
    Am I missing anything here, or is this simply overlooked so far?

    Hello Niels
    Since your class is local and, thus, only know to the "surrounding" application is does not really make sense to make it public to any other application.
    However, if you require to store instances of your local classes in internal tables simply use the most generic reference type possible, i.e. <b>OBJECT</b>.
    The following sample report shows how to do that. Furthermore, I believe it also shows that there are <u><b>no </b></u>serious inconsistency in the ABAP language.
    *& Report  ZUS_SDN_LOCAL_CLASS
    REPORT  zus_sdn_local_class.
    " NOTE: SWF_UTL_OBJECT_TAB is a table type having reference type OBJECT
    *       CLASS lcl_airplane DEFINITION
    CLASS lcl_airplane DEFINITION.
      PUBLIC SECTION.
        DATA:    md_counter(3)             TYPE n.
        METHODS: constructor,
                 get_instances
                   RETURNING
                     value(rt_instances)   TYPE swf_utl_object_tab.
      PRIVATE SECTION.
        CLASS-DATA: mt_instances    TYPE swf_utl_object_tab.
    ENDCLASS.                    "lcl_airplane DEFINITION
    *       CLASS lcl_airplane IMPLEMENTATION
    CLASS lcl_airplane IMPLEMENTATION.
      METHOD constructor.
        APPEND me TO mt_instances.
        DESCRIBE TABLE mt_instances.
        md_counter = syst-tfill.
      ENDMETHOD.                    "constructor
      METHOD get_instances.
        rt_instances = mt_instances.
      ENDMETHOD.                    "get_instance
    ENDCLASS.                    "lcl_airplane IMPLEMENTATION
    DATA:
      gt_instances      TYPE swf_utl_object_tab,
      go_object         TYPE REF TO object,
      go_airplane       TYPE REF TO lcl_airplane.
    START-OF-SELECTION.
      " Create a few airplane instance
      DO 5 TIMES.
        CREATE OBJECT go_airplane.
      ENDDO.
      gt_instances = go_airplane->get_instances( ).
      CLEAR: go_airplane.
      LOOP AT gt_instances INTO go_object.
        go_airplane ?= go_object.
        WRITE: / 'Airplane =', go_airplane->md_counter.
      ENDLOOP.
    END-OF-SELECTION.
    Regards
      Uwe<u></u>

Maybe you are looking for