cancel
Showing results for 
Search instead for 
Did you mean: 

Restrict OVS Entries Based on Field Value

former_member183363
Active Contributor
0 Kudos

Hello everyone,

I've had a look at this section of the SCN for help before posting here --- none seemed to quite fit the bill. Apologies if pre-existing help for this already exists.

I'm modifying the 'projects' WorkCentre for a customer: they have a Customer Contact field which I've added to both the project creation and project overview screens, and turned into an OVS which was easy. They now have an additional requirement --- filter that OVS based on the company named as the buyer on the project creation screen. In theory it's pretty simple --- only show those contacts who have the same company as field X --- but I can't figure out how to go about it. Is there a simple bit of Ruby script to filter this? Do I need to create a custom OVS and do some ABSL scripting? Any help would be appreciated.

Lewis

Accepted Solutions (1)

Accepted Solutions (1)

former_member183363
Active Contributor

An update on this. I found a suitable parameter within the ContactPerson OVS --- RelationshipBusinessPartnerInternalID. This is, I believe, the ID of the company. SO when I tried to go into the ID-field configuration and add this field as a parameter and set it to the value of the company ID, it threw up an error message as below.

However, once I clicked through this it showed as being bound, as shown.

So one would think it'd only show entries where the RelationshipBusinessPartnerInternalID is the same as the company ID, right? But when I'm creating a new project, this happens...


As you can see, all of the contacts are shown, not just the ones for the chosen company. Is anyone able to explain why this isn't working, and how to remedy it? Thanks.

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Lewis,

"RelationshipBusinessPartnerInternalID" is not neccessary the Company ID.

It depends on the RelationshipTypeCode.

If you open the "Advanced" search section in the OVS:

- Do you see somewhere the value "Almika Ltd."?

Bye,

   Horst

former_member183363
Active Contributor
0 Kudos

Do you mean in the studio or in ByDesign? Because if you mean in ByDesign, the company name is right there in the third screenshot under the heading 'business partner name' in the customer contact OVS.

EDIT: I did a manual check, getting the code to pull the relationship business partner internal ID of a contact. That field is indeed the ID of the company to which the contact belongs.

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Lewis,

In ByDesign you do see the "Almika Ltd." besides the label "Company Name".

But that does not mean that this is the value which is transfered as "RelationshipBusinessPartnerInternalID".

Please in ByDesign go the the UI, go to the OVS and open the "Advanced" search.

What fields with what values do you see?

Bye,

   Horst

former_member183363
Active Contributor
0 Kudos

Horst,

These are the fields shown in the advanced pane of the Customer Contact OVS, see below. There are no values in them, because as soon as I click Henry Jones the window closes. I'm pretty sure the RelationshipBusinessPartnerInternalID is the right one though --- I got some code to pull through this ID into a field for the contact Henry Jones, and the string that appeared was the same one that appears in the 'Company ID' box shown.

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Lewis,

So you're right with the binding of "RelationshipBusinessPartnerInternalID" and the "CompanyID" in the UI.

But it looks like the "RelationshipBusinessPartnerInternalID" is not used in the OVS at all.

Therefore no filter will work here.

Can you bind it to another field like "BusinessPartnerID" in the OVS?

Bye,

  Horst

former_member183363
Active Contributor
0 Kudos

Damn...Ok, I'll see what I can do. Thanks for pointing that out, I wouldn't have noticed that.

EDIT: Can't find a suitable field in either the Contact or ContactPerson OVS. I guess I'll need a custom OVS then...any tips on how to configure one based on the BusinessPartner BO? I'm not too hot on all the inports and event handlers etc.

former_member200567
Active Contributor
0 Kudos

Hi, Lewis Peters.

      Let me clear what you want. The contacts of a customer, right?

      If so, use Contact.OVS. And use RelationshipBusinessPartnerID as Inport parameter binding of the OVS. That works. Your parameter must be customer ID.

Regards,

Fred.


former_member183363
Active Contributor
0 Kudos

Fred,

Yes, that's right. You mean the Contact OVS in the Public OVS list?

I chose that, and did this:

When I first got to this screen, clicking the 'Value' button highlighted didn't do anything. I have to click Ok, save and activate the change transaction, then go back into it at which point this happens...

I click the browse button, it pops up a warning box, I click through, then I can click on the Value button. However, when I select any of the data nodes as the parameter, it pops up the warning about extensibility explorer again. Once I click through that it shows the parameter as being bound, but after I save and activate and go to that screen in ByDesign it's still showing all contacts...

former_member200567
Active Contributor
0 Kudos

Hi, Lewis Peters.

1. If you are giving the right parameter , in this case "Customer ID", it should work.

     Can you check your parameter? There is contacts owl under Account Management. You can search with customer ID , I guess.

2. Delete the old ovs, and add it back again.

3. Clicking Value should also work. Don't click OK. Click Value and wait .There is one bad thing about extension fields. When you change something like that to an extension field , you cannot change it back. You have to delete it and readd it again.

Regards,

Fred.

PS. dont worry about the pop message

former_member183363
Active Contributor
0 Kudos

Fred,

I did as you said and waited for a solid minute after clicking Value --- nothing. Should I be raising an incident?

Lewis

former_member200567
Active Contributor
0 Kudos

Lewis,

    Can you check if it is happening in other standard screens too?

    Then , you have to raise an incident. Sorry.

    

    You can test Contacts.OVS with a custom screen if it works  as you wish or not.

Regards,

Fred.

former_member183363
Active Contributor

Did it!

Tried as Fred suggested and tested it on a custom screen, which worked. Process was thus:

I used the Company OVS which was in publicovs/organisationalcentreid because others caused issues, but this might not be the case for others. In the system I was using, the OrganisationalCentreID of the company I was testing against was a different length ('1000' instead of the expected '10000000') than the BusinessPartnerInternalID associated with it. This is why the second element is needed. Using AfterModify coding, I did the following:

This gets the BusinessPartnerInternalID of the company, which is the same as the RelationshipBusinessPartnerInternalID field used in the Contact OVS. Using the parameter binding I just matched up these two and voilà. One can also make the second field invisible so one doesn't clutter up their UIs.

There is I believe a Company OVS which is in the BusinessPartner subsection of the publicovs folder, which may negate having to have the extra field --- however I was experiencing issues using that, so I'm playing it safe for now. If this solution doesn't work on the customer's system in the standard screen I'll just take it up with SAP. Thanks all for your help!

Answers (2)

Answers (2)

former_member183363
Active Contributor
0 Kudos

So I've been fiddling with trying to create a custom OVS based on the BusinessPartner BO. My bindings are set up thus:

That is, Objectid is bound to BusinessPartner.InternalID and Objectname is bound to BusinessPartner.CurrentCommon.BusinessPartnerFormattedName.

Then, in the Controller tab, I selected ValueHelpQuery then BusinessPartner.QueryByIdentification and clicked bind as per the screenshot:

Finally, I set the field I want to be the OVS to use the OVS I've just defined. Now, I just tested it and it's pulling data, which is encouraging. I guess I should've seen it coming that it's pulling every single entity in BusinessPartner --- companies, employees, the lot. It's pulling all the contacts though, so that's something. So next step is: a) how to get it to show only contacts, and b) how to further refine that list to show only contacts from the company whose details are shown in another field on the screen --- those familiar with projects will know that one chooses a customer, and optionally a customer contact. As above, any help would be appreciated, thanks.

former_member200567
Active Contributor
0 Kudos

Hi, Lewis,

     When I want records restricted to a specific country in an OVS, I do this.

Hope this meets your requirement.

Regards,

Fred

former_member183363
Active Contributor
0 Kudos

That's somewhat helpful, thank you --- but can that restriction be bound to another field?

I just had a look at the steps you described above and tried it on the project creation screen --- unfortunately I can't see any field in the ContactPerson OVS to indicate which company a contact belongs to. I suppose I could possibly create my own, but I found the process very confusing.

former_member200567
Active Contributor
0 Kudos


Hi, Lewis,

Did you mean you can't find a suitable parameter in the inport of ContactPerson OVS?

If so, sorry to say but you have to create a custom OVS.

Regards,

Fred

former_member253394
Participant
0 Kudos

Hi Lewis,

I have the same requirement to restrict a value of one OVS field based on the other OVS, but in that case its not working for me.

Example:

first OVS having 2 values like  A

                                             B

                                            

A is having two value   D

                                  E

B is having two values F

                                  G

If i select A in the first OVS then in the second ovs only D and E value should come.

Can you please suggest?

Thanks,

Malkit Singh