Skip to Content
author's profile photo Former Member
Former Member

Sample code for Badi CRM_IC_INBOX_BADI method AFTER_SEARCH

Hi,

I am filtering the search result based on one custom field.

I am able to filter the table C_INBOX_ITEMS.

Can you please provide some sample code to synch C_NATIVE_ITEMS_FOUND .

Thanks

Subhankar

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Dec 12, 2011 at 02:38 PM

    Hi Subhankar,

    The c_native_items_found is a collection of CRM bol entities. So, you must use an iterator to loop trough those entities.

    Normally, I use a strategy like this three steps:

    1. Copy collection

    DATA: lr_bol_entity TYPE REF TO if_bol_entity_col
    lr_bol_entity = c_native_items_found->if_bol_entity_col~get_copy( ).
    

    2. Get iterator

    DATA  lr_iterator TYPE REF TO if_bol_entity_col_iterator.
    lr_iterator =  lr_bol_entity->get_iterator( ).
    

    3. Get first entity and loop the whole collection (and optionally, filter them!)

    DATA: lr_entity TYPE REF TO cl_crm_bol_entity.
    DATA: lv_value TYPE string.
    IF lr_iterator IS BOUND.
      lr_entity = lr_iterator->get_first( ).
      WHILE lr_entity IS BOUND.
        IF lr_entity->get_name( ) = '<Some_object>'.
          lv_value = lr_entity->get_property_as_string( iv_attr_name = '<some_entity_attribute' ).
          IF lv_value = '<some_condition>'.
            c_native_items_found->if_bol_entity_col~remove( lr_entity ). "remove the item
          ENDIF.
        ENDIF.
        lr_entity = lr_iterator->get_next( ).
      ENDWHILE.
    ENDIF.
    

    Check if this can help you a little more.

    Additionally, there is a BOL cookbook available in SDN that can help you a little more.

    Kind regards,

    Garcia

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.