on 03-28-2016 9:34 AM
Hi,
I have a requirement where i need to trigger two different workflow using a single CR, it is working for me as long as I use my inputs from MATERIAL entity
ref following link
but when i give my input from other entity for eg MARCFRGTR it doesnt work, I have changed the structure also in the BADI which is given in the link above.
Can anyone help me on this
Thanks
Arihant
Hi Arihant,
I hope you have created a custom implementation for this BADI.
Please check below points:
CALL METHOD lr_model->create_data_reference
EXPORTING
i_fieldname = if_mdg_bs_mat_gen_c=>gc_fieldname_marcfrgtr
i_struct = lr_model->gc_struct_key_attr
if_table = abap_true
i_tabtype = lr_model->gc_tabtype_sorted
IMPORTING
er_data = lr_data.
get_element_id(
EXPORTING
iv_cr_type = lv_crequest-usmd_creq_type
iv_name = 'CASMARCFT'
IMPORTING
ev_brf_expr_id = lv_brf_expr_id ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
method READ_MARCFRGTR is not there in standard SAP system, and i wanted to do it without going for too much customization and morover the link which i shared shows to put fields in User agent decision table but my requirement is to trigger the workflow based on input in Single value decision table so i am not sure whether that BADI or Enhancement will come in to picture, the concern here i have now is BRF+ decision tables dont support cross entity rules so,
If it is reading material from entity MATERIAL than decision table wont read input from other entity like MARCFRGTR, but if we give our input from the same entity MATERIAL than it works
so is there any way that my decision table reads material from entity MARCFRGTR since we have material (MATNR) in this entity as well
Thanks
Arihant
Hi Arihant,
For example i told a method READ_MARCFRGTR. This is not existing in standard example implementation. You have to create this method and code it similar to READ_MATERIAL.
Please follow below steps in the BADI:
METHOD read_marcfrgtr.
DATA: lr_model TYPE REF TO if_usmd_model_ext.
DATA: lt_sel TYPE usmd_ts_sel.
DATA: ls_sel TYPE usmd_s_sel.
DATA: lt_objlist TYPE usmd_t_crequest_entity.
DATA: ls_objlist TYPE usmd_s_crequest_entity.
DATA: lv_matnr TYPE matnr.
DATA: lr_data TYPE REF TO data.
FIELD-SYMBOLS: <lt_data> TYPE SORTED TABLE.
FIELD-SYMBOLS: <ls_data> TYPE any.
CONSTANTS: lc_incl TYPE ddsign VALUE 'I'.
CONSTANTS: lc_equal TYPE ddoption VALUE 'EQ'.
CLEAR: es_marcfrgtr.
* Get read-only access to USMD model data
CALL METHOD cl_usmd_model_ext=>get_instance
EXPORTING
i_usmd_model = if_mdg_bs_mat_gen_c=>gc_model_mm
IMPORTING
eo_instance = lr_model.
* Read object list of CR and get the one and only material:
* Get the key of the (type 1) entity MATERIAL
* from the object list of this CR
ls_sel-sign = lc_incl.
ls_sel-option = lc_equal.
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 = usmd0_cs_fld-crequest
it_sel = lt_sel
if_use_edtn_slice = abap_false
IMPORTING
et_data = lt_objlist.
READ TABLE lt_objlist INTO ls_objlist INDEX 1.
ASSERT sy-subrc = 0. " CR not found or contains no material
lv_matnr = ls_objlist-usmd_value.
* Prepare result table for MATERIAL read
CALL METHOD lr_model->create_data_reference
EXPORTING
i_fieldname = if_mdg_bs_mat_gen_c=>gc_fieldname_marcfrgtr
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>.
* 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 = 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_marcfrgtr
it_sel = lt_sel
i_readmode = if_usmd_model_ext=>gc_readmode_default
if_use_edtn_slice = abap_false
IMPORTING
et_data = <lt_data>.
* Return the one and only result
READ TABLE <lt_data> ASSIGNING <ls_data> INDEX 1.
ASSERT sy-subrc = 0. " CR not found or contains no material
MOVE-CORRESPONDING <ls_data> TO es_marcfrgtr.
ENDMETHOD.
METHOD if_usmd_ssw_rule_cntx_prepare~prepare_rule_context.
* Add one decision table parameter "Labor" (MARC-CASMARCFT)
* to the user agent decision table
DATA: lv_brf_expr_id TYPE if_fdt_types=>id.
DATA: ls_context TYPE usmd_s_fdt_context_value.
DATA: lv_crequest TYPE usmd_s_crequest.
DATA: ls_marcfrgtr TYPE /MDGMM/_S_MM_PP_MARCFRGTR.
FIELD-SYMBOLS: <value> TYPE any.
* Prepare export parameters
CLEAR et_message.
CLEAR et_rule_context_value.
* Read the one and only material of the CR
CALL METHOD read_marcfrgtr
EXPORTING
iv_cr_number = iv_cr_number
IMPORTING
es_material = ls_marcfrgtr.
* Read the CR itself (to get the CR type
CALL METHOD read_crequest
EXPORTING
iv_cr_number = iv_cr_number
IMPORTING
es_crequest = lv_crequest.
* fill out the return table
get_element_id(
EXPORTING
iv_cr_type = lv_crequest-usmd_creq_type
iv_name = 'CASMARCFT'
IMPORTING
ev_brf_expr_id = lv_brf_expr_id ).
ls_context-id = lv_brf_expr_id.
CREATE DATA ls_context-value TYPE labor.
ASSIGN ls_context-value->* TO <value>.
<value> = ls_material-labor.
APPEND ls_context TO et_rule_context_value.
ENDMETHOD.
Ok I will try this but i have one more concern here, when we upload a material using File upload option through MDG, does in the back-end our system call structure MDGM_*_*_MATERIAL by default? to read the material (remember here i am not giving input to User agent decision table so there is no use of the BADI which is given in the link I guess) or if i modify my programme based on MARCFRGTR it may call it from MDGM_*_*_*_MARCFRGTR structure?
Thanks
Arihant
Yes, I am using a separate CR only for both HERKL and CASMARCFT fields, these two fields i want to club in a single CR which is based on my file upload approach, there i want too check whether it checks for structure MDGMM_*_*_*_MATERIAL in the back end or not, because i think it is reading the material from this structure and since HERKL/CASMARCFT come in a different structure it is getting failed
Is that correct?
This link explains about triggering different user based on input we give
but it is limited to entity MATERIAL i guess, since LABOR is coming under structure ?/MDGM_S_PP_MM_MATERIAL
but my requirement is to trigger different user based on field COO and CAS which are coming under entity MARCFRGTR and structure is /MDGM_S_PP_MM_MARCFRGTR which is not working for me
I checked with the developer and he says this BADI/Enhancement is reading material from structure /MDGM_S_PP_MM_MATERIAL thats why it is not triggering other structure
Is that understanding correct?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.