‎2011 Sep 23 3:01 AM
Hi All,
For the T-Code WRFMATBODY , before saving I have a requirement to check the creation status field and allow only particular users to do the changes for the article.
For that I am trying to implement the check the condition in u201CIF_EX_WRF_MAT_MAINTENANCE~CHECK_DATA_BEFORE_POSTINGu201D for that I created a custom class interface YCL_IM_WRF_MAT_MAINTENANCE and trying to apply the changes in the above mentioned method CHECK_DATA_BEFORE_POSTING.
The importing parameter IV_DATA_OBJECT is of the type CL_MATERIAL_MAINTAINDATA. At the time of saving the values are getting populated only in the protected attributes like ORGANIZATIONAL_LEVEL, FIELDCATALOGUE etc.
Since itu2019s a protected attribute its prompting error when I access in a normal manner. Can you please help me out how to access the protected attribute.
Please help me ....
Thanks,
KK
‎2011 Sep 23 9:33 AM
Hi,
Protected attribute can be access by defining sub class. Suppose if you have a Class C1_MAIN, the protected attribute can be accessed by defining Sub class C1_SUB ( Super class should be C1_MAIN ).
Thanks
Pavan
‎2011 Sep 23 1:53 PM
Hi Pavan,
I have tried accessing the protected attribute using Inheriting property, but since iam writing the code in the method, its prompting syntax error.
For example like this,
class l_org definition.
protected section.
data ORGANIZATIONAL_LEVEL type WRFSCREENVALUES.
endclass.
class lv_data_object definition inheriting from l_org.
methods get_data.
endclass.
class lv_data_object implementation.
method get_Data.
data: l_org type ref to CL_MATERIAL_TEMPLATEDATA,
LV_DATA_OBJECT type ref to CL_MATERIAL_MAINTAINDATA.
lv_data_object->ORGANIZATIONAL_LEVEL = 0.
endmethod.
endclass.
i tried the other way assigning field symbol. The field symbol is not getting assigned.
For example like this,
field-symbols:<lo_lcl> type any.
lv_data_object ?= Iv_data_object.
create object lv_data_object.
lv_org = 'ORGANIZATIONAL_LEVEL'.
assign lv_data_object->(lv_org) to <lo_lcl>.
I tried using ME->ATTRIBUTE, that is also prompting error.
I tried using super class that is also prompting error.
The main class to which the importing parameter IV_DATA_OBJECT is assigned is CL_MATERIAL_MAINTAINDATA and the super class for this is CL_MATERIAL_TEMPLATEDATA.
The Protected attribute is in the class CL_MATERIAL_MAINTAINDATA.
Can you plz help me out how to retrieve from the importing parameter IV_DATA_OBJECT which is of type CL_MATERIAL_MAINTAINDATA.
Thks,
Kiran