cancel
Showing results for 
Search instead for 
Did you mean: 

Method for reading technical key value for material number

Former Member
0 Kudos

Hi Everyone,

           Method for reading technical key for material number in MDG-M.or table containing change request number,technical key and material number.


thanks & regards, Bhuvaneswari


Accepted Solutions (0)

Answers (1)

Answers (1)

former_member209780
Active Participant
0 Kudos

Hi Bhuvaneswari,

Why would you need to read technical key. If you want to read the Entity data or change request data or workflow data you have MDG API. You call the API and get the information you need.

Thanks

Goutham

Former Member
0 Kudos

Hi Goutham,

        

Thanks for your reply,     

       I am trying to read the selected material for single processing in the list of materials attached to one change request in method CHECK_ENTITY for BADI USMD_RULE_SERVICE.

but by using this  method READ_ENTITY_DATA_ALL it retrieves all the materials attached to request.

Any inputs,

Thanks

Bhuvaneswari

Former Member
0 Kudos

Hi

From method READ_ENTITY_DATA_ALL itself, you might be getting all required data in exporting parameter ET_DATA_ENTITY. Check for the reference parameter R_T_DATA in ET_DATA_ENTITY. Field USMDKMMMATERIAL (Technical Key) might be present.

former_member209780
Active Participant
0 Kudos

Hi Bhuvaneswari,

The import parameter IT_DATA in CHECK_ENTITY method will have the material data. If you need any further information of the material use import parameter IO_MODEL and call READ_CHAR_VALUE method by passing information like material number etc. Below is a sample piece of code.

Data: lr_data type ref to data.

Field-symbols: <lt_data> type sorted table,

                        <ls_data> type any. 

CALL METHOD io_model->create_data_reference    

EXPORTING       i_fieldname = "Entity Name"     

i_struct    = io_model->gc_struct_key_attr     

if_table    = abap_true     

i_tabtype  = io_model->gc_tabtype_sorted   

IMPORTING     

er_data    = lr_data. 

ASSIGN lr_data->* TO <lt_data>.

* Read MATERIAL via material number and Change Request ID 

CLEAR lt_sel. 

ls_sel-fieldname = if_mdg_bs_mat_gen_c=>gc_fieldname_material. 

ls_sel-sign  = lc_incl. 

ls_sel-option = lc_equal. 

ls_sel-low    = "Material Number". 

INSERT ls_sel INTO TABLE lt_sel. 

ls_sel-fieldname = usmd0_cs_fld-crequest. 

ls_sel-low      = "Change request number".  

INSERT ls_sel INTO TABLE lt_sel. 

CALL METHOD io_model->read_char_value    

EXPORTING       i_fieldname      = "Entity Name"     

it_sel            = lt_sel     

i_readmode        = if_usmd_model_ext=>gc_readmode_default     

if_use_edtn_slice = abap_false   

IMPORTING       et_data          =.<lt_data>.

Thanks

Goutham