cancel
Showing results for 
Search instead for 
Did you mean: 

MDG Supplier/Customer Search distinction

former_member196830
Active Participant
0 Kudos

Dear MDG gurus,

I've implemented both, the Lean Vendor UI and the ERP Customer UI.

Now I can freely create Vendors and Customers in the system. As you know, they both originate from the Business Partner.

When I get to the search screen to any of them, the search is performed by the Business Partner, which is fine but the result contains both entities - Vendor and Customer.

I am able to filter out the Vendors from the search results (based on role or number ranges) and the same I can do to filter out the Customers when I need to do so from the Vendor Search screen.

My problem is though, that if the users don't filter out the Vendors from the Customer Search screen for example, they can go in through the Customer UI and initiate a Customer Change Request for the Vendors.

Please let me know if there is a way to force the Search to be done based only on one of them (the Vendors or the Customers), and not the based on the Business Partners. I need users to always see only the results for one of them based on the Search screen.

Another approach would be to prevent the users from opening the Vendors and Vendor CRs from the Customer Search screen and vice versa.

I'll be looking forward for your advise..

Best regards,

Boris

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Boris!

Did you get the solution on this?

Could you share it here?

Thanks!

Former Member
0 Kudos

You can enhance the search provider to filter out the results (in customer view, remove vendors and vice versa).

Former Member
0 Kudos

Hi thanks Abdullah,

Could you explain the steps to do that in a little more detail?

Thanks a lot!

Former Member
0 Kudos

You can build a post-exit enhancement to the method that returns the search results. Loop through the results and determine who is a customer and who is a vendor. You just need to pay attention to performance so your additional logic won't slow the search functionality.

Former Member
0 Kudos

Yes, That exactly what I am doing.

In class: CL_MDG_BS_BP_HANDLER we have all the methods like:

QUERY_BP_BY*

but the selects are like this for example (QUERY_BP_BY_GENERAL):

SELECT partner

     FROM but000

     UP TO iv_num_entries ROWS

     INTO  TABLE lt_partner

     WHERE partner  IN lr_partner

       AND type     IN lr_type

       AND mc_name1 IN lr_mc_name1

       AND mc_name2 IN lr_mc_name2

       AND bu_sort1 IN lr_bu_sort1

       AND bu_sort2 IN lr_bu_sort2

       AND augrp    IN lr_augrp

     ORDER BY PRIMARY KEY.



So I difference if we are in customers or suppliers for example like this:


DATA: lo_fpm     TYPE REF TO if_fpm.

     lo_fpm = cl_fpm_factory=>get_instance( ).

     IF lo_fpm is BOUND.

     IF lo_fpm->get_runtime_info( )-config_id 'BS_OVP_CU_CL'. "Customers.

"(we use CBA  + Customising FPM and always this config, no Z's configurations!)

" Add BU_GROUP for customers (i.e. PAYE,RECI,0001,HIER...etc) to lr_bu_group.

     ELSE. "(Suppliers)

" Add BU_GROUP for vendors (i.e. LIEF,KRED...) to lr_bu_group.

     ENDIF.

     ENDIF.

(is this the best way? any other way possible to diference from both?)

and then the select has to be enhanced with:

SELECT partner

     FROM but000

     UP TO iv_num_entries ROWS

     INTO  TABLE lt_partner

     WHERE partner  IN lr_partner

       AND type     IN lr_type

       AND bu_group IN lr_bu_group

       AND mc_name1 IN lr_mc_name1

       AND mc_name2 IN lr_mc_name2

       AND bu_sort1 IN lr_bu_sort1

       AND bu_sort2 IN lr_bu_sort2

       AND augrp    IN lr_augrp

     ORDER BY PRIMARY KEY.



*********************************


The thing is that the filter has to be done before the select, because if you don't put nothing on search criteria and the max number is for example 100 BP... it will select the 100 BP (imagine that all are vendors because vendor number are lowest than customers), then you will have 0 BP at the result.


**********************************


My recomendation is to get the Access key of the class CL_MDG_BS_BP_HANDLER and adapt it.

In this case it is not possible to Create and register a custom access class and redefine methods and suscribe the class to V_MDG_BS_BP_HDL view. as CL_MDG_BS_BP_HANDLER is not an abstract class.



It is more ore less what you were saying?

Former Member
0 Kudos

You could do something like this. You don't need the access key however. You can always enhance the class and write an over-write method. When you display the class in SE24, there is a swirly icon in the application toolbar. That icon is used to enhance the class.

former_member196830
Active Participant
0 Kudos

What I ended up doing is I created a Saved Search and filter the BPs by Number Range. In our case the number ranges are different and it's easy to distinguish the business partners.

You can use it as way to figure out what partner you are dealing with... I did not have to enhance the search handler class, but it's a good idea to do that if you can't get away with just saved search.

Regards,

Boris

former_member196830
Active Participant
0 Kudos

Abdullah, can you just provide the name of the class and the method that needs to be enhanced, so we make it clear?

Thanks in advance,

Boris

Former Member
0 Kudos

I don't have a specific class in mind. I was looking into this a while ago and I did a quick POC using the search method EXECUTE in class: CL_SDQ_USMD_SEARCH_DATA_IMPL. As Ignacio highlighted above, this approach has limitations if all the results returned by EXECUTE were customers when you are looking for vendors and vice versa. I like Ignacio's idea of enhancing the GenIL handler class. Basically, you can defined a sub-class and then use the sub-class in an enhancement to the BP GenIL model.

Answers (0)