How to Programmatically Create and Activate an ABAP Class

Hi,
I have a requirement to programmatically create and activate an ABAP class that implements a 'pre-defined' interface.
Do you have any ideas how this can be done?
Thanks,
Shreevathsa S

Hi,
   Try if GENRATE SUBROUTINE POOL keyword can be of your help.
See the below example,
DATA itab  TYPE TABLE OF string.
DATA prog  TYPE string.
DATA class TYPE string.
APPEND `program.`                     TO itab.
APPEND `class main definition.`       TO itab.
APPEND `  public section.`            TO itab.
APPEND `    class-methods meth.`      TO itab.
APPEND `endclass.`                    TO itab.
APPEND `class main implementation.`   TO itab.
APPEND `  method meth.`               TO itab.
APPEND `    message 'Test' type 'I'.` TO itab.
APPEND `  endmethod.`                 TO itab.
APPEND `endclass.`                    TO itab.
GENERATE SUBROUTINE POOL itab NAME prog.
CONCATENATE `\PROGRAM=` prog `\CLASS=MAIN` INTO class.
CALL METHOD (class)=>meth.
Regards,
Sesh

Similar Messages

  • Re: How do you create and use "common" type classes?

    Hi,
    You have 2 potential solutions in your case :
    1- Sub-class TextNullable class of Framework and add your methods in the
    sub-class.
    This is the way Domain class work. Only Nullable classes are sub-classable.
    This is usefull for Data Dictionary.
    The code will be located in any partition that uses or references the supplier
    plan.
    2- Put your add on code on a specific class and instanciate it in your user
    classes (client or server).
    You could also use interface for a better conception if needed. The code will
    also be in any partition that uses or references the supplier plan where your
    add on class is located.
    If you don't want that code to be on each partition, you could use libraries :
    configure as library the utility plan where is your add-on class.
    You can find an example of the second case (using a QuickSort class,
    GenericArray add-on) with the "QuickSort & List" sample on my personal site
    http://perso.club-internet.fr/dnguyen/
    Hope this helps,
    Daniel Nguyen
    Freelance Forte Consultant
    http://perso.club-internet.fr/dnguyen/
    Robinson, Richard a écrit:
    I'm relatively new to forte and I'd like to know how can you handle utility
    type classes that you want to use through out your application? Ideally
    what I want is a static class with static methods.
    Let's say that I have a StringUtil class that has a bunch of methods for
    manipulating strings.
    My problem is that we have code that runs on the client and code that runs
    on the server. Both areas could use the StringUtil class, but from what I
    understand, I have to create StringUtil in a plan and then create a server
    object of type StringUtil. The server object will eventually get assigned
    to a partition. That's not good since I really want the server object to
    physically reside at the server end and at the client end. (Actually, I
    don't want a server object, I just want to invoke a static method of a
    static class).
    Any clues on how to solve this problem would be appreciated.
    Also, what is the url at Sage-it that has a summary of all emails that have
    been posted to [email protected]? Perhaps this question has been
    answered previously.
    Thanks in advance
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>-
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Hi Richard,
    Your question about "utility classes" brings up a number of issues, all of
    which are important to long-term success with Forte.
    There is no such thing as a static method (method that is associated with a
    class but without an implicit object reference - this/self/me "pointer") in
    TOOL, nor is there such thing as a global method (method not associated
    with a class at all). This is in contrast to C++, which has both, and
    Java, which has static methods, but not global classes. Frequently, Forte
    developers will write code like this:
    result, num : double;
    // get initial value for num....
    tmpDoubleData : DoubleData = new;
    tmpDoubleData.DoubleValue = num;
    result = tmpDoubleData.Sqrt().DoubleValue;
    tmpDoubleData = NIL; // send a hint to the garbage collector
    in places where a C++ programmer would write:
    double result, num;
    // get initial value for num....
    result = Math::Sqrt(num);
    or a Java programmer would write:
    double result, num;
    // get initial value for num....
    result = Math.sqrt(num);
    The result of this is that you end up allocating an extra object now and
    then. In practice, this is not a big deal memory-wise. If you have a
    server that is getting a lot of hits, or if you are doing some intense
    processing, then you could pre-allocate and reuse the data object. Note
    that optimization has its own issues, so you should start by allocating
    only when you need the object.
    If you are looking for a StringUtil class, then you will want to use an
    instance of TextData or TextNullable. If you are looking to add methods,
    you could subclass from TextNullable, and add methods. Note that you will
    still have to instantiate an object and call methods on that object.
    The next issue you raise is where the object resides. As long as you do
    not have an anchored object, you will always have a copy of an object on a
    partition. If you do not pass the object in a call to another partition,
    the object never leaves. If you pass the object to another partition, then
    the other partition will have its own copy of the object. This means that
    the client and the server will have their own copies, which is the effect
    you are looking for.
    Some developers new to Forte will try to get around the lack of global
    methods in TOOL by creating a user-visible service object and then calling
    methods on it. If you have a general utility, like string handling, this
    is a bad idea, since a service object can reside only on a single
    partition.
    Summary:
    * You may find everything you want in TextData.
    * Unless you anchor the object, the instance will reside where you
    intuitively expect it.
    * To patch over the lack of static methods in TOOL, simply allocate an
    instance when required.
    Feel free to email me if you have more questions on this.
    At the bottom of each message that goes through the mailing list server,
    the address for the list archive is printed:
    http://pinehurst.sageit.com/listarchive/.
    Good Luck,
    CSB
    -----Original Message-----
    From: Robinson, Richard
    Sent: Tuesday, March 02, 1999 5:44 PM
    To: '[email protected]'
    Subject: How do you create and use "common" type classes?
    I'm relatively new to forte and I'd like to know how can you handle utility
    type classes that you want to use through out your application? Ideally
    what I want is a static class with static methods.
    Let's say that I have a StringUtil class that has a bunch of methods for
    manipulating strings.
    My problem is that we have code that runs on the client and code that runs
    on the server. Both areas could use the StringUtil class, but from what I
    understand, I have to create StringUtil in a plan and then create a server
    object of type StringUtil. The server object will eventually get assigned
    to a partition. That's not good since I really want the server object to
    physically reside at the server end and at the client end. (Actually, I
    don't want a server object, I just want to invoke a static method of a
    static class).
    Any clues on how to solve this problem would be appreciated.
    Also, what is the url at Sage-it that has a summary of all emails that have
    been posted to [email protected]? Perhaps this question has been
    answered previously.
    Thanks in advance

  • How do I create and activate watched folders in Acrobat Pro XI?

    Our court reporting firm scans large amounts of client exhibits and would love to set up watched folders to convert images to text files. I know that former versions of Acrobat had separate versions of distiller.  What's the story in Pro XI. What is the recommended way to set up watched folders, if there is one?

    As with previous versions Acrobat XI comes with Distiller. As with the previous version the use features of Distiller are the same.
    Do note that Distiller only accepts *.PS files as input for creation of PDF.
    All scanners initial output is an image file fromat (not *.ps). Other applications take the JPEG, TIFF, etc and process the image into other file formats (e.g., PDF).
    Be well...

  • How to accessed,created and modified date of particular file in java

    Hi,
    I am facing one problem.
    I know how to get the modified date/time of file in java.
    but i don't know how to find created and accessed date/time of file in java.
    Thanks,
    Tejas

    I guess thats not possible in in Windows.
    But if u r trying it on a unix machine.
    You can use Runtime class to call exec on the command
    ls -l filename
    and then store the result in a file . And then take out the last modified time. But you cant get created time.
    Thats a clumpsy way i believe.

  • HT201441 how can i create and audio cd from a music track I have on my ipod

    how can i create and audio cd from a music track I have on my ipod

    This is how:
    Go to:
    'File'
    'Share'
    'Quicktime'
    'Expert Settings'
    'Audio as AIFF' or pick your brand of compression.
    Drag and drop the resulting file into iTunes.
    Enjoy!
    P.S. - You didn't need to delete the video but I think that'll be okay.

  • Using macbook pro, how do I create and print labels

    how do I create and print labels using macbook pro

    Do you mean address labels ? Please check out this link
    http://smallbusiness.chron.com/can-print-address-labels-macbook-pro-58714.html
    http://support.apple.com/kb/ht3952

  • How do we create and publish templates in SRM ?

    Good day guru's
    How do  we create and publish templates in SRM , for contracts management ?
    Your help will be appreciated

    Hi,
    What is your SRM version?
    There are 3 buttons (Create, Create template, Create from Template) in the Process Contract screen, bbp_ctr_main in SRM50 (SRM_SERVER 550).
    Regards,
    Masa

  • How do you create and save icc profiles using photoshop?

    How do you create and save icc profiles using photoshop?

    You don't. Color profiles require specific measurement hardware and software.
    Mylenium

  • How do I create and use a watermark in aperture?

    Hello there!
    How to I create and use a watermark in aperture? do I need to download a 3rd party plugin? Any recommendations?
    Thank you!

    Aperture does not support the creation of watermarks; if you want a watermark image with transparent regions you need an application that can handle alpha channels - Prewiew, Photoshop, Pixelmator, Gimp, just to name a few.
    But once you have a watermark image, you can add it to an image, when you export from Aperture. Add the watermark to one of the Export Presets. You will need to create your watermark in different sizes, so you can add it to each of the export pixel sizes for your images, that you are using.
    Another possibility would be using the BorderFX plugin. This versatile plug-in also supports to add graphic overlays to your images, either when exporting or as an Edit plug-in.  http://www.iborderfx.com/BorderFX

  • How do I create and use a ringtone without syncing and without jailbreaking?

    How do I create and use a ringtone without syncing and without jailbreaking?

    You create ringtones on your computer and sync them to your iphone.
    You can buy ringtones from the ringtones section (at the bottom of the screen when you open itunes) of the itunes app on your iphone.
    There may be apps that will do this - not sure.

  • How do I install and activate all my downloads for Adobe lightroom and cs6 design web premium

    how do I install and activate all my downloads for Adobe lightroom and cs6 design web premium?

    I do not provide step by step tutorials.  What aspect of installing are you having difficulty with?  Can you not locate the installations files?  Are you having an issue downloading?  Do you need to know where to find your serial number(s)?

  • How can I install and activate adobe software under creative cloud purchased from other country?

    How can I install and activate adobe software under creative cloud purchased from other country?

    Hi John,
    I appreciate your prompt response.
    We have an Australian client here in the Philippines and would want to purchase an adobe software under Creative Cloud Licensing.
    Since this type of licensing is not yet available here in the Philippines, they are suggesting that they can purchase it in their country.
    My main concern is, will there be any conflict upon installing/activating an adobe software under Creative Cloud which will be purchased from their country?
    And what are the steps for installing and activating a software under this type of license.

  • How does APEX create and save new files. What extension does it save in?

    Hi can someone help me with this question?
    How does APEX create and save new files. What extension does it save in?
    Cheers!
    VJ

    It's really too bad we can't see VJ's face when the concept sinks in. This is one of my favorite moments when teaching APEX classes. Most people love it, some people don't. If nothing else it really proves the power and performance of the Oracle database. Each page view can generate 40+ queries, yet on the average system this takes less than .04 seconds.
    Keep in mind there are no undocumented features or "Oracle Internals" that the APEX team uses to achieve this performance, just sound database design. With every feature they add they evaluate how it will be used and design the tables and indexes to most efficiently answer the query. Sometimes this means going against "purist" normalized principals.

  • Programmatically create and deploy process definition

    1. It seems that PAPI does not support process definition creation and deployment. We need to programmatically create and deploy process definitions, what should we use?
    2. Is it possible to programmatically add variable definitions to a process instance? We have an external program that creates the process instance but sometimes the process instance may need to add some additional variables.
    Thank you for your help,
    shirley

    Hi Shirley,
    You're right PAPI wasn't intended to deploy processes, however, you can deploy processes automatically using ANT.
    You'd need to republish and redeploy (again using ANT) to add additional variables to a deployed process. Simplest thing to do would be to add attributes to an existing BPM Object. If you just added a new variable, you'd need to change argument mapping troughout the project.
    hth,
    Dan

  • How do I create and move photos to a new folder on the iphone4?

    How do I create and move photos to a new folder on the iphone4?

    The way I do it is through iTunes.  First you have to have to import or already have the photos in your computer where you have iTunes and sync your phone.  When you have your phone connected and iTunes open click on the iphone under "devices" in the left sidebar list - then over to the right select Photos then Sync Photos and probably best to check selected folders unless you want them all, then choose the photo folders you want.  You have to have your photos in folders for multiple folders to be created in your phone, the names will be the same as the folders in your computer.  Alternately you can sync from one of your photo programs if they are listed as options and they will go to the phone in the structure you have your photos in in that program. 
    Hope this helps... There may be other ways and other third-party programs for doing this but I haven't looked...

Maybe you are looking for

  • Hp laptop can't boot

    My laptop can't boot after connecting it to a flatscreen using an HDMI cabble, any help-

  • Acrobat Pro Extended 9.3.1 - Can't use "Send for Shared Review"

    After the last update for Acrobat Pro Extended, I cannot send RoboHelp PDF generated documents for shared reivew. I used to be able to send draft reviews of the help (in PDF) using our public shared drive. The error indicates: "The filename you speci

  • GetImageReference and eventListeners

    Hi, Through a textField you can access images (or it's Loader object) with getImageReference( imgId ). This works fine. Now I want to add eventListeners to the Loader to detect mouseClicks on the images. But somehow that part won't work. Code from a

  • IDOC error 29

    How to create sender and receiver ports, I m creating partner profile in which it is asking me for port number, from where will get this number? my IDOC is giving error 29 ... points will be rewarded.

  • I am updating MS CS6 and I am getting this for Illustrator

    Adobe Illustrator CS6 Update (version 16.0.3) Installation failed. Error Code: U44M1P7