cancel
Showing results for 
Search instead for 
Did you mean: 

BadI: USMD_SSW_RULE_CONTEXT_PREPARE

Former Member
0 Kudos

Hey Guys,

I am completely new in the MDG area.

I found the HowTo "Master Data Governance for Material: BADI USMD_SSW_RULE_CONTEXT_PREPARE to enhance User Determination". There it is described how to enhance the context via Enhancement Spot USMD_SSW_SERVICE_PROCESSOR and example implementation MDG_BS_MAT_BRF_CONTEXT_LABOR.

We have following situation: We need the 'plant' for the decision tables in BRF+. So we assumed that we can use the logic described in the howto (although the field 'labor' is used).

I implemented the BadI and tried it via debugging for the standard functionality (labor). Following problem: In method READ_MATERIAL (no change of standard implementation) in line 59 (lr_model->read_char_value after gc_fieldname_material and  usmd0_cs_fld-crequest is set in lt_sel) there are no entries in <lt_data>.

Where could be the problem?

Further question: How is it possible to enhance the code to retrieve the plant values out of the Change request instead of 'labor'?

Thanks in advance.

Regards,

Tass.    

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Next issue: We have the requirement to generate a parallel processing for each plant entry in the user decision table. I tried to put several plant values in the BADI method prepare_rule_context -> lt_rule_context_value contains e.g. 2 plants. The BADI is called in method CL_USMD_WF_SSW-FIND_PATH_PROCESSOR. After the BADI call the method

cl_usmd_wf_ssw_rule_service=>process_dt_for_cr_type is called with the context_values. What happens there is that only the last entry is evaluated (plant is declared as element and so the context_value table is looped over and just the last entry is returned -> The decision table is read only for one plant and not for two).

I hope the issue is understandable. Any ideas? What we need is a possibility to select more entries from the decision table.

Former Member
0 Kudos

Just as an update: We implemented the logic through BadI USMD_SSW_DYNAMIC_AGENT_SELECT. There we select the value through a Z-Table and overrule the entries in table user_entries.

Former Member
0 Kudos

Hi,

now the method read_material works. Following issue: For replicatet materials (real material number) the method worked fine. For intermediat material (starting with $) the method did not retreive any values. When the last call of lr_model->read_char_value is changed (parameter i_readmode to if_usmd_model_ext=>gc_readmode_all_inact) the method works for all situations.

Retreive the value for plant: The value can be retreived throught entity if_mdg_bs_mat_gen_c=>gc_fieldname_marcbasic

  CALL METHOD lr_model->create_data_reference

    EXPORTING

      i_fieldname = if_mdg_bs_mat_gen_c=>gc_fieldname_marcbasic

      i_struct    = lr_model->gc_struct_key_attr

      if_table    = abap_true

      i_tabtype   = lr_model->gc_tabtype_sorted

    IMPORTING

      er_data     = lr_data.

  ASSIGN lr_data->* TO <lt_data>.

  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    = lv_matnr.

  INSERT ls_sel INTO TABLE lt_sel.

  ls_sel-fieldname = usmd0_cs_fld-crequest.

  ls_sel-low       = iv_cr_number.

  INSERT ls_sel INTO TABLE lt_sel.

  CALL METHOD lr_model->read_char_value

    EXPORTING

      i_fieldname       = if_mdg_bs_mat_gen_c=>gc_fieldname_marcbasic

      it_sel            = lt_sel

      i_readmode        = if_usmd_model_ext=>gc_readmode_all_inact

      if_use_edtn_slice = abap_false

    IMPORTING

      et_data           = <lt_data>.

Maybe there is still some fine tuning necessary but the global approach should be all right.

Hope it helps.

d024348
Employee
Employee
0 Kudos

Hi Tass (and whoever is still interested)

With note 1837696, the original example coding should work again.

Issue was that the context of the Change request got lost somewhere.

Best regards and sorry about the delay, Ingo Bruß

Former Member
0 Kudos

Hi Ingo

Can it possible to replace LABOR with MTART in example implementation MDG_BS_MAT_BRF_CONTEXT_LABOR?

As per

For the interface method you can use the default coding from Example Enhancement Implementation MDG_BS_MAT_BRF_CONTEXT_LABOR (Add MARA-LABOR to BRF+ context), Implementing Class CL_MDG_BS_MAT_BRF_CONTEXT_LABO and methods IF_USMD_SSW_RULE_CNTX_PREPARE~PREPARE_RULE_CONTEXT, GET_ELEMENT_ID, READ_MATERIAL and READ_CREQUEST.

I tried that and able to add in decesion table but getting below error in custom BADI

Any suggestion?

d024348
Employee
Employee
0 Kudos

Yes, you can certainly replace the LABOR with MTART - just copy the example implementation and adapt. Not sure why your class doesn't compile - never heard of such an issue, looks like a workbench handling issue.

Former Member
0 Kudos

Hi Ingo

I already raised seperate thread for this with all screen shot on Unable to find user agent from user agent decesion table

Can you porovide your comment on this thread?

former_member193350
Active Participant
0 Kudos

Hi Tass,

As this BAdI is used only for extending the decision tables so you have to include your plant field into this BADI and for method read_material method you have to read the plant data in staging area via change request and matnerial no.

for the error mentioned above you have to give your entity type name instead of labour which you have created in data model like for plant as ZMARC.

and in importing parameter et_data you have to give variable which you declare for zmarc entity. for staging area.

Hope this helps.

Regards

Prateek

Former Member
0 Kudos

Hello,

Even I also faced the same issue Today When I was trying to implement The same BADI.

There are some prerequisite Notes as per SAP Document.

Is there is any possibility that those notes are the  Reason For this issue?

Regards,

Ishani

d024348
Employee
Employee
0 Kudos

Hi all, we are currently investigating issues in the READ_MATERIAL method of the MDGM example implementation, namely why the method does not even read the LABOR any more. Might take some time, though...

Regards, Ingo Bruß

Former Member
0 Kudos

Hi,

Thanks in advance.

Regards,

Ishani