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

T-Code WRFMATBODY before saving

Former Member
0 Likes
463

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

2 REPLIES 2
Read only

Former Member
0 Likes
397

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

Read only

0 Likes
397

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