Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
Showing results for 
Search instead for 
Did you mean: 

Internal Types in Class Builder

Former Member
0 Kudos

Hi Guys,

In am trying to add an internal type to a standard class in <b>Class Builder</b>. I have created a type with Ctrl + F5, But am not sure what to do next. Could any one plz explain me what are all the steps involved?

Thanks in Advance.




Former Member
0 Kudos

Here are some examples:

* Internal table type.

TYPES: ty_t_my_type type standard table of mara.

* Structure type.

TYPES: begin of ty_my_struc,
         field1(4) type c,
         field2    type i,
       end of ty_my_struc.

Then you can use the types:

DATA: it_my_table type ty_t_my_table,
      wa_my_struc type ty_my_struc.

Is this what you needed?

Hi Charles,

Thanks for the reply.

'Direct type entry' option was disabled when I tried to create a new type for a standard SAP class. But it was enabled after Switching off Modfication assistant and I have created a direct type entry :-).



Active Contributor
0 Kudos

Hello Rahesh,

I assume you try to add a new type definition. The possibilties there depend on the release of your system.

In release 4.x - 6.20 you can only define types in the protected and private section. Any definition can be used within any method coding. The use of these types within member or method declaration is of course limitied to private or protected ones. You can refer to the types by their name (like to types defined in forms).

With release 6.40 or higher you can also define types in interfaces and the public section of classes. So they are part of the API of the class and can be also used outside. This can be done by following syntax:

  data: test_Data type cl_My_Class=>ty_Char_40.

So in effect you may use an interface definition as a new kind of type-pool.

Best Regards