Skip to Content

type ref to tableview?

I'd like to write a method that sets a column of a tableControl to inactive. Is it possible to pass a reference to the tableControl to the method so that the method can be used for several tableControls?

this is the tableControl:

CONTROLS tbl_role_holders TYPE TABLEVIEW USING SCREEN '0140'.

when i try to add an importing method parameter "ir_tc" TYPE REF TO TABLEVIEW, the class tableView is not found....

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Dec 14, 2004 at 12:06 PM

    Hi Daniel

    Control declaration types are not classes so you cannot refer to them.

    Instead try making the parameter generic type and pass the name of table control to that parameter. Or just a work-around, try the structure CXTAB_CONTROL (i.e your parameter like CXTAB_CONTROL).

    Hope this helps...

    *--Serdar

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 14, 2004 at 01:24 PM

    Hello Daniel,

    Alternatively, you can also use the type <b>cx_tableview</b>.

    For example, you can have something like :

    
    controls: table_control type tableview using screen 100.
    
    class table_control_operations definition.
      public section.
        methods: hide_column changing tc type cx_tableview.
    endclass.
    
    

    Hope this helps,

    Regards,

    Anand Mandalika.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Daniel Humberg

      Hello Daniel,

      Yes, in this case you cannot add a parameter using TYPE REF TO. You just need to pass the importing parameter by reference.

      TYPE REF TO is more relevant in case you have an instance of an Object. For example, if you want to achieve similar functionality for an ALV grid, then it would make sense for you to have something like

        methods: hide_column importing grid_reference type ref to cl_gui_alv_grid.
      

      .

      In particular, the actual and formal parameters should be declared with identical types.

      Hope this clarifies the point.

      Regrads,

      Anand Mandalika.

      P.S : Serdar's answer, I assume, might also have helped you. You might want to reward the points before you close this question as answered.

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.