cancel
Showing results for 
Search instead for 
Did you mean: 

Filter entities

Former Member
0 Kudos

Hi,

I copied the Items view and made a new view called 'Service offerings'.I require both these assignment blocks in my opportunity.Now whatever i ass to Items view gets reflected in service oferings also and viceversa

How do i prevent this?

Thanks in advance

Shilpi

Accepted Solutions (1)

Accepted Solutions (1)

CarstenKasper
Active Contributor
0 Kudos

After reading this I feel reminded of a little coding I have done some time back. My assignment was to show marketing attributes of different attribute classes in different assignment blocks. What I did was a quick solution as I did not have much time.

I copied the view, as you did. Then in the copied view I had my Z classes where I could make changes. Now in the Context Class, the one with CTXT at the end, there is a method ONNEW_FOCUS. This method is always created by the wizard when you create a related model node.

Now in the ON_NEW_FOCUS method the normal procedure is to get the collection via


lr_col = lr_entity->get_related_entities( '[Some relation name]' ).

after this coding I put some custom coding to filter out entities I did not want to show in that assignment block. I filtered on base of the attribute set, you will probably use the offer type...


Data: 
  lr_iter type ref to if_bol_bo_col_iterator.

lr_iter = lr_col->get_iterator( ).

lr_iter->filter_by_property( iv_attr_name = 'ATTRIBUTE_SET' iv_value = '[The value you desire]' ).

lr_col->clear( ).
lr_property = lr_iter->get_first( ).
while lr_property is bound.
  lr_col->add( lr_property ).
  lr_property = lr_iter->get_next( ).
endwhile.

Now the collection only contains items of this one attribute set as desired and I can set it safely to the context node.

You should have some additional coding in place to prevent users from creating entities of the type you filter out. It will lead to some misunderstanding if entities keep "disappearing".

I had to type the coding in here by hand from my head. There may be mistakes in there, but the idea should be clear.

The big, and more performent, solution would be a new relation in the BOL model that only reads the items from the database that need to get displayed. However for a small development task with time restriction the solution pointed out here will do.

cheers Carsten

Former Member
0 Kudos

Thanks Ton Carsten:)

This solution worked perfectly!!!

Kind Regards

Shilpi

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Since both views are bound to same bol entity, it will get reflected. Remove binding of view context node BTAdminI to the component controller as you did previously for BTAdminH (in your previous thread i suggested you to add code in context class create context node method. remove that code in your view).

But i am not clear what is the business need you are trying to fulfil?

Best regards

Pankaj Kumar

Former Member
0 Kudos

Hi,

The business requirement is as follows:

I should have 2 assignment blocks

1.Service offerings : for this block the f4 help should return items that are in the service category.

2.Solutions : for this block the f4 help should return items that are in the solutions category.

I have used the already existing Items block as my Solutions block and have modified the f4 accordingly.For service offerings block i have copied the original view Items by right clicking and selecting the option copy view.

When i am selecting a service in my service assignment block it is getting reflected in Solutions block too and viceversa.

What should be done?

Thanks and Regards

Shilpi

Former Member
0 Kudos

no pointers:(

Former Member
0 Kudos

hi,

The BTADMINI node is not linked to the component controller but the BTITEMS node is linked to the BTITEMS node of the custom controller OpptDetailsCuCo.

The relations are like BTADMINH->BTITEMS->BTADMINI.

Now the BTITEMS node of both the views is linked to the same node of the custom controller.

What can be done 2 remove this coupling?

Should i create a new BTITEMS node in custom controller and bind it to the the BTITEMS node of one of the views?

Thanks and Regards

Shilpi