cancel
Showing results for 
Search instead for 
Did you mean: 

Local Types in Web Dynpro

Abhijeet-K
Active Participant
0 Kudos

Hi,

In order to modularize the code into discreet parts, I broke it into parts and put into methods (Type 0). A couple of parameters are tables that do not have table types defined in dictionary (e.g. CLOBJEKTE).

Therefore, to pass such parameters between methods, one needs to create z- data elements in the dictionary and refer the same in the web dynpro method. I couldn't find an equivalent of Local Types in Web Dynpro - as available in ABAP Object Classes - where once can declare a types specific to the class. Now, creating many such data dictionary objects isn't a recommended practice.

I would like to know the following-

1. Is it possible to have local types in Web Dynpro?

2. If not, is there any way, other than creating dictionary objects to achive the goal?

-Abhijeet.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

create assitance class, declare types there and use them...

Abhijeet-K
Active Participant
0 Kudos

Hi Manas,

I did that prior to posting the question. Didn't work.

-Abhijeet.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

No. There are no local types in Web Dynpro.

>I did that prior to posting the question. Didn't work.

Actually it does work. In fact you declare your types in any public class or interface and then access them from WDA Component parts as long as the type definitions were public. You have to use them as though they were static parts of the class however.

For instance if I want to declare a component controller attribute and use a table type defintion from my assistance class I would do the following. My assistance class is named ZCL_MHO_WD_SERVICE and in the types tab of the class I have declared a public type named TT_SFLIGHT.

If I put WD_ASSIST->TT_SFLIGHT in the associated type I receive a syntax error. However if I put ZCL_MHO_WD_SERVICE=>TT_SFLIGHT in the associated type, it works just fine. Same goes for method parameters.

In fact instead of using type pools, SAP often creates class interfaces that only have groupings of reusable types in them.

Former Member
0 Kudos

Hi

My fault..I didn't explained in detail and left a clue only.

Anyways Thomas has explained the concept nicely...

Regards

Manas Dua

Abhijeet-K
Active Participant
0 Kudos

Hi Thomas,

I tried doing what you suggested. Conceptually, yes, it did work. But, it didn't adress my problem. To put in brief, the issue was: a dictionary type didn't have a table type.

>in the types tab of the class I have declared a public type named TT_SFLIGHT.

Now, if I create a local type in the assistance class like this-

TYPES: t_clobjekte TYPE STANDARD TABLE OF clobjekte.

And then, make an entry in the Types tab of the class like this (I am copying the internal representation)-

PUBLIC SECTION.

    TYPES tt_clobjekte TYPE t_clobjekte.

I get a very valid error-

In the "PUBLIC SECTION" of a class, you may only refer to global types when typing parameters. However, "T_CLOBJEKTE" is local.

Of course, you cannot (and shouldn't) declare a public type that has its definition as a local type.

If I replace T_CLOBJEKTE in the Types tab declaration with, say, FLIGHTTAB, it works. Also, the web dynpro accepts the static reference <Assitance Class>=>TT_CLOBJEKTE.

Where am I wrong in the process?

-Abhijeet.

Former Member
0 Kudos

Hi

I guess your problem is that you want to create a table type for structure CLOBJEKTE.

Just go to Types tab of assistance class - > create a new type as

TT_CLOBJEKTE with visbility as Public and Click on Arrow button to declare type.

Write the following code in public section

TYPES: TT_CLOBJEKTE type table of CLOBJEKTE.

Activate it..done..

Use it in your program with <CLASS_NAME>=>TT_CLOBJEKTE.

Regards

Manas Dua

Abhijeet-K
Active Participant
0 Kudos

Hi Manas,

It indeed solve the problem. A little cryptic way, though. Thanks, anyway.

Answers (0)