Skip to Content
author's profile photo Former Member
Former Member

Abap Object-oriented question

Hi Folks,

I'm currenty writing a user exit in SAP BW and in this user exit I would like to retrieve the value of a certain instance attribute but I don't manage to do this.

Let me explain you what I mean. At a certain point in some standard code a "create object query" statement occurs which declares a certain class. Via query->n_handle the value of an attribute can be derived in this standard program.

But... then the user exit is being called but I don't have access anymore to query->n_handle. The strange thing is I'm 100% sure the class can still be accessed as I tested in debugging node that I can view the class instance 3<\CLASS=CL_RSR_REQUEST> in debugging mode on the tabstrip table where you usually view internal tables. This instance was created in the standard program via "create object query". Why can't I access this anymore in the user exit while I can perfectly view the class in this user exit while in debugging mode. Can anyone give me a hint how to fetch the value from the attribute of 3<\CLASS=CL_RSR_REQUEST> as I need this badly.

Thanks in advance.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Dec 08, 2003 at 08:39 PM

    I assume that your exit is probably a Customer Function or a BADI. Because of the scope of the interface into the object you are within, you no longer have visibility to the variable holding the pointer to the instance of your class. In other words, you can only see the variables that are exposed to your exit.

    Now why can the debugger see the variable but you can't from the runtime? That has to do with the special way that the debugger actually references memory from any running program. Internally the debugger creates field symbols, referencing the program name and then the variable.

    I don't think this is officially released ABAP functionality, but you should be able to do the same in your program if you create a field name variable and structure the value as follows: (EXTERNAL_PROGRAM)EXTERNAL_VARIABLE. Then assign this fieldname to a Field Symbol. You should then have a field symbol that points to a variable outside of your program area.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 14, 2004 at 09:29 AM

    Hi,

    i tried to understand and reuse your posted ideas. Does i understand right this is a way to

    save the reference to a class instance. why you dont use a data object wich type is ref to cl_class like:

    data: r_ref type ref cl_class.

    Wich version of WAS do you use, i use 6.20 and get errors by exectuing your reports.

    Thank you for answering my question.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.