!--a11y-->
Sampling 
When you model target groups for large installations in the segment builder, avoid running the BW queries allocated to the data sources of the selection attributes over the entire dataset of the 0UCMA_C01 InfoCube in BW. The principle of sampling is to test various profiles against a business partner sample and then simply structure the target group for the entire InfoCube once modeling is complete. The business partner sample is realized in CRM as a special target group and in BW as a hierarchy for the 0BPARTNER InfoObject (business partner). You obtain the extract of the target group selection belonging to the business partner of this sample by modeling an aggregate for the InfoCube. Model the aggregate using the 0BPARTNER characteristic, with the lowest level of the sample hierarchy as the aggregation level.
Um das Sampling auf der Basis von BW-Datenquellen im Segment Builder einzusetzen, gehen Sie wie folgt vor:
...
To use sampling based on BW data sources in the segment builder, proceed as follows:
...
1. In CRM, create a sample. Choose Marketing ® Business Partner Segmentation ® Marketing Segments ® Samples for Segment Builder. Choose Create Profile Group, specifying the SAMPLE profile group category. Also create a rule for sample modeling and sample size. Structure the sample either in background or dialog.
2. Adopt the 0CRM_BPART_SAMPLE_HIER and 0CRM_SAMPLE_TEXT DataSources for the sample hierarchies and their names from the content. Replicate them in BW.
3. Extract your sample into BW. Create an InfoPackage for the 0BPARTNER InfoSource and the 0CRM_BPART_SAMPLE_HIER DataSource. On the Select Hierarchy tab title, refresh the sample hierarchy and mark it as relevant for BW. The system proposes a technical hierarchy name that you can either retain or change. Choose Load hierarchy and flag for activation/activate. Start the loading process. Also use an InfoPackage for the 0CRM_SAMPLE InfoSource and 0CRM_SAMPLE_TEXT DataSource to extract the descriptions of the hierarchies from CRM.
4. Go to the administrator workbench for the 0UCMA_C01 InfoCube and choose Maintain Aggregates. Choose Application Help, where you obtain detailed information on aggregates, as well as their definition and structure (roll-up). Have the system propose aggregates from the queries.
5. From the list of proposed aggregates, search for the most suitable aggregate for the query you want to use in the sample builder. Choose Copy with template. Ensure that the aggregate contains the 0BPARTNER characteristics of dimension. Choose the Hierarchy Level aggregation level. From the list, choose the sample hierarchy previously extracted to BW and define it using hierarchy level 2.
6. Activate and populate the aggregate.
7. In the CRM Easy Access menu, select Marketing ® Business Partner Segmentation ® Marketing Segments ® Segment Builder. In the segment builder choose Extras ® Settings. In the Sampling group box, enter the profile group and the sample you created in step 1 as the sample set and sample respectively.
8. You structure an aggregate for a query- in accordance with the BW sampling rules. If you now access a selection attribute filter in the staging area then this query automatically refers to the above aggregate only. The system uses the hits and the sampling rule to calculate the expected size of the target group, which it then displays. Compare this number with the size of the target group that you planned for the campaign. If the two groups differ considerably in size, change the modeling of your profile and restart the query with reference to the sample. Repeat this procedure until the estimated and planned target groups are the same size. You can now choose Create Target Group. The system now ignores the sample and takes into account all the business partners contains in the 0UCMA_C01 InfoCube.

You must ensure that the aggregates remain manageable in order to maintain system performance and keep the roll-up run times within reasonable limits. When you activate an aggregate for InfoCube 0UCMA_C01, the line item dimensions are erased independently of one another and the navigation attributes chosen for the aggregate are included in a dimension table for each line item dimension. At this point, include the corresponding navigation attribute in the new dimension. Do not include the characteristic of the line item dimension, since this would cause your aggregate to reach a size similar to the original InfoCube, which is not recommended. For example, your regional criteria for target group selection are the city and country. Delete the connection object number from the aggregate and only include the City and Country in the affected dimension.
To optimize system performance, we recommend you always include the time characteristic 0CALMONTH (calendar month/year) in the sampling aggregate.
If you want to use sampling for several BW queries in target group selection then you must modify all aggregates proposed from these queries for the sampling process.Alternatively, you can use an aggregate that contains the characteristics of all these queries. See also the notes in the online documentation on optimizing aggregates. To do this in the system, go to aggregate maintenance and choose Optimize.
In aggregate maintenance, use sampling in the segment builder to check the use of the aggregates. Choose On/off (F7) for each aggregate, compare the runtimes and check the Usage column.
For more information on working with aggregates, especially on roll-ups, see the document “Performance Tuning for Queries with BW Aggregates” on the BW pages in SAPNet ( → Service & Support → BW ASAP for 2.0B).

Queries with time-dependent characteristics for target group selection (for example industry) can only be used for sampling in a system running BW 3.0A. BW 2.1C does not support aggregates with time-dependent characteristics.
When using data sources based on InfoSets for CRM target group selection, the segment builder generates InfoSet queries during runtime, in order to execute the segmentation.For performance reasons it is advisable, when modeling the target group, to not select all the available business partner information, which is downloaded in the retraction from SAP BW to SAP CRM.
Create a sample in SAP CRM, as described in the previous section. Define a sampling InfoSet for this sample. To do this, proceed as follows:
· In the SAP Easy Access Menu, choose Architecture and Technology ® ABAP Workbench ® Utilities ® SAP Query ® InfoSets (transaction SQ02)
· Enter a name for the InfoSet and choose Create.
· Enter a description of the InfoSet.
·
Choose Table
join using basis table.
Specify the name of the container for storing
analytical data. Use the CRM_ADS_TABLES
task in the Easy Enhancement Workbench to find out the name.
You do this by selecting the object name that
does not end in _S.
· In the maintenance screen for the join, select Process ® Insert Table.
· Insert the CRMD_MKTTG_TG_I table (position target group).
· Define a join between the CRMD_MKTTG_TG_I-BP_GUID field and the field that represents the business partner GUID in the ADS table.
· Choose Continue.
· Choose Include All Table Fields.
· Choose Continue.
· Choose Generate.
Now enter the sampling InfoSet in your data source for the segment builder. You also enter the field from the InfoSet, which represents the GUID of the sample target group (CRMD_MKTTG_TK_I-TG_GUID), in the Sample field. This means that the system only uses the sampling InfoSet for selections when modeling the target group. The determination of the expected target group in the segment builder then functions as described in the previous section.

In large installations, an additional performance optimization may be necessary if many campaigns are executed at the same time. In this case you may not always wish to retract the business partner information for the entire dataset from the BW system into the CRM system. This is especially the case if several ADSs are to be filled at the same time. The following, alternative method is available. However, this method requires a considerable administrative effort.
· You extract the sample to be used into the BW system, as a hierarchy for the business partner InfoObject, and create an aggregate for the InfoCube for target group selection, regarding the sample hierarchy level. You then define a query for the InfoCube. For a description of this procedure, see section 5.1.2.
· In the first step of your analysis process in the BW system, select Read Data Via Query, rather than Read Data from InfoProvider, as the data source. Then select the query you defined previously. To improve the performance of selection using this data source, your sample (and, therefore, your aggregate for the InfoCube) should not contain more than 50,000 business partners.
· Once you have finished defining your analysis process, execute the data retraction from the BW system into the CRM system. This way, you receive an ADS, which only contains a sample section of your business partner information. You use this as a basis for defining your sampling InfoSet.
· Once you have finished modeling your target group, and the criteria for the target group have been set, then you define a second analysis process in SAP BW, which is uses the “Read Data from InfoProvider” data source, as described in section 4.4.2.2. In order to further reduce the amount of data to be transferred to the CRM system, you must use transformations from the “Restrict Data Quantity” category to define filter conditions. In doing this, you select filter conditions in accordance with the result of your target group modeling with the segment builder, so that the hit list from the structure of the target group remains unchanged. The data retraction to SAP CRM gives you a second ADS, which only contains the part of the business partner dataset that is relevant to the target group selection. You use this as your basis for defining your InfoSet for the target group structure in the CRM system.