on 04-19-2017 3:50 PM
Hi Expert,
I am doing the validation for material in 'USMD_RULE_SERVICE~CHECK_ENTITY' BADI. Here I am trying to create the custom message as link to point the fields on the screen. but somehow I am not able to achieve the goal.
Below is the code I have implemented in the BADI.
*Start of code
when 'MARCPURCH'.
call method io_model->create_data_reference " key value lr_key is passed in Zerror_msg for link addition in msg
exporting
i_fieldname = 'MARCPURCH'
i_struct = if_usmd_model_ext=>gc_struct_key
if_table = abap_false
importing
er_data = lr_key.
if lr_key is bound.
assign lr_key->* to <ls_key>.
assign component 'MATERIAL' of structure <ls_key> to <lv_key1>.
assign component 'WERKS' of structure <ls_key> to <lv_key2>.
<lv_key1> = <lv_matnr>. "Material number created on run time
<lv_key2> = <lv_werks>. "Plant added
endif.
loop at it_data[] assigning <wa_data> .
assign component 'EKGRP' of structure <wa_data> to <lv_data>.
if <lv_data> <> 'M2'. " or <lv_data> <> 'AQ' or <lv_data> <> 'PQ'. "Title check for company
ls_message-fieldname = 'MARCPURCH-EKGRP'.
ls_message-msgid = 'ZMDGMM'.
ls_message-msgno = '004'.
ls_message-msgty = 'E'.
ls_message-msgv1 = lv_material.
ls_message-row = cl_mdg_bs_key_row_map_service=>set_key(
is_key = lr_key
iv_entity = 'MARCPURCH'
iv_fieldname = 'EKGRP' ).
append ls_message to et_message.
if et_message is not initial.
lo_msg_nav = cl_mdg_bs_mat_msg_nav=>get_instance( ).
lo_msg_nav->save_navigation_data(
exporting it_message = et_message ).
endif.
endif.
endloop.
endcase.
Any help will be highly appreciated.
Thanks
Chandan
Hi,
It does work for the tabbed UI. You need to create data reference for the entity and need to fill the values for key fields in the entity and then pass the reference to the class CL_MDG_BS_KEY_ROW_MAP_SERVICE=>SET_KEY, to set the row value.
Assume lr_key has the data reference of BP_IDNUM entity,
Fill the key values BP_HEADER,BP ID Type, BP ID number, like below.
ASSIGN lr_key->* TO <ls_idnum_key>.
ASSIGN ('<ls_idnum_key>-BP_HEADER') TO <ls_id_data>.
Fill the other key values in the similar way and call the below class,
ls_message-row =
cl_mdg_bs_key_row_map_service=>set_key( is_key = lr_key
iv_entity = ‘BP_IDNUM’
iv_fieldname = <filedname>).
Then, append the message details with row value to the ET_MESSAGE table. It highlights the error field.
Thanks,
Shruthi R
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you guys ..
I got the solution to make the custom error message as hyperlink to corresponding fields. But this works only for sequential UI not the Tabbed UI. Please let me know if any one faced the same issue.
Thanks
Chandan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
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.