https://raw.githubusercontent.com/ajmaradiaga/feeds/main/scmt/topics/SAP-HANA-blog-posts.xml SAP Community - SAP HANA 2024-05-10T05:01:27.468991+00:00 python-feedgen SAP HANA blog posts in SAP Community https://community.sap.com/t5/enterprise-resource-planning-blogs-by-members/advance-shipment-via-procurement/ba-p/13607652 Advance shipment via Procurement 2024-02-19T07:54:29.338000+01:00 Sandeep_Thakur https://community.sap.com/t5/user/viewprofilepage/user-id/1383684 <P>&nbsp;</P><P>In continuous of blog 1 of <A href="https://community.sap.com/t5/enterprise-resource-planning-blogs-by-members/advance-shipment-functionality-in-service-order/ba-p/13592593" target="_blank">Advance Shipment functionality in Service Order</A></P><P>&nbsp;</P><P>&nbsp;</P><P><STRONG>Scenario 2: Service Parts Are Not in Stock in a Warehouse</STRONG></P><P>In this scenario, spare is not available in the company stock. It will be procured from a vendor and then delivered to customer location. In order to procure from vendor, we will create a purchasing requisition followed by purchased order from a service order item.</P><P>And a sales order needs to be created to perform the outbound delivery on the basis. This setting is controlled and maintained at the configuration level for Item category.</P><P>Since this stock we have procured for specific service order hence at the time of goods receipt, parts are recorded as sales order stock (E) so that no one can use this stock.</P><P>Once the goods are procured then rest of the logistic process of delivering a spare part and consumption of the stock post remain identical as Scenario 1 (Service Parts Are Already in Stock in a Warehouse)</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sandeep_Thakur_0-1708076774249.png" style="width: 451px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/66434i349F953F0C368099/image-dimensions/451x239?v=v2" width="451" height="239" role="button" title="Sandeep_Thakur_0-1708076774249.png" alt="Sandeep_Thakur_0-1708076774249.png" /></span></P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>After the service technician confirms the use of the service part with a service confirmation, the final goods issue from the customer consignment stock (-) to the customer is posted including the material consumption.</P><P>&nbsp;</P><P>Process flow of End-to-end process –</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sandeep_Thakur_1-1708076774284.png" style="width: 520px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/66435i06C524E921236F56/image-dimensions/520x242?v=v2" width="520" height="242" role="button" title="Sandeep_Thakur_1-1708076774284.png" alt="Sandeep_Thakur_1-1708076774284.png" /></span></P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P><STRONG>Conclusion</STRONG></P><P><STRONG>&nbsp;</STRONG></P><P>Thanks for reading this blog post. Hopefully the blog post was informative. Please do let us know in case you have any question or query about this process in our Q&amp;A community :&nbsp;<A href="https://answers.sap.com/questions/ask.html?primaryTagId=3ea305d0-7b1c-4ac1-ba66-d1181cec07e0" target="_blank" rel="noopener noreferrer">here</A></P><P><STRONG>&nbsp;</STRONG></P><P>References:</P><UL><LI>Best practices for SAP S/4HANA:&nbsp;<A href="https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/c9b5e9de6e674fb99fff88d72c352291/03600d777c2543a9bfbbd938ac6a815a.html?state=DRAFT&amp;q=advance%20shipment" target="_blank" rel="noopener noreferrer">here</A></LI><LI>SAP S/4HANA Cloud User Community:&nbsp;<A href="https://community.sap.com/topics/s4hana-cloud" target="_blank">Follow it</A></LI></UL><P><STRONG>&nbsp;</STRONG></P><P>&nbsp;</P><P>&nbsp;</P><P><STRONG>&nbsp;</STRONG></P><P><STRONG>&nbsp;</STRONG></P><P>&nbsp;</P> 2024-02-19T07:54:29.338000+01:00 https://community.sap.com/t5/technology-blogs-by-sap/sap-landscape-transformation-replication-server-book-review/ba-p/13614876 SAP Landscape Transformation Replication Server - Book Review 2024-02-22T08:52:50.707000+01:00 RenjithKumar https://community.sap.com/t5/user/viewprofilepage/user-id/182104 <H2 id="toc-hId-987047968"><FONT size="3"><SPAN>In this blog post you will find the Book Review of&nbsp;<A href="https://www.sap-press.com/sap-landscape-transformation-replication-server_5821/" target="_blank" rel="nofollow noopener noreferrer">SAP Landscape Transformation Replication Server (SLT)</A></SPAN></FONT></H2><H2 id="toc-hId-790534463"><FONT size="5"><SPAN>About the Book<BR /></SPAN></FONT><FONT size="5"><SPAN><FONT size="3">Here is the book which is published by SAP Press about SAP SLT.</FONT><FONT size="4"><BR /></FONT></SPAN></FONT></H2><H2 id="toc-hId-594020958"><FONT size="5"><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Shashi_Book.jpg" style="width: 475px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/68939i49767AB8C2BF51E4/image-size/large?v=v2&amp;px=999" role="button" title="Shashi_Book.jpg" alt="Shashi_Book.jpg" /></span><SPAN><BR /></SPAN></FONT></H2><P><SPAN><FONT size="4"><STRONG><FONT size="5">About the publisher</FONT>&nbsp;&nbsp;</STRONG></FONT><BR /><SPAN class="">SAP Press is reputable due to its status as the leading worldwide publisher of SAP software manuals, known for producing high-quality, authoritative, and cutting-edge content in the field of SAP. The SAP Community boasts a vast membership, comprising millions of users and consultants who are well-acquainted with the great reputation of SAP Press</SPAN><BR /></SPAN></P><H3 id="toc-hId-526590172"><FONT size="5">The authors of the book are</FONT></H3><UL><LI><A href="https://www.linkedin.com/in/shashidhar-garimella-b8409674//" target="_blank" rel="noopener nofollow noreferrer">Shashidhar Garimella</A></LI><LI><A href="https://www.linkedin.com/in/prathyusha-garimella-2a178b86/" target="_blank" rel="noopener nofollow noreferrer">Prathyusha Garimella</A></LI></UL><P><STRONG>Shashidhar Garimella</STRONG><SPAN>&nbsp;is a principal architect at SAP America Inc., known for his exceptional skills and expertise in the field of enterprise software solutions.<BR /></SPAN><BR /><STRONG>Prathyusha Garimella</STRONG><SPAN>&nbsp;is a senior consultant at SAP America Inc. With over a decade of IT experience spanning the globe, Prathyusha has successfully deployed various SAP solutions for large corporations, mostly featuring in the Fortune 100 companies worldwide, enabling financial and business transformation capabilities.</SPAN></P><H3 id="toc-hId-330076667"><FONT size="5">What's the latest and greatest book about SAP SLT?</FONT></H3><P>The book "SAP Landscape Transformation Replication Server: The Practical Guide," and upon reading i am convinced that it will serve as an invaluable asset for SAP consultants, especially those with a focus on SAP Analytics and Data Management. This comprehensive guide caters to a wide audience, from novice SAP Consultants to seasoned enterprise architects, offering a well-structured explanation of the core concepts of SAP SLT, complete with architecture diagrams and detailed information, making it highly beneficial for beginners. Advanced SAP architects and consultants will find significant value in the book's comprehensive coverage of overarching topics. Furthermore, the book serves as a practical guidebook for typical SAP consultants and developers, providing detailed steps, screenshots, and elaborate explanations that can be directly applied to project implementations.</P><P><STRONG><FONT size="5">What sets this book apart?&nbsp;&nbsp;</FONT><BR /></STRONG>What sets this book apart is its emphasis on pragmatic customer implementations for advanced consultants, a perspective that is often lacking in many blogs, articles, and even official SAP documentation. The meticulous attention to practicality makes this book an indispensable resource for consultants working in the field of SAP Analytics and data management. Notably, the book's coverage of topics such as Troubleshooting, Monitoring, and Performance Tuning fills a crucial knowledge gap, particularly for support consultants engaged in live projects. Overall, "SAP Landscape Transformation Replication Server: The Practical Guide" stands out as a meticulously crafted resource that caters to the practical needs of consultants working in the dynamic realm of SAP Analytics and Data Management. This book also covers niche topics such as SLT integration with SAP BW and BW/4HANA, Data Intelligence, Data Services.</P><P>If you are working on migrating your SAP system to the cloud(Azure, GCP, AWS,etc), transferring data between SAP systems, or initiating a new SAP project that need SLT, this book is an indispensable resource that should be at the top of your reading list. Kudos to the Shashidhar Garimella and Prathyusha Garimella for their exceptional work in crafting a book that truly encapsulates the expertise derived from decades of experience in the field. Their wealth of knowledge and practical insights are evident throughout the book.</P><H3 id="toc-hId-133563162"><FONT size="5">Where can you get the book?</FONT></H3><P><SPAN>From the SAP PRESS website and bookstore (all formats; hardcovers also sold elsewhere)</SPAN></P><UL><LI><A href="https://www.sap-press.com/sap-landscape-transformation-replication-server_5821/" target="_blank" rel="noopener nofollow noreferrer">SAP Landscape Transformation Replication Server (SLT) - SAP Press</A></LI><LI><A class="" title="https://www.amazon.com/sap-landscape-transformation-replication-server/dp/1493225251" href="https://www.amazon.com/SAP-Landscape-Transformation-Replication-Server/dp/1493225251" target="_blank" rel="noreferrer noopener nofollow">https://www.amazon.com/SAP-Landscape-Transformation-Replication-Server/dp/1493225251</A></LI></UL><P>Thanks<BR />Renjith Kumar</P> 2024-02-22T08:52:50.707000+01:00 https://community.sap.com/t5/technology-blogs-by-sap/global-explanation-capabilities-in-sap-hana-machine-learning/ba-p/13620594 Global Explanation Capabilities in SAP HANA Machine Learning 2024-02-28T00:53:14.190000+01:00 zhengwang https://community.sap.com/t5/user/viewprofilepage/user-id/893377 <P>Machine learning (ML) has great potential for improving products and services across various industries. However, the explainability of ML models is crucial for their widespread adoption. First, explanation helps build trust and transparency between the users and the models. When users understand how ML model works, they are more likely to trust its results. Moreover, explainability allows for better debugging of complex models. By providing explanations for models’ decisions, researchers can gain insights into the underlying patterns, which helps identify potential biases or flaws. Furthermore, the explainability of models enables auditing, a prerequisite for its usage in regulated industries, such as finance and healthcare.</P><P>To benefit from an explainable model, we introduced permutation feature importance as a global explanation method to SAP HANA Predictive Analysis Library (PAL) in the past several months. In this blog post, we will show how to use it in Python machine learning client for SAP HANA (hana-ml), which provides a friendly Python API for many algorithms from PAL.</P><P>After reading this blog post, you will learn:</P><UL class="lia-list-style-type-disc"><LI>Permutation feature importance from its theory to usage</LI><LI>Two alternative global explanation methods available and their comparison to permutation feature importance</LI></UL><P>&nbsp;</P><H1 id="toc-hId-858766783">Permutation feature importance</H1><P>Permutation feature importance is a feature evaluation method that measures the decrease in the model score when we randomly shuffle the feature's values. It reveals the extent to which a specific feature contributes to the overall predictive power of the model by breaking the association between the feature and the true outcome.</P><P>Behind the screen the permutation importance is calculated in the following steps:</P><OL class="lia-list-style-type-lower-roman"><LI>Initially, a reference score is evaluated on the original dataset.</LI><LI>Next, a new dataset is generated by permuting the column of a specific feature, and the score is evaluated again.</LI><LI>Then the permutation importance is defined as the difference between the reference score and the score obtained from permuted dataset.</LI></OL><P>By repeating the second and third steps for each feature, we can get the importance scores for the entire dataset.</P><P>Permutation importance provides highly compressed, global insight to gauge the relative importance of each feature, enabling data scientists and analysts to prioritize their efforts on the most influential variables when building and optimizing models. This approach is particularly useful for handling high-dimensional datasets, as it helps identify the most informative features amidst a vast number of possible predictors.</P><P>Here we use the well-known Titanic dataset to illustrate the usage of permutation importance. In hana-ml, there is a class called DataSets that offers various public datasets. To load the dataset, we can utilize the load_titanic_data method.</P><pre class="lia-code-sample language-python"><code>from hana_ml import dataframe from hana_ml.algorithms.pal.utility import DataSets conn = dataframe.ConnectionContext(url, port, user, pwd) titanic_full, _, _, _ = DataSets.load_titanic_data(conn)</code></pre><P>Titanic dataset describes the survival status of individual passengers on the RMS Titanic. The objective is to predict based on passenger data (i.e. name, age, gender, socio-economic class, etc.) whether a passenger can survive the shipwreck. In our dataset we have 12 columns, and the meaning of each column is below:</P><UL class="lia-list-style-type-circle"><LI>PassengerId - Unique ID assigned to each passenger.</LI><LI>Pclass - Class of ticket purchased (1 = 1st class, 2 = 2nd class, 3 = 3rd class).</LI><LI>Name - Full name and title of the passenger.</LI><LI>**bleep** - Gender of the passenger.</LI><LI>Age - The Age of the passenger in years.</LI><LI>SibSp - Number of siblings and spouses associated with the passenger aboard.</LI><LI>Parch - Number of parents and children associated with the passenger aboard.</LI><LI>Ticket - Ticket number.</LI><LI>Fare - The fare of the ticket purchased by the passenger.</LI><LI>Cabin - The Cabin number that the passenger was assigned to. If NaN, this means they had no cabin and perhaps had not assigned one due to the cost of their ticket.</LI><LI>Embarked - Port of embarkation (S = Southampton, C = Cherbourg, Q = Queenstown).</LI><LI>Survived - Survival flag of passenger (0 = No, 1 = Yes), target variable.</LI></UL><P>To keep things simple and stay on track with our example, we will remove columns with a high number of null values and then build a predictive model to forecast survival status using the remaining features. We rely on PAL's built-in support in classification algorithm for handling other data preprocessing issues like missing values and dataset splitting.</P><pre class="lia-code-sample language-python"><code>from hana_ml.algorithms.pal.unified_classification import UnifiedClassification rdt_params = dict(n_estimators=100, max_depth=56, min_samples_leaf=1, split_threshold=1e-5, random_state=1, sample_fraction=1.0) uc_rdt = UnifiedClassification(func = 'RandomDecisionTree', **rdt_params) features = ["PCLASS", "NAME", "**bleep**", "AGE", "SIBSP", "PARCH", "FARE", "EMBARKED"] uc_rdt.fit(data=titanic_full, key='PASSENGER_ID', features=features, label='SURVIVED', partition_method='stratified', stratified_column='SURVIVED', partition_random_state=1, training_percent=0.7, output_partition_result=True, ntiles=2, categorical_variable=['PCLASS','SURVIVED'], build_report=False, permutation_importance=True, permutation_evaluation_metric='accuracy', permutation_n_repeats=10, permutation_seed=1, permutation_n_samples=None)</code></pre><P>RandomDecisionTree has a practical method for estimating missing data. When it comes to training data, the method calculates the median of all values for numerical variable or the most frequent non-missing value for categorical variable in a certain class, and then uses that value to replace all missing values of that variable within that class. As for test data, the class label is absent, so one missing value is replicated for each class and filled with the corresponding class’s median or most frequent item.</P><P>UnifiedClassification has a method for dataset splitting, so we can use it to randomly split our dataset, using 70% for training and leaving the rest for validating. In addition, RandomDecisionTree has built-in support for categorical variables; all we need to do is specify the parameter categorical_variable for variables that come in integer type.</P><P>To enable the calculation of permutation feature importance, set permutation_importance to True. Additionally, use permutation_evaluation_metric to define the evaluation metric for importance calculation. For classification problems, options include accuracy, auc, kappa and mcc, while for regression problems, options are RMSE, MAE and MAPE. Set permutation_n_repeats to specify the number of times a feature is randomly shuffled. Because shuffling the feature introduces randomness, the results might vary greatly when the permutation is repeated. Averaging the importance measures over repetitions stabilizes the measure at the expense of increased computation time. Use permutation_seed to set the seed for randomly permuting a feature column, which ensures reproducible results across function calls. Moreover, set permutation_n_samples to determine the number of samples to draw in each repeat. While this option may result in less accurate importance estimates, it helps manage computational speed when evaluating feature importance on large datasets. By combining permutation_n_samples with permutation_n_repeats, we can control the trade-off between computational speed and statistical accuracy of this method.</P><P>Permutation importance does not indicate the inherent predictive value of a feature but how important this feature is for a specific model. It is possible that features considered less important for a poorly performing model (with a low cross-validation score) could actually be highly significant for a well-performing model. Therefore it is crucial to assess the predictive power of a model using a held-out set prior to determining importances.</P><pre class="lia-code-sample language-python"><code>uc_rdt.statistics_.collect()</code></pre><TABLE border="1" width="100%"><TBODY><TR><TD width="33.333333333333336%"><SPAN>STAT_NAME</SPAN></TD><TD width="33.333333333333336%"><SPAN>STAT_VALUE</SPAN></TD><TD width="33.333333333333336%"><SPAN>CLASS_NAME</SPAN></TD></TR><TR><TD><SPAN>AUC</SPAN></TD><TD><SPAN>0.7385321100917431</SPAN></TD><TD><SPAN>None</SPAN></TD></TR><TR><TD><SPAN>RECALL</SPAN></TD><TD><SPAN>0.9674418604651163</SPAN></TD><TD>0</TD></TR><TR><TD width="33.333333333333336%"><SPAN>PRECISION</SPAN></TD><TD width="33.333333333333336%"><SPAN>0.7247386759581882</SPAN></TD><TD width="33.333333333333336%">0</TD></TR><TR><TD width="33.333333333333336%"><SPAN>F1_SCORE</SPAN></TD><TD width="33.333333333333336%"><SPAN>0.8286852589641435</SPAN></TD><TD width="33.333333333333336%">0</TD></TR><TR><TD width="33.333333333333336%"><SPAN>SUPPORT</SPAN></TD><TD width="33.333333333333336%"><SPAN>215</SPAN></TD><TD width="33.333333333333336%">0</TD></TR><TR><TD width="33.333333333333336%"><SPAN>RECALL</SPAN></TD><TD width="33.333333333333336%"><SPAN>0.29464285714285715</SPAN></TD><TD width="33.333333333333336%">1</TD></TR><TR><TD width="33.333333333333336%"><SPAN>PRECISION</SPAN></TD><TD width="33.333333333333336%"><SPAN>0.825</SPAN></TD><TD width="33.333333333333336%">1</TD></TR><TR><TD width="33.333333333333336%"><SPAN>F1_SCORE</SPAN></TD><TD width="33.333333333333336%"><SPAN>0.43421052631578944</SPAN></TD><TD width="33.333333333333336%">1</TD></TR><TR><TD width="33.333333333333336%"><SPAN>SUPPORT</SPAN></TD><TD width="33.333333333333336%"><SPAN>112</SPAN></TD><TD width="33.333333333333336%">1</TD></TR><TR><TD width="33.333333333333336%"><SPAN>ACCURACY</SPAN></TD><TD width="33.333333333333336%"><SPAN>0.7370030581039755</SPAN></TD><TD width="33.333333333333336%"><SPAN>None</SPAN></TD></TR><TR><TD><SPAN>KAPPA</SPAN></TD><TD><SPAN>0.3097879442371883</SPAN></TD><TD><SPAN>None</SPAN></TD></TR><TR><TD width="33.333333333333336%"><SPAN>MCC</SPAN></TD><TD width="33.333333333333336%"><SPAN>0.37957621849462986</SPAN></TD><TD width="33.333333333333336%"><SPAN>None</SPAN></TD></TR></TBODY></TABLE><P>We can check the model performance on validation set directly from fitted attribute statistics_. Its validation performance, measured via the accuracy score, is significantly larger than the chance level. This makes it possible to use permutation importance to probe the most predictive features.</P><pre class="lia-code-sample language-python"><code>import matplotlib.pyplot as plt df_imp = uc_rdt.importance_.filter('IMPORTANCE &gt;= 0').collect() df_imp = df_imp.sort_values(by=['IMPORTANCE'], ascending=True) c_title = "Permutation Importance" df_imp.plot(kind='barh', x='VARIABLE_NAME', y='IMPORTANCE', title=c_title, legend=False, fontsize=12) plt.show()</code></pre><P>Feature importances are provided by the fitted attribute importances_. We can visually represent the feature contributions using a bar chart.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GlobalExplanation_1_PermutationImportance.png" style="width: 564px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/71771iED7C1AD6FEA2B6B6/image-size/large?v=v2&amp;px=999" role="button" title="GlobalExplanation_1_PermutationImportance.png" alt="GlobalExplanation_1_PermutationImportance.png" /></span></P><P>While there is some element of luck involved in surviving, it seems some groups of people were more likely to survive than others. The most important features for predicting survival status with a random forest are **bleep**, Pclass and fare, whereas passenger’s family relations or name are deemed less important.</P><P>This is reasonable because women were given priority access to the lifeboats, so they were more likely to survive. Also, both Pclass and fare can be regarded as a proxy for socio-economic status (SES). People with higher SES may have had better access to information, resources, and connections to secure a spot on a lifeboat or be rescued more quickly. They may also possess more experience with navigating emergency situations and better access to survival skills and knowledge.</P><P>Compared to gender and SES, factors such as port of embarkation, family relations, or name played a limited role in survival. Because the chaotic and rapidly evolving nature of the sinking meant that all passengers were subject to the same evacuation protocols, these factors were less relevant in determining a passenger's likelihood of survival.</P><P>Apart from permutation feature importance, there are two additional techniques existing in PAL can be used to gain a global explanation. One is impurity-based feature importance computed on tree-based models and another is SHAP feature importance obtained by aggregating local Shapley values for individual predictions. We will delve into these methods individually through the subsequent two case studies.</P><P>&nbsp;</P><H1 id="toc-hId-662253278">Case study: impurity-based feature importance</H1><P>Tree-based models provide an alternative measure of feature importance deriving from nodes’ splitting process.</P><P>Individual decision trees intrinsically perform feature selection by selecting appropriate split points. This information can be used to measure the importance of each feature; the basic idea is if a feature is frequently used in split points, it is considered more important. In practice, importance is calculated for a single decision tree by evaluating how much each attribute split point improves performance, weighted by the number of observations under each node. The performance measure may be the purity used to select the split points or another more specific error function.</P><P>This notion of importance can be extended to decision tree ensembles by simply averaging the impurity-based feature importance of each tree. By averaging the estimates over several randomized trees, the variance of the estimate is reduced, making it suitable for feature selection. This is known as the mean decrease in impurity, or MDI.</P><P>Note that this computation of feature importance is based on the splitting criterion of the decision trees (such as Gini index), and it is distinct from permutation importance which is based on permutation of the features.</P><P>We show the calculation of impurity-based importance on Titanic dataset. The calculation is incorporated in the fitting of RandomDecisionTree, as demonstrated in the code below.</P><pre class="lia-code-sample language-python"><code>from hana_ml.algorithms.pal.unified_classification import UnifiedClassification rdt_params = dict(n_estimators=100, max_depth=56, min_samples_leaf=1, split_threshold=1e-5, random_state=1, sample_fraction=1.0) uc_rdt = UnifiedClassification(func = 'RandomDecisionTree', **rdt_params) features = ["PCLASS", "NAME", "**bleep**", "AGE", "SIBSP", "PARCH", "FARE", "EMBARKED"] uc_rdt.fit(data=titanic_full, key='PASSENGER_ID', features=features, label='SURVIVED', partition_method='stratified', stratified_column='SURVIVED', partition_random_state=1, training_percent=0.7, output_partition_result=True, ntiles=2, categorical_variable=['PCLASS','SURVIVED'], build_report=False ) uc_rdt.statistics_.collect()</code></pre><P>Prior to inspecting feature importance, it is important to ensure that the model predictive performance is high enough. Indeed, there is no point in analyzing the important features of a non-predictive model. Here we can observe that the validation accuracy is high, indicating that the model can generalize well thanks to the built-in bagging of random forests.</P><P>The feature importance scores of a fitted model can be accessed via the importance_ property. This dataframe has rows representing each feature, with positive values that add up to 1.0. Higher values indicate a greater contribution of the feature to the prediction function.</P><pre class="lia-code-sample language-python"><code>import matplotlib.pyplot as plt df_imp = uc_rdt.importance_.collect() df_imp = df_imp.sort_values(by=['IMPORTANCE'], ascending=True) c_title = "Impurity-based Importance" df_imp.plot(kind='barh', x='VARIABLE_NAME', y='IMPORTANCE', title=c_title, legend=False, fontsize=12) plt.show()</code></pre><P>A bar chart is plotted to visualize the feature contributions.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GlobalExplanation_2_ImpurityBasedImportance.png" style="width: 438px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/71785i9D59EC730ABE4B7F/image-size/large?v=v2&amp;px=999" role="button" title="GlobalExplanation_2_ImpurityBasedImportance.png" alt="GlobalExplanation_2_ImpurityBasedImportance.png" /></span></P><P>Oops! The non-predictive passenger’s name is ranked most important by the impurity-based method which contradicts the permutation method. However, the conclusions regarding the importance of the other features still hold true. The same three features are detected most important by both methods, although their relative importance may vary. The remaining features are less predictive.</P><P>So, the only question is why impurity-based feature importance assigns high importance to variables that are not correlated with the target variable (survived).</P><P>This stems from two limitations of impurity-based feature importance. First, impurity-based importance can inflate the importance of high cardinality features, that is features with many unique values (such as passenger’s name). Furthermore, impurity-based importance suffers from being computed on training set statistics and it cannot be evaluated on a separate set, therefore it may not reflect a feature’s usefulness for make predictions that generalize to unseen data (if the model has the capacity to use the feature for overfit).</P><P>The fact that we use training set statistics explains why passenger’s name has a non-null importance. And the bias towards high cardinality features explains further why the importance has such a large value.</P><P>As shown in previous example, permutation feature importance does not suffer from the flaws of the impurity-based feature importance: it does not exhibit a bias toward high-cardinality features and can be computed on a left-out validation set (as we do in PAL). Using a held-out set makes it possible to identify the features that contribute the most to the generalization power of the inspected model. Features that are important on the training set but not on the held-out set might cause the model to overfit. Another key advantage of permutation feature importance is that it is model-agnostic, i.e. it can be used to analyze any model class, not just tree-based models.</P><P>However, the computation for full permutation importance is more costly. There are situations that impurity-based importance is preferable. For example, if all features are numeric and we are only interested in representing the information acquired from the training set, limitations of impurity-based importance don’t matter. If these conditions are not met, permutation importance is recommended instead.</P><P>Now that we have completed our exploration of impurity-based importance, let's shift our focus to SHAP feature importance.</P><P>&nbsp;</P><H1 id="toc-hId-465739773">Case study: SHAP feature importance</H1><P>SHAP (SHapley Additive exPlanations) is a technique used to explain machine learning models. It has its foundations in coalitional game theory, specifically Shapley values. These values determine the contribution of each player in a coalition game. In the case of machine learning, the game is the prediction for a single instance, features act as players, and they collectively contribute to the model’s prediction outcome. SHAP assigns each feature a Shapley value and uses these values to explain the prediction made by the model.</P><P>The SHAP calculation can be invoked in the prediction method of UnifiedClassification. Once again, we show its application on Titanic dataset. The RandomDecisionTree model is trained as before. To ensure a more valid comparison to permutation importance, we deliberately employ SHAP on the validation set.</P><pre class="lia-code-sample language-python"><code>uc_rdt.partition_.set_index("PASSENGER_ID") titanic_full.set_index("PASSENGER_ID") df_full = uc_rdt.partition_.join(titanic_full) features = ["PCLASS", "NAME", "**bleep**", "AGE", "SIBSP", "PARCH", "FARE", "EMBARKED"] pred_res = uc_rdt.predict(data=df_full.filter('TYPE = 2'), key='PASSENGER_ID', features=features, verbose=False, missing_replacement='feature_marginalized', top_k_attributions=10, attribution_method='tree-shap') pred_res.select("PASSENGER_ID", "SCORE", "REASON_CODE").head(5).collect()</code></pre><P>SHAP by itself is a local explanation method explains the predictions for individual instances. Since we run SHAP for every instance, we get a matrix of Shapley values. This matrix has one row per data instance and one column per feature. To get a global explanation, we need a rule to combine these Shapley values.</P><P>In practice, there are different ways to aggregate local explanations. For instance, we can assess feature importance by analyzing how frequently a feature appears among the top K features in the explanation or by calculating the average ranking for each feature in the explanation. In our case, we opt to use mean absolute Shapley values as an indicator of importance.</P><P>The idea behind this is simple: Features with large absolute Shapley values are considered important. Since we want the global importance, we average the absolute Shapley values for each feature across the data. We can then arrange the features in descending order of importance and present them in a plot, like what we have done before. Another simpler solution is to utilize the ShapleyExplainer module as a visualizer and let it handle the task.</P><pre class="lia-code-sample language-python"><code>from hana_ml.visualizers.shap import ShapleyExplainer features=["PCLASS", "NAME", "**bleep**", "AGE", "SIBSP", "PARCH", "FARE", "EMBARKED"] shapley_explainer = ShapleyExplainer(feature_data=df_full.filter('TYPE = 2').select(features), reason_code_data=pred_res.select('REASON_CODE')) shapley_explainer.summary_plot()</code></pre><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GlobalExplanation_3_ShapImportance.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/71787iD3C45571F0DD24E2/image-size/large?v=v2&amp;px=999" role="button" title="GlobalExplanation_3_ShapImportance.png" alt="GlobalExplanation_3_ShapImportance.png" /></span></P><P>There is a big difference between SHAP feature importance and permutation feature importance. Permutation feature importance is based on the decrease in model performance, while SHAP is based on magnitude of feature attributions. In other words, SHAP feature importance reflects how much the model’s prediction varies can be explained by a feature without considering its impact on performance. If changing a feature greatly changes the output, then it is considered important. As a result, SHAP importance gives higher importance to features that cause high variation in the prediction function.</P><P>Although model variance explained by the features and feature importance are strongly correlated when the model generalizes well (i.e. it does not overfit), this distinction becomes evident in cases where a model overfits. If a model overfits and includes irrelevant features (like the passenger’s name in this instance), the permutation feature importance would assign an importance of zero because this feature does not contribute to accurate predictions. SHAP importance measure, on the other hand, might assign high importance to the feature as the prediction can change significantly when the feature is altered.</P><P>Additionally, it is noteworthy that calculating SHAP can be computationally demanding, especially for models that are not based on trees. If you are only looking for a global explanation, it is suggested to use permutation importance.</P><P>&nbsp;</P><H1 id="toc-hId-269226268">Summary</H1><P>Explainability is of vital importance in machine learning models. It builds trust, aids in understanding, enables debugging, and helps with regulatory compliance. Throughout this blog post, we have presented permutation feature importance as a model-agnostic global explanation method, exploring its theory and practical application on real accessible data. Furthermore, we have showcased its effectiveness by comparing it with two other explanation methods, empowered readers to choose the most suitable approach for their specific use case. Ultimately, incorporating explainability into machine learning models is not only beneficial for the users but also for the overall progress and ethical deployment of AI technologies.</P><P>&nbsp;</P><P>More topics on HANA machine learning:</P><P><A href="https://community.sap.com/t5/technology-blogs-by-sap/sap-hana-machine-learning-resources/ba-p/13511210" target="_blank">SAP HANA Machine Learning Resources</A>&nbsp;</P><P><A href="https://community.sap.com/t5/technology-blogs-by-sap/fairness-in-machine-learning-a-new-feature-in-sap-hana-pal/ba-p/13580185" target="_blank">Fairness in Machine Learning - A New Feature in SAP HANA PAL</A>&nbsp;</P><P><A href="https://community.sap.com/t5/technology-blogs-by-sap/model-compression-without-compromising-predictive-accuracy-in-sap-hana-pal/ba-p/13564339" target="_blank">Model Compression without Compromising Predictive Accuracy in SAP HANA PAL</A>&nbsp;</P><P><A href="https://community.sap.com/t5/technology-blogs-by-sap/a-multivariate-time-series-modeling-and-forecasting-guide-with-python/ba-p/13517004" target="_blank">A Multivariate Time Series Modeling and Forecasting Guide with Python Machine Learning Client for SAP HANA</A>&nbsp;</P><P><A href="http:// https://community.sap.com/t5/technology-blogs-by-sap/model-storage-with-python-machine-learning-client-for-sap-hana/ba-p/13483099" target="_blank" rel="noopener nofollow noreferrer">Model Storage with Python Machine Learning Client for SAP HANA</A>&nbsp;</P><P><A href="http:// https://community.sap.com/t5/technology-blogs-by-sap/identification-of-seasonality-in-time-series-with-python-machine-learning/ba-p/13472664" target="_blank" rel="noopener nofollow noreferrer">Identification of Seasonality in Time Series with Python Machine Learning Client for SAP HANA</A>&nbsp;</P><P><A href="https://community.sap.com/t5/technology-blogs-by-sap/ways-to-accelerate-the-training-process-of-gbdt-models-in-hgbt/ba-p/13562944" target="_blank">Ways to Accelerate the Training Process of GBDT Models in HGBT</A>&nbsp;</P><P><A href="https://community.sap.com/t5/technology-blogs-by-sap/additive-model-time-series-analysis-using-python-machine-learning-client/ba-p/13469016" target="_blank">Additive Model Time-series Analysis using Python Machine Learning Client for SAP HANA</A>&nbsp;</P><P><A href="https://community.sap.com/t5/technology-blogs-by-sap/time-series-modeling-and-analysis-using-sap-hana-predictive-analysis/ba-p/13461469" target="_blank">Time-Series Modeling and Analysis using SAP HANA Predictive Analysis Library(PAL) through Python Machine Learning Client for SAP HANA</A>&nbsp;</P><P><A href="https://community.sap.com/t5/technology-blogs-by-sap/learning-from-labeled-anomalies-for-efficient-anomaly-detection-using/ba-p/13485567" target="_blank">Learning from Labeled Anomalies for Efficient Anomaly Detection using Python Machine Learning Client for SAP HANA</A>&nbsp;<A href="https://community.sap.com/t5/technology-blogs-by-sap/outlier-detection-with-one-class-classification-using-python-machine/ba-p/13481696" target="_blank">Outlier Detection with One-class Classification using Python Machine Learning Client for SAP HANA</A>&nbsp;</P><P><A href="https://community.sap.com/t5/technology-blogs-by-sap/anomaly-detection-in-time-series-using-seasonal-decomposition-in-python/ba-p/13474482" target="_blank">Anomaly Detection in Time-Series using Seasonal Decomposition in Python Machine Learning Client for SAP HANA</A>&nbsp;</P><P><A href="https://community.sap.com/t5/technology-blogs-by-sap/outlier-detection-by-clustering-using-python-machine-learning-client-for/ba-p/13469349" target="_blank">Outlier Detection by Clustering using Python Machine Learning Client for SAP HANA</A>&nbsp;</P><P><A href="https://community.sap.com/t5/technology-blogs-by-sap/outlier-detection-using-statistical-tests-in-python-machine-learning-client/ba-p/13462522" target="_blank">Outlier Detection using Statistical Tests in Python Machine Learning Client for SAP HANA</A>&nbsp;</P><P><A href="https://community.sap.com/t5/technology-blogs-by-sap/weibull-analysis-using-python-machine-learning-client-for-sap-hana/ba-p/13460157" target="_blank">Weibull Analysis using Python machine learning client for SAP HANA</A>&nbsp;</P><P><A href="https://community.sap.com/t5/technology-blogs-by-sap/import-multiple-excel-files-into-a-single-sap-hana-table/ba-p/13469332" target="_blank">Import multiple excel files into a single SAP HANA table</A>&nbsp;</P><P><A href="https://community.sap.com/t5/technology-blogs-by-sap/copd-study-explanation-and-interpretability-with-python-machine-learning/ba-p/13469313" target="_blank">COPD study, explanation and interpretability with Python machine learning client for SAP HANA</A>&nbsp;</P> 2024-02-28T00:53:14.190000+01:00 https://community.sap.com/t5/technology-blogs-by-sap/protecting-your-sap-hana-cloud-and-sap-hana-with-credential-rotation-best/ba-p/13624155 Protecting Your SAP HANA Cloud and SAP HANA with Credential Rotation Best Practices 2024-02-29T18:29:16.597000+01:00 pavlomelnyk https://community.sap.com/t5/user/viewprofilepage/user-id/40105 <P><SPAN>In today's cyber-threat landscape, prioritizing data security is more important than ever. Security is one of the key cornerstones of SAP BTP and SAP HANA Cloud strategies.</SPAN><SPAN>&nbsp;</SPAN></P><P><SPAN>SAP HANA Cloud takes a comprehensive approach to security, providing a layered defense system encompassing authentication, authorization, encryption, and auditing.</SPAN><SPAN>&nbsp;</SPAN></P><P><SPAN>At the heart of this security strategy lies strong credentials management practices, one of which is the credentials rotation. For example, organizations can significantly reduce the risk of unauthorized access and data breaches by enforcing regular password rotation.</SPAN></P><P><STRONG><SPAN>Certificate-based credentials are the game-changer</SPAN></STRONG><SPAN>&nbsp;</SPAN></P><P><SPAN>While strong passwords and their rotation are a must, they're no longer enough. We recommend using certificate-based credentials, a robust security practice that adds an extra layer of protection and should be adopted by all SAP HANA users.</SPAN><SPAN>&nbsp;</SPAN></P><P><SPAN>Certificate-based credentials offer a far more robust solution. Here's what you get:</SPAN><SPAN>&nbsp;</SPAN></P><UL><LI><STRONG><SPAN>Multi-factor Authentication (MFA)</SPAN></STRONG><SPAN>: Imagine needing both a certificate and a secondary factor (e.g., PIN, fingerprint) to access your HANA environment. MFA is typically done at identity provider and mainly in combination with short-lived SAML/JWT tokens for the actual database access.</SPAN><SPAN>&nbsp;</SPAN></LI><LI><STRONG><SPAN>Rotation</SPAN></STRONG><SPAN>: Hackers adore static credentials, but with certificates, they expire regularly, rendering stolen ones useless, </SPAN><SPAN>and you can no longer use them for login</SPAN><SPAN>. It's like changing the locks on your house now and then, depending on how often you need it. </SPAN><SPAN>The benefit of certificates is that you can have multiple certificates for an overlapping time range when changing them.</SPAN><SPAN>&nbsp;</SPAN></LI><LI><STRONG><SPAN>Reduced Attack Surface</SPAN></STRONG><SPAN>: Fewer passwords to manage mean fewer potential entry points for attackers. It's like having fewer windows to climb through.</SPAN><SPAN>&nbsp;</SPAN></LI></UL><P><SPAN>In SAP HANA Cloud, there is a possibility of using X509 certificates, JWT tokens, and SAML assertions. On top of it, HANA provides an extensive certificate management workflow and guidance, which you can read more about </SPAN><A href="https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-security-guide/certificate-management?locale=en-US" target="_blank" rel="noopener noreferrer"><SPAN>here</SPAN></A><SPAN>. For SAP HANA, please refer to the </SPAN><A href="https://help.sap.com/docs/SAP_HANA_PLATFORM/b3ee5778bc2e4a089d3299b82ec762a7/1e6042c4402545f7a0574f7bc91fab25.html?locale=en-US" target="_blank" rel="noopener noreferrer"><SPAN>onprem version of security documentation</SPAN></A><SPAN>.</SPAN><SPAN>&nbsp;</SPAN></P><P><SPAN>In case there is still the need to work with password-based authentication, there are a couple of password rotation tricks on how you can enhance your security and which HANA supports.</SPAN><SPAN>&nbsp;</SPAN></P><P><STRONG><SPAN>How Password Rotation Works in SAP HANA Cloud</SPAN></STRONG><SPAN>&nbsp;</SPAN></P><P><SPAN>Password rotation, also known as password aging, is a security protocol that mandates the periodic change of passwords for user accounts. This practice helps to mitigate the risk of unauthorized access if a password is compromised.&nbsp;</SPAN><SPAN>&nbsp;</SPAN></P><P><SPAN>In SAP HANA Cloud, password rotation is controlled by password policies that can be customized to meet specific organizational requirements. These policies can specify a </SPAN><A href="https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-security-guide/password-policy-configuration-options" target="_blank" rel="noopener noreferrer"><SPAN>wide range of configuration options</SPAN></A><SPAN> like the minimum password length, the required character types, the minimum/maximum password lifetime, and the frequency with which passwords must be updated.&nbsp;</SPAN><SPAN>&nbsp;</SPAN></P><P><SPAN>The SAP Cloud HANA database comes with a default password policy. You can change the default password policy of the database in line with your organization’s security requirements.</SPAN><SPAN>&nbsp;</SPAN></P><P><SPAN>More information about it you can find in ours </SPAN><A href="https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-security-guide/password-policy" target="_blank" rel="noopener noreferrer"><SPAN>SAP HANA Cloud Database Security Guide in a section Password policy</SPAN></A><SPAN>.</SPAN><SPAN>&nbsp;</SPAN></P><P><STRONG><SPAN>Disclaimer: </SPAN></STRONG><SPAN>from the HANA side there is no difference for password management between on-premise HANA and HANA Cloud.</SPAN><SPAN>&nbsp;</SPAN></P><P><STRONG><SPAN>Scenario 1: "Zero down time password change" for database users</SPAN></STRONG><SPAN>&nbsp;</SPAN></P><P>In case your organisation needs to sustain <SPAN>changing passwords for HANA database users without experiencing any interruption in service or accessibility, or in other words, the HANA Cloud DB should remain fully functional and accessible while changing/updating passwords for those users – it is supported by the product.</SPAN><SPAN>&nbsp;</SPAN></P><P><SPAN>On the other hand, in case under “zero downtime password change” is also meant changing the password of a user in HANA without having to change the password used to connect to HANA at the same time in their application to avoid failed connect attempts (something like this can be achieved by allowing connect for one user with multiple passwords) – SAP HANA Cloud DB </SPAN><SPAN>only supports a single password per user at a time</SPAN><SPAN>.</SPAN><SPAN>&nbsp;</SPAN></P><P><SPAN>The proper way to avoid this issue is to use other means of authentication, typically </SPAN><A href="https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-security-guide/x-509-certificate-based-user-authentication" target="_blank" rel="noopener noreferrer"><SPAN>X.509</SPAN></A><SPAN>. In that case you would only configure trust to the X.509 issuer in HANA and set a new X.509 certificate in the application before the current one expires. The same can be achieved if the application supports our </SPAN><A href="https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-security-guide/single-sign-on-integration" target="_blank" rel="noopener noreferrer"><SPAN>SAML/JWT</SPAN></A><SPAN> authentication.</SPAN><SPAN>&nbsp;</SPAN></P><P><SPAN>As a short summary, this is not a limitation on the SAP HANA Cloud DB side but on the application side.</SPAN><SPAN>&nbsp;</SPAN></P><P><STRONG><SPAN>Scenario 2: </SPAN></STRONG><STRONG><SPAN>How to manage technical users with regards to password rotation and their authentication in general?</SPAN></STRONG><SPAN>&nbsp;</SPAN></P><P><SPAN>For technical users, our recommendation remains the same: to use X.509 or SAML/JWT authentication when possible. If password-based authentication is used, this will require any potential password change to be performed simultaneously both in the HANA database and on all clients to avoid failed logins or locking of the technical user due to such failed logins.</SPAN><SPAN>&nbsp;</SPAN></P><P><SPAN>Moving all application access of the technical users to X.509-based authentication will also allow them to update the certificates of the services individually without having to coordinate this as it would be required for a central password change.&nbsp;&nbsp;</SPAN><SPAN>&nbsp;</SPAN></P><P><SPAN>Individual users could still authenticate using passwords, and this distinction would even allow&nbsp;to differentiate between service access and user access. On top of this, you can still rotate the passwords safely if anyone is leaving.</SPAN><SPAN>&nbsp;</SPAN></P><P><STRONG><SPAN>Important:</SPAN></STRONG> it is recommended to <SPAN>use dedicated database users and not mix technical and named user access in case you have </SPAN><SPAN>a technical user that is used by services to access the HANA DB, and they seem to also use that same database user for their real users to access the database.</SPAN><SPAN>&nbsp;</SPAN></P><P><SPAN>More details on user management you can find </SPAN><A href="https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-security-guide/user-types" target="_blank" rel="noopener noreferrer"><SPAN>here</SPAN></A><SPAN>.</SPAN><SPAN>&nbsp;</SPAN></P><P><SPAN>Additionally, what you can do for password change is to:</SPAN><SPAN>&nbsp;</SPAN></P><P><SPAN>1. Suspend the system during the change of the password, see the SAP notes:&nbsp;</SPAN><SPAN>&nbsp;</SPAN></P><UL><LI><A href="https://me.sap.com/notes/1913302" target="_blank" rel="noopener noreferrer"><SPAN>1913302 - SAP HANA: Suspend DB connections for short maintenance tasks&nbsp;</SPAN></A><SPAN>&nbsp;</SPAN></LI><LI><A href="https://me.sap.com/notes/2364819" target="_blank" rel="noopener noreferrer"><SPAN>2364819 - SAP HANA DB connections should be shut down immediately&nbsp;</SPAN></A><SPAN>&nbsp;</SPAN></LI></UL><P><SPAN>2. Disable on the HANA DB the user lock temporarily by setting</SPAN> <A href="https://help.sap.com/docs/SAP_HANA_PLATFORM/b3ee5778bc2e4a089d3299b82ec762a7/61662e3032ad4f8dbdb5063a21a7d706.html#user-lock-time" target="_blank" rel="noopener noreferrer"><SPAN>User Lock Time</SPAN></A> <SPAN>to 0 when changing the password. Then, you have time to change the password on the database and the clients.</SPAN><SPAN>&nbsp;</SPAN></P><P><STRONG><SPAN>Important</SPAN></STRONG><SPAN>: However, there will almost be a timespan (change of password in user store and change of password on SAP HANA DB) where no application user can work on the system.</SPAN><SPAN>&nbsp;</SPAN></P><P><STRONG><SPAN>Scenario 3: S</SPAN></STRONG><STRONG><SPAN>everal teams are working on a project and sharing the same HANA database user across the group</SPAN></STRONG></P><P><SPAN>If your concern is that if anyone leaves the project or company, they are still able to access the database through, for example, Database Explorer, or if they have an S-User ID, we recommend the following:</SPAN><SPAN>&nbsp;</SPAN></P><UL><LI><SPAN>Presumably, when someone leaves the company, their user will be removed from the identity provider and will no longer be able to log in.&nbsp; As for the database users, it might be possible to setup SSO with a mapping between the user used to sign into the identity provider and the database. In that way, once the user is removed from the identity provider, they would no longer be able to log in to the database.</SPAN><SPAN>&nbsp;</SPAN></LI><LI><SPAN>Deletion of separate DB users for each person and make sure the DB user is deleted if a person moves off the project team or company.</SPAN><SPAN>&nbsp;</SPAN></LI><LI><SPAN>Move away from password-based authentication, so another option would be to set up SSO or certificated-based authentication (e.g., X509 or JWT) for created users. Still, you need to delete the respective mapping after the user leaves the project to ensure it has no access like pointed out above for identity provider set up.</SPAN><SPAN>&nbsp;</SPAN></LI><LI><SPAN>P</SPAN><SPAN>erform a password rotation in the current setup (if possible) whenever a user is leaving the project</SPAN><SPAN> if you decide to stay with password-based authentication:</SPAN><SPAN>&nbsp;</SPAN></LI></UL><UL><LI><SPAN>You can use the 'ALTER USER &lt;user&gt; FORCE PASSWORD CHANGE' syntax to force a password rotation on the next login for any user (including SYSTEM); details&nbsp;you can find </SPAN><A href="https://help.sap.com/docs/SAP_HANA_PLATFORM/4fe29514fd584807ac9f2a04f6754767/20d3459f75191014a7bbeb670bad8850.html#loio20d3459f75191014a7bbeb670bad8850__sql_alter_user_1sql_alter_user_force_pass_change" target="_blank" rel="noopener noreferrer"><SPAN>here</SPAN></A><SPAN> in the documentation.</SPAN></LI></UL><P><STRONG><SPAN>Summary</SPAN></STRONG><SPAN>&nbsp;</SPAN></P><P><SPAN>Password rotation is an essential component of a comprehensive cybersecurity strategy. By following the best practices outlined in this blog post, you can significantly enhance the security of your data and applications in SAP HANA Cloud and SAP HANA Platform.</SPAN><SPAN>&nbsp;</SPAN></P><P><SPAN>Still, our primary recommendation is to adopt certificated-based authentication and rotation by making use of X509, JWT or SAML, more details on it you can find here: </SPAN><A href="https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-security-guide/user-authentication-mechanismsS" target="_blank" rel="noopener noreferrer"><SPAN>SAP HANA Cloud, SAP HANA Database Security Guide</SPAN></A><SPAN>.</SPAN><SPAN>&nbsp;</SPAN></P><P><SPAN>Also, some recent additional security settings can be found under the topic </SPAN><A href="https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-sql-reference-guide/create-usergroup-statement-access-control" target="_blank" rel="noopener noreferrer"><SPAN>connection restriction</SPAN></A><SPAN> of SAP HANA Cloud, HANA DB Security Guide, and connect restriction policies, which&nbsp;will be a topic for our next blog post, so stay tuned!</SPAN></P><P>&nbsp;</P><P><SPAN>&nbsp;</SPAN></P> 2024-02-29T18:29:16.597000+01:00 https://community.sap.com/t5/technology-blogs-by-members/workload-in-the-sap-hana/ba-p/13625979 Workload in the SAP HANA 2024-03-06T03:19:54.266000+01:00 AtulKumarJain https://community.sap.com/t5/user/viewprofilepage/user-id/4422 <H1 id="toc-hId-858919525"><FONT color="#0000FF"><SPAN>Options for Managing Workload&nbsp;</SPAN></FONT></H1><P><FONT size="2"><SPAN>Workload management can be configured at multiple levels: at the operating system-level, by using global initialization settings, and at the session level.</SPAN></FONT></P><P><FONT size="2"><SPAN>There are a number of things you can do to influence how workload is handled:</SPAN></FONT></P><UL><LI><FONT size="2"><SPAN>Outside the SAP HANA system on the operating system level you can set the affinity of the available cores.</SPAN></FONT></LI><LI><FONT size="2"><SPAN>You ca</SPAN></FONT></LI><LI><FONT size="2"><SPAN>n apply static settings using parameters to configure execution, memory management and peak load situations.</SPAN></FONT></LI><LI><FONT size="2"><SPAN>You can influence workload dynamically at system runtime by defining workload classes.</SPAN></FONT></LI></UL><P><FONT size="2"><SPAN>All of these options have default settings which are applied during the HANA installation. These general-purpose settings may provide you with perfectly acceptable performance in which case the workload management features described here may not be necessary.&nbsp;</SPAN></FONT></P><P><FONT size="2"><SPAN>Before you begin with workload management, you should ensure that the&nbsp;</SPAN></FONT></P><P><FONT size="2"><SPAN>System generally is well configured</SPAN></FONT></P><UL><LI><FONT size="2"><SPAN>SQL statements are tuned</SPAN></FONT></LI><LI><FONT size="2"><SPAN>Distributed environment tables are optimally distributed and that indexes have been defined as needed.</SPAN></FONT></LI></UL><TABLE><TBODY><TR><TD><P><FONT color="#0000FF"><STRONG>Area</STRONG></FONT></P></TD><TD><P><FONT color="#0000FF"><STRONG>Possible Actions</STRONG></FONT></P></TD></TR><TR><TD><P><FONT size="2"><SPAN>CPU</SPAN></FONT></P></TD><TD><P><FONT size="2"><SPAN>Settings related to affinity are available to bind server processes to specific CPU cores. Processes must be restarted before these changes become effective.</SPAN></FONT></P></TD></TR><TR><TD><P><FONT size="2"><SPAN>CPU Thread Pools</SPAN></FONT></P></TD><TD><P><FONT size="2"><SPAN>Global execution settings are available to manage CPU thread pools and manage parallel execution (concurrency).</SPAN></FONT></P></TD></TR><TR><TD><P><FONT size="2"><SPAN>Memory</SPAN></FONT></P></TD><TD><P><FONT size="2"><SPAN>Global memory manager settings are available to apply limits to the resources allocated to expensive SQL statements.</SPAN></FONT></P></TD></TR><TR><TD><P><FONT size="2"><SPAN>Admission Control</SPAN></FONT></P></TD><TD><P><FONT size="2"><SPAN>Global admission control settings can be used to apply system capacity thresholds above which SQL statements can be either rejected or queued.</SPAN></FONT></P></TD></TR><TR><TD><P><FONT size="2"><SPAN>Priority and Dynamic Workload Class Mapping</SPAN></FONT></P></TD><TD><P><FONT size="2"><SPAN>A more targeted approach to workload management is possible by setting up pre-configured classes which can be mapped to individual user sessions. You can, for example, map an application name or an application user to a specific workload class. Classes include the option to apply a workload priority value.</SPAN></FONT></P></TD></TR></TBODY></TABLE><H1 id="toc-hId-662406020"><FONT size="4" color="#0000FF"><STRONG><SPAN>1.Controlling CPU Consumption</SPAN></STRONG></FONT></H1><P><FONT size="2"><SPAN>SAP HANA can exploit the processor’s NUMA architecture to optimize performance by applying NUMA core affinity settings to server processes and by specifying NUMA node location preferences for specific database objects.</SPAN></FONT></P><P><FONT size="2"><SPAN>Applying NUMA core affinity settings to server processes.</SPAN></FONT></P><P><FONT size="2"><SPAN>Specifying NUMA node location preferences for specific database objects</SPAN></FONT></P><P><FONT size="2"><SPAN>Note: As an alternative to applying CPU affinity settings you can achieve similar performance gains by changing the parameter [execution] max_concurrency in the global.ini configuration file. Changing the configuration file may be more convenient and doesn’t require the system to be offline.</SPAN></FONT></P><P><FONT size="2"><SPAN>Examining the System Topology</SPAN></FONT></P><UL><LI><FONT size="2"><SPAN>The lscpu command returns a listing of details of the system architecture.&nbsp;</SPAN></FONT></LI><LI><FONT size="2"><SPAN>hdbcons</SPAN></FONT></LI></UL><P><FONT size="2"><SPAN>The database management client console hdbcons can also be used to retrieve topology information</SPAN></FONT></P><P><FONT size="2"><SPAN>Information about the system topology and the CPU configuration is available in system views</SPAN></FONT></P><P><FONT size="2"><SPAN>select * from SYS.M_HOST_INFORMATION where key in ('cpu_sockets','cpu_cores','cpu_threads');</SPAN></FONT></P><P><FONT size="2"><SPAN>select MAX_NUMA_NODE_COUNT, MAX_LOGICAL_CORE_COUNT from SYS.M_NUMA_RESOURCES;&nbsp;</SPAN><SPAN>select HOST, NUMA_NODE_ID, NUMA_NODE_DISTANCES, MEMORY_SIZE from SYS.M_NUMA_NODES;</SPAN></FONT></P><P><STRONG><FONT size="2">Applying Affinity Configuration Changes</FONT></STRONG></P><P><FONT size="2"><SPAN>You can use the affinity configuration parameter to restrict CPU usage of SAP HANA server processes to certain CPUs or ranges of CPUs.</SPAN></FONT><FONT size="2"><SPAN>You can set restrictions for the following servers: nameserver, indexserver, compileserver, preprocessor, and xsengine ,</SPAN></FONT><FONT size="2"><SPAN>Few examples for restrictions&nbsp;</SPAN></FONT></P><P><FONT size="2"><SPAN>ALTER SYSTEM ALTER CONFIGURATION ('daemon.ini', 'SYSTEM') SET ('nameserver', 'affinity') = '0,16'</SPAN></FONT></P><P><FONT size="2"><SPAN>ALTER SYSTEM ALTER CONFIGURATION ('daemon.ini', 'SYSTEM') SET ('indexserver', 'affinity') = '8-15,24-31'</SPAN></FONT></P><P><FONT color="#0000FF"><STRONG><FONT size="4">2.&nbsp;Controlling Parallel Execution of SQL Statements</FONT></STRONG></FONT></P><P><FONT size="2"><SPAN>You can apply ini file settings to control the two thread pools SqlExecutor and&nbsp;</SPAN></FONT><FONT size="2"><SPAN>JobExecutor that control the parallelism of statement execution.</SPAN></FONT><FONT size="2"><SPAN>The settings described here should only be modified when other tuning techniques like remodeling, repartitioning, and query tuning have been applied. Modifying the parallelism settings requires a thorough understanding of the actual workload since they have impact on the overall system behaviour. Modify the settings iteratively by testing each adjustment.</SPAN></FONT></P><P><FONT size="2"><SPAN>You can set a limit for both SqlExecutor and JobExecutor to define the maximum number of threads. You can use this for example on a system where OLAP workload would normally consume too many CPU resources to apply a maximum value to the JobExecutor to reserve resources for OLTP workload.</SPAN></FONT></P><P><FONT size="2"><SPAN>Lowering the value of these parameters can have a drastic effect on the parallel processing of the servers and reduce the performance of the overall system. Adapt with caution by iteratively making modifications and testing. For more information, see Understand your Workload and SAP Note 2222250 - FAQ SAP HANA Workload Management which contains more details of the workload configuration parameters.</SPAN></FONT></P><P><FONT size="2"><SPAN>The following SqlExecutor parameters are in the sql section of the</SPAN> <SPAN>indexserver.ini file.&nbsp;</SPAN></FONT><FONT size="2"><SPAN>sql_executors - sets a soft limit on the target number of logical cores for the SqlExecutor&nbsp;</SPAN><SPAN>pool.</SPAN></FONT></P><P><FONT size="2"><SPAN>max_sql_executors - sets a hard limit on the maximum number of logical cores that can be&nbsp;</SPAN></FONT><FONT size="2"><SPAN>used.</SPAN></FONT></P><P><FONT size="2"><SPAN>Caution</SPAN></FONT></P><P><FONT size="2">SAP HANA will not accept new incoming requests if the limit is exceeded. Use this parameter with extreme care.The following JobExecutor parameters are in the execution section of the global.ini or indexserver.ini.</FONT></P><P><FONT size="2">max_concurrency - sets the target number of logical cores for the JobExecutor pool.</FONT></P><P><FONT size="2">max_concurrency_hint - limits the number of logical cores for job workers even&nbsp;&nbsp;&nbsp;</FONT></P><P><FONT size="2">if more active job workers would be available&nbsp;</FONT></P><P><FONT size="2">default_statement_concurrency_limit - restricts the actual degree of&nbsp;parallel execution per connection within a statement.</FONT></P><P><FONT size="4" color="#0000FF"><STRONG>3. Setting a Memory Limit for SQL Statements</STRONG></FONT></P><UL><LI><FONT size="2"><STRONG>statement_memory_limit </STRONG><SPAN>- defines the maximum memory allocation &nbsp; per&nbsp; statement in GB After setting this parameter, statements that exceed the limit you have set on a host are stopped by running out of memory.</SPAN></FONT></LI><LI><FONT size="2"><STRONG>statement_memory_limit_threshold </STRONG><SPAN>- defines a percentage of the global allocation limit. Parameter statement_memory_limit is respected only if total </SPAN><SPAN>used memory exceeds the global allocation limit by this threshold percentage. The default value is 0% (of the global_allocation_limit) so statement_memory_limit is always respected.</SPAN></FONT></LI></UL><P><FONT size="2"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN>Example</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P style=" padding-left : 60px; "><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="atul_0-1709392944929.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/74549i29BB936B55696784/image-size/medium?v=v2&amp;px=400" role="button" title="atul_0-1709392944929.png" alt="atul_0-1709392944929.png" /></span></P><P style=" padding-left : 60px; ">&nbsp;</P><P><FONT size="4" color="#0000FF"><STRONG>4.Managing Peak Load (Admission Control)</STRONG></FONT></P><P><FONT size="2"><SPAN>The admission control feature is enabled by default&nbsp;&nbsp;</SPAN><SPAN>Use the admission control feature to apply processing limits and to decide how to handle new requests if the system is close to the point of saturation.</SPAN><SPAN>Limits can be applied at two levels so that&nbsp;</SPAN></FONT></P><UL><LI><FONT size="2"><SPAN>Request placed in the queued</SPAN></FONT></LI><LI><FONT size="2"><SPAN>Higher threshold for maximum workload</SPAN><STRONG><BR /></STRONG></FONT></LI></UL><P><FONT size="2"><SPAN>and the related threshold values and configurable parameters are available in the indexserver.ini file.</SPAN></FONT></P><TABLE><TBODY><TR><TD><P><STRONG>Parameter</STRONG></P></TD><TD><P><STRONG>Default</STRONG></P></TD><TD><P><STRONG>Detail</STRONG></P></TD></TR><TR><TD><P><SPAN>enable</SPAN></P></TD><TD><P><SPAN>True</SPAN></P></TD><TD><P><SPAN>Enables or disables the admission control feature.</SPAN></P></TD></TR><TR><TD><P><SPAN>queue_cpu_threshold</SPAN></P></TD><TD><P><SPAN>90</SPAN></P></TD><TD><P><FONT size="2"><SPAN>The percentage of CPU usage above which requests will be queued. Queue details are available in the view M_ADMISSION_CONTROL_QUEUES. The value 0 or 100 means that no requests are queued.</SPAN></FONT></P></TD></TR><TR><TD><P><FONT size="2"><SPAN>queue_memory_threshold</SPAN></FONT></P></TD><TD><P><FONT size="2"><SPAN>0</SPAN></FONT></P></TD><TD><P><FONT size="2"><SPAN>The percentage of memory usage above which requests will be queued. The value 0 or 100 means that no requests are queued.</SPAN></FONT></P></TD></TR><TR><TD><P><FONT size="2"><SPAN>reject_cpu_threshold</SPAN></FONT></P></TD><TD><P><FONT size="2"><SPAN>0</SPAN></FONT></P></TD><TD><P><FONT size="2"><SPAN>The percentage of CPU usage above which requests will be rejected. The default value 0 means that no requests are rejected, but may be queued.</SPAN></FONT></P></TD></TR><TR><TD><P><FONT size="2"><SPAN>reject_memory_threshold</SPAN></FONT></P></TD><TD><P><FONT size="2"><SPAN>0</SPAN></FONT></P></TD><TD><P><FONT size="2"><SPAN>The percentage of memory usage above which requests will be rejected. The default value 0 means that no requests are rejected, but may be queued.</SPAN></FONT></P></TD></TR></TBODY></TABLE><P style=" padding-left : 60px; "><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="atul_1-1709393111488.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/74551i4AFD4CE1BDA1C1BE/image-size/medium?v=v2&amp;px=400" role="button" title="atul_1-1709393111488.png" alt="atul_1-1709393111488.png" /></span></P><P><FONT size="2"><SPAN>There are many other parameters which is related to Queue Management such as</SPAN></FONT></P><UL><LI><FONT size="2"><SPAN>queue_wait_time_threshold</SPAN></FONT></LI><LI><FONT size="2"><SPAN>record_limit</SPAN></FONT></LI><LI><FONT size="2"><SPAN>max_queue_size</SPAN></FONT></LI><LI><FONT size="2"><SPAN>dequeue_interval</SPAN></FONT></LI><LI><FONT size="2"><SPAN>dequeue_size</SPAN></FONT></LI><LI><FONT size="2"><SPAN>queue_timeout</SPAN></FONT></LI><LI><FONT size="2"><SPAN>Queue_timeout_check_interval</SPAN></FONT></LI></UL><H1 id="toc-hId-465892515"><FONT size="4" color="#0000FF">5. Managing Workload with Workload Classes</FONT></H1><P><FONT size="2"><SPAN>You can manage workload in SAP HANA by creating workload classes and workload class mappings</SPAN></FONT><FONT size="2"><SPAN>You can classify workloads based on user and application context information and apply configured resource limitations (related to statement memory or thread limits) or a priority value.&nbsp;</SPAN></FONT><FONT size="2"><SPAN>Workload class settings override other ini file configuration settings which have been applied and also override user parameter settings&nbsp;</SPAN></FONT><FONT size="2"><SPAN>workload class settings only apply for the duration of the current session, whereas changes applied to the user persist</SPAN></FONT></P><P style=" padding-left : 60px; "><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="atul_2-1709393234627.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/74552i9547BA9CE80A9D5C/image-size/medium?v=v2&amp;px=400" role="button" title="atul_2-1709393234627.png" alt="atul_2-1709393234627.png" /></span></P><P><FONT size="2">Properties for Workload Classes</FONT><BR /><STRONG><FONT size="2">Priority</FONT></STRONG><BR /><FONT size="2">This prioritizes statements in the current execution. Priority values of 0 (lowest priority) to 9 (highest) are available; the default value is 5.</FONT></P><P><STRONG><FONT size="2">CPU and Memory Limits</FONT></STRONG></P><P><FONT size="2">STATEMENT THREAD LIMIT</FONT><BR /><FONT size="2">default_statement_concurrency_limit</FONT><BR /><FONT size="2">STATEMENT MEMORY LIMIT</FONT><BR /><FONT size="2">statement_memory_limit_threshold</FONT><BR /><FONT size="2">TOTAL STATEMENT THREAD LIMIT</FONT><BR /><FONT size="2">default_statement_concurrency_limit</FONT><BR /><FONT size="2">TOTAL STATEMENT MEMORY LIMIT</FONT><BR /><FONT size="2">total_statement_memory_limit</FONT></P><P><STRONG><FONT size="2">Timeout Values</FONT></STRONG></P><P><FONT size="2">STATEMENT TIMEOUT</FONT><BR /><FONT size="2">WRITE TRANSACTION LIFETIME</FONT><BR /><FONT size="2">IDLE CURSOR LIFETIME</FONT></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="atul_3-1709393520781.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/74553i7FE61F297D540FC1/image-size/medium?v=v2&amp;px=400" role="button" title="atul_3-1709393520781.png" alt="atul_3-1709393520781.png" /></span></P><P>&nbsp;</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="atul_4-1709393528893.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/74554iCF143B5863AE5FB7/image-size/medium?v=v2&amp;px=400" role="button" title="atul_4-1709393528893.png" alt="atul_4-1709393528893.png" /></span></P><P>&nbsp;</P><P><I><SPAN>Ref and further notes</SPAN></I></P><P><BR /><BR /></P><P><FONT size="2"><SPAN>2938708 - How to create a HANA workload class and mapping for a particular user</SPAN></FONT></P><P><FONT size="2"><SPAN>2222250 - FAQ: SAP HANA Workload Management</SPAN></FONT></P><P><FONT size="2"><SPAN>Help.sap.com</SPAN></FONT></P><P>&nbsp;</P><P>&nbsp;</P> 2024-03-06T03:19:54.266000+01:00 https://community.sap.com/t5/supply-chain-management-blogs-by-members/troubleshooting-removal-of-deleted-shipment-pos-from-mrrl-batch-jobs/ba-p/13629243 Troubleshooting: Removal of deleted Shipment POs from MRRL Batch jobs 2024-03-06T08:57:10.666000+01:00 prasanna_tiwari https://community.sap.com/t5/user/viewprofilepage/user-id/888534 <P><STRONG><U>Introduction</U></STRONG>:</P><P>In this blog post I am going to explain the steps/actions required to avoid the existing deleted/cancelled Shipment POs from appearing into MRRL batch jobs in SAP S/4 Hana.</P><P><STRONG><U>Scenario</U></STRONG>:</P><P>Scenario at client place is Creating Purchase Order (PO), Goods Receipt (GR) and invoice via MRRL (Background job).</P><P>In above mentioned process, purchase order, GR posting &amp; reversal &amp; Invoice posting &amp; reversal happened &amp; then deleted the line item from Shipment PO.</P><P>when this MRRL batch job is running that deleted line-item Shipment PO is still occurring in MRRL batch job report.</P><P>We are getting below message for above PO in spool batch job report.</P><P>“<STRONG>Item 00001 of purchasing document XXXXXXXXX does not exist.”</STRONG></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="prasanna_tiwari_0-1709707022788.jpeg" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/76158i838F0A0D291BFF30/image-size/medium?v=v2&amp;px=400" role="button" title="prasanna_tiwari_0-1709707022788.jpeg" alt="prasanna_tiwari_0-1709707022788.jpeg" /></span></P><P><STRONG><U>Steps to avoid this:</U></STRONG></P><OL><LI>We must first uncheck the ERS field in the PO and save it.</LI></OL><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="prasanna_tiwari_1-1709707022795.jpeg" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/76160iB9328BAF7C9D71B0/image-size/medium?v=v2&amp;px=400" role="button" title="prasanna_tiwari_1-1709707022795.jpeg" alt="prasanna_tiwari_1-1709707022795.jpeg" /></span></P><P>&nbsp;</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="prasanna_tiwari_2-1709707022799.jpeg" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/76159i137D778EBFE402F2/image-size/medium?v=v2&amp;px=400" role="button" title="prasanna_tiwari_2-1709707022799.jpeg" alt="prasanna_tiwari_2-1709707022799.jpeg" /></span></P><P>&nbsp;</P><OL><LI>Then cancel the invoice of that PO (via MIRO)</LI><LI>After unchecking the ERS field in PO and cancelling the invoice, the further steps to be processed namely GR cancellation (cancel shipment via Transaction code VI02) and PO line-item deletion (via Transaction code ME22N).</LI></OL><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="prasanna_tiwari_3-1709707022805.jpeg" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/76162i65E8DECA5D3015F8/image-size/medium?v=v2&amp;px=400" role="button" title="prasanna_tiwari_3-1709707022805.jpeg" alt="prasanna_tiwari_3-1709707022805.jpeg" /></span></P><P>&nbsp;</P><P><STRONG><U>&nbsp;</U></STRONG></P><P>And that’s it, with this we can avoid the cancelled/deleted PO from appearing into MRRL background Batch jobs.</P><P>&nbsp;</P><P><STRONG><U>Background of ERS</U></STRONG>: <SPAN>Evaluated receipt settlement involves an agreement between the vendor (creditor) and the buying entity that the former does not issue invoices for purchasing transactions. Instead, the invoice document is posted automatically in the buying entity's system based </SPAN><SPAN>on data from the PO and goods receipts.</SPAN></P><P>ERS should be maintained in Vendor Master and Purchasing info record</P><P>Vendor Master :</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="prasanna_tiwari_4-1709707022811.jpeg" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/76163i9058ADBA78FF11BE/image-size/medium?v=v2&amp;px=400" role="button" title="prasanna_tiwari_4-1709707022811.jpeg" alt="prasanna_tiwari_4-1709707022811.jpeg" /></span></P><P>&nbsp;</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="prasanna_tiwari_5-1709707022816.jpeg" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/76161i2CA479ADD6B43CE4/image-size/medium?v=v2&amp;px=400" role="button" title="prasanna_tiwari_5-1709707022816.jpeg" alt="prasanna_tiwari_5-1709707022816.jpeg" /></span></P><P>&nbsp;</P><P>&nbsp;</P><P>Purchase Info Record : Info Category as Standard</P><OL><LI>Select the&nbsp;<STRONG>GR-Bsd IV&nbsp;</STRONG>indicator</LI><LI>De-select the&nbsp;<STRONG>No ERS&nbsp;</STRONG>indicator</LI></OL><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="prasanna_tiwari_6-1709707022821.jpeg" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/76164iA7772F6B03759E72/image-size/medium?v=v2&amp;px=400" role="button" title="prasanna_tiwari_6-1709707022821.jpeg" alt="prasanna_tiwari_6-1709707022821.jpeg" /></span></P><P>&nbsp;</P><P>===0====</P><P>I sincerely hope that the information provided in this post helps you. Please feel free to comment, ask questions and post your thoughts on how you liked it.</P><P>&nbsp;</P><P>Best Regards,</P><P>Prasanna Tiwari</P> 2024-03-06T08:57:10.666000+01:00 https://community.sap.com/t5/technology-blogs-by-members/custom-fields-and-logics-create-and-capturing-the-changes-into-transport/ba-p/13625192 Custom Fields and Logics - Create and Capturing the Changes into Transport Request 2024-03-06T09:38:04.081000+01:00 VaraPrasadT https://community.sap.com/t5/user/viewprofilepage/user-id/38562 <P><STRONG>Custom fields and logics</STRONG> are strong tools that enable users to modify software systems to meet their unique requirements, increasing efficiency and functionality.&nbsp;</P><P>Custom fields and logics are frequently implemented using the software system's administration interfaces or configuration tools. Without needing to know programming, users with the proper permissions can use these interfaces to add, edit, or remove custom fields as well as define custom logics.</P><P>Custom Fields and logic Fiori app can be used by&nbsp; SAP business specialists and implementation consultants can design their own fields and enhance the existing applications that have enabled their extensibility for the key users.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="VaraPrasadT_0-1709294762154.png" style="width: 719px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/74118i694C7E739BDC5CAE/image-dimensions/719x91?v=v2" width="719" height="91" role="button" title="VaraPrasadT_0-1709294762154.png" alt="VaraPrasadT_0-1709294762154.png" /></span></P><P>Custom Logic, Data Source Extensions, and Custom Fields tabs are available by default to fulfill the business requirement.</P><P><STRONG>Custom Fields:</STRONG>&nbsp;We can use this process to create and manage custom fields that can be used to improve applications that have allowed key users to extend their functionality.</P><P><SPAN><STRONG>Data Source Extensions:</STRONG>&nbsp;</SPAN>Create, edit, and delete data source extensions in order to enable the usage of existing fields in predelivered data sources.</P><P><STRONG>Custom Logic:&nbsp;</STRONG>Through this process, We can develop and manage custom logic to improve applications that allow key users to extend the application logic.</P><P>We can determine whether it is or not already exists by using the search option. You can register a new filed enablement that is necessary as part of a business requirement by using the Plus (+) button.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="VaraPrasadT_2-1709464753900.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/74637iA021F247AD83B896/image-size/large?v=v2&amp;px=999" role="button" title="VaraPrasadT_2-1709464753900.png" alt="VaraPrasadT_2-1709464753900.png" /></span></P><P>Following the click of the + button, you will be able to search the Business context according to your needs. It will display several entries in the business contexts; you can then choose the appropriate entry based on your needs.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="VaraPrasadT_1-1709294835506.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/74119i71808247589762E2/image-size/large?v=v2&amp;px=999" role="button" title="VaraPrasadT_1-1709294835506.png" alt="VaraPrasadT_1-1709294835506.png" /></span></P><P>Complete the required fields as shown on the screen below, then click the "Create" button and proceed for publish.&nbsp;<BR /><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="VaraPrasadT_2-1709294946574.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/74120i30A77B6F5FDF4443/image-size/large?v=v2&amp;px=999" role="button" title="VaraPrasadT_2-1709294946574.png" alt="VaraPrasadT_2-1709294946574.png" /></span></P><P><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="VaraPrasadT_0-1709466401835.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/74640iAD0EC2AEA6D31317/image-size/large?v=v2&amp;px=999" role="button" title="VaraPrasadT_0-1709466401835.png" alt="VaraPrasadT_0-1709466401835.png" /></span></P><P>Additionally, we can use the other tabs, such as UIs and reports,&nbsp;mail templates, form templates, and business scenarios, and add the field that is necessary to enable into any of the Fiori Apps in&nbsp;accordance with the requirement.</P><P>SAP has provided the options below <STRONG>to save changes into a Transport Request (TR)</STRONG> so that they can be moved into higher systems, such as the Preproduction and Production systems.</P><P>Using <EM><STRONG>Configure Software Packages</STRONG></EM> App, we can register the development packages that are required for the project development.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="VaraPrasadT_1-1709466898975.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/74642iCFEBBB9F6BCC0C85/image-size/large?v=v2&amp;px=999" role="button" title="VaraPrasadT_1-1709466898975.png" alt="VaraPrasadT_1-1709466898975.png" /></span></P><P>We can add our project development packages, which are already in the system, by using the <STRONG>Add Registration</STRONG> button.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="VaraPrasadT_2-1709467034640.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/74643i850C6DCE70E2B0C4/image-size/large?v=v2&amp;px=999" role="button" title="VaraPrasadT_2-1709467034640.png" alt="VaraPrasadT_2-1709467034640.png" /></span></P><P>and also have the choice to allow tasks and requests to be handled automatically. A Transport Request and associated task will be generated automatically for this package.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="VaraPrasadT_3-1709467271107.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/74645iB2ED2FC4B0EACA08/image-size/large?v=v2&amp;px=999" role="button" title="VaraPrasadT_3-1709467271107.png" alt="VaraPrasadT_3-1709467271107.png" /></span></P><P>To Register the extensions into a Transport request, SAP has provide another app called <STRONG>Register Extensions for Transport. </STRONG>By using this app, the changes that done can be saved into Transport for further landscape systems.&nbsp;</P><P><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="VaraPrasadT_5-1709467667065.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/74648i2278B5841F5E15F9/image-size/large?v=v2&amp;px=999" role="button" title="VaraPrasadT_5-1709467667065.png" alt="VaraPrasadT_5-1709467667065.png" /></span></P><P>Note :&nbsp;&nbsp;if Automatic Request and Task handling are chosen, this will be generated automatically in the event that there isn't a transport request.&nbsp;Using the "<STRONG>Assign to Transport Request</STRONG>" button, we can also manually assign the transport request.&nbsp;</P><P>Now you can check the changes into your transport request.</P><P>Conclusion :&nbsp;This blog post describes how to move the enhancements or extensions made with Custom fields and logic app.&nbsp;</P> 2024-03-06T09:38:04.081000+01:00 https://community.sap.com/t5/technology-blogs-by-sap/using-hints-with-sqlscript-procedures/ba-p/13620274 Using Hints with SQLScript procedures 2024-03-12T14:51:12.837000+01:00 Taesuk https://community.sap.com/t5/user/viewprofilepage/user-id/202976 <H1 id="toc-hId-858763838">Introduction</H1><P>To resolve a problematic SQL statement inside a SQLScript procedure may require adding a hint to resolve the issue. For general SQL statements, a statement hint can be used to apply and manage hints without the&nbsp; changing the original source code of the calling application.</P><P>For SQLScript procedures, table variables are used to assign results of a SQLStatement and the variable can be referenced in a subsequent statement. During the execution call of the procedure,&nbsp;the procedure logic will be compiled and cached. Some logic will be inlined into another statement and some can be materialized into a local temp table. The name of the temp table is determined during the optimization of the procedure.</P><P>Due to such behavior, the lifecycle of an inner SQL statement referencing local temp table(s) is only valid until the procedure gets recompiled or invalidated. The recompilation can occur due to logic changes and/or dependent object changes such as metadata changes. So, to add a hint for an inner SQL statement, changing the SQLScript source application code was the only available option. If the source was part of an application standard code, it was even more difficult to add the hint.</P><P>To simplify managing hints applied to inner SQL statements, 2 features have been recently delivered for SAP HANA Cloud and HANA 2.0 SPS07.</P><UL><LI>Adding hints to SQLScript procedure code with cascade</LI><LI>Pinning SQL Hints to SQLScript procedure using statement hints</LI></UL><P>The details of the functionality can be found in the documentation&nbsp;for both&nbsp;<A href="https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-performance-guide-for-developers/using-hints-with-sqlscript-procedures?locale=en-US" target="_self" rel="noopener noreferrer">SAP HANA Cloud, SAP HANA database</A> and <A href="https://help.sap.com/docs/SAP_HANA_PLATFORM/9de0171a6027400bb3b9bee385222eff/5d895ce3b30448db91531b8e03cd2428.html?locale=en-US" target="_self" rel="noopener noreferrer">SAP HANA, platform edition</A>.</P><H1 id="toc-hId-662250333">&nbsp;</H1><H1 id="toc-hId-465736828">Demo environment setup</H1><P>1. Let's first create a very simple table with some basic data</P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-sql"><code>CREATE TABLE ORDERS(PRODUCT_ID NVARCHAR(10), DESCRIPTION NVARCHAR(100), PRIMARY KEY(PRODUCT_ID)); insert into ORDERS(PRODUCT_ID, DESCRIPTION) VALUES ('0000000001', 'Description of product 1'); insert into ORDERS(PRODUCT_ID, DESCRIPTION) VALUES ('0000000002', 'Description of product 2'); insert into ORDERS(PRODUCT_ID, DESCRIPTION) VALUES ('0000000003', 'Description of product 3'); insert into ORDERS(PRODUCT_ID, DESCRIPTION) VALUES ('0000000004', 'Description of product 4'); insert into ORDERS(PRODUCT_ID, DESCRIPTION) VALUES ('0000000005', 'Description of product 5'); insert into ORDERS(PRODUCT_ID, DESCRIPTION) VALUES ('0000000006', 'Description of product 6'); insert into ORDERS(PRODUCT_ID, DESCRIPTION) VALUES ('0000000007', 'Description of product 7'); insert into ORDERS(PRODUCT_ID, DESCRIPTION) VALUES ('0000000008', 'Description of product 8'); insert into ORDERS(PRODUCT_ID, DESCRIPTION) VALUES ('0000000009', 'Description of product 9'); insert into ORDERS(PRODUCT_ID, DESCRIPTION) VALUES ('0000000010', 'Description of product 10');</code></pre><P>&nbsp;</P><P>&nbsp;</P><P>2. Then create 2 procedures that is similar to how AMDP are structured with stub or wrapper procedure and main procedure which is called by the wrapper procedure.</P><P>For this example, the procedures are manually created which is very simple. The product_id is passed as input parameter and the data record is returned from ORDERS table for the given PRODUCT_ID.&nbsp;</P><P>The main procedure with the following logic to return the data record as output</P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-sql"><code>CREATE OR REPLACE PROCEDURE GET_ORDERS( in "IV_PRODUCT_ID" NVARCHAR(10), out "ET_ORDER" ORDERS) language sqlscript sql security invoker as begin ET_ORDER = SELECT * FROM ORDERS where PRODUCT_ID = :IV_PRODUCT_ID; end;</code></pre><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>And the stub procedure is created with a timestamp as a wrapper procedure of the main procedure.</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-sql"><code>CREATE OR REPLACE PROCEDURE "GET_ORDERS#20220227123129" ( IN "IV_PRODUCT_ID" NVARCHAR(10) ) LANGUAGE sqlscript sql security invoker as begin call GET_ORDERS("IV_PRODUCT_ID" =&gt; :IV_PRODUCT_ID, "ET_ORDER" =&gt; :ET_ORDER); select * from :ET_ORDER; end;</code></pre><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><H1 id="toc-hId-269223323">Applying hints to inner SQL statements of SQLScript procedure</H1><P>First, we will check the default behavior prior without apply hints.</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-sql"><code>call "GET_ORDERS#20220227123129"('0000000010');</code></pre><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp; A single row will be returned for the given product_id</P><P><span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="DefaultResult.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/71713i4D59298F2B0ED4E5/image-size/large?v=v2&amp;px=999" role="button" title="DefaultResult.png" alt="DefaultResult.png" /></span></P><P>&nbsp;</P><P>&nbsp;</P><P>Looking into the SQL plan cache, only the stub procedure call was cached while the main procedure call was inlined to the stub procedure logic during the SQLScript procedure compilation.</P><P>Also, the inner select statement is cached&nbsp; as the following</P><P>&nbsp;</P><TABLE border="1" width="100%"><TBODY><TR><TD width="100%">/* procedure: "DBADMIN"."GET_ORDERS" variable: ET_ORDER line: 7 col: 2 (at pos 141) */ SELECT * FROM ORDERS where PRODUCT_ID = CAST(N'0000000010' AS NVARCHAR(10))</TD></TR></TBODY></TABLE><P>The statement is prefixed with a comment indicating that the result was assigned to ET_ORDER table variable at line: 7 col:2 in GET_ORDERS procedure.</P><P>This time we would like to check the behavior of the new features starting with adding hints to SQLScript procedure code with cascade.&nbsp;</P><P>Let's clear the SQL plan cache&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-sql"><code>ALTER SYSTEM CLEAR SQL PLAN CACHE;</code></pre><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>Now call the procedure again with adding a hint cascading to all inner statements.</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-sql"><code>call "GET_ORDERS#20220227123129"('0000000010') with hint (NO_USE_HEX_PLAN cascade);</code></pre><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>The result is the same returning 1 record</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DefaultResult.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/79050i2E8432BC7A373AC8/image-size/large?v=v2&amp;px=999" role="button" title="DefaultResult.png" alt="DefaultResult.png" /></span></P><P>Then check the SQL plan cache again for the inner SQL statement cached and find the hint cascaded down from the procedure call and used.</P><P>&nbsp;</P><TABLE border="1" width="100%"><TBODY><TR><TD width="100%">/* procedure: "DBADMIN"."GET_ORDERS" variable: ET_ORDER line: 7 col: 2 (at pos 141) */ SELECT * FROM ORDERS where PRODUCT_ID = CAST(N'0000000010' AS NVARCHAR(10)) <FONT color="#993300">WITH HINT(NO_USE_HEX_PLAN)</FONT></TD></TR></TBODY></TABLE><P>Finally, we will check the 2nd option. Let's clear the SQL plan cache again</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-sql"><code>ALTER SYSTEM CLEAR SQL PLAN CACHE;</code></pre><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>We will now use the statement hint to add USE_HEX_PLAN directly to the inner SQL statement this time.</P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-sql"><code>ALTER SYSTEM ADD STATEMENT HINT (USE_HEX_PLAN) ON PROCEDURE GET_ORDERS FOR SELECT * FROM ORDERS where PRODUCT_ID = :IV_PRODUCT_ID;</code></pre><P>&nbsp;</P><P>&nbsp;</P><P>We call the procedure again without any hints as we had for the default call and&nbsp;check the default behavior prior without apply hints.&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-sql"><code>call "GET_ORDERS#20220227123129"('0000000010');</code></pre><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>Then finally check the SQL plan cache for the inner SQL statement.&nbsp;Notice that the hint was appended with a comment indicating that the hint was added by the Statement Hint.</P><P>&nbsp;</P><TABLE border="1" width="98.73577749683945%"><TBODY><TR><TD width="100%">/* procedure: "DBADMIN"."GET_ORDERS" variable: ET_ORDER line: 7 col: 2 (at pos 141) */ SELECT * FROM ORDERS where PRODUCT_ID = CAST(N'0000000010' AS NVARCHAR(10)) <FONT color="#993300">/*added by Statement Hint:*/ with hint(USE_HEX_PLAN)</FONT></TD></TR></TBODY></TABLE><H1 id="toc-hId-72709818">&nbsp;</H1><H1 id="toc-hId--123803687">Conclusion</H1><P>We have checked 2 different methods of adding hints to inner SQL statements of SQLScript procedure which would be useful to manage the performance of the inner SQL statement of a SQLScript procedure without changing the SQLScript code itself.</P><P>But one thing to keep in mind is that mixing the 2 methods can cause unexpected results such as the following by adding 2 conflicting hints.&nbsp;</P><P>&nbsp;</P><TABLE border="1" width="100%"><TBODY><TR><TD width="100%">/* procedure: "DBADMIN"."GET_ORDERS" variable: ET_ORDER line: 7 col: 2 (at pos 141) */ SELECT * FROM ORDERS where PRODUCT_ID = CAST(N'0000000010' AS NVARCHAR(10)) /*added by Statement Hint:*/ with hint(<FONT color="#993300">USE_HEX_PLAN, NO_USE_HEX_PLAN)</FONT></TD></TR></TBODY></TABLE> 2024-03-12T14:51:12.837000+01:00 https://community.sap.com/t5/crm-and-cx-blogs-by-sap/effectively-adopting-recurring-service-process-from-s-4-hana-service/ba-p/13633284 Effectively adopting Recurring Service process from S/4 HANA Service Management into your business 2024-03-13T15:18:20.952000+01:00 shruthi_j_b https://community.sap.com/t5/user/viewprofilepage/user-id/148568 <P style=" text-align : justify; ">Regular maintenance aids in maintaining a customer's assets at their best performance levels while reducing the likelihood of breakdowns and the costs associated with repairs.</P><P style=" text-align : justify; ">Our preventive maintenance solution, designed to sustain customer assets, facilitates consistent production by mitigating unexpected breakdowns. This solution creates and executes orders at specified intervals/usage, drastically improving asset production efficiency and minimizing breakdowns. Notably, this solution also reduces maintenance costs and contributes to recurring service revenues for customers. It adeptly manages both commercial aspects through service orders, as per the service contract, and technical aspects through execution orders.</P><P style=" text-align : justify; ">There are different types of Maintenance Plans, namely: Single cycle plans based on time or performance, strategy plans, or multiple counter maintenance plans that are implemented on need basis . Once you create a maintenance plan, you can schedule the plan to generate call objects when the system is due for maintenance.</P><P style=" text-align : justify; ">The normal recurring service is the process that is more straightforward and is suitable for simple servicing scenarios and is inclusive of commercial aspects in the same document. The Service with Advanced Execution is a process that combines commercial aspects of service with maintenance management for tasks that require detailed planning and execution. Maintenance task lists help in planning and organizing maintenance work efficiently, saving time during scheduling. They're especially useful for frequent tasks requiring the same materials, and for recurring and one-time tasks. The service part handles the customer's needs, pricing, satisfaction, and profit, while the maintenance management part focuses on planning, understanding equipment technicalities, and carrying out the service. The process creates Execution Order Items, which can be part of a service order or a maintenance plan. These items generate a maintenance order, enabling the service's planning and execution.</P><P style=" text-align : justify; ">The information below explains how to differentiate between the two.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Image 1 : Apps related to Recurring Service" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/79173i59C1AE50D59EE924/image-size/large?v=v2&amp;px=999" role="button" title="RS1.png" alt="Image 1 : Apps related to Recurring Service" /><span class="lia-inline-image-caption" onclick="event.preventDefault();">Image 1 : Apps related to Recurring Service</span></span></P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P><span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Image 2: Recurring Service with Advanced Execution" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/79175iA204167792939752/image-size/large?v=v2&amp;px=999" role="button" title="RSAP1.png" alt="Image 2: Recurring Service with Advanced Execution" /><span class="lia-inline-image-caption" onclick="event.preventDefault();">Image 2: Recurring Service with Advanced Execution</span></span></P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><TABLE><TBODY><TR><TD width="56"><P><STRONG>S.I No</STRONG></P></TD><TD width="142"><P><STRONG>Category </STRONG></P></TD><TD width="227"><P><STRONG>Recurring Service </STRONG></P></TD><TD width="265"><P><STRONG>Recurring Service with Advanced Execution </STRONG></P></TD></TR><TR><TD width="56"><P>1</P></TD><TD width="142"><P>Scenarios</P></TD><TD width="227"><P>Classic Recurring Service</P></TD><TD width="265"><P>Preventive Maintenance</P></TD></TR><TR><TD width="56"><P>2</P></TD><TD width="142"><P>ABAP Call Type Technical code</P></TD><TD width="227"><P>Maintenance Service Call Type<STRONG> '5'</STRONG></P></TD><TD width="265"><P>Maintenance Service Call Type<STRONG> '6'</STRONG></P></TD></TR><TR><TD width="56"><P>3</P></TD><TD width="142"><P>Types of MPLAN supported</P></TD><TD width="227"><P>Single Cycle (Time or Performance), Multiple-Counter</P></TD><TD width="265"><P>Single Cycle (Time or Performance), Multiple-Counter, Strategy Time Based. Strategy Performance Based</P></TD></TR><TR><TD width="56"><P>4</P></TD><TD width="142"><P>Preceding Document</P></TD><TD width="227"><P>Service Template</P></TD><TD width="265"><P>Service Contract</P></TD></TR><TR><TD width="56"><P>5</P></TD><TD width="142"><P>Mandatory Inputs for Scheduling</P></TD><TD width="227"><P>Service Template<BR />Either Technical Object OR Service Contract<BR />Call Object Type (Service Order or Service Quotation)</P></TD><TD width="265"><P>Service Contract<BR />Work Centre<BR />Planning Plant<BR />Call Object Type (Service Order)</P></TD></TR><TR><TD width="56"><P>6</P></TD><TD width="142"><P>Output</P></TD><TD width="227"><P>Service Order or Service Quotation</P></TD><TD width="265"><P>Service Order with Execution Order</P></TD></TR><TR><TD width="56"><P>7</P></TD><TD width="142"><P>Source of Service Transaction Items</P></TD><TD width="227"><P>Service Order Template</P></TD><TD width="265"><P>Service Contract Items</P></TD></TR><TR><TD width="56"><P>8</P></TD><TD width="142"><P>Task List&nbsp;</P></TD><TD width="227"><P>Table OISD (Service Product with Task List)</P></TD><TD width="265"><P>Directly from Maintenance Item, else from table OISD.</P></TD></TR><TR><TD width="56"><P>9</P></TD><TD width="142"><P>Supported Service Document Types</P></TD><TD width="227"><P>Service Order and Service Quotation</P></TD><TD width="265"><P>Service Order</P></TD></TR><TR><TD width="56"><P>10</P></TD><TD width="142"><P>Applications support and GUI support</P></TD><TD width="227"><P>Supports on Fiori Apps</P></TD><TD width="265"><P>GUI (TCODES: IP01/02/03 and IP10, etc) and Fiori Apps</P></TD></TR></TBODY></TABLE><P>The ABAP code flow for simple recurring service is as follows:</P><P>FAELLIGE_MHIS_ORDER ( FM)&nbsp; -&gt;<BR />PERFORM service_order_create -&gt;<BR />CL_CRMS4_MPLAN_SCHEDULING-IF_CRMS4_MPLAN_SCHEDULING~CREATE_ORDER( ) -&gt;<BR />CL_CRMS4_MPLAN_ORDER_CREATION-IF_CRMS4_MPLAN_ORDER_CREATION~CREATE_ORDER( )-&gt;<BR />CL_CRMS4_MPLAN_ORDER_CREATION-&gt;CREATE_ORDER_FROM_TEMPLATE( )-&gt;<BR />CL_CRMS4_MPLAN_ORDER_PREPARE-IF_CRMS4_MPLAN_ORDER_PREPARE~GET_DATA_FOR_CREATION ( )-&gt;<BR />CRM_ORDER_MAINTAIN-&gt;( call back to FAELLIGE_MHIS_ORDER )-&gt;<BR />PERFORM service_order_post_mhio (calling CRM_ORDER_SAVE).<BR /><BR /></P><P>The ABAP code flow for recurring service with execution order item ( Advanced Execution ) is as follows:</P><P><BR />FAELLIGE_MHIS_ORDER (FM) -&gt;PERFORM create_srvo_pmo-&gt;<BR />SERVICE ORDER CREATION: PERFORM service_order_create -&gt;<BR />CL_CRMS4_MPLAN_SCHEDULING-IF_CRMS4_MPLAN_SCHEDULING~CREATE_ORDER( ) -&gt;<BR />CL_CRMS4_MPLAN_ORDER_CREATION-IF_CRMS4_MPLAN_ORDER_CREATION~CREATE_ORDER( )-&gt;<BR />CL_CRMS4_MPLAN_ORDER_CREATION-&gt;CREATE_ORDER_FROM_CONTRACT( )<BR />CL_CRMS4_MPLAN_ORDER_PREPARE-IF_CRMS4_MPLAN_ORDER_PREPARE~GET_DATA_FOR_CREATION ( )-&gt;<BR />CRM_ORDER_MAINTAIN-&gt;(call back to PERFORM create_srvo_pmo )-&gt;<BR />MAINTENANCE ORDER in BUFFER :<BR />PERFORM order_create_f13 -&gt; (call back to FAELLIGE_MHIS_ORDER)-&gt;<BR />PERFORM update_srvo_pmo-&gt;<BR />EXACT OBJECT ID of PLANT MAINTENANCE ORDER:<BR />PERFORM order_update_f13-&gt;( call back to PERFORM update_srvo_pmo )-&gt;<BR />(Logic for Creation of the DOCFLOW between Plant Maintenance Order and Service Order and vice versa).<BR /><BR /></P><P>In conclusion, the distinction between normal Recurring service and Service with Advanced Execution lies in their complexity and scope. The decision to select one over the other depends on the specific needs and requirements of the business.</P><P>Further Readings :</P><OL><LI><A href="https://community.sap.com/t5/enterprise-resource-planning-blogs-by-sap/types-of-maintenance-plans/ba-p/13574995" target="_blank">Types of Maintenance Plans - SAP Community</A></LI><LI><A href="https://community.sap.com/t5/enterprise-resource-planning-blogs-by-sap/introduction-to-service-with-advanced-execution-in-sap-s-4hana-2023/ba-p/13576379" target="_blank">Introduction to Service with Advanced Execution in... - SAP Community</A></LI><LI><A href="https://community.sap.com/t5/enterprise-resource-planning-blogs-by-sap/execution-status-in-service-with-advanced-execution/ba-p/13580310" target="_blank">Execution Status in Service with Advanced Executio... - SAP Community</A></LI><LI><A href="https://blogs.sap.com/2023/12/28/deep-dive-execution-order-item-and-billable-maintenance-order/" target="_blank" rel="noopener noreferrer">Execution order item and billable maintenance order</A></LI><LI><A href="https://community.sap.com/t5/enterprise-resource-planning-blogs-by-sap/service-with-advanced-execution-process-flow-1-start-planning-after-service/ba-p/13626292" target="_blank">Service with Advanced Execution: Process Flow 1 – ... - SAP Community</A></LI></OL> 2024-03-13T15:18:20.952000+01:00 https://community.sap.com/t5/technology-blogs-by-sap/how-data-anonymization-in-sap-hana-secure-generative-ai-applications/ba-p/13636987 How Data Anonymization in SAP HANA secure Generative AI applications through SAP Datasphere 2024-03-15T20:12:44.703000+01:00 DKK https://community.sap.com/t5/user/viewprofilepage/user-id/131035 <P><STRONG>Introduction</STRONG></P><P>As Generative AI continues to evolve, the complexities surrounding the management of Personally Identifiable Information (PII) also increase.AI systems can sometimes deduce PII from seemingly harmless data or unintentionally reveal PII in their results. Therefore, it's essential for AI developers and users to understand these potential risks and take proactive measures to address them.</P><P><STRONG>Personally identifiable information (PII)</STRONG> refers to any information that can be used to identify an individual. This might include, but is not limited to, name, social security number, date and place of birth, mother’s maiden name, or biometric records. In the digital age, it could also include digital identity data such as IP addresses or mobile device IDs.</P><P>Handling PII responsibly is critical for many reasons:</P><UL><LI>Respecting Privacy</LI><LI>Ensuring Security</LI><LI>Building Trust</LI></UL><P>On the regulatory front, there are laws including the European Union's General Data Protection Regulation (GDPR) and the U.S.'s California Consumer Privacy Act (CCPA) that offer a framework for PII management. These laws empower individuals with rights over their personal data. However, it's worth noting that these regulations are relatively recent and still evolving. There's also ongoing discourse about the optimal way<BR />to regulate AI systems to balance the need for privacy protection and technological innovation.&nbsp;<STRONG>SAP HANA Data Anonymization</STRONG> provides methods in order to overcome all the above potential risks. The methods supported by SAP HANA are :</P><UL><LI>k-anonymity</LI><LI>l-diversity</LI><LI>Differential privacy</LI></UL><P>More information on the SAP HANA Documentation :<BR /><A href="https://help.sap.com/docs/SAP_HANA_PLATFORM/f88e51df089949b2af06ac891c77abf8/ee693d6584d243e1a0daf7c137f9600c.html" target="_blank" rel="noopener noreferrer">https://help.sap.com/docs/SAP_HANA_PLATFORM/f88e51df089949b2af06ac891c77abf8/ee693d6584d243e1a0daf7c137f9600c.html</A></P><P><STRONG>Architecture</STRONG></P><P>On this blog we will explore the various solutions for tackling PII-related challenges through the SAP Business Technology Platform. We'll be focusing on SAP Datasphere's capabilities, which not only enable us to consolidate all necessary data sources, SAP or non-SAP, but also leverage SAP HANA's powerful data anonymization methods. This combination ensures your data's security while maximizing its potential.</P><P>Considering the unique capabilities and skills of the personas interacting with SAP Datasphere, we have come to the following options.</P><P><EM>We really hope that the first option , direct usage of Data Anonymization annotations from SAP Datasphere interface to be on the roadmap really soon.</EM></P><P><EM><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="anon1.png" style="width: 855px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/80029iC024EE3281490FCE/image-size/large?v=v2&amp;px=999" role="button" title="anon1.png" alt="anon1.png" /></span></EM></P><P>&nbsp;</P><P>A generic <STRONG>architecture of a Generative AI</STRONG> project, where SAP Datasphere takes center stage, can be seen below :&nbsp;</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="anon2.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/80032iC4D078C045C42647/image-size/large?v=v2&amp;px=999" role="button" title="anon2.png" alt="anon2.png" /></span></P><P>More information regarding the <STRONG>CAP LLM Plugin</STRONG> , please check this link</P><P><A href="https://community.sap.com/t5/technology-blogs-by-sap/elevating-data-privacy-in-sap-cap-based-genai-applications-with-cap-llm/ba-p/13585745" target="_blank">https://community.sap.com/t5/technology-blogs-by-sap/elevating-data-privacy-in-sap-cap-based-genai-applications-with-cap-llm/ba-p/13585745</A></P><P><STRONG>Hybrid Approach, focus mainly for Business personas</STRONG></P><P>The starting point for business users will be a local table accessible through the SAP DSP interface <STRONG>(INPUT)</STRONG>.<BR />We'll elaborate more on this in the upcoming images. The entire process will be seamlessly managed behind the scenes, offering a user-friendly experience <STRONG>(PROCESS)</STRONG>. It will be set up just once on the underlying SAP HANA of SAP DSP. A procedure will generate an Anonymization view, which will be displayed on the SAP Datasphere interface <STRONG>(OUTPUT)</STRONG>. This procedure is programmed to run every minute. Only when the user activates the "enable" flag during the initial step will this procedure execute. Otherwise, it simply remains inactive.&nbsp;The final output will be an SAP Datasphere view, tailor-made for business users based on their specific requirements. The anonymized view produced can be distributed by the Data Controller to the necessary DSP spaces, substituting the original non-anonymized dataset. This straightforward step allows us to exert additional control over the access permissions for the Data Consumer.</P><P><STRONG>Hybrid approach</STRONG></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="anon3.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/80038iF49833709ED7B128/image-size/large?v=v2&amp;px=999" role="button" title="anon3.png" alt="anon3.png" /></span></P><P><STRONG>Details regarding the Configuration&nbsp;(SAP Datasphere Local Table)</STRONG></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="anon4.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/80041iAF8553372463858E/image-size/large?v=v2&amp;px=999" role="button" title="anon4.png" alt="anon4.png" /></span></P><P><STRONG>Information regarding SAP HANA Procedure and Scheduler</STRONG></P><P><STRONG><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="anon5.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/80044iC36E6A316195D436/image-size/large?v=v2&amp;px=999" role="button" title="anon5.png" alt="anon5.png" /></span></STRONG></P><P><STRONG>Conclusion</STRONG></P><P>In conclusion, the use of SAP Datasphere in a generative AI scenario presents an array of advantages. It significantly enhances data handling and security, ensuring the protection of personally identifiable information through SAP HANA's anonymization methods. The versatility of SAP Datasphere allows it to cater to both IT and Business personas, offering a range of implementation methods including direct, SQL, Python or via a CAP Application. Being a one-stop solution for all generative AI needs, its hybrid approach is highly flexible, capable of extending and adapting to any specific requirement.</P><P>This makes SAP Datasphere a highly efficient and user-friendly tool for handling generative AI scenarios.</P> 2024-03-15T20:12:44.703000+01:00 https://community.sap.com/t5/technology-blogs-by-sap/taking-data-federation-to-the-next-level-accessing-remote-abap-cds-view/ba-p/13635034 Taking Data Federation to the Next Level: Accessing Remote ABAP CDS View Entities in SAP HANA Cloud 2024-03-25T13:35:26.317000+01:00 SeungjoonLee https://community.sap.com/t5/user/viewprofilepage/user-id/204092 <P>Accessing data in ABAP systems, such as SAP BTP ABAP environment, S/4HANA Cloud, BW/4HANA, and others, from an external SAP HANA database is not merely a new requirement or passing trend; it has been a longstanding and ongoing need to enhance and streamline business processes. This need becomes even more crucial when considering the SAP HANA Cloud, which serves as a single gateway for all your enterprise data and where next-generation <A href="https://www.sap.com/products/technology-platform/hana/features/intelligent-data-apps.html" target="_self" rel="noopener noreferrer">Intelligent Data Applications</A> are built and run.</P><P>However, there are several reasons why directly accessing the ABAP-managed standard objects in the underlying SAP HANA database of an ABAP system is not recommended. These include the instability of names and internal structures, unexpected typecasts, incorrect session variables, and bypassed ABAP-level security, among other concerns. For more details on these issues, please refer to <A href="https://me.sap.com/notes/2511210" target="_self" rel="noopener noreferrer">SAP Note 2511210</A>.</P><P>To overcome these challenges, data federation through the Smart Data Integration (SDI) ABAP adapter has been proposed as a potential solution, while data replication is supported by both the SDI ABAP adapter and SAP Landscape Transformation (SLT). It is important to mention, though, that the SDI ABAP adapter, as explained by <A href="https://community.sap.com/t5/user/viewprofilepage/user-id/232650" target="_self">Zili Zhou</A> in her <A href="https://community.sap.com/t5/technology-blogs-by-sap/why-sdi-abap-for-virtual-access-in-sap-data-warehouse-cloud-should-be/ba-p/13542586" target="_self">blog</A>, is primarily designed for data replication and may have limitations when it comes to data federation due to limited pushdown capabilities.</P><P>In this context, I'm glad to share that starting with SAP HANA Cloud, SAP HANA Database (SAP HANA database in SAP HANA Cloud) QRC 01/2024, a new Smart Data Access (SDA) ABAP adapter has been released. This adapter allows for accessing ABAP CDS view entities in a remote ABAP system using SQL via Open Database Connectivity (ODBC) from an SAP HANA database in SAP HANA Cloud. Please find a nutshell of this new capability below:</P><UL><LI>Create a remote source to an ABAP system based on SAP ABAP Platform 2108 or later.</LI><LI>Virtualize&nbsp;remote ABAP CDS view entities by creating read-only virtual tables that point to them, and if needed, also pass parameters to the remote parameterized ABAP CDS view entities.</LI><LI>All&nbsp;limitations from <A href="https://me.sap.com/notes/2511210" target="_self" rel="noopener noreferrer">SAP Note 2511210</A> have been lifted, providing the most optimal pushdown capabilities for data federation.</LI><LI>This&nbsp;capability is only available in SAP HANA database in SAP HANA Cloud.</LI></UL><P><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Overview.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/79105i6CAD8EAD9B62CA8D/image-size/large?v=v2&amp;px=999" role="button" title="Overview.png" alt="Overview.png" /></span>&nbsp;<SPAN>&nbsp;</SPAN></P><H3 id="toc-hId-1117999706">Prerequisites &amp; considerations</H3><P>First, please ensure that the versions of the ABAP system and SAP HANA database in SAP HANA Cloud are as mentioned below:</P><UL><LI>The&nbsp;ABAP system should be based on SAP ABAP Platform 2108 or a later version where SQL service is available. For instance, starting with S/4HANA 2021, SQL service has been available.</LI><LI><A href="https://help.sap.com/docs/hana-cloud-database" target="_self" rel="noopener noreferrer">SAP HANA Cloud, SAP HANA Database</A> (SAP HANA database in SAP HANA Cloud) should be QRC 01/2024 or a later version where ODBC driver for ABAP is available, and the script server should be enabled and running.</LI></UL><P>Another aspect that should be considered is whether the ABAP system is protected by a corporate firewall (e.g., on-prem S/4HANA). If it is, then SAP Cloud Connector is required.</P><P>If the above conditions are met, the next step is to expose ABAP CDS view entities from the ABAP system side so that they can be accessed from SAP HANA database in SAP HANA Cloud via the SQL service.</P><P>Since developing and exposing an SQL service in the ABAP system is not the focus of this blog and has already been well-explained by <A href="https://community.sap.com/t5/user/viewprofilepage/user-id/179779" target="_self">Frank-Martin Haas</A> in his <A href="https://community.sap.com/t5/technology-blogs-by-sap/consuming-cds-view-entities-using-odbc-based-client-tools/ba-p/13509459" target="_self">blog</A>, please refer to his <A href="https://community.sap.com/t5/technology-blogs-by-sap/consuming-cds-view-entities-using-odbc-based-client-tools/ba-p/13509459" target="_self">blog</A> and the following links.</P><UL><LI>SAP Business Technology Platform: <A href="https://help.sap.com/docs/btp/sap-business-technology-platform/developing-and-exposing-sql-service-in-abap-system" target="_self" rel="noopener noreferrer">Developing and Exposing an SQL Service in the ABAP System</A></LI><LI>SAP&nbsp;Tutorials: <A href="https://developers.sap.com/tutorials/abap-environment-abap-sql.html#86c473cc-3d69-4bc1-bd5d-253223304208" target="_self" rel="noopener noreferrer">Using ODBC driver for SQL Service</A> (From Step 3 to Step 9)</LI></UL><P><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Detail.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/83487iA3AE8FD71B71657F/image-size/large?v=v2&amp;px=999" role="button" title="Detail.png" alt="Detail.png" /></span><SPAN>&nbsp;</SPAN>&nbsp;</P><H3 id="toc-hId-921486201">Getting started with SDA ABAP adapter (<EM>abapodbc</EM>)</H3><P>If everything is ready in the ABAP system to expose ABAP CDS view entities, let’s configure the SDA ABAP adapter from the SAP HANA database in SAP HANA Cloud.</P><P>The configuration steps are almost the same as using SDA with other remote sources: downloading the DigiCert SSL certificate, importing the certificate for SSL connection, creating a remote source, and finally, creating a virtual table. Please refer to the examples below.</P><P><STRONG>Download the DigiCert SSL certificate:</STRONG></P><pre class="lia-code-sample language-bash"><code>-- DigiCert Global Root CA curl -O https://dl.cacerts.digicert.com/DigiCertGlobalRootCA.crt.pem -- DigiCert Global Root G2 curl -O https://dl.cacerts.digicert.com/DigiCertGlobalRootG2.crt.pem</code></pre><P>Since DigiCert has stopped signing certificates with the root certificate authority (CA) "DigiCert Global Root CA" and is now moving forward with the "DigiCert Global Root G2" certificate, it is recommended to add both certificates during the switching period. However, using only one certificate is basically sufficient.</P><P><STRONG>Import the certificate for SSL connection:</STRONG></P><pre class="lia-code-sample language-sql"><code>-- import the certificate for SSL connection (CA) CREATE PSE SSL; CREATE CERTIFICATE CA_CERT FROM ' -----BEGIN CERTIFICATE----- MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh ... CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4= -----END CERTIFICATE----- '; -- import the certificate for SSL connection (G2) CREATE CERTIFICATE G2_CERT FROM ' -----BEGIN CERTIFICATE----- MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh ... CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4= -----END CERTIFICATE----- '; ALTER PSE SSL ADD CERTIFICATE CA_CERT; ALTER PSE SSL ADD CERTIFICATE G2_CERT; SET PSE SSL PURPOSE REMOTE SOURCE;</code></pre><P><STRONG>Create a remote source:</STRONG></P><pre class="lia-code-sample language-sql"><code>-- create a remote source to the ABAP SQL service endpoint CREATE REMOTE SOURCE ABAP ADAPTER "abapodbc" CONFIGURATION 'uidtype=alias;driver=ODBC_driver_for_ABAP.so;servicepath=/sap/bc/sql/sql1/sap/s_privileged;host=&lt;abap_host_name&gt;;port=&lt;abap_port_number&gt;;language=EN;typemap=semantic;' WITH CREDENTIAL TYPE 'PASSWORD' USING 'user=&lt;user_name&gt;;password=&lt;password&gt;';</code></pre><P>Alternatively, like other SDA adapters, the remote source can be created using the SAP HANA Database Explorer UI. Once the remote source is created, the exposed ABAP CDS View entities can be browsed using the SAP HANA Database Explorer as described below.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Remote Objects.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/79077iFAE849766E95A010/image-size/large?v=v2&amp;px=999" role="button" title="Remote Objects.png" alt="Remote Objects.png" /></span></P><P><STRONG>Create virtual tables:</STRONG></P><pre class="lia-code-sample language-sql"><code>-- create virtual tables by pointing to the exposed ABAP CDS view entities CREATE VIRTUAL TABLE DEMO.V_ORDERS AT "ABAP"."NULL"."ZORDERS"."Orders"; CREATE VIRTUAL TABLE DEMO.V_ORDERITEMS AT "ABAP"."NULL"."ZORDERS"."OrderItems";</code></pre><P>Alternatively, virtual tables can also be created using the SAP HANA Database Explorer UI by selecting the remote object and clicking on the 'Create Virtual Object(s)' button in the screenshot above.</P><P>Please also refer to the links below for further details.</P><UL><LI>SAP&nbsp;HANA Cloud, SAP HANA Database Data Access Guide: <A href="https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-data-access-guide/import-certificates-for-ssl-connections-to-remote-sources" target="_self" rel="noopener noreferrer">Import Certificates for SSL Connections to Remote Source</A></LI><LI>SAP&nbsp;HANA Cloud, SAP HANA Database Data Access Guide: <A href="https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-data-access-guide/create-abap-cloud-remote-source" target="_self" rel="noopener noreferrer">Create an ABAP Cloud Remote Source</A></LI></UL><P>Before moving forward, please don’t forget to create statistics on virtual tables. Creating statistics is always strongly recommended to ensure optimal decision-making on the query execution plan by the query optimizer.</P><P><STRONG>Create statistics on a virtual table:</STRONG></P><pre class="lia-code-sample language-sql"><code>CREATE STATISTICS ON DEMO.V_ORDERS TYPE SIMPLE; CREATE STATISTICS ON DEMO.V_ORDERITEMS TYPE SIMPLE;</code></pre><P>Further details can be found at the link below.</P><UL><LI>SAP&nbsp;HANA Cloud, SAP HANA Database Data Access Guide: <A href="https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-data-access-guide/create-statistics-on-virtual-table-or-linked-database" target="_self" rel="noopener noreferrer">Create Statistics on a Virtual Table or Linked Database</A><BR />&nbsp;</LI></UL><H3 id="toc-hId-724972696">Query execution and execution plan</H3><P>With above configurations, if the same statement from the <A href="https://community.sap.com/t5/technology-blogs-by-sap/consuming-cds-view-entities-using-odbc-based-client-tools/ba-p/13509459" target="_self">blog</A> by <A href="https://community.sap.com/t5/user/viewprofilepage/user-id/179779" target="_self">Frank-Martin Haas</A> is executed but with virtual tables, the result will be as follows.</P><pre class="lia-code-sample language-sql"><code>SELECT OI."Item", SUM(OI."Amount") FROM DEMO.V_ORDERS O INNER JOIN DEMO.V_ORDERITEMS OI ON O."Id" = OI."Orderid" GROUP BY "Item";</code></pre><P><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Join.png" style="width: 955px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/79078i0945DFD451821803/image-size/large?v=v2&amp;px=999" role="button" title="Join.png" alt="Join.png" /></span></P><P>Now, let’s see the query plan using <STRONG><EM>Analyze - Explain Plan</EM></STRONG>.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Plan.png" style="width: 955px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/79079iEDDCEEF77B139DB8/image-size/large?v=v2&amp;px=999" role="button" title="Plan.png" alt="Plan.png" /></span></P><P><SPAN>As you can see, both aggregation and join are pushed down to the remote ABAP system and executed there. In other words, both aggregation and join are performed on the remote side, and then the result is transferred to the SAP HANA database in SAP HANA Cloud. Since SDA is a part of SAP HANA core like the query optimizer, if statistics are available, the query optimizer will create the most optimal execution plan based on the tight integration with SDA.<BR />&nbsp;</SPAN></P><H3 id="toc-hId-528459191">Other limitations</H3><P>The most important limitation to keep in mind is that the SDA ABAP adapter supports only read-only virtual tables at the moment. This leads to the following limitations:</P><UL><LI>DMLs&nbsp;(e.g., INSERT/UPDATE/DELETE) cannot be executed on virtual tables.</LI><LI>WITH&nbsp;REMOTE is not supported when executing CREATE VIRTUAL TABLE.</LI><LI>Join&nbsp;relocation to a remote ABAP system, which requires temporary table creation, is not supported. However, if another remote source with temporary table creation capability is involved additionally, join relocation to that remote source is possible but it will be decided by the query optimizer.<BR />&nbsp;</LI></UL><H3 id="toc-hId-331945686">FAQs</H3><P><STRONG>Q:</STRONG> Is this SDA ABAP adapter only available in the SAP HANA database in SAP HANA Cloud? Is there any plan to support this in SAP HANA Platform 2.0?<BR /><STRONG>A:</STRONG><SPAN> Yes, it is only available in the SAP HANA database in SAP HANA Cloud. There are no concrete plans to support this in SAP HANA Platform 2.0.</SPAN></P><P><STRONG>Q:</STRONG> Is there any plan to support real-time replication, such as SDA-based remote table replication described in this <A href="https://community.sap.com/t5/technology-blogs-by-sap/a-new-approach-for-replicating-tables-across-different-sap-hana-systems/ba-p/13460061" target="_self">blog</A>? If not, what is the recommended technology for replicating ABAP CDS view entities?<BR /><STRONG>A:</STRONG><SPAN> There are no plans to support real-time replication with the SDA ABAP adapter. The SDA ABAP adapter is designed for data federation purposes only, even though toggling to a snapshot replica is supported to improve query performance. For replicating ABAP CDS view entities, it is recommended to use SDI ABAP adapter or SLT.</SPAN></P><P><STRONG>Q:</STRONG> Is it possible to pass parameters to the remote ABAP CDS view entity through the virtual table?<BR /><SPAN><STRONG>A:</STRONG> Yes, passing parameters to the remote ABAP CDS view entity is supported. Please refer to the link below.</SPAN></P><UL><LI>SAP&nbsp;HANA Cloud, SAP HANA Database Data Access Guide: <A href="https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-data-access-guide/virtualizing-parameterized-sql-views" target="_self" rel="noopener noreferrer">Virtualizing Parameterized Views</A></LI></UL><P><STRONG>Q:</STRONG> Is it possible to connect to the on-prem ABAP system? If so, how can it be done?<BR /><SPAN><STRONG>A:</STRONG> Yes, the way of connecting the on-prem ABAP system can be found in the links below.</SPAN></P><UL><LI>SAP&nbsp;HANA Cloud, SAP HANA Database Data Access Guide: <A href="https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-data-access-guide/create-abap-on-premise-remote-source" target="_self" rel="noopener noreferrer">Create an ABAP On-Premise Remote Source</A></LI></UL><P>However, please ensure that the following conditions are met:</P><OL><LI>The on-prem ABAP system is based on SAP ABAP Platform 2108 or later version.</LI><LI>SAP Cloud Connector is properly configured so that the on-prem ABAP system is ‘reachable’ from the SAP Cloud Connector and SAP BTP Cockpit.</LI><LI>SAP Cloud Connector is enabled, and the corresponding IP addresses are allowed in the SAP HANA database configuration in SAP HANA Cloud.</LI><LI>The CREATE REMOTE SOURCE statement includes the correct specifications for <EM>useCloudConnector</EM> and <EM>ConnectivityLocationId</EM> properties.</LI></OL><P><STRONG>Q:</STRONG> It seems that only the ‘technical user’ can be used for authentication. Are there any plans to support other authentication methods?<BR /><SPAN><STRONG>A:</STRONG> Yes, other authentication methods will be considered in the future.</SPAN></P><P><SPAN><STRONG>Q:</STRONG>&nbsp;Is it also possible to access remote ABAP CDS (DDIC-based) views or other remote ABAP-managed objects?<BR /><STRONG>A:</STRONG>&nbsp;No, only remote ABAP CDS view entities or remote parameterized ABAP CDS view entities can be accessed.&nbsp;For the differences between ABAP CDS (DDIC-based) views and ABAP CDS view entities, please refer to this <A href="https://community.sap.com/t5/technology-blogs-by-sap/a-new-generation-of-cds-views-how-to-migrate-your-cds-views-to-cds-view/ba-p/13508307" target="_self">blog</A>.<BR /></SPAN></P><P><STRONG>Q:</STRONG> Is it possible to use the linked database feature?<BR /><SPAN><STRONG>A:</STRONG> The linked database feature with a 3-part name is supported. However, passing parameters through the linked database feature is not supported. Linked database optimized mode is also not supported in SAP HANA Cloud.<BR /></SPAN>&nbsp;&nbsp;</P><H3 id="toc-hId-135432181">Conclusion</H3><P>To conclude, it is evident that accessing data in ABAP systems plays a vital role in the development of <A href="https://www.sap.com/products/technology-platform/hana/features/intelligent-data-apps.html" target="_self" rel="noopener noreferrer">Intelligent Data Applications</A> on the SAP HANA database in SAP HANA Cloud. This also aligns perfectly with the concept of <A href="https://www.sap.com/products/erp/rise/clean-core.html" target="_self" rel="noopener noreferrer">Clean Core</A>, which involves minimizing customizations and rearchitecting them on SAP BTP, particularly on the SAP HANA database in SAP HANA Cloud. By elevating data federation to the next level with SDA ABAP adapter and embracing these practices, organizations can unlock the full potential of their data, leveraging the power of SAP HANA Cloud. So, don't miss out on the opportunity to harness the benefits of <A href="https://www.sap.com/products/technology-platform/hana/features/intelligent-data-apps.html" target="_self" rel="noopener noreferrer">Intelligent Data Applications</A> and propel your business towards success with the SAP HANA database in SAP HANA Cloud.</P> 2024-03-25T13:35:26.317000+01:00 https://community.sap.com/t5/technology-blogs-by-sap/product-updates-for-sap-business-application-studio-march-2024-edition/ba-p/13648823 Product Updates for SAP Business Application Studio - March 2024 Edition 2024-03-26T08:39:28.924000+01:00 FranziMickIT https://community.sap.com/t5/user/viewprofilepage/user-id/163138 <P><SPAN>Dear community,</SPAN></P><P><SPAN>Welcome to our detailed exploration of some recent enhancements within the SAP Business Application Studio. This post will guide you through key updates, including our streamlined Storyboard, a newly designed 'Welcome' page, the introduction of SAPUI5 adaptation projects, a comprehensive SAPUI5 Walkthrough Tutorial with TypeScript, and the new feature – release of the powerful UI5 linter. Each feature mentioned contributes to overall user productivity, designed to improve your working experience with us.</SPAN></P><P>&nbsp;</P><H1 id="toc-hId-860854818"><SPAN>Enhancing Productivity with our Updated Storyboard</SPAN></H1><P><SPAN>SAP Business Application Studio now provides a streamlined storyboard. The improved interface allows you to readily view which service actions and functions your application includes. This overview aids in the comprehension and management of your tools, ensuring you are using your resources to their full potential.</SPAN></P><P><SPAN>We've also added the option to trigger the creation of unbound actions and functions directly. This eliminates the need for extra steps and consolidates key tasks in one location, reducing the time required for task navigation and management.</SPAN></P><P><SPAN>The described enhancements improve the experience in two major ways: by having a more complete, clearer visualization of your app's functions and by simplifying the creation and editing process. </SPAN></P><P><SPAN>Have a look at some sample of our updated storyboard below:</SPAN></P><DIV class=""><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Updated Storyboard of SAP Business Application Studio" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/86106i8BE37DF5ED510DBF/image-size/large?v=v2&amp;px=999" role="button" title="Storyboard_updated.gif" alt="Updated Storyboard of SAP Business Application Studio" /><span class="lia-inline-image-caption" onclick="event.preventDefault();">Updated Storyboard of SAP Business Application Studio</span></span><P>&nbsp;</P></DIV><H1 id="toc-hId-664341313"><SPAN>New Welcome Page for SAP HANA Applications</SPAN></H1><P><SPAN>Our new 'Welcome' page, designed with your needs in mind, serves as an efficient gateway to interact with SAP HANA-related features within SAP Business Application Studio. This hub offers enriched documentation, insightful blogs, and direct access to various integral aspects that can facilitate and speed up your SAP HANA development journey.</SPAN></P><DIV class=""><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="SAP HANA Welcome Page in SAP Business Application Studio" style="width: 804px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/86115iD11E7F6904117CAC/image-size/large?v=v2&amp;px=999" role="button" title="SAP HANA Welcome Page.jpg" alt="SAP HANA Welcome Page in SAP Business Application Studio" /><span class="lia-inline-image-caption" onclick="event.preventDefault();">SAP HANA Welcome Page in SAP Business Application Studio</span></span><P><SPAN>As soon as you start your SAP Business Application Studio instance for SAP HANA Native Applications, you will find this new page. Some of the hyperlinks point to guides within SAP Business Application Studio, others to outside of it, including blogs on community.sap.com and material on help.sap.com.</SPAN></P></DIV><P><SPAN>The information is segmented into five structured sections. The 'Start' segment provides straightforward access to SAP HANA project creation, while the 'Development' section enlists tools to accelerate initiating a project or service.</SPAN></P><P><SPAN>The 'Blog posts' segment serves as a crucial knowledge base, offering valuable insights into SAP HANA development, including vital components like calculation view modeling and best practices. For those aspiring to refine their skills, the 'Get Started with SAP HANA' section presents comprehensive learning materials related to SAP HANA development, facilitating continuous skill improvement.</SPAN></P><P><SPAN>Lastly, the 'Help' section plays the role of an informative guide, providing exhaustive documentation pertaining to SAP HANA development topics. In essence, our 'Welcome' page aims to be a comprehensive, easy-to-navigate resource, dedicated to refining your SAP HANA developmental experience, right from the outset.</SPAN></P><P>&nbsp;</P><H1 id="toc-hId-467827808"><SPAN>SAPUI5 Adaptation Projects for SAP S/4HANA Cloud Public Edition</SPAN></H1><P><SPAN>SAP Business Application Studio now enables a significant feature for enhancing SAP S/4HANA Cloud Public Edition - the ability to employ SAPUI5 adaptation projects. These projects enable the creation of application variants tailored to fulfill the specific business requirements of diverse business roles, organizational units, and countries. They offer the ability to design efficient processes by concealing unnecessary fields, representing data in chart formats, or alternation between responsive and grid tables for enhanced data comprehension.</SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Creation of an SAPUI5 Adaptation Project" style="width: 384px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/86119i01D85E8480FE8668/image-size/medium?v=v2&amp;px=400" role="button" title="Adaptation Projects.jpeg" alt="Creation of an SAPUI5 Adaptation Project" /><span class="lia-inline-image-caption" onclick="event.preventDefault();">Creation of an SAPUI5 Adaptation Project</span></span></P><P><SPAN>The primary advantage of an adaptation project lies in allowing you to leverage the original SAP Fiori application, its OData service, and application logic, to exclusively govern modifications specific to the application variant. Upon deployment, the source application and the derived application variant co-exist under distinct titles, accessible to corresponding business users via uniquely named application tiles in ‘My Home’, the new SAP S/4HANA Cloud Public Edition’s starting point.</SPAN></P><P><SPAN><A href="https://community.sap.com/t5/enterprise-resource-planning-blogs-by-sap/extending-sap-s-4hana-cloud-public-edition-using-sapui5-adaptation-projects/ba-p/13607813" target="_self">See this blog post from Elisabeth Riemann linking to an extensive, end-2-end tutorial</A>.</SPAN></P><P><SPAN>Did you know that adaptation projects are a part of ‘SAPUI5 flexibility’? <A href="https://help.sap.com/docs/UI5_FLEXIBILITY/430e2c1a4ff241bc8162df4bf51e0730/e36d19b3d24f47199a9a82d3faa508c3.html?language=en-US&amp;locale=en-US" target="_self" rel="noopener noreferrer">Everything you want to know about this toolset is described in our Help Portal</A>.</SPAN></P><P>&nbsp;</P><H1 id="toc-hId-271314303"><SPAN>SAPUI5 Walkthrough Tutorial with TypeScript</SPAN></H1><P>Our UI5 team has created this&nbsp;tutorial to introduce&nbsp;<A href="https://ui5.sap.com/#/topic/dad1905a07f849ce9c509721317d38d8" target="_self" rel="noopener noreferrer">all development paradigms of SAPUI5 and also demonstrate the benefits of TypeScript with SAPUI5</A>.</P><P><SPAN>This tutorial provides extensive guidance on key SAPUI5 development principles and data binding concepts through creating an application from scratch. After this, the tutorial guides you through enhancing the app with advanced features like navigation, control extension, responsiveness, and exploring built-in support tools.</SPAN></P><P>&nbsp;</P><H1 id="toc-hId-74800798"><SPAN>Introducing UI5 linter</SPAN></H1><P>We have introduced UI5 linter, a static code analysis tool that enhances code quality, readability, security, and efficiency. Its initial features focus on validating compliance with the Best Practices for UI5 Developers, reporting areas of concern like deprecated APIs, synchronous loading mechanisms, and global variables usage. The UI5 linter can be easily installed and used via .npm package manager and is instrumental in preparing your project for future versions of UI5.</P><P>Use the UI5 linter to identify problematic code that does not follow UI5 best practices.</P><P><A href="https://community.sap.com/t5/technology-blogs-by-sap/introducing-ui5-linter/ba-p/13633898" target="_self">Learn more about UI5 linter in a blog post from Oliver Graeff</A>.</P><P><SPAN>.</SPAN></P><P><SPAN>That brings us to the end of this update. We hope you found this insight into our recent enhancements beneficial. As we continue to enhance SAP Business Application Studio, we encourage you to explore and leverage these new features to increase your productivity. Thank you for your ongoing commitment to our products, and we ensure that we remain dedicated to improving your user experience. Stay connected for our next round of updates!</SPAN></P><P><SPAN>Happy coding!</SPAN></P> 2024-03-26T08:39:28.924000+01:00 https://community.sap.com/t5/technology-blogs-by-sap/safeguarding-data-privacy-in-ksa-leveraging-sap-to-navigate-ndmo-s/ba-p/13652286 Safeguarding Data Privacy in KSA - Leveraging SAP to navigate NDMO’s Regulations in Digital Era 2024-03-28T12:05:30.971000+01:00 Zainab_ASalam https://community.sap.com/t5/user/viewprofilepage/user-id/1426218 <P><FONT face="courier new,courier" size="2" color="#333333">Blog v1.0 &nbsp;| &nbsp;</FONT><FONT face="courier new,courier" size="2" color="#333333">Published On: 28 March 2024</FONT></P><P><FONT face="courier new,courier" size="2"><FONT color="#333333">Authors:&nbsp;</FONT><a href="https://community.sap.com/t5/user/viewprofilepage/user-id/76380">@asadkhan02</a>&nbsp;,&nbsp;<a href="https://community.sap.com/t5/user/viewprofilepage/user-id/1427434">@AyeshaSafeer</a>&nbsp;,&nbsp;<a href="https://community.sap.com/t5/user/viewprofilepage/user-id/1426218">@Zainab_ASalam</a>&nbsp;</FONT></P><P style=" text-align: center; "><FONT face="courier new,courier" size="2" color="#808080">_________________________________________</FONT></P><P><FONT face="arial,helvetica,sans-serif" color="#000080">In today's digital era, data privacy is a crucial issue for both individuals and organizations. The <STRONG>Saudi National Data Management Office</STRONG> (<STRONG>NDMO</STRONG>), in partnership with the <STRONG>Saudi Data and</STRONG> <STRONG>Artificial Intelligence Authority</STRONG> (<STRONG>SDAIA</STRONG>), has introduced stringent <STRONG>Data Governance and Personal Data Protection Standards</STRONG>. These regulations mandate all organizations operating across various industries in the Kingdom of Saudi Arabia comply by <STRONG>September 2024</STRONG>.</FONT></P><P><FONT face="arial,helvetica,sans-serif" color="#000080">Failure to comply with these regulations can result in hefty financial fines reaching SAR 3 million or higher in some cases, reputational damage, legal consequences, and loss of trust among customers and partners.</FONT></P><P><FONT face="arial,helvetica,sans-serif" color="#000080"><SPAN>To ensure compliance with these new regulations, organizations are encouraged to implement processes aligned with the 15 domains outlined by the NDMO for Data Governance and Personal Data Protection Standards. Leveraging technology as an enabler, organizations can implement robust data privacy measures and effectively meet these requirements.</SPAN></FONT></P><P><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Top 5 Areas part of 15 Domains outlined by NDMO for Data Governance and Personal Data Protection Standards" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/87957i2C22EE02F15D3B98/image-size/large?v=v2&amp;px=999" role="button" title="Picture1.png" alt="Top 5 Areas part of 15 Domains outlined by NDMO for Data Governance and Personal Data Protection Standards" /><span class="lia-inline-image-caption" onclick="event.preventDefault();">Top 5 Areas part of 15 Domains outlined by NDMO for Data Governance and Personal Data Protection Standards</span></span></P><P><FONT size="3" color="#000080">SAP, a global leader in enterprise software, provides advanced technologies with artificial intelligence (AI) capabilities that provide a solid foundation for organizations to implement data governance and personal data protection processes. SAP solutions enable Saudi organizations to efficiently navigate and fulfill regulatory requirements:</FONT></P><P><FONT face="arial,helvetica,sans-serif" size="3" color="#333399"><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Picture2.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/87931iD46B5558704106BA/image-size/large?v=v2&amp;px=999" role="button" title="Picture2.png" alt="Picture2.png" /></span></FONT></P><P><FONT face="arial,helvetica,sans-serif" size="3" color="#000080"><SPAN>By implementing SAP solutions, Saudi organizations can empower their data privacy practices, mitigate compliance risks, and build trust among stakeholders. SAP technologies uphold data integrity, safeguard personal information, offer the framework for regulatory compliance implementation, and adapt to the demands of the digital age.</SPAN></FONT></P><P><FONT face="arial,helvetica,sans-serif" size="3" color="#000080">As a team at SAP, we are committed to supporting organizations in achieving their regulatory compliance initiatives. We invite you to take the next step by exploring how our technologies and solutions can assist you on this journey.</FONT></P><P><FONT face="arial,helvetica,sans-serif" size="3" color="#000080">Contact us today to learn more about how SAP can help you navigate the complex landscape of data privacy regulations in Saudi Arabia and ensure compliance.</FONT></P><P>&nbsp;</P> 2024-03-28T12:05:30.971000+01:00 https://community.sap.com/t5/enterprise-resource-planning-blogs-by-members/elucidation-of-associations-in-cds-views/ba-p/13655229 Elucidation of Associations in CDs Views 2024-04-02T20:20:00.019000+02:00 akashkannan22 https://community.sap.com/t5/user/viewprofilepage/user-id/847958 <P><STRONG><U><SPAN>ASSOCIATIONS:</SPAN></U></STRONG></P><P>ASSOCIATIONS are kind of Joins to fetch data from multiple tables on Join Conditions but these are ‘JOINS ON-DEMAND’ i.e. they will only be triggered when user would access the required data which needs the Association of tables.&nbsp; For example, your CDS view has 4 Associations configured and user is fetching data for only 2 tables, the ASSOICATION on other 2 tables will not be triggered and the system would return the results quickly, so it enables really high turn-around time as compared to regular SQL JOINS.<BR /><STRONG><SPAN>Associations</SPAN></STRONG>&nbsp;are defined with ‘Cardinality’. Syntax :&nbsp;<STRONG><SPAN>association[&lt;cardinality&gt;]</SPAN></STRONG><BR />Cardinality concept is not new and holds the same concept with CDS views as well.&nbsp; There are 4 types of Cardinality possible based on the data and relationship in the tables joined;</P><UL><LI><STRONG><SPAN>0..1</SPAN></STRONG></LI><LI><STRONG><SPAN>0..n or 0..*</SPAN></STRONG></LI><LI><STRONG><SPAN>1..0</SPAN></STRONG></LI><LI><STRONG><SPAN>1..n or 1..*</SPAN></STRONG></LI></UL><P><STRONG><U><SPAN>NOTE</SPAN></U></STRONG>: If you are confused on what kind of association I should configure in my CDS view then you can apply a rule of thumb: ‘always use this :&nbsp;<STRONG><SPAN>association[1].&nbsp;&nbsp;</SPAN></STRONG>This will always trigger an OUTER join and will work in all the cases.<BR />Let’s create a CDS view with ASSOCIATION concept.</P><OL><LI>Create View with Association template;</LI></OL><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akashkannan22_13-1712036254761.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/89457i9CA1BFE368FEE609/image-size/medium?v=v2&amp;px=400" role="button" title="akashkannan22_13-1712036254761.png" alt="akashkannan22_13-1712036254761.png" /></span></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akashkannan22_14-1712036280209.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/89459iFEFD7A93F463E637/image-size/medium?v=v2&amp;px=400" role="button" title="akashkannan22_14-1712036280209.png" alt="akashkannan22_14-1712036280209.png" /></span></P><UL><LI>Below is the default structure you will get. As you can see the association cardinality is defined as ‘Association[1]’. You can keep it as it is, if you are not sure what association you have to assign.</LI><LI>Check the default Association name as&nbsp;<STRONG><SPAN>_association_name</SPAN></STRONG>. This can be any name of your choice but SAP has created a naming convention standard to start this name with an underscore(_) and it is always good to follow SAP standard best practices.</LI></UL><DIV class="">&nbsp;</DIV><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akashkannan22_15-1712036299874.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/89461i2F29AF8D6990688B/image-size/medium?v=v2&amp;px=400" role="button" title="akashkannan22_15-1712036299874.png" alt="akashkannan22_15-1712036299874.png" /></span></P><OL><LI>Add the required data elements to complete the view. Lets take the same example we did with JOIN view.</LI></OL><P><STRONG><SPAN>EXPOSED Association</SPAN></STRONG></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akashkannan22_16-1712036322062.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/89463i57464185A6B80F81/image-size/medium?v=v2&amp;px=400" role="button" title="akashkannan22_16-1712036322062.png" alt="akashkannan22_16-1712036322062.png" /></span></P><P>Right click and select ‘Show SQL CREATE Statement;</P><DIV class="">&nbsp;</DIV><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akashkannan22_17-1712036347398.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/89465iE10E73146097EE6D/image-size/medium?v=v2&amp;px=400" role="button" title="akashkannan22_17-1712036347398.png" alt="akashkannan22_17-1712036347398.png" /></span></P><P>As you can see, NO Join is created;</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akashkannan22_18-1712036370810.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/89467i3504C75096E1D278/image-size/medium?v=v2&amp;px=400" role="button" title="akashkannan22_18-1712036370810.png" alt="akashkannan22_18-1712036370810.png" /></span></P><UL><LI>We can add separate fields in the CDS view as well like a join and that is called Ad-Hoc Association Concept. In this scenario a join will be performed beforehand.</LI></UL><P><STRONG><SPAN>AD-HOC Association:</SPAN></STRONG><STRONG><SPAN><BR /></SPAN></STRONG></P><P>&nbsp;</P><DIV class="">&nbsp;</DIV><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akashkannan22_19-1712036394799.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/89468i4C32D9A13AA2E572/image-size/medium?v=v2&amp;px=400" role="button" title="akashkannan22_19-1712036394799.png" alt="akashkannan22_19-1712036394799.png" /></span></P><P>Check the SQL CREATE statement.&nbsp; Note that a ‘LEFT OUTER MANY TO ONE JOIN’ is created.&nbsp; The join created because we selected individual fields instead of exposing the whole Association and it is LEFT OUTER MANY TO ONE i.e. *..1 due to the fact that we configured cardinality like ASSOCIATION[1].</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akashkannan22_20-1712036428618.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/89472i963532D4B64339C0/image-size/medium?v=v2&amp;px=400" role="button" title="akashkannan22_20-1712036428618.png" alt="akashkannan22_20-1712036428618.png" /></span></P><P>As we saw above the ASSOCIATION concept with EXPOSED and AD-HOC Associations.&nbsp; Now lets activate the view with Exposed Association and see how it performs a join at RUN Time.<BR /><BR />Activate this view and hit F8 to execute;</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akashkannan22_21-1712036455327.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/89473iB3111837EE1BD912/image-size/medium?v=v2&amp;px=400" role="button" title="akashkannan22_21-1712036455327.png" alt="akashkannan22_21-1712036455327.png" /></span></P><P>Execute and look at highlighted – CDS View name and CARRID data AA and AZ.&nbsp; Also note that NO data from table SPFLI is displayed as NO join is yet performed.</P><DIV class="">&nbsp;</DIV><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akashkannan22_22-1712036478950.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/89475i69FF9CBC46641A1D/image-size/medium?v=v2&amp;px=400" role="button" title="akashkannan22_22-1712036478950.png" alt="akashkannan22_22-1712036478950.png" /></span></P><P>Now if you want to see further Airport information for CARRID ‘AA’ from table SPFLI. right click on any row with CARRID ‘AA’ and choose ‘Follow Association’.&nbsp; Another pop-up window will opn, click the Association type;</P><DIV class="">&nbsp;</DIV><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akashkannan22_23-1712036536140.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/89477iAD0672D93183985D/image-size/medium?v=v2&amp;px=400" role="button" title="akashkannan22_23-1712036536140.png" alt="akashkannan22_23-1712036536140.png" /></span></P><P>Check data:&nbsp; Join is now performed&nbsp;<STRONG><SPAN>ON-DEMAND</SPAN></STRONG>&nbsp;and data only for CARRID ‘AA’ is displayed based on Association Key.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akashkannan22_24-1712036559565.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/89479i916287240B2A3358/image-size/medium?v=v2&amp;px=400" role="button" title="akashkannan22_24-1712036559565.png" alt="akashkannan22_24-1712036559565.png" /></span></P><P>In summary, Association concept is one of the wonderful things I liked about CDS views.&nbsp; So intelligently, SAP developed this to save the effort in reading only the information which is required for the analytics purpose.&nbsp; You can feel the real difference after designing a very complex CDS view with a combination of multiple table and other CDS views.&nbsp; The very complex CDS view still performance great when Associations are used.&nbsp; In this blog post, we saw the Association concept together with Exposed and Ad-Hoc associations.</P> 2024-04-02T20:20:00.019000+02:00 https://community.sap.com/t5/technology-blogs-by-sap/workload-analysis-for-hana-platform-series-2-analyze-the-cpu-threads-and/ba-p/13608317 Workload Analysis for HANA Platform Series - 2. Analyze the CPU, Threads and Numa Utilizations 2024-04-02T22:26:10.409000+02:00 tao_shen https://community.sap.com/t5/user/viewprofilepage/user-id/276170 <P>In the previous blog, we had discussed the workload pattern. This blog dissects how the CPU, threads and NUMA related topic will influence the workload, and how to figure out the most useful information through the workload analysis. The conclusion can be used for further tuning the HANA system into a good shape on CPU resources consumption.</P><P><STRONG>How to Begin with CPU Utilization Analysis</STRONG></P><P>The analysis of CPU utilization stands as a key element within the broader scope of workload analysis. Determining the right approach to analyze CPU usage is crucial. It's essential to first identify the type of CPU utilization that may be problematic—be it user CPU utilization within the HANA instance, system CPU utilization governed by the OS, or a combination of both. A clear understanding of this distinction is necessary to properly address the issue.</P><P>Should the user CPU utilization be significant, it would be prudent to delve into thread information to gain insights into ongoing processes. Conversely, if the focus is on system CPU utilization from the OS, gathering thread data alongside call stack histories is advisable. Collaboration with the OS Administrator might also be necessary to investigate any scheduled jobs or activities that coincide with peak usage times.</P><P>In this blog, our primary focus is on user CPU utilization, which is directly impacted by the workload within the HANA instance. A valuable starting point for gaining deeper insights is to analyze thread samples. The monitoring views pertinent to this are:</P><UL><LI><A href="https://help.sap.com/docs/HANA_SERVICE_CF/7c78579ce9b14a669c1f3295b0d8ca16/b6ef1509be6e4b1caeb35cb6675296c3.html" target="_blank" rel="noopener noreferrer">HOST_SERVICE_THREAD_SAMPLES View (Embedded Statistics Service) | SAP Help Portal</A></LI><LI><A href="https://help.sap.com/docs/SAP_HANA_PLATFORM/4fe29514fd584807ac9f2a04f6754767/d2176a65d2951014b80cbf93343900d5.html" target="_blank" rel="noopener noreferrer">M_SERVICE_THREAD_SAMPLES System View | SAP Help Portal</A></LI></UL><P>Although both views contain very similar data, for the purpose of workload analysis, we particularly concentrate on specific columns within these views:</P><DIV class=""><DIV class=""><DIV class=""><DIV class=""><TABLE border="1"><TBODY><TR><TD width="251.475px"><P>HOST</P></TD><TD width="131.709px"><P>VARCHAR(64)</P></TD><TD width="407.207px"><P>Displays the host name.</P></TD></TR><TR><TD width="251.475px"><P>TIMESTAMP</P></TD><TD width="131.709px"><P>TIMESTAMP</P></TD><TD width="407.207px"><P>Displays the timestamp of the record.</P></TD></TR><TR><TD width="251.475px"><P>THREAD_TYPE</P></TD><TD width="131.709px"><P>VARCHAR(128)</P></TD><TD width="407.207px"><P>Displays the thread type.</P></TD></TR><TR><TD width="251.475px"><P class="">THREAD_METHOD</P></TD><TD width="131.709px"><P class="">VARCHAR(256)</P></TD><TD width="407.207px"><P class="">Displays the thread method.</P></TD></TR><TR><TD width="251.475px"><P class="">THREAD_DETAIL</P></TD><TD width="131.709px"><P class="">NVARCHAR(256)</P></TD><TD width="407.207px"><P class="">Displays the thread detail (truncated).</P></TD></TR><TR><TD width="251.475px"><P class="">THREAD_STATE</P></TD><TD width="131.709px"><P class="">VARCHAR(32)</P></TD><TD width="407.207px"><P class="">Displays the thread state.</P></TD></TR><TR><TD width="251.475px"><P class="">STATEMENT_HASH</P></TD><TD width="131.709px"><P class="">VARCHAR(32)</P></TD><TD width="407.207px"><P class="">Displays the unique identifier for an SQL string.</P></TD></TR><TR><TD width="251.475px"><P class="">ROOT_STATEMENT_HASH</P></TD><TD width="131.709px"><P class="">VARCHAR(32)</P></TD><TD width="407.207px"><P class="">Displays the MD5 hash value for the root statement string.</P></TD></TR><TR><TD width="251.475px"><P class="">USER_NAME</P></TD><TD width="131.709px"><P class="">NVARCHAR(256)</P></TD><TD width="407.207px"><P>Displays the SQL user name.</P></TD></TR><TR><TD width="251.475px"><P>APPLICATION_NAME</P></TD><TD width="131.709px"><P>NVARCHAR(256)</P></TD><TD width="407.207px"><P>Displays the name of the application.</P></TD></TR><TR><TD width="251.475px"><P>APPLICATION_USER_NAME</P></TD><TD width="131.709px"><P>NVARCHAR(256)</P></TD><TD width="407.207px"><P>Displays the application user name.</P></TD></TR><TR><TD width="251.475px"><P>APPLICATION_SOURCE</P></TD><TD width="131.709px"><P>NVARCHAR(256)</P></TD><TD width="407.207px"><P>Displays that the application can define which source file SAP HANA is called from. The usage is up to the application. This value is also displayed in M_PREPARED_STATEMENTS.APPLICATION_SOURCE.</P></TD></TR><TR><TD width="251.475px"><P>STATEMENT_THREAD_LIMIT</P></TD><TD width="131.709px"><P>INTEGER</P></TD><TD width="407.207px"><P>Displays the effective statement thread limit.</P></TD></TR><TR><TD width="251.475px"><P>STATEMENT_MEMORY_LIMIT</P></TD><TD width="131.709px"><P>INTEGER</P></TD><TD width="407.207px"><P>Displays the effective statement memory limit.</P></TD></TR><TR><TD width="251.475px"><P>PASSPORT_COMPONENT_NAME</P></TD><TD width="131.709px"><P>NVARCHAR(32)</P></TD><TD width="407.207px"><P>Displays the passport component name.</P></TD></TR><TR><TD width="251.475px"><P>PASSPORT_ACTION</P></TD><TD width="131.709px"><P>NVARCHAR(40)</P></TD><TD width="407.207px"><P>Displays the passport action.</P></TD></TR><TR><TD width="251.475px"><P>NUMA_NODE_INDEX</P></TD><TD width="131.709px"><P>SMALLINT</P></TD><TD width="407.207px"><P>Displays the last known NUMA node that the thread was executed on.</P></TD></TR><TR><TD width="251.475px"><P>WORKLOAD_CLASS_NAME</P></TD><TD width="131.709px"><P>NVARCHAR(256)</P></TD><TD width="407.207px"><P>Displays the name of the workload class.</P></TD></TR></TBODY></TABLE></DIV><DIV><DIV><DIV>&nbsp;</DIV><DIV><SPAN>Please find more information in SAP Note&nbsp;<A href="https://me.sap.com/notes/2114710" target="_self" rel="noopener noreferrer">2114710 - FAQ: SAP HANA Threads and Thread Samples</A></SPAN></DIV></DIV><DIV><DIV><P><STRONG>Considerations for CPU Utilization in HANA Workload Analysis</STRONG></P><P>Now that we have the tools at our disposal, where should we initiate our analysis of CPU utilization? Addressing CPU usage within SAP HANA is multifaceted. A high CPU usage, peaking at 90% of total capacity—for instance, with 8 sockets, 208 CPU cores, and hyper-threading—suggests that approximately 374 threads (90% of 208 x 2 logical CPU cores) are active. This scenario often leads to system hang-ups and prevents new user connections. However, this is not the sole concern.</P><P>We also face perplexing situations where a mere 50% CPU utilization can cause similar system hang-ups, or times when the system appears idle yet experiences high system CPU utilization. Moreover, there are instances where a single statement monopolizes all threads despite workload classifications and global concurrency limits being in place.</P><P>To unravel these complexities, a thorough review of thread samples, supplemented by other monitoring views, is necessary for deeper insight into the system's behaviour.</P><P>Typically, the following factors can lead to CPU-related issues in a HANA system:</P><UL><LI>OS configurations</LI><LI>Expensive SQL statements alongside impractical concurrency settings</LI><LI>Absence of secondary indexes on column tables</LI><LI>NUMA node contentions</LI><LI>System CPU utilization at the OS level</LI><LI>Concurrency controls implemented by applications</LI><LI>Conflicting schedules of background jobs</LI><LI>Activities of the statistics server</LI><LI>Admission control setting</LI><LI>And more.</LI></UL><P>It's worth noting that high CPU usage doesn't inherently indicate a problem. At times, it may signify that the HANA system is effectively utilizing its capacity to handle the workload, which is not a concern. Our goal is to identify workload contributors to minimize CPU consumption and safeguard the system against potential future issues.</P></DIV></DIV></DIV></DIV></DIV></DIV><DIV class=""><DIV class="">&nbsp;</DIV><DIV class="">Please find more information in SAP Note&nbsp;<A href="https://me.sap.com/notes/2100040/E" target="_self" rel="noopener noreferrer">2100040 - FAQ: SAP HANA CPU</A></DIV><DIV class="">&nbsp;</DIV><DIV class=""><P><STRONG>Analyzing CPU Utilization Issues: Two Practical Examples</STRONG></P><P>In this section, we simulate two real-world scenarios to provide deeper insights into CPU utilization analysis in SAP HANA environments.&nbsp;</P><P><SPAN>Before diving into the analysis of expensive statements, it's crucial to establish an understanding of the system's configuration that affects workload management. In the examples that we will explore, the system is equipped with :</SPAN></P><UL><LI><SPAN>8 sockets, and each socket houses 52 logical CPU cores. </SPAN></LI><LI><SPAN>global.ini -&gt; [execution] -&gt; default_statement_concurrency_limit set to 12</SPAN></LI><LI><SPAN>Admission control set to default (indexserver.ini -&gt; [admission_control] -&gt; queue_cpu_threshold = 90)</SPAN></LI></UL></DIV><DIV class=""><P><U>Example 1 - CPU Spikes Caused by Expensive Statements</U></P><P>Expensive statements in a database context typically refer to queries that run longer than anticipated or consume a significant amount of memory during execution. In the realm of workload analysis, especially concerning CPU consumption, we focus on those statements that utilize a large number of running threads. In our example, various types of statements have been identified that could potentially cause extremely high CPU utilization. These could be so intensive as to lead to system hang-ups.</P><P>This situation might involve complex join operations, extensive data aggregation, or poorly optimized queries that put a heavy load on the CPU. Identifying and optimizing these expensive statements is crucial to prevent CPU spikes and maintain system stability. This process involves analyzing query execution plans, reviewing indexing strategies, and possibly restructuring or simplifying the queries themselves to reduce their resource demands.</P></DIV><DIV class=""><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CPU_Analysis_1.jpg" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/67899i333BE2262D15378E/image-size/large?v=v2&amp;px=999" role="button" title="CPU_Analysis_1.jpg" alt="CPU_Analysis_1.jpg" /></span></P></DIV><DIV class=""><P>In the given example, we observe distinct CPU utilization patterns over a span of two weeks on the HANA platform, with utilization nearing 100%. The first week’s pattern is characterized by abrupt spikes in CPU usage, quickly rising and falling, whereas the second week displays more frequent and enduring peaks.</P><UL><LI><STRONG>Peak CPUs Lasting for a Few Minutes:</STRONG> Such short-term CPU spikes are not unusual in database environments. They typically arise from intensive data loading, execution of complex queries, or during routine operations like backups or batch processing. However, the spikes observed here warrant close examination due to their extreme frequency and high utilization rates, which could indicate underlying issues needing immediate attention.</LI><LI><STRONG>Peak CPUs Lasting for Hours:</STRONG> The prolonged CPU peaks, extending over several hours, present a more critical challenge. They could be symptomatic of deeper issues such as inefficient query design, absence of necessary secondary indexes, or even physical hardware constraints. Persistent high CPU utilization of this nature demands a comprehensive analysis to pinpoint the fundamental causes and to devise appropriate strategies for optimization and adjustment to prevent potential system degradation or failure.</LI></UL></DIV><DIV class="">It turns out that three major contributors are responsible for the high CPU utilizations within these two weeks.</DIV><UL><LI><FONT color="#FF0000"><STRONG>Statement 1</STRONG></FONT>: Executed by user axxx from application source axxx:1, this statement has been stable in production for years. Following a logical adjustment on the application side intended to enhance capacity during request processing, the number of connections initiated by this statement increased. Despite the implementation of a global statement concurrency parameter and a designated workload class, this statement alone occupied 90% of CPU resources when activated. The immediate solution is to curb the number of concurrent connections either at the application level or by refining the HANA workload class parameters. Specifically, adjusting the workload class "wlc_1" to impose a stricter statement concurrency limit is recommended, especially by employing the Hierarchies of Workload Classes feature available in HANA 2.0 SPS 6 and above.</LI><LI><STRONG><FONT color="#FF00FF">Statement 2</FONT></STRONG>: Run by the application user SYSTEM, this activity is associated with HANA's internal optimize compression function, which is automatically calculated and optimized as part of the delta merge operation. Historically, it has been challenging to restrict the CPU consumption of this process. However, with the introduction in HANA 2.0 SPS03, the parameter indexserver.ini -&gt; [optimize_compression] -&gt; row_order_optimizer_threads can now be set to a specific value to moderate the concurrency of this activity effectively.</LI><LI><STRONG><FONT color="#339966">Statement 3</FONT></STRONG><SPAN>: A select statement executed by user cxxx and application source axxx:3, it has been noted for its prolonged execution time and exceptionally high CPU usage. Thread sampling revealed that most threads were engaged in "IndirectScanVecOutJob&lt;range&gt;" or "ClusterScanBvOutJob&lt;BV&gt;", indicative of extensive table scans. More information on thread methods related to table scans can be found in SAP Note </SPAN><A href="https://me.sap.com/notes/2114710/E" target="_self" rel="noopener noreferrer">2114710 - FAQ: SAP HANA Threads and Thread Samples</A></LI></UL><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tao_shen_0-1708376179959.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/67895i25BBB6890AD7F18B/image-size/large?v=v2&amp;px=999" role="button" title="tao_shen_0-1708376179959.png" alt="tao_shen_0-1708376179959.png" /></span></P><UL class="lia-list-style-type-circle"><LI>When look into the detail, we found that table MATDOC and MATDOC_EXTRACT, had lack of secondary index on the key column "MATNR" or "WERKS". Per seconds, the number of column scan can reach to 10 billions+, which is quite significant.&nbsp;Creating a secondary index on this key column should alleviate the CPU strain by optimizing the data retrieval process.</LI></UL><TABLE width="422"><TBODY><TR><TD width="87">TABLE_NAME</TD><TD width="87">COLUMN_NAME</TD><TD width="151">SCANNED_RECORDS</TD><TD width="97">SCR_PER_S</TD></TR><TR><TD>MATDOC</TD><TD>MATNR</TD><TD>828290874021485</TD><TD>19304757728</TD></TR><TR><TD>MATDOC_EXTRACT</TD><TD>WERKS</TD><TD>109487724317894</TD><TD>10032855641</TD></TR></TBODY></TABLE><DIV class="">&nbsp;</DIV><DIV class=""><U>Example 2 - System Hanging due to NUMA Contention</U></DIV><DIV class="">Sometimes we suffer system hanging situation, but seeing that the overall CPU consumption is not reach to its maximum capacity, or even lower than 50%. This may indicate that the short board is on the NUMA Node (CPU socket) side. The following example showing a NUMA contention analysis from high level, using thread samples. There are also tools to monitor the NUMA awareness from OS level, which gives more details, but thread sample could tell, in the first picture, which contributor may cause the contention issue.</DIV><DIV class="">&nbsp;</DIV><DIV class=""><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tao_shen_1-1708480795073.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/68527iF4BF4E102E4673B5/image-size/large?v=v2&amp;px=999" role="button" title="tao_shen_1-1708480795073.png" alt="tao_shen_1-1708480795073.png" /></span><BR /><P>The chart offers a detailed view of the running threads across NUMA nodes in a HANA system equipped with 8 sockets, each hosting 52 logical CPUs. Here’s a refined analysis of the patterns observed and their potential implications:</P><UL><LI><FONT color="#808080">NUMA Node 4</FONT>: The count of running threads frequently exceeds the threshold of 52, occasionally spiking to over 95. This pattern suggests excessive parallelism from specific statements or multiple statements accessing the same table or partition. These occurrences appear to bypass the constraints set by global parameters or workload classes, which either lack a total concurrency limit or have a single statement concurrency limit set too high. Such scenarios necessitate a review of the implicated statements to understand the cause of the surge in connections. Repartitioning tables may be beneficial, distributing data across partitions aligned with different NUMA nodes to balance the load. Moreover, the surges in thread count may be attributed to specific thread types like JobWorkers or SQLExecutors. A detailed statement-level investigation is warranted to identify and implement appropriate solutions.</LI><LI><FONT color="#00CCFF">NUMA Node 4:</FONT> There’s a significant, consistent surge that extends for 30 minutes, signalling NUMA node contention. This is a critical observation as it suggests that the transactions competing for memory resources within this node are likely causing system performance degradation or even system hangs. This could be due to a variety of factors such as the lack of secondary indexes which forces full table scans, or database operations, e.g. optimize compression, that have not been sufficiently controlled. Implementing limitations on internal job concurrency, as prescribed by HANA's configuration settings, might serve as a remedial measure.</LI><LI>Across the remaining NUMA nodes, exceeding the 52-thread limit occasionally doesn’t necessarily indicate a problem; it may reflect the system making full use of the resources at its disposal, which is typically a positive scenario. Nevertheless, it is crucial to ensure that the workload is evenly distributed to prevent any single NUMA node from being overloaded while others are underutilized. Vigilant monitoring for NUMA contention is essential, particularly when the overall CPU capacity is not fully leveraged, to mitigate any adverse effects on system behaviour.</LI></UL></DIV><DIV class="">&nbsp;</DIV><DIV class=""><STRONG>Reducing CPU Utilization on Primary Site by Using Active/Active Read Enable Features</STRONG></DIV></DIV><P><SPAN>Utilizing Active/Active Read-Enabled (AARE) in SAP HANA can swiftly reduce CPU and memory usage on the primary site. By rerouting read operations to a secondary site—through hints in SQL, ABAP, Procedure or CDS views—resource consumption can be balanced without altering existing job logic. Monitoring the secondary site is vital to ensure it doesn't affect system replication performance. For details on AARE, refer to the official SAP documentation.</SPAN></P><UL><LI><A href="https://help.sap.com/docs/SAP_HANA_PLATFORM/6b94445c94ae495c83a19646e7c3fd56/fe5fc53706a34048bf4a3a93a5d7c866.html" target="_blank" rel="noopener noreferrer">Active/Active (Read Enabled) | SAP Help Portal</A></LI><LI><A href="https://me.sap.com/notes/2732012/E" target="_blank" rel="noopener noreferrer">2732012 - Using Active/Active read enabled feature of SAP HANA in SAP S/4HANA Collective Note</A></LI><LI><A href="https://me.sap.com/notes/2737255/E" target="_blank" rel="noopener noreferrer">2737255 - Limitations and Fallback Conditions of Statement Routing to a Read Enabled Secondary System Using Active/Active(Read Enabled) Feature in System Replication</A></LI></UL><P>&nbsp;</P><DIV class=""><span class="lia-unicode-emoji" title=":hear_no_evil_monkey:">🙉</span><span class="lia-unicode-emoji" title=":see_no_evil_monkey:">🙈</span><span class="lia-unicode-emoji" title=":speak_no_evil_monkey:">🙊</span></DIV><P><STRONG>Workload Analysis for HANA Platform Series</STRONG></P><P>This blog post is part of the 'Workload Analysis for HANA Platform Series'. In upcoming posts, we will demonstrate how to analyze the issue related to CPU, threads and NUMA Node . Here's what you can look forward to in this series:</P><UL class="lia-list-style-type-disc"><LI><A href="https://community.sap.com/t5/technology-blogs-by-sap/workload-analysis-for-hana-platform-series-0-hana-workload-analysis/ba-p/13605267" target="_self">0. HANA Workload Analysis Overview</A></LI><LI><A href="https://community.sap.com/t5/technology-blogs-by-sap/workload-analysis-for-hana-platform-series-1-define-and-understand-the/ba-p/13608296" target="_self">1. Define and Understand the Workload Pattern</A></LI><LI><STRONG>2. Analyze the CPU, Threads and Numa Utilizations&nbsp;(This blog)</STRONG></LI><LI>3. Identify the Memory Consumption</LI><LI>4. How the Network, I/O and locks influent the workload</LI><LI>5. Performance Impact by HANA Internal Functions</LI><LI>6. HANA Workload Management Methodology</LI></UL><P><SPAN>Stay tuned as we explore these aspects in detail, providing insights and strategies to optimize your HANA environment.</SPAN></P> 2024-04-02T22:26:10.409000+02:00 https://community.sap.com/t5/artificial-intelligence-and-machine-learning-blogs/mastering-sap-hana-cloud-vector-engine-for-rag-driven-llm-applications-an/ba-p/13662515 Mastering SAP HANA Cloud Vector Engine for RAG-driven LLM Applications: An Insightful Guide 2024-04-08T18:23:37.926000+02:00 YangYue01 https://community.sap.com/t5/user/viewprofilepage/user-id/1409138 <H2 id="toc-hId-991602921">Introduction to Vector Similarity in RAG</H2><P><SPAN>Retrieval-Augmented Generation (RAG) techniques significantly improve the contextual relevance of large language model (LLM) outputs by incorporating real-time database lookups. <A href="https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-vector-engine-guide/sap-hana-cloud-sap-hana-database-vector-engine-guide" target="_self" rel="noopener noreferrer">SAP HANA Cloud vector engine</A> plays a key role here, enabling efficient retrieval of pertinent data through vector similarity measures, thereby augmenting the performance of RAG tasks.</SPAN></P><P><SPAN>This tutorial provides a comprehensive walkthrough, using <STRONG>Python</STRONG>, to showcase the utilization of SAP HANA cloud vector engine&nbsp;in a&nbsp;RAG-based LLM application.</SPAN></P><H2 id="toc-hId-795089416">Setting Up: Connecting to SAP HANA</H2><P>Start by establishing a secure connection to your SAP HANA instance.</P><P>&nbsp;</P><pre class="lia-code-sample language-python"><code>from hdbcli import dbapi # Establish a connection. Replace placeholders with actual credentials. connection = dbapi.connect( address="HANA_DB_ADDRESS", # Your database address port="HANA_DB_PORT", # Typically 443 for HTTPS user="YOUR_USERNAME", # HANA DB username password="YOUR_PASSWORD", # Corresponding password charset="utf-8", # Ensures correct encoding use_unicode=True # Allows for Unicode characters )</code></pre><P>&nbsp;</P><H2 id="toc-hId-598575911">Creating an Embedding Table</H2><P><SPAN>For RAG to work, we need to store document vector representations. This involves creating a table in SAP HANA for embeddings.</SPAN></P><P>&nbsp;</P><pre class="lia-code-sample language-python"><code>cursor = connection.cursor() # SQL statement to create an embedding table create_table_sql = """ CREATE COLUMN TABLE embeddings_table ( id INTEGER PRIMARY KEY, -- Unique identifier for each document document NVARCHAR(5000), -- Text content of the document embedding REAL_VECTOR(768) -- Vector representation of the document ) """ # Executing the table creation SQL command cursor.execute(create_table_sql) connection.commit() cursor.close()</code></pre><P>&nbsp;</P><H2 id="toc-hId-402062406">Populating the Table with Document Embeddings</H2><P>Before retrieval, our table needs populating with document embeddings. This involves defining documents, simulating embedding generation, and batch inserting these into SAP HANA.</P><H3 id="toc-hId-334631620">Defining Documents</H3><P>&nbsp;</P><pre class="lia-code-sample language-python"><code># A curated list of documents for embedding documents = [ "What is natural language processing?", "How do vector embeddings work?", "Examples of machine learning applications.", "Understanding deep learning for text analysis.", "The impact of artificial intelligence on society." ]</code></pre><P>&nbsp;</P><H3 id="toc-hId-138118115">Generating Embeddings</H3><P>Simulate LLM calls for embedding generation. In practice, replace this with actual model interactions.</P><P>&nbsp;</P><pre class="lia-code-sample language-python"><code>def get_embedding(document): # Placeholder function to simulate embedding generation return [float(i) for i in range(768)] # Returns a fixed-size (768) dummy vector</code></pre><P>&nbsp;</P><H3 id="toc-hId--58395390">Batch Insertion into SAP HANA</H3><P>Efficiently insert the document embeddings into the database.</P><P>&nbsp;</P><pre class="lia-code-sample language-python"><code>cursor = connection.cursor() # SQL command template for inserting document embeddings insert_sql = """ INSERT INTO embeddings_table (id, document, embedding) VALUES (?, ?, TO_REAL_VECTOR(?)) """ # Iteratively inserting each document and its embedding for i, document in enumerate(documents, start=1): embedding_str = str(get_embedding(document)).replace(" ", "") # Execute insert command for each document cursor.execute(insert_sql, (i, document, embedding_str)) connection.commit() cursor.close()</code></pre><P>&nbsp;</P><H2 id="toc-hId--383991614">Executing Vector Similarity Searches</H2><P>With the database prepared, perform a similarity search to find relevant documents for a given query.</P><H3 id="toc-hId--451422400">Generating Query Embedding</H3><P>First, generate an embedding for the query.</P><P>&nbsp;</P><pre class="lia-code-sample language-abap"><code>query = "What is an example of vector similarity search?" query_embedding = get_embedding(query)</code></pre><P>&nbsp;</P><H3 id="toc-hId--647935905">Conducting Similarity Searches</H3><P>Use L2 distance and cosine similarity measures to find the most relevant documents.</P><P>&nbsp;</P><pre class="lia-code-sample language-python"><code>cursor = connection.cursor() # L2 Distance search l2_query = """SELECT TOP 5 id, document FROM embeddings_table ORDER BY L2DISTANCE(embedding, TO_REAL_VECTOR(?))""" cursor.execute(l2_query, (str(query_embedding).replace(" ", ""),)) l2_results = cursor.fetchall() # Cosine Similarity search cosine_query = """SELECT TOP 5 id, document FROM embeddings_table ORDER BY COSINE_SIMILARITY(embedding, TO_REAL_VECTOR(?)) DESC""" cursor.execute(cosine_query, (str(query_embedding).replace(" ", ""),)) cosine_results = cursor.fetchall() cursor.close()</code></pre><P>&nbsp;</P><P><SPAN>The </SPAN><EM>l2_results</EM><SPAN> and </SPAN><EM>cosine_results</EM><SPAN> variables in the code snippet above contain the top 5 outcomes of similarity searches performed on the database, ordered from the most relevant to the least relevant.</SPAN></P><H2 id="toc-hId--626277772">Conclusion</H2><DIV class=""><DIV class=""><DIV class=""><DIV class=""><DIV class=""><DIV class=""><DIV class=""><DIV class=""><DIV class=""><DIV class=""><DIV class=""><DIV class=""><P><SPAN>This tutorial demonstrates how SAP HANA cloud's vector engine can be utilized in a RAG-based LLM application. The approach enhances LLM responses by ensuring that the generated outputs are informed by the most relevant data.</SPAN></P><H2 id="toc-hId--822791277"><SPAN>Reference</SPAN></H2><UL><LI><SPAN>Official SAP HANA Cloud Vector Engine Documentation:&nbsp;</SPAN><SPAN><A href="https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-vector-engine-guide/sap-hana-cloud-sap-hana-database-vector-engine-guide" target="_blank" rel="noopener noreferrer">https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-vector-engine-guide/sap-hana-cloud-sap-hana-database-vector-engine-guide</A></SPAN></LI></UL></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV> 2024-04-08T18:23:37.926000+02:00 https://community.sap.com/t5/technology-blogs-by-sap/sap-datapshere%E3%81%A7%E3%81%AE-hana-cloud-data-lake-%E3%81%AE%E5%88%A9%E7%94%A8%E6%96%B9%E6%B3%95/ba-p/13637646 SAP Datapshereでの HANA Cloud, Data Lake の利用方法 2024-04-12T11:12:57.669000+02:00 fumihisa_yagawa https://community.sap.com/t5/user/viewprofilepage/user-id/252530 <H1 id="toc-hId-859899649">はじめに</H1><P>SAPは、インメモリ、カラムストアという優位なアーキテクチャを前提として設計された SAP HANA およびSAP HANA Cloud をご提供しています。この高速な SAP HANA Cloud のデータ処理機能を、Data Warehouse(DWH、あるいは情報系システムやOLAPと呼ばれるかもしれません)の用途でお使いいただくために、DWHの利用や運用に適した様々な機能をパッケージ化した製品としてSAP Datasphere を提供しています。SAP HANAのインメモリアーキテクチャはすべてのデータをメモリに配置する事で高速な検索処理能力を発揮しますが、一方で相対的にメモリはストレージ(HDDやSSD)よりも高価であり、大規模なデータを扱う場合にはコストも重要な課題になります。SAP HANA Cloudにおけるこのコスト最適化問題の解決策として、<A href="https://community.sap.com/t5/technology-blogs-by-sap/hana-cloud-%E3%81%A7%E3%83%87%E3%83%BC%E3%82%BF%E3%81%AE%E9%9A%8E%E5%B1%A4%E5%8C%96%E3%82%92%E5%AE%9F%E7%8F%BE%E3%81%99%E3%82%8Bnative-storage-extension-nse/ba-p/13465950" target="_self">Native Storage Extension&nbsp;</A>と <A href="https://community.sap.com/t5/technology-blogs-by-sap/hana-cloud-data-lake-first-step/ba-p/13448060" target="_self">HANA Cloud, Data Lake</A>という機能を提供していることを、過去のブログでご紹介してきました。今回のブログでは、これらの機能をSAP Datasphereで利用する方法についてご紹介いたします。</P><P>Native Storage ExtensionとHANA Cloud, Data Lakeについては、それぞれのブログ(<A href="https://community.sap.com/t5/technology-blogs-by-sap/hana-cloud-%E3%81%A7%E3%83%87%E3%83%BC%E3%82%BF%E3%81%AE%E9%9A%8E%E5%B1%A4%E5%8C%96%E3%82%92%E5%AE%9F%E7%8F%BE%E3%81%99%E3%82%8Bnative-storage-extension-nse/ba-p/13465950" target="_self">HANA Cloud でデータの階層化を実現するNative Storage Extension(NSE)</A>および <A href="https://community.sap.com/t5/technology-blogs-by-sap/hana-cloud-data-lake-first-step/ba-p/13448060" target="_self">HANA Cloud, Data Lake First step</A>)をご参照いただくとして、ここでは概略をご説明します。</P><P>いずれの機能もSAP HANA Cloudの階層化データ管理を担うための機能です。データベースに格納されるデータは時間の経過とともに利用頻度が低下する傾向にあり、利用頻度の高いデータと、低いデータに対して同じコストをかけて維持するのは得策ではありません。利用頻度の高いデータは高い処理速度で、利用頻度の低いデータはコストに見合った処理性能の領域に格納する事で、コストとシステム性能のバランスを取る事ができます。</P><P>SAP HANA Cloud の Native Storage Extensionは、SAP HANAソフトウエアに組み込まれたデータ階層化機能で、「page loadable」という属性を与えた「データの単位」を対象に、データアクセスがなくなるとメモリから揮発し、次回のデータアクセス要求に応じてHANA Cloudのストレージ領域(永続領域)からメモリ領域に配置され、処理されることでメモリ領域のサイズを抑える事ができます。</P><P>SAP HANA Cloud, Data Lake はSAP HANAとは独立したData Lake relational engine にテーブルが作成され、HANA Cloud 上の仮想テーブルとして利用されます。Data Lake relational engineはインメモリアーキテクチャではありませんが、DWH用途には最適なカラムストアアーキテクチャを有しており、ストレージベースでありながら、(HANAには及ばないものの)高速にデータ処理を行えるエンジンとなっています。<BR /><BR /><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fumihisa_yagawa_0-1710396483375.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/80393iECDAC5DAFF93E888/image-size/large?v=v2&amp;px=999" role="button" title="fumihisa_yagawa_0-1710396483375.png" alt="fumihisa_yagawa_0-1710396483375.png" /></span></P><P style=" text-align: center; ">図1 :&nbsp; 階層化機能 概要図</P><P style=" text-align: center; ">&nbsp;</P><H1 id="toc-hId-663386144">SAP DatasphereにおけるNative Storage Extensionの利用</H1><P>前述のNSEに関するブログにあるように、HANA CloudではNSEを利用する対象テーブルに割り当てられたパーティションに対し、SQLコマンドによる操作で<SPAN>「Page Loadable」属性を与える事で、対象のパーティションのデータが階層化管理の対象として機能しました。</SPAN></P><P>SAP Datasphereでは、この設定方法をより簡易に行う事ができる様、管理画面のGUIを使用して設定できるようになっています。一方で、階層化管理の対象の単位は、パーテイションではなく、テーブル単位となっています。また、<FONT color="#FF0000">デフォルトの設定はNSEの機能が有効</FONT>な<A href="https://help.sap.com/docs/SAP_DATASPHERE/c8a54ee704e94e15926551293243fd1d/407d1dff76a842699ea08c17eb8748dd.html?locale=ja-JP" target="_self" rel="noopener noreferrer">ウォームストアへの格納</A>となっています。Databuilder の画面から、該当のテーブルのプロパティを表示させ、「テーブルデータをメモリに保存」のスライドボタンを有効にして、NSEの機能を無効化して、パフォーマンスを上げる事ができます。</P><P>&nbsp;</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fumihisa_yagawa_4-1710408782728.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/80557i08832517FFD8320B/image-size/large?v=v2&amp;px=999" role="button" title="fumihisa_yagawa_4-1710408782728.png" alt="fumihisa_yagawa_4-1710408782728.png" /></span></P><P style=" text-align: center; ">図2 : テーブルデータをメモリに保存(NSEを利用しない)設定</P><P>このことから、Datasphereのテーブルを設定する際は、2つの点を考慮して行っていただく必要があります。</P><UL><LI>テーブル単位で、アクセス頻度が高いか、低いか</LI><LI>アクセス頻度が高いテーブルであると判断される場合はデータビルダ画面の「テーブルサービス」の設定を「テーブルデータをメモリに保存」フラグをONにする</LI></UL><P>HANA Cloudでは、パーティション単位でNSEの機能が設定できるため、一つのテーブル(主に時間の経過とともにデータが増加するトランザクションデータのテーブル)に対して最近のデータと過去のデータを分けて階層化管理が可能でしたが、現時点ではSAP Datasphereではパーティションの作成はできますが、NSE機能の設定の粒度はテーブル単位となっていますので、テーブル単位でアクセス頻度が高いか、低いかを指針にして、NSEの機能を活用するようにして下さい。</P><P>&nbsp;</P><H1 id="toc-hId-466872639">SAP DatasphereにおけるData Lakeの利用</H1><P>一方で、多くのお客様が、一つのテーブルのデータに対して階層化管理を行いたいというニーズをお持ちになると想定されますので、その際は以降でご紹介するData Lakeの機能をご検討下さい。本ブログの以下の手順で設定できる構成を以下に示します。</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fumihisa_yagawa_5-1712818573315.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/94937i27F43A5DB15D72BD/image-size/large?v=v2&amp;px=999" role="button" title="fumihisa_yagawa_5-1712818573315.png" alt="fumihisa_yagawa_5-1712818573315.png" /></span></P><P style=" text-align: center; ">図3: 本ブログにおける Data Lake 構成例</P><P>図3では、SAP DatasphereのスペースAにあるメモリテーブルと、Data Lakeに配したストレージベースのテーブルを活用する場合の構成を示しています。この場合でも、オンメモリほどのパフォーマンスではないものの、常にオンラインで利用する事ができる様にData Lakeのデータへは仮想テーブルを介してアクセスできるようになっています。</P><H1 id="toc-hId-270359134">Open SQLスキーマの利用</H1><P>最初にご説明した通り、SAP DatasphereはHANA Cloudのデータベースを利用しており、通常のデータはSAP Datasphereから操作をする事で、テーブルなどのオブジェクトの管理が行われています。一方でData Lakeで利用されるテーブルは現在のところHANA Cloud から直接操作する必要があります。そのためにSAP Datasphereの Open SQL スキーマ を利用します。図3で示されているように、アクティブに利用するデータは通常のスペースで管理され、Data Lakeに格納するデータは、Open SQL スキーマを介してHANA Cloud経由で利用する、という点にご注意下さい。Open SQLスキーマについての詳細は<A href="https://help.sap.com/docs/SAP_DATASPHERE/be5967d099974c69b77f4549425ca4c0/3de55a78a4614deda589633baea28645.html?locale=ja-JP" target="_self" rel="noopener noreferrer">こちら</A>をご参照ください。</P><P>&nbsp;</P><H1 id="toc-hId-73845629">Data Lakeの利用方法</H1><P>最初に、Data Lakeの機能を利用するための準備設定を行います。左画面のメニューから「スペース管理」を選択します。Data Lakeの機能を使用するスペースの「編集」ボタンをクリックします。</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fumihisa_yagawa_1-1710740839415.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/81996i5C73BFBE4FB80F42/image-size/large?v=v2&amp;px=999" role="button" title="fumihisa_yagawa_1-1710740839415.png" alt="fumihisa_yagawa_1-1710740839415.png" /></span></P><P style=" text-align: center; ">図4:Data Lakeを使用するスペースの選択</P><P>続いてスペース管理の画面から「概要」タブが選択されている事を確認し、「データレイクアクセス」の項で「データレイクにアクセスするには、このスペースを使用します」のチェックボックスをチェックし、保存した後、デプロイをクリックします。</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fumihisa_yagawa_0-1712557934722.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/92636i1CA326C023022E02/image-size/large?v=v2&amp;px=999" role="button" title="fumihisa_yagawa_0-1712557934722.png" alt="fumihisa_yagawa_0-1712557934722.png" /></span></P><P style=" text-align: center; ">図5:Data Lakeアクセスするための設定</P><P>ここでの注意点は、Data Lakeにアクセスするスペースは、<A href="https://help.sap.com/docs/SAP_DATASPHERE/be5967d099974c69b77f4549425ca4c0/93d0b5d4faa24777a4b78513f7ed6172.html?locale=ja-JP#:~:text=%E3%82%B9%E3%83%88%E3%83%AC%E3%83%BC%E3%82%B8%E5%89%B2%E3%82%8A%E5%BD%93%E3%81%A6%E3%81%A7%E3%80%81%E3%83%81%E3%82%A7%E3%83%83%E3%82%AF%E3%83%9C%E3%83%83%E3%82%AF%E3%82%B9%20%E3%83%87%E3%83%BC%E3%82%BF%E3%83%AC%E3%82%A4%E3%82%AF%E3%81%AB%E3%82%A2%E3%82%AF%E3%82%BB%E3%82%B9%E3%81%99%E3%82%8B%E3%81%AB%E3%81%AF%E3%80%81%E3%81%93%E3%81%AE%E3%82%B9%E3%83%9A%E3%83%BC%E3%82%B9%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%BE%E3%81%99%E3%80%82%E3%82%92%E9%81%B8%E6%8A%9E%E3%81%97%E3%81%BE%E3%81%99%E3%80%82%E4%BB%96%E3%81%AE%E3%82%B9%E3%83%9A%E3%83%BC%E3%82%B9%E3%81%8B%E3%82%89%E3%83%87%E3%83%BC%E3%82%BF%E3%83%AC%E3%82%A4%E3%82%AF%E3%81%AB%E3%81%99%E3%81%A7%E3%81%AB%E3%82%A2%E3%82%AF%E3%82%BB%E3%82%B9%E3%81%97%E3%81%A6%E3%81%84%E3%82%8B%E5%A0%B4%E5%90%88%E3%81%AF%E3%80%81%E3%82%B9%E3%83%9A%E3%83%BC%E3%82%B9%E3%82%92%E5%89%B2%E3%82%8A%E5%BD%93%E3%81%A6%E3%82%8B%E3%81%93%E3%81%A8%E3%81%8C%E3%81%A7%E3%81%8D%E3%81%BE%E3%81%9B%E3%82%93%E3%80%82" target="_self" rel="noopener noreferrer">1つのインスタンスにおいて1つとなります</A>。複数のスペースでData Lakeにアクセスする場合は、Data Lakeテーブルをそれぞれのスペースで共有するようにして利用します。本ブログでは、Data Lakeアクセス可能なスペースでの手順をご紹介します。</P><P>続いてOpen SQLスキーマを利用する準備を行います。</P><P>左端のメニューから「スペース管理」を選択し、「データベースアクセス」タブをクリックします。データベースユーザにある「作成」ボタンをクリックし、OPEN SQL スキーマにアクセスするためのデータベースユーザを作成します。これはSAP Datasphereとは異なる、HANA Cloudへアクセスするためのユーザになります。</P><P>&nbsp;</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fumihisa_yagawa_3-1712563989885.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/92708i264082BDBB9F4A55/image-size/large?v=v2&amp;px=999" role="button" title="fumihisa_yagawa_3-1712563989885.png" alt="fumihisa_yagawa_3-1712563989885.png" /></span></P><P style=" text-align: center; ">図6: Open SQL Schemaにアクセスするためのデータベースユーザの作成</P><P>データベースユーザの作成画面では、「データベースユーザ名の接尾辞」を設定し、「読み込みアクセスを有効化」、「書き込みアクセスを有効化」をチェックして「作成」をクリックし、データベースユーザを登録します。画面が閉じたら、「保存」をし、続けて「デプロイ」を実行してください。</P><P>&nbsp;</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fumihisa_yagawa_4-1712564487323.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/92709i23EE7C6D4995CB54/image-size/large?v=v2&amp;px=999" role="button" title="fumihisa_yagawa_4-1712564487323.png" alt="fumihisa_yagawa_4-1712564487323.png" /></span></P><P style=" text-align: center; ">図7 : データベースユーザの登録</P><P style=" text-align: center; ">&nbsp;</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fumihisa_yagawa_0-1712565041254.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/92712i6A11300E43DF2879/image-size/large?v=v2&amp;px=999" role="button" title="fumihisa_yagawa_0-1712565041254.png" alt="fumihisa_yagawa_0-1712565041254.png" /></span></P><P style=" text-align: center; ">図8 : 保存とデプロイの実行</P><P>デプロイが完了し、ユーザが追加されたら、そのユーザのチェックボックスにチェックを入れ、行の右端にあるインフォメーションアイコンをクリックします。</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fumihisa_yagawa_0-1712649283228.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/93280iC344CD5D18CCBD8B/image-size/large?v=v2&amp;px=999" role="button" title="fumihisa_yagawa_0-1712649283228.png" alt="fumihisa_yagawa_0-1712649283228.png" /></span></P><P style=" text-align: center; ">図9 : 追加されたユーザの情報確認</P><P>データベースユーザ詳細画面が表示されますので、Open SQL スキーマパスワードを取得します。「新しいパスワードを申請」ボタンをクリックし、可視化ボタン(目玉アイコン)を押してから「パスワードのコピー」をクリックし、作成したユーザ用のパスワードを入手します。以後、この画面からは同じパスワードを入手する事はできませんので、必要があれば記録しておいてください。ただし、本シナリオの場合はログインの度に毎回新しいパスワードを生成しても特に問題はありません(ので記録し忘れても大丈夫)。</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fumihisa_yagawa_2-1712650248753.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/93314i404EEA9A76D544EF/image-size/large?v=v2&amp;px=999" role="button" title="fumihisa_yagawa_2-1712650248753.png" alt="fumihisa_yagawa_2-1712650248753.png" /></span></P><P style=" text-align: center; ">図10 : データベースユーザのパスワードの取得方法</P><P>取得したパスワードを使って、Open SQL スキーマの領域にアクセスします。前述しましたが、Open SQL スキーマとは、SAP Datasphereの管理下ではないHANA Cloud から操作する必要があります。そのため、SQLコマンドを使用することができる、データベースエクスプローラーというツールを介して操作します。作成したデータベースユーザにチェックを入れ、メニューにある「データベースエクスプローラを開く」をクリックします。</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fumihisa_yagawa_4-1712650527107.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/93318i007D227DD44B505A/image-size/large?v=v2&amp;px=999" role="button" title="fumihisa_yagawa_4-1712650527107.png" alt="fumihisa_yagawa_4-1712650527107.png" /></span></P><P style=" text-align: center; ">図11 : データベースエクスプローラの起動</P><P>ログインプロパティの入力画面に先ほど取得したパスワードを入力し、「OK」すれば、Open SQL スキーマを管理するHANA Cloudへのログインが完了します。</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fumihisa_yagawa_5-1712651501710.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/93373iFE30C39A55DB57DA/image-size/large?v=v2&amp;px=999" role="button" title="fumihisa_yagawa_5-1712651501710.png" alt="fumihisa_yagawa_5-1712651501710.png" /></span></P><P style=" text-align: center; ">図12 : ログインプロパティの入力</P><P>ログインに使用したデータベースエクスプローラは、HANA Cloud用のSQL入力用のツールです。このツールを使用して、SAP DatasphereのOpen SQL スキーマで使用しているデータベース領域に直接SQLコマンドを実行する事ができます。以降の操作では、下の図のData Lakeにあるテーブルを作成し、このテーブルをOpen SQL スキーマにある仮想テーブルで参照する設定を行います。</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fumihisa_yagawa_4-1712818546260.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/94936iBFC18E674CA8D784/image-size/large?v=v2&amp;px=999" role="button" title="fumihisa_yagawa_4-1712818546260.png" alt="fumihisa_yagawa_4-1712818546260.png" /></span></P><P style=" text-align: center; ">図3: 本ブログにおける Data Lake 構成例(再掲)</P><P>まずData Lakeの物理テーブル(図中 <FONT color="#FF0000">① <FONT color="#000000">SALES_Datalake</FONT></FONT>)を作成します。HANA Cloudに接続したDatabase ExplorerからData Lakeにテーブルを作成する場合 ”DATA_LAKE_EXECUTE" というシステムプロシージャを使用し、Data Lakeを管理するData Lake relational engineに対してSQL(Create table)文を間接的に実行させます。</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-sql"><code>call "DWC_GLOBAL"."DATA_LAKE_EXECUTE"('CREATE TABLE SALES_Datalake( Sales_ID INTEGER, ShopID INTEGER, Purchase_Num INTEGER, Prod_ID INTEGER, Price INTEGER, Order_date date )');</code></pre><P>&nbsp;</P><P>&nbsp;</P><P>上記のSQLプロシージャ文を、Database ExplorerのSQLコンソール画面から実行します。左上にあるSQLコンソール起動アイコンをクリックし、実行してください。</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fumihisa_yagawa_1-1712741537035.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/94548i0811761E7EBE4B59/image-size/large?v=v2&amp;px=999" role="button" title="fumihisa_yagawa_1-1712741537035.png" alt="fumihisa_yagawa_1-1712741537035.png" /></span></P><P style=" text-align: center; ">図13 : Data Lake テーブル作成</P><P><SPAN>次に、今作成したData Lake内のテーブルを参照する、Open SQL スキーマ内の仮想テーブル(図中<FONT color="#FF0000">②</FONT> V_SALES_Datalake)を作成します。仮想テーブルの作成は ”DATA_LAKE_CREATE_VIRTUAL_TABLE" というシステムプロシージャを使用します。</SPAN></P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-sql"><code>CALL "DWC_GLOBAL"."DATA_LAKE_CREATE_VIRTUAL_TABLE" ( VIRTUAL_TABLE_NAME =&gt; 'V_SALES_Datalake', DATA_LAKE_TABLE_NAME =&gt; 'SALES_Datalake' );</code></pre><P>&nbsp;</P><P>&nbsp;</P><P>Database Explorerから上記SQLプロシージャ文を実行すると、Data Lakeにある実テーブルを、SAP Datasphereから参照するための仮想テーブルが作成されます。実行完了を確認したのち、左上のペインにある「catalog」フォルダを展開し、「Table」アイコンをクリックすると、左下のペインに作成された仮想テーブルがリストされることが確認できます(図中にもあるWarningに関しては、本シナリオでは特に影響はありません)。</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fumihisa_yagawa_3-1712743221149.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/94583iD36F81ACD0FBE0DE/image-size/large?v=v2&amp;px=999" role="button" title="fumihisa_yagawa_3-1712743221149.png" alt="fumihisa_yagawa_3-1712743221149.png" /></span></P><P style=" text-align: center; ">図14 : Open SQL スキーマ 仮想テーブル作成と確認方法</P><P style=" text-align : left; ">作成した仮想テーブルに対して<SPAN>挿入および更新するための権限を SAP Datasphere のスペースに付与します。これにより、SAP Datasphereのデータ フローによってテーブルにデータを挿入する権限を与えます。次の手順で、スペースにすべての権限を付与します(JAPAN_D&amp;Aは実施した環境のスペース名です、適宜ご自身のスペース名に置き換えてください)。</SPAN></P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-sql"><code>GRANT ALL PRIVILEGES on "JAPAND&amp;A#YAGAWA"."V_SALES_Datalake" to JAPAND&amp;A with grant option</code></pre><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fumihisa_yagawa_2-1712745275984.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/94613iEAD06B7FA1D0CE82/image-size/large?v=v2&amp;px=999" role="button" title="fumihisa_yagawa_2-1712745275984.png" alt="fumihisa_yagawa_2-1712745275984.png" /></span></P><P style=" text-align: center; ">図15 : 仮想テーブルに権限付与</P><P>以上で、Data Lakeに物理テーブルを作成し、Open SQL スキーマにこれを参照する仮想テーブルが作成されました。それではSAP Datasphereからこの仮想テーブルを操作してみましょう。</P><P>Data Lakeに作成したテーブルに、SQL Open スキーマにある仮想テーブル経由でデータをインポートするため、ソースとなるCSVファイルを、AMAZON AWS S3に配置し、これをDatasphereのデータフローを使ってデータを格納します。AWS S3との接続設定に関しては、<A href="https://community.sap.com/t5/technology-blogs-by-sap/%E8%A4%87%E8%A3%BD%E3%83%95%E3%83%AD%E3%83%BC-part4-amazon-s3%E3%82%92%E3%82%BF%E3%83%BC%E3%82%B2%E3%83%83%E3%83%88%E3%81%A8%E3%81%97%E3%81%9F%E8%A4%87%E8%A3%BD%E3%83%95%E3%83%AD%E3%83%BC/ba-p/13590365" target="_self">こちらのブログ</A>をご参照ください。このブログに基づき、Import_Location_from_S3 という接続設定を作成しておきます。また、接続先のAWS S3 には、インポートファイルをアップロードしておいてください。サンプルとして&nbsp;<A href="https://github.com/fyaga/BLOG_SAMPLE/blob/f4c10c9fbe79c8c1d81ebb08d66f6d3a3485c17b/SampleDate_DataLake2024.csv" target="_self" rel="nofollow noopener noreferrer"> SampleData_Datalake2024.csv</A> を添付します。</P><P>ブラウザのSAP Datasphereのタブを選択し左のメニューから「データビルダ」を選択、「フロー」タブをクリックし、「新規データフロー」タイルをクリックします。</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fumihisa_yagawa_1-1712901572843.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/95484i33D6B02837DA9177/image-size/large?v=v2&amp;px=999" role="button" title="fumihisa_yagawa_1-1712901572843.png" alt="fumihisa_yagawa_1-1712901572843.png" /></span></P><P style=" text-align: center; ">図16 : AWS S3からCSVファイルをインポートするデータフローの作成</P><P>新規データフロー作成画面にて、左のペインから「ソース」タブをクリックし、「接続」フォルダを展開すると、上記で準備した Import_Location_from_S3がリストされます。これを展開すると、アップロード済のファイルがリストされます(下の画面では、AWS S3に作成したフォルダ dspimportlocation の下)。この中からData Lakeに配置するためのデータ SampleData_Datalake2024.csv を、Drug &Dropし、中央のワークスペースに配置します。</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fumihisa_yagawa_0-1712903320785.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/95491i96E9C5BEEFDE8FC6/image-size/large?v=v2&amp;px=999" role="button" title="fumihisa_yagawa_0-1712903320785.png" alt="fumihisa_yagawa_0-1712903320785.png" /></span></P><P style=" text-align: center; ">図17 : AWS S3に配置したCSVをソースとして定義</P><P>つづいて「リポジトリ」タブをクリックし、作成した仮想テーブル「V_SALES_Datalake」をクリックし、ワークスペースにDrug &amp; Dropします。この時同時に表示されるコンテキストメニューから「ターゲット」を選択します。<span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fumihisa_yagawa_0-1712906422341.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/95508iFD58D126E41547BD/image-size/large?v=v2&amp;px=999" role="button" title="fumihisa_yagawa_0-1712906422341.png" alt="fumihisa_yagawa_0-1712906422341.png" /></span></P><P style=" text-align: center; ">図18 : 仮想テーブルをターゲットとして定義</P><P style=" text-align : left; ">ワークスペースのソースオブジェクト(AWS S3ファイル)の黒い ● を、ターゲット(V_SALES_Datalake)にDrug & Drop で結線し、ターゲットオブジェクトをクリックしたのち右のペインのプロパティ画面を下方にスクロールして、ソースとターゲットの項目をマッピングします。こちらも左の項目をDrug &Dropすることでマッピングする事ができます。なお、ソースのCSVファイルの1行目にヘッダー行としてターゲットテーブルのカラム名を記入しておくと、自動マッピングする事も可能です。</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fumihisa_yagawa_0-1712906968471.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/95515i439C5ABC9DC8EB6C/image-size/large?v=v2&amp;px=999" role="button" title="fumihisa_yagawa_0-1712906968471.png" alt="fumihisa_yagawa_0-1712906968471.png" /></span></P><P style=" text-align: center; ">図19 : ソースとターゲットの関連付け</P><P style=" text-align : left; ">設定したデータフローを左上のアイコン「保存」し(データフロー名を指定します)続いて「デプロイ」します。ワークスペースの中央下に「Deployed...」のメッセージが表示されたらデータフローの準備は完了です。このメッセージは自動的に消えますのでご注意下さい(しばらくすると右ペインのプロパティの表示が「未デプロイ」から「デプロイ済み」に更新されるので、こちらで確認可能です)。</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fumihisa_yagawa_0-1712907545612.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/95520i0EA53AAD9239C929/image-size/large?v=v2&amp;px=999" role="button" title="fumihisa_yagawa_0-1712907545612.png" alt="fumihisa_yagawa_0-1712907545612.png" /></span></P><P style=" text-align: center; ">図20 : データフローの保存とデプロイ</P><P style=" text-align : left; ">このデータフローにより、AWS S3にアップロードされたCSVファイルを、Data Lakeにインポートできるようになりました。このワークフローをスケジュールに基づき実行させる場合は、右ペインのプロパティの「実行ステータス」にある「スケジュール」アイコンをクリックし、スケジュールを作成する事ができます。ここでは、すぐにデータフローを実行したいので、左上にある「実行」アイコンをクリックし、データフローを実行します。</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fumihisa_yagawa_0-1712908205799.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/95529i802096FD6DBAC767/image-size/large?v=v2&amp;px=999" role="button" title="fumihisa_yagawa_0-1712908205799.png" alt="fumihisa_yagawa_0-1712908205799.png" /></span></P><P style=" text-align: center; ">図21 : データフローのスケジュール実行と直接実行方法</P><P>データフロー完了のメッセージ(DIRECT run of DATA_FLOW .... completed&nbsp; このメッセージは自動で消えます)を確認するか、右ペインのプロパティにある実行ステイタスで「完了」を確認したら、ターゲットオブジェクトをクリックし、表示されるコンテキストアイコンから「データのプレビュー」をクリックすると、下方にこのオブジェクトのデータを確認する事ができます。このオブジェクトは仮想テーブルであり、その実態はData Lakeを参照しているので、これでData Lakeにデータをインポートしたことが確認できました。</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fumihisa_yagawa_3-1712908890292.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/95536i628B76A8E03DF52C/image-size/large?v=v2&amp;px=999" role="button" title="fumihisa_yagawa_3-1712908890292.png" alt="fumihisa_yagawa_3-1712908890292.png" /></span></P><P style=" text-align: center; ">図22 : データフローの実行確認と、その実行結果の確認</P><P>&nbsp;</P><P>&nbsp;</P><P>SAP Datasphereにおける Data Lakeの利用方法については以上となります。</P><P>SAP DatasphereにてData Lakeを利用したときのパフォーマンスに関する情報として、以下のブログが参考になりますので、リンクをご紹介しておきます。</P><P><A href="https://community.sap.com/t5/technology-blogs-by-sap/working-with-the-embedded-data-lake-in-sap-datasphere/ba-p/13569701" target="_self">Working with the Embedded Data Lake in SAP Datasphere</A></P> 2024-04-12T11:12:57.669000+02:00 https://community.sap.com/t5/data-and-analytics-blog-posts/why-don-t-we-use-data-and-analytics-group-on-sap-community/ba-p/13666201 Why Don't We Use Data and Analytics Group on SAP Community? 2024-04-18T18:28:14.375000+02:00 TuncayKaraca https://community.sap.com/t5/user/viewprofilepage/user-id/137163 <P>Hey Data and Analytics Folks! Why Don't We Use <A href="https://community.sap.com/t5/data-and-analytics/gh-p/data-analytics" target="_self">Data and Analytics</A> Group on SAP Community instead of <A href="https://community.sap.com/t5/technology/ct-p/technology" target="_self">Technology</A>?</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TuncayKaraca_1-1712778519559.png" style="width: 761px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/94808iB9F1693F79E6207B/image-dimensions/761x194?v=v2" width="761" height="194" role="button" title="TuncayKaraca_1-1712778519559.png" alt="TuncayKaraca_1-1712778519559.png" /></span></P><P>Of course, it does not matter at the end. As long as if you tag your posts with SAP Managed tags everybody can find your posts. But there is a really one huge difference for usability that here in <A href="https://community.sap.com/t5/interest-groups/ct-p/interests" target="_self">Interests Groups</A> we can <STRONG>reply-the-reply</STRONG> but under <A href="https://community.sap.com/t5/products-and-technology/ct-p/products" target="_self">Products and Technology</A>&nbsp;we cannot! Check out this blog post&nbsp;<A href="https://community.sap.com/t5/technology-blogs-by-sap/sap-datasphere-is-ready-to-take-over-the-role-of-sap-bw/bc-p/13666176" target="_self">SAP Datasphere is ready to take over the role of SAP BW</A> by&nbsp;<a href="https://community.sap.com/t5/user/viewprofilepage/user-id/705968">@kenneth_dalvik</a>&nbsp;and all responses that are very all boring sequential --there is no&nbsp;<STRONG>reply-the-reply</STRONG> option!&nbsp;<span class="lia-unicode-emoji" title=":upside_down_face:">🙃</span></P><P>So let's start using this group&nbsp;Here is already available <A href="https://community.sap.com/t5/data-and-analytics/gh-p/data-analytics" target="_self">Data and Analytics</A>.&nbsp; &nbsp;The group will be definitely a perfect fit for <a href="https://community.sap.com/t5/c-khhcw49343/SAP+Analytics+Cloud/pd-p/67838200100800006884" class="lia-product-mention" data-product="3-1">SAP Analytics Cloud</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/SAP+Datasphere/pd-p/73555000100800002141" class="lia-product-mention" data-product="16-1">SAP Datasphere</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/SAP+Analytics+Cloud%25252C+hybrid+analytics/pd-p/464f79a9-d5e9-4113-8e9f-7ff61b577b4f" class="lia-product-mention" data-product="6-1">SAP Analytics Cloud, hybrid analytics</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/SAP+HANA+Cloud%25252C+SAP+HANA+database/pd-p/ada66f4e-5d7f-4e6d-a599-6b9a78023d84" class="lia-product-mention" data-product="40-1">SAP HANA Cloud, SAP HANA database</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/SAP+Analytics+Cloud%25252C+connectivity/pd-p/0db4caf8-3039-4a93-9d11-543de33255a4" class="lia-product-mention" data-product="193-1">SAP Analytics Cloud, connectivity</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/SAP+Analytics+Cloud%25252C+analytics+designer/pd-p/3f33380c-8914-4b7a-af00-0e9a70705a32" class="lia-product-mention" data-product="97-1">SAP Analytics Cloud, analytics designer</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/SAP+S%25252F4HANA+Cloud%25252C+extended+edition/pd-p/73b37c4d-a4aa-4de9-aeb9-a5dc59710b26" class="lia-product-mention" data-product="244-1">SAP S/4HANA Cloud, extended edition</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/SAP+S%25252F4HANA+Embedded+Analytics/pd-p/8492b555-b489-4972-8e37-83f2f27ae399" class="lia-product-mention" data-product="1067-1">SAP S/4HANA Embedded Analytics</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/SAP+Business+Planning+and+Consolidation%25252C+version+for+SAP+NetWeaver/pd-p/01200615320800001016" class="lia-product-mention" data-product="460-1">SAP Business Planning and Consolidation, version for SAP NetWeaver</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/SAP+Business+Warehouse+Accelerator/pd-p/01200615320800000698" class="lia-product-mention" data-product="722-1">SAP Business Warehouse Accelerator</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/BW+%252528SAP+Business+Warehouse%252529/pd-p/242586194391178517100436979900901" class="lia-product-mention" data-product="1-1">BW (SAP Business Warehouse)</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/SAP+BW%25252F4HANA/pd-p/73554900100800000681" class="lia-product-mention" data-product="466-1">SAP BW/4HANA</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/BW+SAP+BEx+Analyzer/pd-p/720735023700999283551380474299965" class="lia-product-mention" data-product="919-1">BW SAP BEx Analyzer</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/BW+SAP+BEx+Web/pd-p/835872679136515185293228681234825" class="lia-product-mention" data-product="920-1">BW SAP BEx Web</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/SAP+ASE+-+BW+Enablement/pd-p/758617099728293421716080695502398" class="lia-product-mention" data-product="1038-1">SAP ASE - BW Enablement</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/BW+SAP+HANA+Data+Warehousing/pd-p/337684911283545157914465705009179" class="lia-product-mention" data-product="921-1">BW SAP HANA Data Warehousing</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/SAP+Data+Services/pd-p/01200314690800000395" class="lia-product-mention" data-product="527-1">SAP Data Services</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/SAP+Data+Intelligence/pd-p/73555000100800000791" class="lia-product-mention" data-product="15-1">SAP Data Intelligence</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/SAP+Data+Custodian/pd-p/73554900100700002051" class="lia-product-mention" data-product="1204-1">SAP Data Custodian</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/SAP+Big+Data+Services/pd-p/73555000100800000691" class="lia-product-mention" data-product="439-1">SAP Big Data Services</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/SAP+BusinessObjects+-+Platform+Administration/pd-p/493706448058243238508632186627562" class="lia-product-mention" data-product="1051-1">SAP BusinessObjects - Platform Administration</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/SAP+BusinessObjects+-+Semantic+Layer/pd-p/280909257853820289811451573728573" class="lia-product-mention" data-product="1053-1">SAP BusinessObjects - Semantic Layer</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/SAP+BusinessObjects+Mobile/pd-p/01200314690800000346" class="lia-product-mention" data-product="337-1">SAP BusinessObjects Mobile</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/SAP+BusinessObjects+-+Semantic+Layer+-+SDK/pd-p/724814917412511087954547042734363" class="lia-product-mention" data-product="1054-1">SAP BusinessObjects - Semantic Layer - SDK</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/SAP+BusinessObjects+-+Web+Intelligence+%252528WebI%252529/pd-p/907900296036854683333078008146613" class="lia-product-mention" data-product="1055-1">SAP BusinessObjects - Web Intelligence (WebI)</a>&nbsp;</P><P>These are welcome too <a href="https://community.sap.com/t5/c-khhcw49343/SAP+Master+Data+Governance/pd-p/67837800100800004488" class="lia-product-mention" data-product="697-1">SAP Master Data Governance</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/SAP+NetWeaver+Master+Data+Management/pd-p/01200615320800000588" class="lia-product-mention" data-product="739-1">SAP NetWeaver Master Data Management</a>&nbsp;<a href="https://community.sap.com/t5/c-khhcw49343/SAP+Data+Quality+Management+for+SAP+NetWeaver+MDM/pd-p/01200615320800002027" class="lia-product-mention" data-product="526-1">SAP Data Quality Management for SAP NetWeaver MDM</a>&nbsp;</P><P>One thing I've noticed we cannot submit the blog posts directly. We need to "Submit for Review" only. You can still post discussions aka questions directly.&nbsp;</P><P>Thanks owners&nbsp;@ColinC, @meganhoy, @moshenaveh, @caroleighdeneen, @craigcmehil for their support!</P><P>Regards,<BR />Tuncay Karaca</P> 2024-04-18T18:28:14.375000+02:00 https://community.sap.com/t5/technology-blogs-by-sap/understanding-data-modeling-tools-in-sap/ba-p/13689215 Understanding Data Modeling Tools in SAP 2024-05-02T16:25:43.459000+02:00 Marwah_Shwaiki https://community.sap.com/t5/user/viewprofilepage/user-id/7391 <P>Choosing the right SAP data modeling solution can be a challenging task, as there are multiple options available, including cloud-based or on-premise solutions with or without data visualization capabilities etc..so to select the best tool that can meet the project requirements and specifications, several factors need to be considered including, reviewing the raw data source and understanding how it will be used, assessing the need for data warehousing capabilities, evaluating the team's skill sets, and deciding whether a cloud or on-premise solution is preferred.</P><P>During the last few years, I've worked with almost all the SAP Data Modeling tools that are available, and In this blog article, I would like to briefly highlight the strength of each tool and where would be the best fit for it <span class="lia-unicode-emoji" title=":hugging_face:">🤗</span>.</P><P>&nbsp;</P><H3 id="toc-hId-1122738336">Understanding Data Modeling</H3><P>so what it's data modeling in SAP and why it's important?&nbsp;<span class="lia-unicode-emoji" title=":thinking_face:">🤔</span></P><P><SPAN>when we talk about Data modeling we are defining the process of creating diagrams that show how data flows in and out of a database. These diagrams define the data formats, structures, and functions required to support the data flow. Once the database is built, the data model becomes documentation for its existence and design. Data models provide a framework of relationships between data elements within a database. They enable different applications to share the same data and create a simple and logical database that eliminates redundancy, reduces storage requirements, and enables efficient retrieval. </SPAN></P><DIV class=""><DIV class=""><DIV class=""><DIV class=""><DIV class=""><DIV><DIV class=""><DIV class=""><DIV class=""><DIV class=""><DIV class=""><DIV class=""><DIV><DIV class=""><DIV class=""><DIV class=""><DIV class=""><DIV class=""><H3 id="toc-hId-926224831">&nbsp;</H3></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV><H3 id="toc-hId-729711326">SAP HANA Calculation Views</H3><P>SAP HANA calculation views are the key data modeling object on HANA, it's a graphical object that describes all the data processing steps from raw data to the final, consumable output.</P><P>Common data processing steps include filtering data, combining data, aggregating data, calculating new values, converting values, and ranking data. Calculation views are built in layers so that each calculation view can consume other calculation views to form a stack of super-models. This approach promotes the reuse of calculation views at the lower levels.</P><P><!-- notionvc: 1f08f122-aff1-4b17-a252-88f24ff50cd6 --></P><P><STRONG>Strengths:</STRONG></P><UL><LI><STRONG>In-Memory Processing:</STRONG> Data processing occurs directly in memory, ensuring high performance.</LI><LI><STRONG>Graphical Interface:</STRONG> Intuitive tools make it easy to create and visualize models.</LI><LI><STRONG>Custom Logic:</STRONG> Ability to integrate custom SQL for tailored data processing.</LI><LI><STRONG>Advanced Analytics:</STRONG> Supports spatial, graph, text analytics, and predictive/machine learning.</LI></UL><P><STRONG>Best Fit:</STRONG> Developing flexible data marts with custom logic requirements.</P><H3 id="toc-hId-533197821">SAP BW/4HANA</H3><P>SAP BW/4HANA is an on-premise data warehouse. The main purpose of a data warehouse is to extract data from any data source, integrate the data, store the cleansed data, and provide modeling tools so that data models can be created ready for use by any analytical tool. This is exactly what SAP BW/4HANA can do.<!-- notionvc: fbec00b1-c3e6-4815-9168-a79d91e7b64e --></P><P><STRONG>Strengths:</STRONG></P><UL><LI><STRONG>Ready-Made Models:</STRONG> Comprehensive data models are provided for virtual and physical storage.</LI><LI><STRONG>Data Warehousing Features:</STRONG> Supports dimensional modeling, hierarchies, and efficient data storage.</LI><LI><STRONG>Graphical Tool:</STRONG> User-friendly interface for efficient model visualization.</LI><LI><STRONG>On-Premise Deployment:</STRONG> Ideal for industries requiring high security and data control.</LI></UL><P><STRONG>Best Fit:</STRONG> Establishing on-premise data warehouses with strong data integration needs.</P><H3 id="toc-hId-336684316">ABAP CDS Views</H3><P>ABAP CDS Views enable developers to create data models that are semantically rich. These models are then exposed to UI clients by the application services. CDS Views is the central pillar of S/4HANA development and is used as the core technology in most of SAP's programming models.</P><P><STRONG>Strengths:</STRONG></P><UL><LI><STRONG>High Performance:</STRONG> Data processing is pushed down to the database level, ensuring efficiency.</LI><LI><STRONG>Ready-Made Models for SAP S/4HANA:</STRONG> Simplifies operational reporting on S/4HANA.</LI><LI><STRONG>Flexible Development:</STRONG> Allows for code-based customization leveraging SQL skills.</LI></UL><P><STRONG>Best Fit:</STRONG> Operational reporting on SAP S/4HANA with ready-made content.</P><H3 id="toc-hId-140170811">SAP Analytics Cloud</H3><P>SAP Analytics Cloud is an end-to-end cloud solution that brings together business intelligence, augmented analytics, predictive analytics, and enterprise planning in a single system. It is a solution aimed at business users for self-service analytics.<!-- notionvc: d7bd6f38-61bc-42a0-a555-c9dd8eff176f --></P><P><STRONG>Strengths:</STRONG></P><UL><LI><STRONG>Integrated Modeling:</STRONG> Modeling seamlessly integrated with reporting tools for streamlined analytics.</LI><LI><STRONG>Cloud-Based:</STRONG> No need for software installation; data modeling is conducted in the cloud.</LI><LI><STRONG>Self-Service Analytics:</STRONG> Empowers business users to create their own models.</LI></UL><P><STRONG>Best Fit:</STRONG> Organizations seeking self-service analytics with integrated modeling and reporting.</P><H3 id="toc-hId--56342694">SAP Datasphere</H3><P>which is so far My Absolute favorite tool <span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:">😁</span>!&nbsp;<SPAN>It is a public cloud software as a service (SaaS) data warehouse that supports the business data warehouse architecture. This tool effortlessly harmonizes data across the enterprise, making it a must-have for any business. It includes services for data modeling, data integration, cataloging, and data warehousing across SAP and non-SAP data, making it a one-stop-shop for all data management needs</SPAN></P><P><!-- notionvc: 70a2bda6-9fce-4816-8c17-7c73a80c91b7 --></P><P><STRONG>Strengths:</STRONG></P><UL><LI><STRONG>Comprehensive Data Warehouse Features:</STRONG> Supports dimensional modeling, data history management, and hierarchy modeling.</LI><LI><STRONG>Scalability:</STRONG> Easily scale resources in the cloud, supporting new innovations.</LI><LI><STRONG>Cloud Service:</STRONG> Simplifies software management through cloud consumption.</LI></UL><P><STRONG>Best Fit:</STRONG> Cloud-based data warehousing with advanced features and scalability.</P><H3 id="toc-hId--252856199">SAP BusinessObjects BI Semantic Layer (Universes)</H3><P>An organized collection of objects that called a Universe, which consists of dimensions, measures, and attributes grouped by business topics. The skill of a Universe developer is to create objects that resemble business terms by mapping them to the columns of the database tables. In some cases, SQL coding may be required to generate the value of the objects.<!-- notionvc: 28e2218d-7548-4c77-93ca-b664e5293a5d --></P><P><STRONG>Strengths:</STRONG></P><UL><LI><STRONG>User-Friendly Interface:</STRONG> Graphical tool simplifies data modeling tasks.</LI><LI><STRONG>SQL-Based Development:</STRONG> Easy to understand for database developers.</LI><LI><STRONG>Mature Tool:</STRONG> Offers a wide range of features for diverse modeling needs.</LI></UL><P><STRONG>Best Fit:</STRONG> Supporting SAP BusinessObjects reporting tools with Universes.</P><P><SPAN><BR />for more information, I would recommend this&nbsp;&nbsp;<A href="https://learning.sap.com/learning-journeys/exploring-data-modeling-with-sap-solutions" target="_self" rel="noopener noreferrer">Learning journey</A>&nbsp; from SAP which will give you an overview of all the SAP data modeling solutions&nbsp;<span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:">😊</span></SPAN></P><P>&nbsp;</P><P>&nbsp;</P><P><SPAN><!-- notionvc: 5ddaf2db-05cb-4914-8c1b-ab9fad69323a --></SPAN></P> 2024-05-02T16:25:43.459000+02:00 https://community.sap.com/t5/technology-blogs-by-sap/tracking-hana-machine-learning-experiments-with-mlflow-a-technical-deep/ba-p/13692481 Tracking HANA Machine Learning experiments with MLflow: A technical Deep Dive 2024-05-08T17:00:00.007000+02:00 martinboeckling https://community.sap.com/t5/user/viewprofilepage/user-id/43098 <H1 id="toc-hId-865290017">Introduction</H1><P><SPAN><SPAN class="">This blog post is part of a series describing the usage of MLflow with HANA Machine Learning co-authored by &nbsp;<a href="https://community.sap.com/t5/user/viewprofilepage/user-id/39047">@stojanm</a>&nbsp;and <a href="https://community.sap.com/t5/user/viewprofilepage/user-id/43098">@martinboeckling</a>.</SPAN> In this blog post we provide a more technical deep dive on the setup of a MLFlow instance and provide a general introduction how Machine Learning models trained with HANA ML can be logged with MLflow. The first blog post of the blog series is called&nbsp;<A href="https://community.sap.com/t5/technology-blogs-by-sap/tracking-hana-machine-learning-experiments-with-mlflow-a-conceptual-guide/ba-p/13688478" target="_self">Tracking HANA Machine Learning experiments with MLflow: A Conceptual Guide for MLOps</A>&nbsp;and gives an introduction to the topic of MLOps with MLflow.</SPAN></P><P>Starting with the python HANA ML package version 2.13, HANA Machine Learning added support for tracking of experiments with the MLflow package, which makes the incorporation of models developed using HANA Machine Learning into a comprehensive MLOps pipeline easy to achieve.&nbsp;</P><P>In this blog post we will provide an overview how MLflow can be used together with HANA ML. MLflow, which manages the experiment tracking and artefact management can run as a managed service at a hyperscaler platform, deployed locally or on a remote infrastructure. In the following we describe how to deploy MLflow on SAP Business Technology Platform &nbsp;and how to track your HANA machine learning experiments with MLFlow. In addition, we present which methods and algorithms in the hana ml package currently support the experiment tracking feature. Finally, we touch on the possibility to use logged models in MLflow for prediction.</P><H1 id="toc-hId-668776512">Prerequisites</H1><P>In this blog post we solely focus on the technical integration of HANA ML and MLflow as a logging platform. Generally, we assume that Python is already installed together with an already established development environment. Furthermore, we will not completely explain all details of docker and Cloud Foundry, but simply focus on the essential parts for HANA ML and MLFlow within this blog post.</P><H1 id="toc-hId-472263007">Set up MLFlow on BTP</H1><P><SPAN>MLFlow is leveraged and integrated in different solutions. For example Databricks as well Machine Learning in Microsoft Fabric integrate or provide a managed MLflow instance. In case MLFlow is not yet provided, we outline in this section a possibility to deploy MLflow in SAP BTP. We focus for simplicity reasons on the SQLite based deployment of MLflow. However, for productive environments it is recommended to separate the storage from the runtime of the MLFlow instance. A detailed explanation for setting up your own MLFlow server with alternatives to SQLite can be found under the following&nbsp;</SPAN><SPAN>link:&nbsp;<A href="https://mlflow.org/docs/latest/tracking/server.html" target="_blank" rel="noopener nofollow noreferrer">https://mlflow.org/docs/latest/tracking/server.html</A>. In the following paragraphs, we focus on a step by step overview to set up your own MLFlow instance using SQLite in BTP.</SPAN></P><P>As a first step we want to create a local docker file which can be used to upload it to our BTP environment. In the following code snippet, we provide the coding used to construct your own docker container locally. For that, paste the following code into a file called Dockerfile within your desired local folder.</P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-bash"><code># Retrieve a python version as a base runtime for our docker container FROM python:3.10-slim # Run the pip install command for the package of mlflow RUN pip install mlflow # Create a temporary folder within our docker container to store our artifact RUN mkdir -p /mlflow # Expose the port 7000 to make our application which runs within docker accessable over the defined port EXPOSE 7000 # Define environment variables BACKEND_URI and ARTIFACT_ROOT to define the backend uri as also the # artifact root ENV BACKEND_URI sqlite:///mlflow//mlflow.db ENV ARTIFACT_ROOT /mlflow/artifacts # run the shell comand to setup our mlflow server within our docker container CMD mlflow server --backend-store-uri ${BACKEND_URI} --host 0.0.0.0 --port 7000</code></pre><P>&nbsp;</P><P>&nbsp;</P><P>After creating successfully the Docker object, you can run&nbsp;<STRONG>docker build -t {tagname}.</STRONG>&nbsp;to construct your docker container. Afterwards, the local docker image is locally built. To expose the docker image, we push the image to a docker registry. In our example, we assume that you already have a docker registry set up where you can push your image to. For that step, you can run the following commands: <STRONG>docker tag {tagname} {dockerhub repository tag}</STRONG>,&nbsp;<STRONG>docker push {</STRONG>dockerhub repository tag<STRONG>&nbsp;}.&nbsp;</STRONG>After the successful run of the command, you see within your private docker hub the newly published docker container, which contains MLflow and all its dependencies inside of it.</P><P>After the successful publishing of your docker image to your registry, we can run the following command to create a BTP app based on the published docker image:</P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-bash"><code>cf push APP-NAME --docker-image REPO/IMAGE:TAG</code></pre><P>&nbsp;</P><P>&nbsp;</P><P>After successfully publishing the docker image on our BTP Cloud Foundry environment, we can find our published app within our BTP account and are able to access&nbsp;it under the published URL.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="MLFlow Initial UI.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/106232iB3F8015926221314/image-size/large?v=v2&amp;px=999" role="button" title="MLFlow Initial UI.png" alt="MLFlow Initial UI.png" /></span></P><H2 id="toc-hId-404832221"><SPAN>Set up tracking for MLflow</SPAN></H2><P>With MLflow users have the possibility to track their trained HANA ML models. In the following paragraph, we introduce the aspects that are needed to be able to log HANA ML models into MLflow itself.&nbsp;</P><P>To be able to use MLFlow together with HANA ML, we need to first install besides the HANA ML package also the MLFlow package. Therefore, you need to run the following command in your virtual environment, to be able to run the following scripts.</P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-bash"><code>pip install mlflow hana-ml</code></pre><P>&nbsp;</P><P>&nbsp;</P><P>As a general setup, we first need to run the following command to set up our tracking with MLFlow to our available MLFlow instance. Therefore, place into the following two lines first your personal MLFlow tracking URI and your own custom experiment. In case you do not want to create a separate experiment, the different runs together with the MLFlow model are stored under the default experiment.</P><P>The method that allows us to track HANA ML models is implemented in the HANA ML package and is called enable_mlflow_autologging(schema=None, meta=None, is_exported=False, registered_model_name=None). This method can be used for initialised HANA ML models that are under the following methods:</P><UL><LI><A href="https://help.sap.com/doc/1d0ebfe5e8dd44d09606814d83308d4b/2.0.07/en-US/pal/algorithms/hana_ml.algorithms.pal.auto_ml.AutomaticClassification.html#hana_ml.algorithms.pal.auto_ml.AutomaticClassification.enable_mlflow_autologging" target="_blank" rel="noopener noreferrer">AutomaticClassification</A></LI><LI><A href="https://help.sap.com/doc/1d0ebfe5e8dd44d09606814d83308d4b/2.0.07/en-US/pal/algorithms/hana_ml.algorithms.pal.auto_ml.AutomaticRegression.html#hana_ml.algorithms.pal.auto_ml.AutomaticRegression.enable_mlflow_autologging" target="_blank" rel="noopener noreferrer">AutomaticRegression</A></LI><LI><A href="https://help.sap.com/doc/1d0ebfe5e8dd44d09606814d83308d4b/2.0.07/en-US/pal/algorithms/hana_ml.algorithms.pal.auto_ml.AutomaticTimeSeries.html#hana_ml.algorithms.pal.auto_ml.AutomaticTimeSeries.enable_mlflow_autologging" target="_blank" rel="noopener noreferrer">AutomaticTimeSeries</A></LI><LI><A href="https://help.sap.com/doc/1d0ebfe5e8dd44d09606814d83308d4b/2.0.07/en-US/pal/algorithms/hana_ml.algorithms.pal.pipeline.Pipeline.html#hana_ml.algorithms.pal.pipeline.Pipeline.enable_mlflow_autologging" target="_blank" rel="noopener noreferrer">Pipeline</A></LI><LI><A href="https://help.sap.com/doc/1d0ebfe5e8dd44d09606814d83308d4b/2.0.07/en-US/pal/algorithms/hana_ml.algorithms.pal.unified_classification.UnifiedClassification.html#hana_ml.algorithms.pal.unified_classification.UnifiedClassification.enable_mlflow_autologging" target="_blank" rel="noopener noreferrer">Unified_Classification</A></LI><LI><A href="https://help.sap.com/doc/1d0ebfe5e8dd44d09606814d83308d4b/2.0.07/en-US/pal/algorithms/hana_ml.algorithms.pal.unified_regression.UnifiedRegression.html#hana_ml.algorithms.pal.unified_regression.UnifiedRegression.enable_mlflow_autologging" target="_blank" rel="noopener noreferrer">Unified_Regression</A></LI></UL><P>Within the method enable_mlflow_autologging the user has different keywords that can be filled that allows us to influence the behaviour of our MLFlow autologging in HANA ML.</P><UL><LI>schema: Defines the HANA database schema for MLFlow autologging where the MLflow logging table is stored</LI><LI>meta: Defines the name of the model storage table in HANA database</LI><LI>is_exported: Determines if the hana model binaries should be exported to MLflow</LI><LI>registered_model_name: Name of the model stored in MLflow</LI></UL><P>In the following section we provide an overview for the Unified Interface how the logging of MLflow can be used.</P><H1 id="toc-hId-79235997">Run HANA ML Algorithms with MLflow</H1><P>As we have explained and outlined in the sections above, we have created a MLFlow instance and have introduced the syntax that is needed for the logging of HANA ML models in MLflow. In the following sections we will provide based on an example how the logging of HANA ML models on MLflow is done.</P><H2 id="toc-hId-11805211">Model training of HANA ML with MLFlow</H2><P>For the training of HANA ML in combination with MLflow, we focus in this blog post on the Unified Method. We apply for the respective elements a Classification on the sample bank dataset which can be found under the&nbsp;<A href="https://github.com/SAP-samples/hana-ml-samples/blob/main/Python-API/pal/datasets/bank-additional-full-with-header.csv" target="_blank" rel="noopener nofollow noreferrer">HANA ML sample dataset folder on GitHub</A>.</P><P>The dataset can either be uploaded directly to the SAP HANA database or you could also use SAP Datasphere as your starting point. Generally, to use HANA ML directly you would need to store the dataset in a HANA database. However, HANA ML also provides methods to integrate third party files/ data structures. This involves Pandas, Spark as also shapefiles. In addition also HANA Data Lake file tables can be integrated with HANA ML functionalities. An overview of the different methods can be found under the&nbsp;<A href="https://help.sap.com/doc/1d0ebfe5e8dd44d09606814d83308d4b/2.0.07/en-US/hana_ml.dataframe.html" target="_blank" rel="noopener noreferrer">following page</A>. In the following paragraphs, we will go through the sample code that we have created to combine HANA ML and MLFlow.</P><H2 id="toc-hId--184708294">Connect to HANA database (Deployed under SAP Datasphere)</H2><P>To be able to connect to the HANA database instance, we first need to build up a connection to the HANA database. In our example, we load the data from the data samples provided by HANA ML. During the time of this blog post, the OpenSQL schema of Datasphere only supports Basic Authentication. Therefore, in this blog post we only elaborate how the connection is done over basic authentication. SAP HANA standalone supports however non-basic authentication, which are also supported in the HANA ML package to connect certificate based to the SAP HANA instance.</P><P>To establish the connection to the HANA database, we make use of the implemented HANA ML dataframe class and call the method ConnectionContext. We store the instance of the connection in the variable&nbsp;<STRONG>conn</STRONG>. To now be able to establish the connection to the HANA database view or table, we will need to specify over the method table the connection. The beautiful aspect is that overall, the dataset is not going to be loaded to the Python runtime, but will only be represented with a proxy to the actual table in the HANA database. All transformations, if done over the methods of HANA ML, are then pushed down to the database itself and executed there if the training is executed. In our case, we load the sample dataset into our database by making use of the provided methods of the HANA ML package.</P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-python"><code>""" This script provides a short example how HANA ML and MLFlow can be integrated together. The credentials to the database are following the currently supported authentification (Basic) of the SAP Datasphere OpenSQL schema. Overall, HANA Cloud standalone is also able to support multiple other authentification methods. We have used an abstraction python file (constants) where we retrieve the securely stored authentification properties. To get more details about the exact method structure needed, please have a look at the documentation: https://help.sap.com/doc/1d0ebfe5e8dd44d09606814d83308d4b/2.0.07/en-US/hana_ml.dataframe.html#hana_ml.dataframe.ConnectionContext """ from hana_ml import dataframe from hana_ml.algorithms.pal.unified_classification import UnifiedClassification from hana_ml.algorithms.pal.auto_ml import AutomaticClassification import mlflow from hana_ml.algorithms.pal.auto_ml import Preprocessing from hana_ml.algorithms.pal.partition import train_test_val_split from constants import db_url, db_user, db_password # dataset retrieval conn = dataframe.ConnectionContext(address=db_url, port=443, user=db_user, password=db_password) dataset_data, training_data, _, test_data = DataSets.load_bank_data(connection=conn, schema=schema_name, train_percentage=0.7, valid_percentage=0, test_percentage=0.3, seed=43)</code></pre><P>&nbsp;</P><P>&nbsp;</P><P>After connecting to the database, the user is able to use the preprocessing methods implemented in HANA ML. Generally, the different changes are pushed down to the HANA database and are not executed within the Python runtime. In our use case, we do not need to use the data preprocessing as we directly retrieve a sample dataset which we can directly use for our ML training.</P><P>After finishing the potentially needed transformations, we are now able to implement the tracking of our HANA ML runs with the possibility of MLFlow. Similar to the normal usage of MLFlow, we set up first our tracking uri under which we want to store our HANA ML runs and models. In your case you would need to change the keyword <STRONG>mlflow_tracking_uri</STRONG> with your respective MLflow tracking URL. Furthermore, we then are able to specify the experiment name under which the runs are tracked. If we do not specify a specific experiment, the runs are tracked under the Default experiment.</P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-python"><code># set up MLFlow mlflow.set_tracking_uri(mlflow_tracking_uri) mlflow.set_experiment("HANA ML Experiment")</code></pre><P>&nbsp;</P><P>&nbsp;</P><P>In the following chapters, we will provide an outline how the exact training is performed and what components are logged to MLflow.</P><H3 id="toc-hId--252139080">Unified Method</H3><P>For the example we use the implemented Hybrid Gradient Boosting Tree as a classification algorithm for our Classification. In order to perform the classification, we use the Unified Classification in order to be able to run our algorithm. On the defined variable, we then use the implemented enable_mlflow_autologging method. This allows us to directly log the model using implemented auto logging behaviour.</P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-python"><code>uc = UnifiedClassification(func="HybridGradientBoostingTree") uc.enable_mlflow_autologging() uc.fit(training_data, key="ID", label="responded")</code></pre><P>&nbsp;</P><P>&nbsp;</P><P>We call the fit method once we have initiated the HANA ML model variable and the associated autologging for MLflow. For the fit method, we have in total two different options. Firstly, the non-partitioned training dataset where we only use the training dataset. If we decide to partition our training dataset, we allow to create a validation dataset for which we can log metrics automatically during training.</P><P>If we do not define for our fit function the partitioning, we will not log metrics within MLFlow. In the following image, you can see how a potential HANA ML tracked run looks like in MLFlow together with the stored HANA ML model in MLflow.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="MLflow Initial Model.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/107009i7D8C6FCD09145880/image-size/large?v=v2&amp;px=999" role="button" title="MLflow Initial Model.png" alt="MLflow Initial Model.png" /></span></P><P><SPAN>If we decide to partition our dataset, here for instance to partition the dataset along the defined primary key, we are able to directly log evaluation metrics relevant for the Classification we have used. This includes the following metrics: AUC, Recall, Precision, F1 Score, Accuracy, Kappa coefficient and the Mathews Correlation Coefficient (MCC). This would directly allow us to compare multiple runs within our MLFlow project to one another and measure the different performances.</SPAN></P><P><FONT face="inherit"><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="MLFlow Metric Model.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/107015i7FB44324969988A4/image-size/large?v=v2&amp;px=999" role="button" title="MLFlow Metric Model.png" alt="MLFlow Metric Model.png" /></span></FONT></P><P><FONT face="inherit">&nbsp;In addition to the general run, HANA ML also logs the model to MLflow. What is logged to MLflow depends on the parameters set&nbsp;for the method </FONT><STRONG>enable_mlflow_autologging</STRONG><FONT face="inherit">. If for instance everything is set to the default settings, we will see the following yaml file to be logged </FONT>to MLflow.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="MLflow model.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/107027i73AC9FF7204BAD74/image-size/large?v=v2&amp;px=999" role="button" title="MLflow model.png" alt="MLflow model.png" /></span></P><P>&nbsp;<SPAN>If within the method&nbsp;</SPAN><STRONG>enable_mlflow_autologging </STRONG><FONT face="inherit">the parameter is set to is_exported, the model binaries stored in the model storage on HANA are exported to MLflow. This setting would allow us to </FONT>retrieve<FONT face="inherit">&nbsp;the trained model from MLflow and use it in a different HANA database for prediction purposes. In addition to the yaml file containing the metadata we now can see a created subfolder called models which contains the necessary model </FONT>artefacts<FONT face="inherit">&nbsp;normally stored in the HANA database now in MLflow.</FONT></P><P><FONT face="inherit"><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="MLflow exported model.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/107028i5B476B0754A68F6C/image-size/large?v=v2&amp;px=999" role="button" title="MLflow exported model.png" alt="MLflow exported model.png" /></span></FONT></P><P><FONT face="inherit">After the training is finished, we have </FONT><SPAN>besides the auto logging capabilities of HANA ML for MLflow the possibility to track further artefacts in MLflow. In the following section we will outline a few possibilities that exist with the additional tracking.</SPAN></P><H2 id="toc-hId--577735304">Additional logging possibilities</H2><P>Besides the outlined auto logging capabilities, we can track with MLFlow additional artefacts to the respective run. In the following chapters, we outline selected possibilities to further enrich the auto logging for HANA ML runs tracked in MLFlow.</P><H3 id="toc-hId--645166090">Adding run and experiment description</H3><P><SPAN>The description in the experiment section can be handy once the number of your experiments grows in the repository. In addition, mlflow allows to also add individual description to each run of an experiment. Using the following methods you can set up both:</SPAN></P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-python"><code>from mlflow.tracking import MlflowClient current_experiment=dict(mlflow.get_experiment_by_name("HANA ML Experiment")) experiment_id=current_experiment['experiment_id'] run = mlflow.active_run() MlflowClient().set_experiment_tag(experiment_id,"mlflow.note.content", "This experiment shows the automated methods of HANA machine learning and how to track them with MLFLOW") MlflowClient().set_tag(run.info.run_id, "mlflow.note.content", "This is a run tracked with Unified Classification from HANA Machine Learning")</code></pre><P>&nbsp;</P><P>&nbsp;</P><H3 id="toc-hId--916910964">Logging input datasets</H3><P><SPAN>Sometimes it is important to keep the input dataset also as part of the tracking with MLflow. Since HANA machine learning datasets are located in HANA, they need to be converted to pandas DataFrames to be tracked as shown in the following code:</SPAN></P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-python"><code># Store training dataset in MLFlow itself pandas_training_dataset = training_data.collect() mlflow_dataset = mlflow.data.from_pandas(pandas_training_dataset, name="Customer data", targets="LABEL") mlflow.log_input(mlflow_dataset, context='training')</code></pre><P>&nbsp;</P><P>&nbsp;</P><P><SPAN>This results in the change, that the respective state of the training data is logged to the current run. The logged dataset can be found in the associated MLflow run, where the schema of the dataset is provided together with some metadata information about the number of rows and number of elements. In addition, also the provided context is marked in the UI of MLflow.</SPAN></P><P><SPAN><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="2024-05-07_16-02-25.png" style="width: 799px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/106929iF8F82FDDFDF435A7/image-size/large?v=v2&amp;px=999" role="button" title="2024-05-07_16-02-25.png" alt="2024-05-07_16-02-25.png" /></span></SPAN></P><H3 id="toc-hId--1113424469"><SPAN>Logging a model report</SPAN></H3><P><SPAN>In addition to the logging of the dataset, it might also be important to add a model report to MLFlow. HANA ML generally provides different interactive visualisations for the trained model artefact, which can be stored as an HTML file. After the storing of the model report to your local repository, we can log the input of the model report to our current run. This allows us to interactively explore the model report automatically generated by HANA ML and make it accessible in MLFlow. To log the HANA ML model report, you can use the following code snippet.</SPAN></P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-python"><code># create additional model report in MLFlow UnifiedReport(uc).display(save_html="UnifiedReport") mlflow.log_artifact("UnifiedReport_unified_classification_model_report.html")</code></pre><P>&nbsp;</P><P>&nbsp;</P><P><SPAN>After the Model report is stored successfully under the current run, we can see in the artefact&nbsp;tab in MLFlow the interactive model report:</SPAN></P><P><SPAN><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="artifact_mlflow.gif" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/107064i48983C52AA76D768/image-size/large?v=v2&amp;px=999" role="button" title="artifact_mlflow.gif" alt="artifact_mlflow.gif" /></span></SPAN></P><P>&nbsp;<SPAN>The complete script used for this section can be found in the following code snippet:</SPAN></P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-python"><code>from hana_ml import dataframe from hana_ml.algorithms.pal.unified_classification import UnifiedClassification from hana_ml.visualizers.unified_report import UnifiedReport import mlflow from hana_ml.algorithms.pal.utility import DataSets from constants import db_url, db_user, db_password # dataset retrieval conn = dataframe.ConnectionContext(address=db_url, port=443, user=db_user, password=db_password) dataset_data, training_data, _, test_data = DataSets.load_bank_data(connection=conn, schema=schema_name, train_percentage=0.7, valid_percentage=0, test_percentage=0.3, seed=43) # set up MLflow mlflow.set_tracking_uri(tracking_uri) mlflow.set_experiment("HANA ML Experiment") # set up classification uc = UnifiedClassification(func="HybridGradientBoostingTree") uc.enable_mlflow_autologging(is_exported=True) # train model uc.fit(training_data, key="ID", label="LABEL", partition_method="stratified", stratified_column="ID", partition_random_state=43, build_report=True) # create additional model report in MLFlow UnifiedReport(uc).display(save_html="UnifiedReport") mlflow.log_artifact("UnifiedReport_unified_classification_model_report.html") # Store training dataset in MLFlow itself pandas_training_dataset = training_data.collect() mlflow_dataset = mlflow.data.from_pandas(pandas_training_dataset, name="Customer data", targets="LABEL") mlflow.log_input(mlflow_dataset, context='training')</code></pre><P>&nbsp;</P><P>&nbsp;</P><H2 id="toc-hId--1016534967">Apply of trained model</H2><P>After we have finished our training, we are able with HANA ML to retrieve the model from MLFLow and use it for our prediction purposes. For this purpose, we will create a separate Python script where we will provide an overview to retrieve the trained MLflow model.</P><P>Similar to our training script, we first set up our connection to the HANA database and establish the connection to our table. In our case, we simply use the sample dataset provided by HANA ML.</P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-python"><code>from hana_ml import dataframe from hana_ml.algorithms.pal.unified_classification import UnifiedClassification from hana_ml.visualizers.unified_report import UnifiedReport import mlflow from hana_ml.algorithms.pal.utility import DataSets from constants import db_url, db_user, db_password # dataset retrieval conn = dataframe.ConnectionContext(address=db_url, port=443, user=db_user, password=db_password) dataset_data, training_data, _, test_data = DataSets.load_bank_data(connection=conn, schema=schema_name, train_percentage=0.7, valid_percentage=0, test_percentage=0.3, seed=43)</code></pre><P>&nbsp;</P><P>&nbsp;</P><P><SPAN>Similar to our training script, we need to set the tracking url for MLflow and need to initiate the model storage of HANA. If we have decided to not export the HANA ML model to MLflow, we need to specify the same schema for the model storage where our HANA ML model is stored after the successful run. In case we have exported our model, we are able to specify a different schema. In the following, you can see the necessary script in order to retrieve the logged HANA ML model from MLflow.</SPAN></P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-python"><code># set up MLFlow and model storage mlflow.set_tracking_uri(tracking_url) model_storage = ModelStorage(connection_context=conn, schema=schema_name)</code></pre><P>&nbsp;</P><P>&nbsp;</P><P>After the model storage has been initiated, we are able to retrieve the stored HANA ML model from MLflow. In order to select the correct model, you need to extract the correct run id associated to the model you would like to apply for your prediction dataset. In our case, this is the test dataset we have received from the sample dataset method. The model_uri needed for the model retrieval is consisting of the following pattern 'runs:/{run id}/model', in which you would need to exchange the run id with your respective run. For the actual retrieval of the model, we use the initiated model storage, in our case called <STRONG>model_storage</STRONG>&nbsp;and call the method <STRONG>load_mlflow_model</STRONG> to load the MLflow model to our HANA database and assign the respective proxy to our variable <STRONG>mymodel</STRONG>. The variable <STRONG>mymodel</STRONG> is then used to call the predict method in order to apply our model to our dataset. In the end we transform our prediction dataset into a Pandas DataFrame to look at the content of the created DataFrame. Normally, we could directly persist the created temporary table with the <A href="https://help.sap.com/doc/1d0ebfe5e8dd44d09606814d83308d4b/2.0.07/en-US/hana_ml.dataframe.html#hana_ml.dataframe.DataFrame.save" target="_self" rel="noopener noreferrer">save method</A> and therefore make the dataset available for further processing.</P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-python"><code># load logged run from MLflow to HANA ML logged_model = 'runs:/d8a763b7b81940598633605e447cd880/model' mymodel = model_storage.load_mlflow_model(connection_context=conn, model_uri=logged_model) dataset_data_predict = mymodel.predict(data=test_data, key="ID") # collect the predicted dataset to see content in dataframe print(dataset_data_predict.collect())</code></pre><P>&nbsp;</P><P>&nbsp;</P><P><SPAN>After running the script, you should be able to see the following terminal output, for which we can see the download of the artefact stored in MLflow and the created prediction dataset, which consists in our case of 4 columns: ID (primary key), SCORE (predicted label), CONFIDENCE (prediction confidence for applied row) and REASON_CODE (influence of individual variables to prediction output). </SPAN></P><P><SPAN><span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Terminal output MLflow HANA model.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/107043i774317219AD52360/image-size/large?v=v2&amp;px=999" role="button" title="Terminal output MLflow HANA model.png" alt="Terminal output MLflow HANA model.png" /></span></SPAN></P><P>&nbsp;<SPAN>In case we have exported our model, the output of our terminal look slightly different indicating that we also download the respective model artefacts stored additionally to the yaml file. In the following you see the complete script used for applying the model to a new dataset.</SPAN></P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-python"><code>from hana_ml import dataframe from hana_ml.model_storage import ModelStorage from hana_ml.algorithms.pal.utility import DataSets import mlflow from constants import db_url, db_user, db_password conn = dataframe.ConnectionContext(address=db_url, port=443, user=db_user, password=db_password) # full_set, diabetes_train, diabetes_test, _ = DataSets.load_diabetes_data(conn) dataset_data, training_data, _, test_data = DataSets.load_bank_data(connection=conn, schema=schema_name, train_percentage=0.7, valid_percentage=0, test_percentage=0.3, seed=43) # set up MLFlow and model storage mlflow.set_tracking_uri(tracking_uri) model_storage = ModelStorage(connection_context=conn, schema=schema_name) # load logged run from MLflow to HANA ML logged_model = 'runs:/ed7b8d4734cb42ca90c417f932957b40/model' mymodel = model_storage.load_mlflow_model(connection_context=conn, model_uri=logged_model) dataset_data_predict = mymodel.predict(data=test_data, key="ID") # collect the predicted dataset to see content in dataframe print(dataset_data_predict.collect())</code></pre><P>&nbsp;</P><P>&nbsp;</P><H1 id="toc-hId--919645465"><SPAN>Key take aways</SPAN></H1><P><SPAN>In this blog post we have showcased an end to end example how MLflow can be integrated in your HANA ML workload by providing the possibility to share and compare multiple tracked runs in MLflow. If the data is already stored in HANA, this allows you to directly interact with MLflow while being able to run your Machine Learning algorithms on data stored in the HANA database without the need to transfer your data between multiple systems. This blog covered an essential part of the automated logging capabilities of HANA ML models into MLflow.&nbsp;</SPAN></P><P>We highly appreciate your thoughts, comments and questions under this blog post. In case you want to reach out for general questions around HANA, or specifically HANA ML, don't hesitate to use the <A href="https://community.sap.com/t5/technology-q-a/qa-p/technology-questions" target="_self">Q&amp;A tool</A>&nbsp;with the respective tags that describe your question.</P> 2024-05-08T17:00:00.007000+02:00