cancel
Showing results for 
Search instead for 
Did you mean: 

How to read classification data in MDGM

Former Member
0 Kudos

Hi Gurus,

Can someone help me how to read classification data(class and characteristics values) assigned to material while creating material in SAP MDG-M

Accepted Solutions (0)

Answers (1)

Answers (1)

shivananddeshmu
Explorer
0 Kudos

Hi,

The question is not clear. As I understand you need to read the classification data entered in the MDG-M UI.

- You can read the class & charact data in CHECK BADI

- You can read the class & charact data in Derive BADI (Howewer you cannot default/derive classification entity using the derive BADI)

- You can read classification entity using Governance APIs

Where do you want to access this data ?

Former Member
0 Kudos

Hi shivanand,

could you please provide me some sample code to read class & charact data in Derive BADI.

d024348
Employee
Employee
0 Kudos

For BAdI USMD_RULE_SERVICE_CROSS_ET, there is an example implementation that also reads classification data.

Regards, Ingo Bruß

shivananddeshmu
Explorer
0 Kudos

Hello Anand,

Can you please explain where,when and why you want to read the classification data to get clear picture ?

Anyway,

In Derive and Check BADI you get reference to IO_MODEL instance of type IF_USMD_MODEL_EXT.

This interface has many methods to read the entity values :

You can try methods

IO_model->retrieve_char_value ()


For using the API please refer the below document.

http://scn.sap.com/docs/DOC-45127

Best Regards,

Shivanand

Former Member
0 Kudos

Hi Shivanand

I am trying to read the material number with the below code in Derive method of interface IF_USMD_MODEL_EXT but it is returning null.could you please correct me if anything wrong in below code.

   CALL METHOD io_model->create_data_reference

     EXPORTING

       i_fieldname = if_mdg_bs_mat_gen_c=>gc_fieldname_material

       i_struct    = if_usmd_model_ext=>gc_struct_key_attr

       i_tabtype   = if_usmd_model_ext=>gc_tabtype_sorted

     IMPORTING

       er_data     = lr_t_data_material

       et_message  = lt_usmd_message.

   ASSERT lt_usmd_message IS INITIAL. " Room for error handling here...

   ASSIGN lr_t_data_material->* TO <lt_data_material>.

   CREATE DATA lr_data_material LIKE LINE OF <lt_data_material>.

   ASSIGN lr_data_material->* TO <ls_data_material>.

* Selection Criteria - MATNR

   ls_sel-fieldname = 'MATERIAL'.

   ls_sel-option    = 'EQ'.         "equal

   ls_sel-sign      = 'I'.          "including

   INSERT ls_sel INTO TABLE lt_sel.

*  Read Material

   CALL METHOD io_model->read_char_value

     EXPORTING

       i_fieldname = if_mdg_bs_mat_gen_c=>gc_fieldname_material

       i_readmode  = if_usmd_model_ext=>gc_readmode_all_inact

       it_sel      = lt_sel

     IMPORTING

       et_data     = <lt_data_material>

       et_message  = lt_usmd_message.

shivananddeshmu
Explorer
0 Kudos

At a quick look, you are trying to read value of material with value space !

There is no value in ls_sel-low or high .. could this be your problem ?

You can also use IF_USMD_MODEL_CR_EXT~GET_CR_OBJECTLIST method to get the list of materials in the CR.

Former Member
0 Kudos

Thanks shivanand for your response

If i don't pass the lt_sel parameter in above code i am getting all material numbers but my requirement is to get the material no generated after entering the data like (plant storage location) in initial screen and click on continue.