Getting cl_abap_structdescr for method parameters of LOCAL classes?

Hi guys
I have a bit of a of a problem with getting an instance of the cl_abap_structdescr class for a method parameter type of a local class. The RTTI structure abap_parmdescr can only be used to diffrentiate between the basic built-in ABAP types and whether types are structures, tables or references. The question now arrives that once you have diffentiated that the parameter is a structure how do you determine the actual structure TYPE name for local classes to create an instance of the cl_abap_structdescr to continue your run-time analysis. For dictionary classes the parameter type name can be retrieved from the seosubcodf table, to me it looks as if one would have to resort to scanning the source code of local classes to arrive at the actual  structure type name, but before I go to THAT kind of trouble I was wondering whether somebody out there might have a better solution for me. Your help would be grreatly appreciated and rewarded ;).
Kind regards
Ettienne Hugo

Hello Uwe
Thanks for your reply, I checked out the CL_OO_LOCAL_CLASSES class, unfortunately the class actually operates on the local classes declared for a dictionary class. I think to clarify my question I should point out that the parameters I'm trying to process are parameters that belong to classes that are defined and implemented using include programs, these include programs would then typically be used in Function Groups to construct applications so the classes that I refer to are actually not in any way related to dictionary classes. The cl_abap_classdescr class works fine on these types of classes when you refer to them using the "\PROGRAM=my_program\CLASS=my_class" format with the describe_by_name method, unfortunately the class just does not provide sufficient information for structure type parameters to actually construct them during run-time...
Stay well
Ettienne

Similar Messages

  • How to get names of method parameters ?

    How to get names of method parameters (Not only their type and value) is it only possible during debugging ??
    for example void myFunction(int a,int b)
    I need the "a" , and the "b" The issiue is about the java.lang.reflect.InvocationHandler ,
    and its method invoke(Object proxy,
    Method method,
    Object[] args)
    throws Throwable
    I Have the parameter objects themself and their types using method.getParameters() , this is fine ,, but i need the names of the parameters !!!

    If the class file was compiled without debug information included then it is impossible to get the original parameter names, as used in the source code.
    However, If the class file does include debug information, then the method names are hidden deep within the class file. You'd need to parse the class file yourself. Check out a copy of the Java VM Specification for a detailed format of the java class file format.
    It's not a trivial task to parse the java class file, and the VM spec isn't easy reading. You'd nearly be writing a class file disassembler.

  • Access fo Method parameters to Anonymous Class ?

    Can somebody please provide some more information on the statement below? I am also searching for some sample code implementations of it. It would help the cause better.
    +"Methods of the object of the anonymous class need access to final local variables and method parameters belonging to the method in which the anonymous class is defined. "+
    Thanks in Advance

    We're concerned here with "local" classes, i.e. classes defined inside methods (not all anonymous classes are local, and not all local classes are anonymous).
    The thing about local classes is that, unlike local variables etc., instances of a local class may survive the method returning. For example a local class might be a listener which gets added to a swing component, it could be a Runnable that get's launched as a thread.
    Local classes get to access local variables and parameters of the method in which they are declared but the variables or parameters have to be declared final because, since the class needs to be able to access the value of the local variable even after the method exits, and the variable ceases to exist, what actually happens it that the value of the variable is copied into a special field of the anonymous class, and if the variable could be changed after the class was defined, the two copies would then disagree.

  • Can we chagne Super class method parameters in Sub class

    Hi,
    I created a super class.  In that class i created a method. That method is having 4 input parameters and 4 export parameters.
    I created a sub class for that super class. I need to use only 2 input parameters in this class rather than 4 parameters. I want to delete 2 Input parameters in the sub class of the super class method.  Is it possible.
    If possible. can we give an simple code or pseudo code?
    regards,
    krishna

    Hi,
    I think you can not.
    Because, only public attributes can be inherited and they will remain public in the subclass.
    for further detail check,
    http://help.sap.com/saphelp_nw70/helpdata/en/1d/df5f57127111d3b9390000e8353423/content.htm
    regards,
    Anirban

  • Step by Step Procedure For defining/Implementing a Local Class

    Hi!
    I need simple step-by-step procedure for defining a local class ( having 1 function only) in ABAP

          CLASS lcl_class DEFINITION
    CLASS lcl_class DEFINITION.
      PUBLIC SECTION.
        METHODS fm.
    ENDCLASS.                    "lcl_class DEFINITION
          CLASS lcl_implementation DEFINITION
    CLASS lcl_class IMPLEMENTATION.
      METHOD fm.
        CALL FUNCTION 'FM'.
      ENDMETHOD.                    "fm
    ENDCLASS.                    "lcl_implementation DEFINITION
    This is basic structure, which can be defined in an include (top include for data declaration), or some where local in your report / method.
    You can use this class be instantiating it (CREATE OBJECT) and then call the method via the instance like this:
    DATA: lr_object TYPE REF TO lcl_class.
    START-OF-SELECTION.
      CREATE OBJECT lr_object.
      CALL METHOD lr_object->fm.

  • Setting default values for Method Parameters (Like in C++)

    Hello. In Java can I define a method like...
    public boolean AddCommand(int commandType, ObjectClass object = null) {
        // Some code here.
        return true;
    }So that I can call it with
    ObjectClass object = new ObjectClass();
    result = AddCommand(2, object);or with
    result = AddCommand(2);I know I can do it with C/C++ which is the language I have experience with.

    I would think this would be a better example of default methods and constructors using this:
    public class MyClass{
        int myInt = 0;
        MyOtherClass m = null;
        MyClass(){  //no argument constructor
          this(defaultWhatever, defaultMyOtherClass);//call real constructor
        MyClass(int myInt){  //one argument
          this(myInt, defaultMyOtherClass);//call real constructor
        MyClass(int myInt, MyOtherClass m){  //actual constructor
         this.myInt = myInt;
         this.MyOtherClass = m;
        public void myDefaultMethod()
            this.myRealMethod(defaultValue);
        public void myRealMethod(int val)
            System.out.println(val);//do work with val
    }I try to avoid default methods and such anyways. It's not hard to pass in regularly used values, better than hiding the implementation.

  • Get a reference of a local class at another program

    Hello experts! Sorry if this has been asked before, but I couldn't find exactly what I'm searching for.
    Within function-pool MIGO (main program of transaction MIGO), there's a local class LCL_MIGO_KERNEL. This class has the private attribute PT_CHANGE_TAKEIT (which is an internal table).
    During the execution of MIGO, for a certain criteria, I would like to clear the contents of PT_CHANGE_TAKEIT. Since it's a private attibute, I have managed to create a new public method that just clears it. This method was defined and inplemented within ENHANCEMENT SPOTS available all over SAPLMIGO. My method is ZZ_CLEAR_PT_CHANGE_TAKEIT. So far so good.
    Now, I have to call this method. I have found no other ENHANCEMENT SPOTS in SAPLMIGO at a place where I would me able to make the call (eg, don't know if the criteria fits yet).
    Inside BADI MB_MIGO_BADI, method LINE_MODIFY, I have just what I need to know if I should clear PT_CHANGE_TAKEIT.
    However, inside here I don't have access to the instance of class LCL_MIGO_KERNEL (the instance itself is (SAPLMIGO)LCL_MIGO_GLOBALS=>KERNEL)
    So far I have managed to get a pointer to the instance with:
      FIELD-SYMBOLS: <lfs_kernel> TYPE ANY.
      ASSIGN ('(SAPLMIGO)LCL_MIGO_GLOBALS=>KERNEL')
        TO <lfs_kernel>.
    So I have the instance of the class, but how can I call my method ZZ_CLEAR_PT_CHANGE_TAKEIT?
    The command  call method <lfs_kernel>->zz_clear_pt_change_takeit.
    can't be done because ""<LFS_KERNEL>" is not a reference variable" as the sintax check tells me.
    I have tried stuff like
      CREATE DATA dref TYPE REF TO
                 ('\FUNCTION-POOL=MIGO\CLASS=LCL_MIGO_KERNEL').
      ASSIGN dref->* TO <ref>.
    but nothing works so far.
    I know if LCL_MIGO_KERNEL was a class from SE24 (not a local one), I could just create a field-symbol of that type instead of type ANY and it would work.
    Does anyone have an idea how that can be done?
    Thank you very much!

    I have managed to do what I needed by calling my method from other ENHANCEMENT SPOTS within SAPLMIGO and some extra coding on MB_MIGO_BADI, but unfortunately I couldn't do what I originaly wanted which was to call a method of a local class from another program, something that could be handy in other situations.
    If it's not lack of knowledge by myself and it really can't be done, I think the ABAP OO framework fell just short of having that flexibility, since I can get the field-symbol to point to the instance of the class, but just can't call the method because of syntax issues.
    Thanks!
    Well it seems you already solved, but I got curious and knew how this could be done, so I wanted to prove it and here it is:
    * This would be inside the Function group
    CLASS lcl_kernel DEFINITION.
      PUBLIC SECTION.
        METHODS:
          zz_clear_pt_change_takeit.
    ENDCLASS.                    "lcl_kernel DEFINITION
    CLASS lcl_kernel IMPLEMENTATION.
      METHOD zz_clear_pt_change_takeit.
        WRITE 'Dummy! I do nothing!'.
      ENDMETHOD.                    "zz_clear_pt_change_takeit
    ENDCLASS.                    "lcl_kernel IMPLEMENTATION
    START-OF-SELECTION.
    * This is just to create the reference. It corresponds to
    * (SAPLMIGO)LCL_MIGO_GLOBALS=>KERNEL in your example
      DATA: kernel  TYPE REF TO lcl_kernel.
      CREATE OBJECT kernel.
    *----------------- Now your program (which supposedly does not have
    *----------------- access to kernel or even lcl_kernel def)
    *----------------- would begin
      FIELD-SYMBOLS: <lfs_kernel> TYPE ANY.
      DATA: generic_ref           TYPE REF TO object.
      ASSIGN ('KERNEL')
        TO <lfs_kernel>.
      generic_ref = <lfs_kernel>.
      TRY.
          CALL METHOD generic_ref->('ZZ_CLEAR_PT_CHANGE_TAKEIT').
        CATCH cx_sy_dyn_call_illegal_method .
      ENDTRY.
    Apart from that, I wouldn't access a local class this way. There's a reason for blocking the access, one of them being that SAP could change local classes without notice thus breaking your program.

  • OO: translation of explanatory texts for methods and parameters

    Hi multilanguage community,
    in class builder, we can give explanatory texts for methods, parameters, attributes and so on.
    When I GOTO TRANSLATION, only text elements are given for translation.
    How to translate the rest?
    TIA,
    Clemens

    Hi Jörn,
    sorry, we have SAP ECC 6.0 SE63 Menu path Tramslation -> ABAP Objects -> Short text. A popup comes up for selection:
    Object Type Selection
        A1 Application Texts
        KP Knowledge Provider
        OT OTR
        S1 Partial Delivery 1
        S2 Partial Delivery 2
        S3 ABAP Texts
        S4 Repository Texts
        S5 Other Interface Texts
        S6 Technical Short Texts
        S7 Local Object Types
        S8 HR Texts
    Where to go from here?
    Thanks.
    Clemens

  • Native method in local class

    Hi there,
    this is a repost of my question but now in the right forum.
    I have a problem with a native method of a local class that hides a member class:
    public class SomeClass
         class MemberClass
              public native void bla();
              public void out()
                   System.out.println("A");
         public void foo()
              class MemberClass
                   public native void bla();
                   public void out()
                        System.out.println("B");
              MemberClass myClass = new MemberClass();
              myClass.out();
         public static void main(String[] args)
              SomeClass someClass = new SomeClass();
              someClass.foo();
    }The class MemberClass exist in two different ways. Every class has it's own out() method. The local class just hides the member class. Now I want to implement the native methods bla() of the two classes.
    If I call
    javac SomeClass.hI get
    SomeClass.class
    SomeClass$MemberClass.class
    SomeClass$1MemberClass.classwhich makes sense to me. We have one class file for the member class and one for the local class.
    If I use
    javah SomeClassthen I get
    JNIEXPORT void JNICALL Java_SomeClass_00024MemberClass_bla(JNIEnv *, jobject);in the header file for the member class. No header file for the local class was created.
    Therefore I call
    javah SomeClass$1MemberClassand I get another header file which is for the local class. But this header file declares the same native method:
    JNIEXPORT void JNICALL Java_SomeClass_00024MemberClass_bla(JNIEnv *, jobject);This is ambiguous... If I would implement the native method, then I couldn't even say for which one of the native methods it will be used. Maybe for both.. which wouldn't make any sense too.
    What is wrong here?
    Thank you for your thoughts :-)

    Interesting...From the JLS under "fully qualified name"
    [http://java.sun.com/docs/books/jls/third_edition/html/names.html#71701]
    "Every package, top level class, top level interface, and primitive type has a fully qualified name."
    From the javah docs
    javah [ options ] fully-qualified-classname
    And note this under the JNI spec for "FindClass"
    [http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/functions.html#wp16027]
    "The name argument is a fully-qualified class name or an array type signature "
    Does that mean that you can't use JNI to access a local class? Seems like I have seen posts that said that was possible.

  • Method parameters

    Hello
    I'm usimg this code to get the local variables in case of a method entry:
                error = jvmti->GetLocalVariableTable(method, &entryCount, &localVariableEntry);
                if(error == JVMTI_ERROR_NONE) {
                    jvmtiLocalVariableEntry* entry = localVariableEntry;
                    for(int i = 0; i < entryCount; i++, entry++) {
                        cout << entry->signature << ":" << entry->name << endl;
                        jvmti->Deallocate(reinterpret_cast<unsigned char*>(entry->signature));
                        jvmti->Deallocate(reinterpret_cast<unsigned char*>(entry->name));
                        jvmti->Deallocate(reinterpret_cast<unsigned char*>(entry->generic_signature));
                    } // for
                    jvmti->Deallocate(reinterpret_cast<unsigned char*>(localVariableEntry));
                } else if(error = JVMTI_ERROR_ABSENT_INFORMATION) {
                    cout << "<NO LOCAL VARIABLE INFORMATION AVAILABLE>" << endl;
                } else {
                    cout << "<ERROR>" << endl;
                } // if...else if...elseNow I'm wondering how to find the method parameters in all this local variables...
    Is there a way to get obly the method parameters?
    Thank you very much and with kind regards
    Alexander Schell
    Edited by: EJP on 3/10/2011 20:24: added {noformat}{noformat} tags: please use them.
    Edit: Moved the first code-tag
    Edited by: user3948319 on 03.10.2011 08:02                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Hello and thanks for the answer...
    That was my first assumption...but after running the code I got some puzzling results...here's an example:
    callbackMethodEntry: methodName=reverse methodSignature=(Ljava/util/List;)V methodGenerigPtr=(Ljava/util/List<*>;)V classSignature=Ljava/util/Collections; thread=DestroyJavaVM
    I:i
    I:mid
    I:j
    Ljava/lang/Object;:tmp
    I:i
    I:mid
    Ljava/util/ListIterator;:fwd
    Ljava/util/ListIterator;:rev
    Ljava/util/List;:list
    I:size
    The method entered takes surely one argument - a list...but the list is not the first entry in the array which is created by calling getLocalVariableTable...so I'm a wee bit confused right now...
    I also don't understand under which circumstances the JVMTI_ERROR_ABSENT_INFORMATION error is raised...
    before I forget: Thanks for the tip with the code tags...I looked for something to mark the code but could not find it...
    With kind regards
    Alexander Schell

  • Change value of GV_MAXROWS for method GET_DATA for class CL_THTMLB_F4HELP

    Hi Friends,
    I am working on the F4 help of a custom field on the WebUI screen.
    I have implemented the GET_V method of the context node attribute and it is working fine, and displaying the results in the F4 help. However, I need to filter these values. So, I have created a Searchhelp exit.
    The issue is while filtering in Search help exit, the record_tab[] is filled with only first 500 entries. For this I have manually changed the value of CALLCONTROL-MAXRECORDS = '99999' and it fetches all the existing records in GUI and the filtering works fine. But the same logic doesn't work for Web UI screen. The reason for this is, from Web UI, the class CL_THTMLB_F4HELP is called. In this the method GET_DATA is used to fetch the records. Here there is a field gv_maxrows that is by default '500'. Now, in debugging if i change this to '99999', it works fine. So, how can I do this in coding. How can I change the value of gv_maxrows of the method GET_DATA of the class CL_THTMLB_F4HELP. Can I do this in GET_V method or in the Search Help exit.
    Your response will be appreciated.
    Thanks & Regards,
    Raju.

    Hi!
    I think that I was not clear in my requirement actually i need to add the document to a folder in a product catalog. So the document is stil not there.
    please suggest to get the folder info where the document needs to be attached.
    Thanks
    Mayank

  • How to get the method names in a class

    hi  friends,
    Could any of you tell me the report or function module  to display all the method names in a given class.
    thanks in advance.
    regards,
    kumar

    Hi Kumar ,
    Open ur class in SE24 transaction ,there is a tab for methods ..
    u'll get the list of methods form there ... n in source u'll get their operative details
    Regards
    Renu

  • 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>

  • Multiple HTTP GET requests for individual classes

    Hello,
    I have a Java plug-in deployed under tomcat 6. JRE version is 1.6.0_16. All the required jars are deployed packed (pack.gz) and the applet tag has 'java_arguments' parameter defined as:
    <param name='java_arguments' value='-Xms256m -Xmx512m -Djnlp.packEnabled=true -Djnlp.versionEnabled=true' />
    All the jars get loaded nicely as I see in the Tomcat access log:
    127.0.0.1 - - [03/Mar/2010:17:24:04 +0000] "GET /testapplet/lib/log4j-1.2.13.jar.pack.gz?version-id=1.2.13 HTTP/1.1" 200 0
    but immediately I see a bunch of GET requests for the individual classes in the same log4j jar:
    127.0.0.1 - - [03/Mar/2010:17:24:06 +0000] "GET /testapplet/lib/org/apache/log4j/Logger.class HTTP/1.1" 404 0
    127.0.0.1 - - [03/Mar/2010:17:24:06 +0000] "GET /testapplet/lib/org/apache/log4j/Category.class HTTP/1.1" 404 0
    127.0.0.1 - - [03/Mar/2010:17:24:06 +0000] "GET /testapplet/lib/org/apache/log4j/spi/AppenderAttachable.class HTTP/1.1" 404 0
    As you can see each of these GET requests are returned a Http error code 404. While testing locally, this isn't adding any delays, but over a real deployment it's bound to be slow down the applet loading while the server is responding to each of these class requests.
    Subsequently, the application itself runs without any issues and these bogus class requests failures have no effect (thankfully) on the functionality.
    Any one seen this behavior? Appreciate any thoughts or help.
    Regards,
    Parag

    http://forums.java.net/jive/thread.jspa?threadID=75990&tstart=0

  • Save an input mask as variant for a method of a Z class

    Hi all,
    quite a dumb question, but I switched to OO abap recently and can't find this feature...
    When I'm creating a custom function module, I can test in debug simply lauching it and saving parameters of the input mask iin a Variant, so that I can try the run with these params whenever I want simply loading the variant I saved.
    Now... I'm working on a method in a custom class; I'd like to test but everytime I have to populate the parameter mask since I can't find a "save variant" option. Is there any way to accomplish this? Thanks in advance.

    Could write an ABAP UNIT class and definition and perform ABAP UNIT test on the object...ABAP Unit is regression testing for programmers but I do development testing with the tool.

Maybe you are looking for

  • ABAP query to be modified

    Hi, I have one ABAP query which is already created by someone. I want to ADD one field in where condition.. How do I do itu2026Need to add it in where condition in select query. I want to know the steps to be followed.. Thanks RB

  • In customer master how to default a field

    HI All, In customer master how to default '1' in tax classification field for all new ship to party ? Thanks in advance....

  • N-72 is not strting (crash in the middle of softwa...

    hi In the morning when Alarm wake me up. i found my Nokia n72 was continuesly on vibration. I just switch it off and then switch it on. The fond was dull and lean after restart. so i try to update the software. When updation was done. PC hangs, and t

  • Investment managment in BI

    Hi all, My company planning to implement Investment Managment module in BI-7. Please forward me good document related to this and share your experiance if you implemented. regards Gunjan.

  • Trouble with Apple Repair Service

    Hi All, Anyone know how to get in touch with customer service at Apple? I had to bring my iMac in for service related to the power problem recall (http://www.apple.com/support/imac/repairextensionprogram/). Was told it woulod take 2-3 days. Now a wee