0% found this document useful (0 votes)
303 views2 pages

CRM BOL Query and Result Processing

This document contains code to query a CRM business object model using the SAP CRM Business Object Layer (BOL) API. It loads a component set, gets an instance of a query service, sets query parameters, executes the query to get results, and displays the results. The query retrieves data for a specific object ID from the 'BTQuery1O' query in the model. Field values from each returned entity are extracted and added to a table for output.

Uploaded by

Berk Can Polat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
303 views2 pages

CRM BOL Query and Result Processing

This document contains code to query a CRM business object model using the SAP CRM Business Object Layer (BOL) API. It loads a component set, gets an instance of a query service, sets query parameters, executes the query to get results, and displays the results. The query retrieves data for a specific object ID from the 'BTQuery1O' query in the model. Field values from each returned entity are extracted and added to a table for output.

Uploaded by

Berk Can Polat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

REPORT 

zbp_p_bolinse38.
 
TYPES : BEGIN OF ty_tab ,
          value1 TYPE string,
          value2 TYPE string,
          value3 TYPE string,
          value4 TYPE string,
        END OF ty_tab.
 
DATA: lr_core   TYPE REF TO cl_crm_bol_core,
      lr_query  TYPE REF TO cl_crm_bol_query_service,
      lr_query1 TYPE REF TO cl_crm_bol_query_service,
      lr_result TYPE REF TO if_bol_entity_col,
      lr_entity TYPE REF TO cl_crm_bol_entity,
      lv_string TYPE string,
      lt_tab    TYPE TABLE OF ty_tab WITH HEADER LINE.
 
TRY .
 
 
    lr_core = cl_crm_bol_core=>get_instance( ).
 
    lr_core->load_component_set( 'ONEORDER' ). " bsp_wd_cmpwb'de çalışma sü
resi repository-component-models altında ne varsa
 
    lr_query = cl_crm_bol_query_service=>get_instance( iv_query_name = 'BTQ
uery1O' ). "" bsp_wd_cmpwb'de bol model tarayıcısı-sorgu nesnesinden buldu
m
 
    DATA it_parms TYPE crmt_name_value_pair_tab.
    DATA wa_parms TYPE crmt_name_value_pair.
 
 
  "Bol Model tarayıcısındaki sorgu nesnesi BTQuery1O altındaki sorgu tipin
de ne varsa o 
    wa_parms-name = 'OBJECT_ID'.
    wa_parms-value = '0000008224'.
    APPEND wa_parms TO it_parms.
 
* Add the selection parameters
    CALL METHOD lr_query->set_query_parameters
      EXPORTING
        it_parameters = it_parms.
 
* Get the result list
    lr_result = lr_query->get_query_result( ).
 
    lr_entity ?= lr_result->get_first( ).
 
 
    WHILE lr_entity IS BOUND.
      "Bol Model tarayıcısındaki sorgu nesnesi BTQuery1O altındaki sorgu s
onuç tipinde ne varsa o 
      lt_tab-value1 = lr_entity->get_property_as_string( 'CRM_GUID' ).
      APPEND lt_tab.
      lr_entity ?= lr_result->get_next( ).
    ENDWHILE.
 
    cl_demo_output=>display( lt_tab ).
 
  CATCH cx_crm_cic_parameter_error .
    MESSAGE 'Pass Value to variable error!' TYPE 'E'.
ENDTRY.

You might also like