cancel
Showing results for 
Search instead for 
Did you mean: 

Get attribute using get method

Former Member
0 Kudos

Hi All,

I have an attribute C_MyAttr of type 'c' defined in the 'Attributes' tab in component controller.There is a requirement to define get and set methods for this attribute.

Please let me know the code to define this in the methods tab.

Thanks

Kukku.

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>

> Hi All,

>

> I have an attribute C_MyAttr of type 'c' defined in the 'Attributes' tab in component controller.There is a requirement to define get and set methods for this attribute.

>

> Please let me know the code to define this in the methods tab.

>

> Thanks

> Kukku.

This sounds pretty basic.

For you SET method define an importing parameter of the method of type 'c' (perhaps named i_myattr). For the code:

wd_this->c_myattr = i_myattr.

For the GET method define a returning or exporting parameter of method of type 'c' (perhaps name e_myattr). For the code:

e_myattr = wd_this->c_myattr.

Former Member
0 Kudos

Hi Thomas,

ThankYou for the quick response. I was a web dynpro Java developer and now into web dynpro ABAP.

The above code solved my problem for get method. But for set method,

wd_this->c_myattr = i_myattr.

I am getting 'i_myattr' is unknown

I defined an importing parameter of the method of type c.

Thanks

K

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>

> Hi Thomas,

>

> ThankYou for the quick response. I was a web dynpro Java developer and now into web dynpro ABAP.

>

> The above code solved my problem for get method. But for set method,

>

> wd_this->c_myattr = i_myattr.

>

> I am getting 'i_myattr' is unknown

>

> I defined an importing parameter of the method of type c.

>

> Thanks

> K

Well if you defined an importing parameter and named it i_myattr then you won't get this error message. Check again that your names match.

Answers (0)