Reputation: 99
I need to get protected attribute attr_1
of class Class_1
in my own Z-class
and use it as an input parameter for my method GET_CAMP_DATA()
.
Can anybody help me to solve my problem?
I want to do something like this:
DATA(lv_camp_id) = Class_1=>attr_1`.
CALL METHOD GET_CAMP_DATA
EXPORTING
iv_camp_id = lv_camp_id
IMPORTING
et_result = lt_result
Upvotes: 0
Views: 5032
Reputation: 5713
Three options:
1.Implement a method get_attr_1
in Class_1, return attr_1
in this method.
2.Set attr_1
as public
and read-only
class Class_1 definition
public
final
create public global friends Z-class.
public section.
data attr_1 type your_type read-only.
protected section.
private section.
endclass.
3.Define Z-class
as a friend of Class_1
class Class_1 definition
public
final
create public global friends Z-class.
public section.
protected section.
data: attr_1 type your_type.
private section.
endclass.
Upvotes: 1