Ansicht
Dokumentation
CRM_PRODUCT_INFOSETS - Create InfoSets for Product Segmentation
Vendor Master (General Section) General Material DataThis documentation is copyright by SAP AG.
To create product segments, you need a data source that supports the segmentation of set type data. This data source has to be based on an InfoSet.
SAP delivers the following InfoSets as examples:
- CRM_MKTTG_SET_CR_CONTROL for set type CRM_CR_CONTROL
- CRM_MKTTG_SET_EXCH_BUS for set type CRM_EXCH_BUS
- CRM_MKTTG_SET_PR_REST_IN for set type CRM_PR_REST_IN
- CRM_MKTTG_SET_TR_CONTROL for set type CRM_TR_CONTROL
To build your own InfoSets for set types, use the following procedure:
- Create a structure that contains the attributes of the set type (e.g. set type table structure) and the GUID. You can use structure CRMT_MKTTG_SETTYPE_CR_CONTROL for the set type CRM_CR_CONTROL as an example.
- Create a new InfoSet as data reading program with this structure.
- Copy an existing data reading program (e.g. from InfoSet CRM_MKTTG_SET_CR_CONTROL).
report rsaqdvp_template .
*
*---------------------------------------------------------------------*
* declarations
* (insert your declarations in this section)
*---------------------------------------------------------------------*
data:
crmt_mkttg_settype_cr_control type crmt_mkttg_settype_cr_control ,
it_data type standard table of crmt_mkttg_settype_cr_control .
field-symbols:
* !! the following comment MUST NOT BE CHANGED !!
*
*-------------------------------------------------------------------*
* selection screen statements
*-------------------------------------------------------------------*
* (define your selection-screen here)
data:
lv_repid type syrepid,
lt_selections type standard table of rsparams,
ls_selection type rsparams,
lt_fieldinfo type table of rsel_info,
ls_fieldinfo type rsel_info,
lv_string type string,
lv_fieldname type name_feld.
data: ls_gen_sel_option type comt_prsearch_gen,
lt_gen_sel_options type comt_prsearch_gen_tab,
lv_frgid type typename,
lv_attrid type fieldname,
lv_low type string.
data: lt_product type comt_prsearch_selection_tab,
ls_data type crmt_mkttg_settype_cr_control .
data:
lt_result type standard table of swhactor.
field-symbols: <fs> like line of it_data,
field-symbols
types: begin of ty_date_sel,
sign(1) type c,
option(2) type c,
low(45) type c,
high(45) type c,
end of ty_date_sel.
data: lt_date_sel type table of ty_date_sel,
ls_date_sel type ty_date_sel.
*-------------------------------------------------------------------*
* read data into IT_DATA
*-------------------------------------------------------------------*
* (select your data here into internal table IT_DATA)
*** filters
lv_repid = sy-repid.
*** read selections of query
call function 'RS_REFRESH_FROM_SELECTOPTIONS'
exporting
curr_report = lv_repid
tables
selection_table = lt_selections
exceptions
not_found = 1
no_report = 2
others = 3.
*** get fiedinfos for selections
call function 'RS_REPORTSELECTIONS_INFO'
exporting
report = lv_repid
tables
field_info = lt_fieldinfo
exceptions
no_selections = 1
report_not_existent = 2
subroutine_pool = 3
others = 4.
loop at lt_fieldinfo into ls_fieldinfo.
read table lt_selections into ls_selection
with key selname = ls_fieldinfo-name.
if sy-subrc = 0 and not ls_selection-sign is initial.
* Get the BP of the attribute
ls_gen_sel_option-frgtype_id = 'CRM_CR_CONTROL'.
split ls_fieldinfo at '-' into lv_string lv_fieldname.
select single attribute_id into ls_gen_sel_option-attribute
from comc_settyp_attr
where settype_id = 'CRM_CR_CONTROL'
and field_name = lv_fieldname.
ls_gen_sel_option-sign = 'I'.
ls_gen_sel_option-low = ls_selection-low.
if ls_gen_sel_option-low ca '*'.
ls_gen_sel_option-option = 'CP'.
else.
ls_gen_sel_option-option = 'EQ'.
endif.
append ls_gen_sel_option to lt_gen_sel_options.
endif.
endloop.
* correct result can be verified in settyp table - here SOK_SIMPLE_ALL
* intersting breakpoint: in method LOCAL_SEARCH
* of class CL_COM_PRSEARCHTOOL_ATTR
if lt_gen_sel_options is not initial.
call function 'COM_PRODUCT_GETLIST_API'
exporting
iv_max_rows = 0
it_gen_sel_options = lt_gen_sel_options
iv_scenario = 'CL_COM_PRSEARCHSCENARIO_ATTR'
iv_request_data = 'X'
importing
et_product = lt_product
exceptions
no_scenario = 1
error_getlist = 2
others = 3.
loop at lt_product assigning
ls_data-product_guid =
append ls_data to it_data.
endloop.
endif.
*------------------------------------------------------------*
* output of the data
* (this section can be left unchanged)
*------------------------------------------------------------*
* Check variables
data: r_tabname type string value '%dtab'.
field-symbols:
assign (r_tabname) to
concatenate r_tabname '[]' into r_tabname.
assign (r_tabname) to
loop at it_data assigning
move-corresponding
move-corresponding
append
check 1 = 2. "to avoid generated check routine
* !! the following comment MUST NOT BE CHANGED !!
*
endloop.
CRM_MKTTG_PRODUCT_GEN: Infoset for product master data
ROGBILLS - Synchronize billing plans General Material Data
This documentation is copyright by SAP AG.
Length: 8457 Date: 20240523 Time: 175817 sap01-206 ( 69 ms )