Skip to content

Instantly share code, notes, and snippets.

@svict4
Created January 17, 2018 01:03
Show Gist options
  • Select an option

  • Save svict4/ae1a56b5285afa61cdff1bbf1a0a1873 to your computer and use it in GitHub Desktop.

Select an option

Save svict4/ae1a56b5285afa61cdff1bbf1a0a1873 to your computer and use it in GitHub Desktop.
ABAP SAP CRM - BOL Entity Query
DATA: lv_bol_core TYPE REF TO cl_crm_bol_core,
lv_query TYPE REF TO cl_crm_bol_query_service,
lv_collection TYPE REF TO if_bol_entity_col,
lr_entity TYPE REF TO cl_crm_bol_entity,
lt_table TYPE TABLE OF bu_partner.
*-- Get an instance of the core and fire it up.
lv_bol_core = cl_crm_bol_core=>get_instance( ).
lv_bol_core->start_up( 'BP_APPL' ). "Component Set
*-- Query object for the component in get_instance
lv_query = cl_crm_bol_query_service=>get_instance( 'BuilIDNumberSearch' ).
*-- Set a criteria for the query
lv_query->set_property( iv_attr_name = 'IDENTIFICATIONNUMBER'
iv_value = '123456789X' ).
*-- Execute the query
lv_collection = lv_query->get_query_result( ).
*-- Iterate through the results
lr_entity = lv_collection->get_first( ).
WHILE lr_entity IS BOUND.
*-- Chuck the BP ID from the entity into a local table then grab the next result.
APPEND lr_entity->get_property_as_string( iv_attr_name = 'BP_NUMBER' ) TO lt_table.
lr_entity = lv_collection->get_next( ).
ENDWHILE.
*-- Return the BP Ids from the Customers with '123456789X' as their CRN.
rt_bp_nums = lt_table.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment