<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Devesh Singh on Medium]]></title>
        <description><![CDATA[Stories by Devesh Singh on Medium]]></description>
        <link>https://medium.com/@deveshsin?source=rss-99fa7ef0c8a4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*t3gcFXtu_Dt1kUP_ImxQ5g.jpeg</url>
            <title>Stories by Devesh Singh on Medium</title>
            <link>https://medium.com/@deveshsin?source=rss-99fa7ef0c8a4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 07:53:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@deveshsin/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Unleash the Power of Lightweight AI: ABAP SDK for Google Cloud V1.12 is Now Generally Available]]></title>
            <link>https://medium.com/google-cloud/unleash-the-power-of-lightweight-ai-abap-sdk-for-google-cloud-v1-12-is-now-generally-available-bbaf31f714e1?source=rss-99fa7ef0c8a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/bbaf31f714e1</guid>
            <category><![CDATA[abap-sdk-for-google-cloud]]></category>
            <category><![CDATA[sap]]></category>
            <category><![CDATA[gemma]]></category>
            <category><![CDATA[vertex-ai]]></category>
            <category><![CDATA[gemini]]></category>
            <dc:creator><![CDATA[Devesh Singh]]></dc:creator>
            <pubDate>Thu, 09 Oct 2025 03:36:22 GMT</pubDate>
            <atom:updated>2025-10-09T03:36:22.591Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UVBqXFqM4ElHrcSdsGSWYg.png" /></figure><p>We’re excited to announce the General Availability of <a href="https://cloud.google.com/sap/docs/abap-sdk/on-premises-or-any-cloud/whats-new#version-1-12"><strong>ABAP SDK for Google Cloud V1.12</strong></a> for the on-premises and any cloud editions! This new version brings powerful enhancements to your generative AI development in ABAP, offering developers more control, transparency, and access to new open models.</p><p>This release is focused on giving you fine-grained control over your AI applications, moving them from experimental prototypes to reliable, enterprise-grade solutions built right within your SAP system.</p><h3><strong>Key Features in ABAP SDK for Google Cloud V1.12</strong></h3><p>Version 1.12 introduces new features that enhance model choice and provide deeper insights into the model’s reasoning process.</p><h4><strong>1. New Model Support: Integrate Google’s Lightweight Gemma Models</strong></h4><p>We are expanding your generative AI options by introducing <a href="https://cloud.google.com/sap/docs/abap-sdk/on-premises-or-any-cloud/latest/vertex-ai-sdk/invoke-gemma-models">support for <strong>Gemma models</strong></a> through the SDK.</p><p><a href="https://ai.google.dev/gemma/docs"><strong>Gemma</strong></a> is a family of <strong>lightweight, state-of-the-art open models</strong> developed by Google DeepMind. These models are derived from the same research and technology used to create the Gemini models, offering a smaller, efficient, and open-weight alternative.</p><p>This addition means you can now:</p><ul><li><strong>Process Sensitive Data Securely:</strong> You can deploy and host the Gemma models directly within your own <strong>Google Cloud Project</strong>. This localization allows you to derive insights from highly <strong>sensitive or regulated data</strong> without needing to send it to a shared or external model endpoint.</li><li><strong>Innovate More Efficiently:</strong> Leverage Gemma’s speed and efficiency for tasks like text generation, summarization, and question-answering in resource-conscious applications.</li><li><strong>Widen Your AI Portfolio:</strong> Choose the optimal model — whether it’s Gemini for complex, state-of-the-art multi-modal tasks or Gemma for streamlined, focused text generation — based on your specific SAP use case requirements.</li></ul><p>You can access and invoke Gemma models deployed on <a href="https://cloud.google.com/sap/docs/abap-sdk/on-premises-or-any-cloud/latest/vertex-ai-sdk/invoke-gemma-models#vertex-ai-model-garden"><strong>Google’s Vertex AI</strong></a> as well as <a href="https://cloud.google.com/sap/docs/abap-sdk/on-premises-or-any-cloud/latest/vertex-ai-sdk/invoke-gemma-models#cloud-run"><strong>Google Cloud Run</strong></a> using ABAP classes available with the SDK.</p><h4><strong>2. Control Randomness for with the Seed Parameter for Consistent Outputs from Gemini models</strong></h4><p>For many enterprise applications, consistency is key. Whether you’re generating standardized reports, running tests, or ensuring compliance, you need predictable AI results.</p><p>With V1.12, you can now <strong>control the randomness of Gemini’s output</strong> by <a href="https://cloud.google.com/sap/docs/abap-sdk/on-premises-or-any-cloud/latest/vertex-ai-sdk/invoke-gemini-models#control-randomness-model-output"><strong>setting the seed parameter</strong></a>.</p><ul><li><strong>Deterministic Results:</strong> By providing a specific seed value, the model’s output becomes predictable and reproducible, making it easier to debug, test, and deploy AI-powered features in production.</li><li><strong>Reliable Testing:</strong> Run the same prompt multiple times and consistently receive the same response, drastically simplifying your quality assurance (QA) processes for AI-driven ABAP applications.</li></ul><h4><strong>3. Gain Insight into Gemini’s Reasoning with the Thinking Configuration</strong></h4><p>Generative AI models can sometimes feel like a “black box.” To address this, we’ve introduced the ability to get <strong>deeper insights into Gemini’s decision-making process</strong>.</p><p>By <a href="https://cloud.google.com/sap/docs/abap-sdk/on-premises-or-any-cloud/latest/vertex-ai-sdk/invoke-gemini-models#set-thinking-config"><strong>setting the thinking configuration</strong></a>, you can instruct the model to include its internal “thoughts” or reasoning steps within its response. This powerful feature enables:</p><ul><li><strong>Transparency and Trust:</strong> Understand why the model provided a certain response, which is crucial for compliance and business process validation.</li><li><strong>Better Prompt Engineering:</strong> Analyze the model’s internal processing to refine your prompts and achieve more targeted, accurate business outcomes.</li><li><strong>Resource Management:</strong> You can also specify the <strong>maximum number of tokens</strong> the model can use for this internal thought process, allowing you to manage the complexity and overall size of the response payload.</li></ul><h3><strong>Get Started Today!</strong></h3><p>The ABAP SDK for Google Cloud V1.12 is now available and ready to power your next generation of AI-driven SAP applications.</p><p><strong>Existing Users:</strong> <a href="https://cloud.google.com/sap/docs/abap-sdk/on-premises-or-any-cloud/latest/install-config#abap-sdk-update"><strong>Upgrade</strong></a> your current ABAP SDK to V1.12 to immediately take advantage of these new features.</p><p><strong>New Users:</strong> Visit our official documentation to <a href="https://cloud.google.com/sap/docs/abap-sdk/on-premises-or-any-cloud/latest/install-config#abap-sdk-install"><strong>start your installation</strong></a> and configuration journey.</p><p>We’re committed to continually enhancing the ABAP SDK to bring you the full power of Google Cloud and Vertex AI directly into your SAP landscape. Start building smarter, more reliable, and more insightful ABAP applications today!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bbaf31f714e1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/unleash-the-power-of-lightweight-ai-abap-sdk-for-google-cloud-v1-12-is-now-generally-available-bbaf31f714e1">Unleash the Power of Lightweight AI: ABAP SDK for Google Cloud V1.12 is Now Generally Available</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlock free access to Gemini 2.0 from SAP applications]]></title>
            <link>https://medium.com/google-cloud/unlock-free-access-to-gemini-2-0-from-sap-applications-fcd9dfd746a1?source=rss-99fa7ef0c8a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/fcd9dfd746a1</guid>
            <category><![CDATA[abap-sdk-for-google-cloud]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[abap]]></category>
            <category><![CDATA[gemini]]></category>
            <category><![CDATA[sap]]></category>
            <dc:creator><![CDATA[Devesh Singh]]></dc:creator>
            <pubDate>Thu, 20 Feb 2025 08:37:25 GMT</pubDate>
            <atom:updated>2025-02-20T15:53:00.383Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6jJVBkxAfzrFbw6TMWO_SA.jpeg" /></figure><h3><strong>Introduction</strong></h3><p>The advent of large language models (LLMs) like Google’s<a href="https://deepmind.google/technologies/gemini/"> Gemini 2.0</a> [<a href="https://blog.google/technology/google-deepmind/google-gemini-ai-update-december-2024/#ceo-message">Launch Message</a>] presents exciting possibilities for enhancing SAP applications/Agents with AI-powered capabilities. However, many SAP developers might be deterred by the perceived complexities and costs associated with cloud projects and service deployments. This blog post demonstrates how to invoke the Gemini models including the recent<a href="https://cloud.google.com/vertex-ai/generative-ai/docs/gemini-v2#20_models"> Gemini 2.0 Flash</a> model directly from your SAP ABAP environment without needing a Google Cloud project or incurring any direct costs.</p><p>We will achieve this by leveraging Google’s<a href="https://ai.google.dev/api?lang=swift"> Gemini API</a> (Generative Language API) through<a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/overview"> ABAP SDK for Google Cloud</a>. ABAP SDK for Google Cloud brings the power of Google Cloud to SAP developers in the programming language of their choice <a href="https://training.sap.com/content/abap-programming-training">— ABAP</a>. The SDK is available as a set of client libraries in the form of ABAP classes. Using these classes, ABAP developers can connect to and use Google Cloud APIs across AI/ML, enterprise, maps and workspace APIs.</p><h4><strong>Using API Keys for Simplified Access</strong></h4><p>Google’s Gemini API offers a streamlined way to interact with Gemini models using API Keys. This approach eliminates the need for complex service account setups and project configurations, making it ideal for prototyping and proof-of-concepts.</p><h4><strong>Prerequisites</strong></h4><ol><li><strong>SAP System with ABAP SDK for Google Cloud:</strong> Ensure your SAP system has the latest version of the ABAP SDK for Google Cloud installed and configured. Refer to the <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/overview">official Google Cloud documentation</a> for installation instructions for <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/on-premises-or-any-cloud/latest/install-config">on premise</a> or <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/btp/latest/install-config">BTP</a>.</li><li><strong>Google Account (Free Tier):</strong> You need a Google account (Gmail ID). The free tier provides sufficient resources for generating API Keys and exploring the Gemini API.</li><li><strong>API Key Generation:</strong> Generate an API Key for the Generative Language API. Refer to the steps <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/quick-prototyping-with-gemini#generate-api-key">here</a> to generate an API Key. Securely store this key, as you’ll need it with the SDK to invoke Gemini.</li></ol><h3><strong>Invoking Gemini 2.0 Flash from ABAP</strong></h3><p>Once you have installed and configured the SDK, make use of the ABAP class ​​/GOOG/CL_GENERATIVELANG_V1BETA shipped with the SDK to invoke Gemini API.</p><p>Setup authentication for invoking the API by following the steps below.</p><ol><li>Generate an API Key following the steps <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/quick-prototyping-with-gemini#generate-api-key">here</a> if you have not already generated it.</li><li>Setup authentication using the generated API key through either of below two ways,</li></ol><ul><li><a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/quick-prototyping-with-gemini#authenticate-api-key-stored-sap-ssf">Authenticate by using API Keys stored in SAP SSF</a>,</li><li><a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/quick-prototyping-with-gemini#authenticate-api-key-custom-auth-class">Authenticate by using an API key through a custom authentication class</a>.</li></ul><p>In this blog I would try to show a simple example use case of invoking Gemini 2.0 flash by an ABAP GenAI bot or Agent to extract the customer name, issue category and issue reported from the text of customer query. In typical business scenarios, the Agent can be a SAP function module, class method or an ODATA service with well defined input output parameters. Customer query, instructions and prompt can be the input parameters to the Agent.</p><p><strong>Customer Query -</strong></p><p><em>From: John Doe</em></p><p><em>Query: Received a broken Cymbal monster truck, initially the manufacturer offered a replacement but not shifts the responsibility to the retailer to provide the replacement. I want replacement for the broken truck.</em></p><p><strong>Instructions to the bot -</strong></p><p><em>“You are a Customer Service Agent. Your job is to review queries from customers and find out what is the issue that they are facing. Respond in JSON format in plain text without any backticks with fields “CustomerName”, “IssueCategory” and “IssueReported”. Populate the customer name in the field “CustomerName”, category of the issue from texts “REPLACEMENT”, “POOR QUALITY”, “ORDER DELAYED” in field “IssueCategory”, and summarise the issue in the query and put in the field “IssueReported”. If there are no issues, populate text “No Issues” in the field “IssueReported” and “NO ISSUES” in the field “IssueCategory”.”</em></p><p><strong>Input Prompt to the model -</strong></p><p><em>“Find out the issue in the below customer query”</em></p><p>In this blog, I will show the implementation for the Agent infused with Gemini through a simple report program.</p><pre>TYPES:<br>  BEGIN OF ty_agent_response,<br>    customer_name  TYPE string,<br>    issue_category TYPE string,<br>    issue_reported TYPE string,<br><br>  END OF ty_agent_response.<br><br>DATA lv_sys_instruction TYPE string.<br>DATA lv_client_key      TYPE /goog/keyname.<br>DATA lv_model_id        TYPE string.<br>DATA lv_prompt          TYPE string.<br>DATA lv_customer_query  TYPE string.<br>DATA ls_input           TYPE /goog/cl_generativelang_v1beta=&gt;ty_045.<br>DATA ls_agent_response  TYPE ty_agent_response.<br>DATA ls_part            TYPE /goog/cl_generativelang_v1beta=&gt;ty_068.<br>DATA lt_parts           TYPE /goog/cl_generativelang_v1beta=&gt;ty_t_068.<br>DATA ls_content         TYPE /goog/cl_generativelang_v1beta=&gt;ty_018.<br>DATA lv_err_msg         TYPE string.<br><br>lv_model_id = &#39;gemini-2.0-flash&#39;.  &quot; You can also change the Model ID of your choosing<br>lv_client_key = &#39;&lt;Client Key&gt;&#39;.    &quot; Client key configured in table /GOOG/CLIENT_KEY<br><br>lv_customer_query = |{ &#39;From: John Doe&#39; } | &amp;&amp; |{ &#39;Query: Received a broken Cymbal monster truck,&#39; } | &amp;&amp;<br>                    |{ &#39;initially the manufacturer offered a replacement but not shifts the&#39; } | &amp;&amp;<br>                    |{ &#39;responsibility to the retailer to provide the replacement.&#39; } | &amp;&amp;<br>                    |{ &#39;I want replacement for the broken truck.&#39; }|.<br><br>lv_sys_instruction  = |{ &#39;You are a Customer Service Agent. Your job is to review queries from&#39; } | &amp;&amp;<br>                      |{ &#39;customers and find out what is the issue that they are facing. Respond in&#39; } | &amp;&amp;<br>                      |{ &#39;JSON format in plain text without any backticks with fields &quot;CustomerName&quot;, &quot;IssueCategory&quot; and &quot;IssueReported&quot;.&#39; } | &amp;&amp;<br>                      |{ &#39;Populate the customer name in the field &quot;CustomerName&quot;, category of the issue&#39; } | &amp;&amp;<br>                      |{ &#39;from texts &quot;REPLACEMENT&quot;, &quot;POOR QUALITY&quot;, &quot;ORDER DELAYED&quot; in field  &quot;IssueCategory&quot;,&#39; } | &amp;&amp;<br>                      |{ &#39;and summarise the issue in the query and put in the field  &quot;IssueReported&quot;.&#39; } | &amp;&amp;<br>                      |{ &#39;If there are no issues, populate text &quot;No Issues&quot; in the field &quot;IssueReported&quot;&#39; } | &amp;&amp;<br>                      |{ &#39;and &quot;NO ISSUES&quot; in the field &quot;IssueCategory&quot;.&#39; }|.<br><br>lv_prompt = |{ &#39;Find out the issue in the below customer query&#39; } | &amp;&amp; lv_customer_query.<br><br>IF lv_sys_instruction IS NOT INITIAL.<br>  ls_input-system_instruction-role = &#39;system&#39;.<br>  ls_part-text = lv_sys_instruction.<br>  APPEND ls_part TO ls_input-system_instruction-parts.<br>  CLEAR ls_part.<br>ENDIF.<br>ls_content-role = &#39;user&#39;.<br>IF lv_prompt IS NOT INITIAL.<br>  ls_part-text = lv_prompt.<br>  APPEND ls_part TO ls_content-parts.<br>  CLEAR ls_part.<br>ENDIF.<br>APPEND ls_content TO ls_input-contents.<br>CLEAR ls_content.<br>TRY.<br>    DATA(lo_gemini_invoker) = NEW /goog/cl_generativelang_v1beta( iv_key_name = lv_client_key ).<br>    lo_gemini_invoker-&gt;generate_content_models( EXPORTING iv_p_models_id = lv_model_id<br>                                                          is_input       = ls_input<br>                                                IMPORTING es_output      = DATA(ls_output)<br>                                                          ev_ret_code    = DATA(lv_ret_code)<br>                                                          ev_err_text    = DATA(lv_err_text)<br>                                                          es_err_resp    = DATA(ls_err_resp) ).<br>    IF lo_gemini_invoker-&gt;is_success( lv_ret_code ) = abap_true.<br>      ASSIGN ls_output-candidates[ 1 ] TO FIELD-SYMBOL(&lt;ls_candidate&gt;).<br>      IF sy-subrc = 0.<br>        lt_parts = &lt;ls_candidate&gt;-content-parts.<br>        ASSIGN lt_parts[ 1 ] TO FIELD-SYMBOL(&lt;ls_part&gt;).<br>        IF sy-subrc = 0.<br>          DATA(lv_response) = &lt;ls_part&gt;-text.<br>          /goog/cl_json_util=&gt;deserialize_json( EXPORTING iv_json          = lv_response<br>                                                          iv_pretty_name   = /ui2/cl_json=&gt;pretty_mode-extended<br>                                                IMPORTING es_data          = ls_agent_response ).<br>          cl_demo_output=&gt;display( ls_agent_response ).<br>        ELSE.<br>          cl_demo_output=&gt;display( |Model stopped generating response due to finish reason: { &lt;ls_candidate&gt;-finish_reason }| ).<br>        ENDIF.<br>      ENDIF.<br>    ELSE.<br>      cl_demo_output=&gt;display( |Error occurred, reason: { lv_ret_code }:{ lv_err_text }| ).<br>    ENDIF.<br>  CATCH /goog/cx_sdk INTO DATA(lo_cx_sdk).<br>    lv_err_msg = lo_cx_sdk-&gt;get_text( ).<br>    cl_demo_output=&gt;display( |Exception occurred, reason: { lv_err_msg }| ).<br>ENDTRY.</pre><p>When run, the program outputs the response from Gemini, serialized in ABAP types, ready to be used in follow-on business logic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4F8Knn8pj5y1vNkbbQW9cg.jpeg" /></figure><h3><strong>Explore Gemini models through a demo program shipped with the SDK</strong></h3><p>Additionally you can also play around with the demo program that we ship with the SDK. Follow steps from our public documentation <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/quick-prototyping-with-gemini#run_sample_code">here</a> to run the demo program for your prompts. It also supports multimodal invocation with images, documents and videos.</p><h3><strong>Important Considerations</strong></h3><ul><li><strong>API Key Security:</strong> Protect your API Key and avoid embedding it directly in production code. Use secure configuration mechanisms.</li><li><strong>Rate Limits:</strong> Be aware of the Generative Language API’s rate limits and implement appropriate error handling.</li><li><strong>Prompt Engineering:</strong> The quality of the model’s output depends heavily on the prompt. Experiment with different prompt formats to achieve the desired results.</li><li><strong>Cost Management:</strong> While API Keys offer a cost-free entry point for exploration, monitor your API usage to ensure you stay within the free tier limits.</li></ul><h3><strong>Implementing production use cases with Gemini</strong></h3><p>While Gemini API is great for quick use cases and prototyping, we recommend you use Vertex AI API to implement your heavy production use cases to realise the true potential of Gemini models. Checkout our <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/overview">Vertex AI SDK for ABAP</a> (embedded in the latest version of ABAP SDK) to build your production SAP ABAP GenAI Applications/Agents. The SDK let’s you <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/invoke-gemini-models">invoke Gemini</a>, leverage <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/use-function-calling">SAP function calling</a>, <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/generate-embeddings">generate embeddings</a> and <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/use-vector-search">perform vector search</a> natively from your ABAP environment with two to four lines of ABAP code.</p><h3><strong>Conclusion</strong></h3><p>By leveraging the Generative Language API and API Keys, SAP ABAP developers can seamlessly integrate the power of Gemini 2.0 Flash into their applications without the need for complex cloud project setups or direct costs. This approach empowers developers to explore AI-driven functionalities and enhance their SAP solutions with intelligent GenAI Agents. Remember to consult the latest Google Cloud documentation for the most up-to-date information and best practices.</p><p>Share your experiences and feedback with us on our Google Cloud Channel (link below).</p><p><a href="https://www.googlecloudcommunity.com/gc/forums/filteredbylabelpage/board-id/cloud-developer-tools/label-name/abap%20sdk">https://www.googlecloudcommunity.com/gc/forums/filteredbylabelpage/board-id/cloud-developer-tools/label-name/abap%20sdk</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fcd9dfd746a1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/unlock-free-access-to-gemini-2-0-from-sap-applications-fcd9dfd746a1">Unlock free access to Gemini 2.0 from SAP applications</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Efficiently Migrating Excel Files to Google Sheets in Enterprise Cloud Migrations]]></title>
            <link>https://medium.com/google-cloud/efficiently-migrating-excel-files-to-google-sheets-in-enterprise-cloud-migrations-ebc07eb803da?source=rss-99fa7ef0c8a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebc07eb803da</guid>
            <category><![CDATA[abap]]></category>
            <category><![CDATA[google-sheet-api]]></category>
            <category><![CDATA[microsoft-excel]]></category>
            <category><![CDATA[sap]]></category>
            <category><![CDATA[abap-sdk-for-google-cloud]]></category>
            <dc:creator><![CDATA[Devesh Singh]]></dc:creator>
            <pubDate>Wed, 05 Feb 2025 05:18:45 GMT</pubDate>
            <atom:updated>2025-02-05T05:18:45.140Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LuV02gXcGahQQVEz3C69cw.png" /></figure><p>Enterprises migrating to Google Workspace, often from environments like Azure or Office 365, frequently encounter challenges with legacy Microsoft Excel (.xlsx) files. While Google Workspace offers powerful collaboration and accessibility, seamlessly migrating the existing Excel files (or transforming the incoming Excel files) to Google Sheets is crucial for a smooth transition.</p><p>This article explores how enterprises can leverage the <a href="https://developers.google.com/drive/api/reference/rest/v3">Google Drive API</a> to build efficient migration pipelines, specifically using the <a href="https://developers.google.com/drive/api/reference/rest/v3/files/copy">files.copy</a> method to convert .xlsx files to Google Sheets format. We’ll also demonstrate how this pipeline can be orchestrated efficiently from an SAP ABAP environment using the ABAP SDK for Google Cloud, highlighting a practical migration solution for businesses with SAP based business processes.</p><h4><strong>The Enterprise Migration Challenge — Excel in a Google Workspace World</strong></h4><ul><li><strong>Cloud Collaboration is Key:</strong> Modern enterprises rely on cloud-based solutions like Google Workspace for enhanced collaboration and accessibility.</li><li><strong>Migration Challenges:</strong> Migrating to Google Workspace from platforms like Azure/Office 365 often reveals a challenge with legacy Microsoft Excel (.xlsx) files.</li><li><strong>Excel’s Limitations in Google Drive:</strong> Uploading .xlsx files to Google Drive provides basic access but doesn’t fully leverage Google Sheets’ collaborative features.</li><li><strong>Impact on Collaboration and newer applications:</strong> This limitation can hinder the benefits of migrating to Google Workspace, leading to old habits and data silos.</li><li><strong>Going Beyond Simple Transfer:</strong> Enterprises need a strategic approach that goes beyond simple file transfer, ensuring data integrity and access to Google Sheets’ full functionality.</li></ul><blockquote><strong>A robust and automated process for converting .xlsx files to Google Sheets format is crucial for a successful transition.</strong></blockquote><h4><strong>Unlocking the Power of the Google Drive API</strong></h4><p>The Google Drive API provides programmatic access to manage files and folders within Google Drive. It’s a powerful tool for automating file operations, including migration.</p><p><a href="https://developers.google.com/drive/api/reference/rest/v3/files/copy">Files.copy</a> is the specific method within the Drive API that is the key for our migration process. It allows us to create a copy of a file, and crucially, change its MIME type during the copy process. The MIME type identifies the file’s format. By changing the MIME type from application/vnd.openxmlformats-officedocument.spreadsheetml.sheet (for .xlsx) to application/vnd.google-apps.spreadsheet (for Google Sheets), we effectively convert the file.</p><p>This presents enterprises with unique opportunities like,</p><ul><li>Direct conversion of files without the need for an intermediate format.</li><li>Preserve the original data (most of the time — some complex formatting might require adjustments).</li><li>Build automation pipelines, either through application logic or scripts and workflows.</li></ul><p>Few things to consider before designing your pipelines,</p><ul><li>Authentication: Requires proper authentication to access the Google Drive API (OAuth 2.0).</li><li>Error Handling: Implement robust error handling to manage potential issues (e.g., file not found, API quota limits).</li></ul><p>Below are the parameters that you should pass to the <a href="https://developers.google.com/drive/api/reference/rest/v3/files/copy">files.copy</a> method of the Google Drive API from you application logic.</p><ul><li><strong>fileId:</strong> ID of the XLSX file on your Google Drive (<a href="https://developers.google.com/drive/api/reference/rest/v3/files/copy#path-parameters">Path Parameter</a>)</li><li><strong>supportsAllDrives:</strong> “true” to include “My Drive” and “Shared Drives” (<a href="https://developers.google.com/drive/api/reference/rest/v3/files/copy#query-parameters">Query Parameter</a>)</li><li>Below fields in the <a href="https://developers.google.com/drive/api/reference/rest/v3/files/copy#request-body"><strong>request body</strong></a>,</li></ul><ol><li><strong>mimeType:</strong> ‘application/vnd.google-apps.spreadsheet’ which is Mime Type of Google Sheets</li><li><strong>name:</strong> user specified File Name of the Google Sheet to which XLSX content would be copied to</li><li><strong>parents[]:</strong> Append Folder ID of the Google Drive folder where the Google Sheet is to be placed</li></ol><p>You can skip passing the name in the request body if you want to create the Google Sheet with the same name as the XLSX file.</p><p>You can skip passing parents in the request body if you would like to create the Google Sheet in the same folder as your XLSX file is in (a prefix Copy of would be added to the new file).</p><h4><strong>Building the Migration Pipeline</strong></h4><p>To efficiently build your migration pipelines, you can task an <strong>“Agent”</strong> to perform or orchestrate the file conversion.</p><blockquote><strong>An agent is an application that attempts to achieve a goal as described through application logic, using the tools that it has at it’s disposal.</strong></blockquote><p>Here the task or the goal of the Agent is to efficiently copy the xlsx files as Google Sheets and the tool that it has is the Google Drive API’s copy files method.</p><p>For an enterprise, the Agent to realise this use case can be,</p><ul><li>Either an automation application scheduled to run at a frequency or an event, or</li><li>A script scheduled to run at frequency or an event.</li></ul><p>Below is an enterprise architecture showcasing an Agent to orchestrate Microsoft Excel migration to Google Sheets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GHedWYouQrJclXxu" /></figure><p>Application logic for the Agent can be,</p><ul><li>Take a <strong>source Google Drive ID</strong> as input which has the Microsoft Excel files,</li><li>Take a <strong>target Google Drive ID</strong> as input to place the copy Google Sheet files,</li><li>List the File IDs of the excel files at the source Google Drive using <a href="https://developers.google.com/drive/api/reference/rest/v3/files/list">files.list</a> method of the Google Drive API,</li><li>Iterate the list of IDs for excel files to invoke <a href="https://developers.google.com/drive/api/reference/rest/v3/files/copy">files.copy</a> method of the Google Drive API by passing the parameters as described in the article before,</li><li>Handle any errors from the API (authentication issues, quota limits, etc.) and log them either in Google Cloud Logging or at your enterprise logging platform.</li></ul><p>Choose to run the Agent in batches (background jobs) to improve performance and reduce API call overhead.</p><h4><strong>SAP ABAP Integration: Orchestrating the Migration from Your ERP</strong></h4><p>Many enterprises rely heavily on SAP for managing core business processes. Integrating the Excel to Google Sheets migration pipeline with SAP offers significant advantages:</p><ul><li><strong>Centralized Control:</strong> Manage the migration directly from within the SAP environment.</li><li><strong>Automation:</strong> Trigger the migration based on SAP events (e.g., file uploads, scheduled jobs).</li><li><strong>Simplified Workflow:</strong> Streamline the migration process and integrate it seamlessly into existing business workflows.</li><li><strong>Improved Data Governance:</strong> Ensures that Excel files are migrated and integrated into Google Sheets according to established SAP specific business rules.</li></ul><p>The <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/on-premises-or-any-cloud/whats-new">ABAP SDK for Google Cloud</a> provides a set of tools and libraries for ABAP developers to interact with Google Cloud services, including the <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/btp/latest/reference/googcl_drive_v3">Google Drive API</a> which can be used as a tool to build a SAP ABAP based Agent to realise efficient conversion of your existing and incoming excel files to Google Sheets.</p><p>Below is an architecture to show ABAP based Agent performing your migration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vTmfsdVYZt_J92rP" /></figure><p>To build the Agent in SAP, you would have to,</p><ul><li><a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/on-premises-or-any-cloud/latest/install-config#abap-sdk-install">Install</a> and <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/on-premises-or-any-cloud/latest/install-config#configure_sap_security_settings">configure security settings</a> of the ABAP SDK for Google Cloud,</li><li><a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/on-premises-or-any-cloud/latest/authentication-oauth-client-credentials">Configure OAuth 2.0 based authentication</a> to invoke Google Drive API,</li><li>Pick authorization scopes for your enterprise from the <a href="https://developers.google.com/drive/api/reference/rest/v3/files/copy#authorization-scopes">list here</a> to maintain in <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/on-premises-or-any-cloud/latest/authentication-oauth-client-credentials#oauth_setup_client_profile">OAuth profile in SAP</a>,</li><li><a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/on-premises-or-any-cloud/latest/authentication-oauth-client-credentials#validate-auth-config">Validate authentication configuration</a> by running the authentication validator tool shipped with the SDK.</li></ul><p>Once you have setup the SDK to invoke Google Drive, you can build the application logic for the Agent using the method <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/btp/latest/reference/googcl_drive_v3#copy_files"><strong>COPY_FILES</strong></a> of SDK shipped class <strong>/GOOG/CL_DRIVE_V3</strong>. Below is the code snippet to show you the API invocation through the SDK class natively from the ABAP application layer.</p><pre>DATA:<br>  lv_q_supportsalldrives TYPE string,<br>  lv_p_file_id           TYPE string,<br>  ls_input               TYPE /goog/cl_drive_v3=&gt;ty_010.<br><br>TRY.<br><br>* Open HTTP Connection<br>    DATA(lo_client) = NEW /goog/cl_drive_v3( iv_key_name = &#39;&lt;Client Key&gt;&#39; ).<br><br>* Populate relevant parameters<br>    lv_q_supportsalldrives = &#39;true&#39;.<br>    lv_p_file_id = &#39;&lt;File ID of the XLSX file on Google Drive&gt;&#39;.<br><br>    ls_input-mime_type = &#39;application/vnd.google-apps.spreadsheet&#39;. &quot;Mime Type of Google Sheets<br>    ls_input-name = &#39;&lt;File Name of the Google Sheet to which XLSX content would be copied to&gt;&#39;.<br>    APPEND &#39;&lt;Folder ID of the Google Drive folder where the Google Sheet is to be placed&gt;&#39; TO ls_input-parents.<br><br>* Call API method: drive.files.copy<br>    CALL METHOD lo_client-&gt;copy_files<br>      EXPORTING<br>        iv_q_supportsalldrives = lv_q_supportsalldrives<br>        iv_p_file_id           = lv_p_file_id<br>        is_input               = ls_input<br>      IMPORTING<br>        es_output              = DATA(ls_output)<br>        ev_ret_code            = DATA(lv_ret_code)<br>        ev_err_text            = DATA(lv_err_text)<br>        es_err_resp            = DATA(ls_err_resp).<br>    IF lo_client-&gt;is_success( lv_ret_code ).<br>      MESSAGE &#39;Success&#39; TYPE &#39;S&#39;.<br>    ELSE.<br>      MESSAGE lv_err_text TYPE &#39;E&#39;.<br>    ENDIF.<br><br>* Close HTTP Connection<br>    lo_client-&gt;close( ).<br><br>  CATCH /goog/cx_sdk INTO DATA(lo_exception).<br>    MESSAGE lo_exception-&gt;get_text( ) TYPE &#39;E&#39;.<br><br>ENDTRY.</pre><p>ABAP based Agent can use the same to build it’s copy files functionality based on application logic as described earlier in the article.</p><p>The ABAP Agent to migrate excel files can be orchestrated through,</p><ul><li><strong>Background Jobs:</strong> Schedule ABAP background jobs to run the Agent at specific intervals or during off-peak hours.</li><li><strong>User Events:</strong> Trigger the Agent based on user actions within SAP (e.g., uploading an Excel file to a specific transaction).</li><li><strong>Workflow Integration:</strong> Integrate the Agent into SAP workflows to automate it as part of broader business processes.</li></ul><h4><strong>Benefits and Conclusion</strong></h4><p>Migrating legacy Excel files to Google Sheets is a critical step in a successful transition to Google Workspace. By leveraging this approach, organisations can unlock the full potential of Google Workspace, improve collaboration, and streamline their business processes. With this migration, they can use Google Sheets API to read the excel data from the converted Sheet from their transformed applications, which was not possible with the excel files.</p><p>The seamless invocation of Google APIs through ABAP SDK for Google Cloud presents significant opportunities for SAP enterprises to build Agents to manage their excel migration pipelines. They can also think about building similar Agents to realise their other business processes, unlocking the full potential of Google Cloud and leveraging Google Cloud as their side by side extension to fuel business outcomes.</p><blockquote><strong>These Agents can be GenAI Agents as well and can use </strong><a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/overview"><strong>Vertex AI SDK</strong></a><strong> as a tool to realise GenAI based use cases.</strong></blockquote><p>We encourage you to try and explore the migration Agent described in this article. Also, let us know if you have similar Agentic opportunities in your business processes.</p><p>Share your experiences and feedback with us on our Google Cloud Channel (link below).</p><p><a href="https://www.googlecloudcommunity.com/gc/forums/filteredbylabelpage/board-id/cloud-developer-tools/label-name/abap%20sdk?source=post_page-----c6005f18af0d--------------------------------">Developer Tools</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ebc07eb803da" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/efficiently-migrating-excel-files-to-google-sheets-in-enterprise-cloud-migrations-ebc07eb803da">Efficiently Migrating Excel Files to Google Sheets in Enterprise Cloud Migrations</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Invoke Gemini AI models from SAP applications]]></title>
            <link>https://medium.com/google-cloud/invoke-gemini-ai-models-from-sap-applications-c6005f18af0d?source=rss-99fa7ef0c8a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6005f18af0d</guid>
            <category><![CDATA[google-gemini-ai]]></category>
            <category><![CDATA[abap]]></category>
            <category><![CDATA[abap-sdk-for-google-cloud]]></category>
            <category><![CDATA[sap]]></category>
            <category><![CDATA[vertex-ai]]></category>
            <dc:creator><![CDATA[Devesh Singh]]></dc:creator>
            <pubDate>Fri, 11 Oct 2024 12:21:28 GMT</pubDate>
            <atom:updated>2024-10-12T09:37:42.714Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8HfHvnVNWxYhKgYfuz0XtA.png" /></figure><p>SAP businesses today need a faster, cheaper and leaner way to infuse AI into their business processes. To help our customers with this challenge, we <a href="https://www.googlecloudcommunity.com/gc/Developer-Tools/Harnessing-Google-AI-s-Potential-Within-SAP-Introducing-the/td-p/804833">recently launched</a> our <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/overview">Vertex AI SDK for ABAP</a>, a powerful toolset to natively utilize the full potential of Google’s <a href="https://cloud.google.com/vertex-ai/docs/start/introduction-unified-platform">Vertex AI</a> capabilities directly from SAP applications. This means that, with minimal efforts, ABAP developers can leverage SDK modules to <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/invoke-gemini-models">invoke Gemini AI models</a>, <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/generate-embeddings">embedding models</a>, <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/use-vector-search#create-manage-vector-index">create, manage and deploy vector index</a>, <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/use-vector-search#search_nearest_neighbors">perform vector semantic search</a> and much more from their known ABAP environment. They can also start their <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/quick-prototyping-with-gemini">prototyping with Gemini models</a> in free and paid tier directly from SAP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*M0eY1G3EdKV2c_9M" /></figure><p>In this blog post we would see how customers and developers can start their journey of building Gemini AI infused ABAP applications with a few installation and configuration steps. At the end of this blog you will have an understanding of the below,</p><ul><li>Configure Model Generation parameters for a Gemini Model,</li><li>Invoke the Gemini Model,</li><li>Capture model response,</li><li>Error and exception handling.</li></ul><h3>Installation of the SDK</h3><p>Vertex AI SDK for ABAP is built on top of our ABAP SDK for Google Cloud, and is available from Version 1.8 of the ABAP SDK. If you’re already using version 1.7 or earlier of the on-premises or any cloud edition of the SDK, we encourage you to <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/on-premises-or-any-cloud/latest/install-config#abap-sdk-install">download and install the latest version</a> of the SDK to get the latest and greatest of our tool sets and enablements.</p><p>If you have restrictions or in lack of SAP system, you can install your own SAP sandbox and try out the SDK by following our blog “<a href="https://www.linkedin.com/pulse/install-abap-platform-trial-2022-google-cloud-vertex-ai-ameya-suvarna-pqiic/?trackingId=6LRgk0GnQCWWgdZhihaEXg%3D%3D">Install ABAP Platform Trial 2022 on Google Cloud Platform and Install Vertex AI SDK for ABAP</a>”.</p><h3>Use cases</h3><p>Using the Gemini models, SAP customers and developers can perform,</p><ul><li><strong>Automatic order processing:</strong> Gemini can extract order details from emails, PDFs, or other unstructured data sources and provide structured output to enable automatic creation sales orders in SAP, reducing manual effort and errors.</li><li><strong>Financial Forecasting:</strong> Gemini can analyze SAP financial data and reports to generate accurate financial forecasts and identify potential risks and opportunities.</li><li><strong>Supply Chain Optimization:</strong> Gemini can analyze supply chain data to predict demand fluctuations, optimize inventory levels, and identify potential disruptions, improving efficiency and resilience for businesses.</li><li><strong>Customer Sentiment Analysis:</strong> Gemini can analyze customer feedback from surveys, social media, and other sources to understand customer sentiment and identify areas for improvement in SAP Customer Experience solutions.</li><li><strong>Personalized Product Recommendations:</strong> Gemini can analyze customer data and product information to provide personalized product recommendations, increasing sales and customer satisfaction.</li><li><strong>Fraud Detection:</strong> Gemini can analyze transaction data to identify patterns and anomalies that may indicate fraudulent activities in business processes.</li></ul><p>….and much more.</p><p>Using the Vertex AI SDK for ABAP, customers can now think of building these use cases natively from their ABAP environment. It alleviates the technological challenge of lack of enabler SDK for ABAP developers, that other programming languages have (Python, Java, <a href="http://node.js/">Node.js</a>, etc. have dedicated Vertex AI SDKs) to build AI centric applications.</p><p><strong><em>Okk….enough of sales pitch….let’s get into invoking Gemini models….</em></strong></p><h3>Configure Model Generation Parameters</h3><p>For invoking Gemini AI models, the SDK comes with a central SAP table maintenance based configuration to define model configurations for your scenarios centrally one time against a “Model Key”, and use the key to invoke the model at different placeholders in your application logic. Refer to the link <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/install-configure-vertex-ai-sdk-abap#configure-model-generation-parameters">here</a> on how to navigate to the configuration table (table /GOOG/AI_CONFIG) and look at the table fields in detail.</p><p>Main information held in this table are,</p><ul><li>A developer defined “Model Key” as a configuration id,</li><li><a href="https://cloud.google.com/vertex-ai/generative-ai/docs/learn/model-versions#stable-versions-available">Model ID</a> of the Gemini model, such as gemini-1.5-flash-001,</li><li><a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/on-premises-or-any-cloud/latest/install-config#client_key_config">ABAP SDK client key</a> name to connect to the backend Vertex AI API,</li><li><a href="https://cloud.google.com/vertex-ai/generative-ai/docs/learn/prompts/adjust-parameter-values">Model generation parameters</a>, such as temperature, top-k and top-p sampling etc..</li></ul><p><a href="https://cloud.google.com/vertex-ai/generative-ai/docs/learn/prompts/adjust-parameter-values">Model generation parameters</a> are parameters of the model that can be used to control the model responses to get the best responses for your business scenarios. You can provide values for these generation parameters in the configuration table against the model key and these would take into effect when the model is invoked using the SDK from your application logic.</p><p>For example, if you want the model to be more creative, define a higher value of temperature (closer to 1) for the configured model key. If you want the model to give a more deterministic and focussed response, define a lower value of temperature (closer to 0) for the configured model key.</p><h3>Invoke Gemini Models</h3><p><a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/invoke-gemini-models">Gemini Generative Model Invoker</a> component of the SDK can be used to invoke text and multimodal Gemini models from your ABAP based applications. You can invoke the model by,</p><ul><li><a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/invoke-gemini-models#instantiate-gemini-invoker-class">Instantiating</a> class /GOOG/CL_GENERATIVE_MODEL with the model key defined in the model configuration table,</li><li>Calling method <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/invoke-gemini-models#generate_content_with_a_prompt">GENERATE_CONTENT</a> with a prompt to invoke the model id defined against the model key in the configuration table (model generation parameters if defined are taken into effect),</li><li>Chain the invocation with method <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/invoke-gemini-models#get_text_response">GET_TEXT</a> to capture the model response.</li></ul><h4>Invocation in action with a use case</h4><p>Imagine below use case of a business user who wants to know if there are any risks in their incoming orders.</p><blockquote>“As a business user, I want to know if there are any risky clauses in the delivery comments of an incoming purchase order.</blockquote><blockquote>If yes, the corresponding sales order should be created in blocked status along with an alert generated to review the blocked order.</blockquote><blockquote>If there are no risky clauses, the sales order should be created without any blocks.”</blockquote><p>The business would like to implement this requirement using Google’s AI capabilities natively from their SAP environment. This implementation is typically known as <a href="https://en.wikipedia.org/wiki/Business_rules_engine">business rule engines</a> (BRE) which allows you to define, deploy, and execute business rules. Refer to our <a href="https://cloud.google.com/solutions/sap/docs/architectures/abap-sdk/gemini-powered-business-rule-engine">reference architecture</a> to implement such rule engines in your SAP applications using Gemini. To implement this, you can have a SAP program running as a background job and,</p><ul><li>ABAP SDK for Google Cloud can be used to <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/samples/docai-process-single-document#on-premises-or-any-cloud-edition">invoke Google Cloud Document AI</a> to parse the <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/samples/gcs-download-file-bucket">incoming purchase orders in a GCS bucket</a> and determine the delivery comments from the response.</li><li>Invoke Gemini Generative Model Invoker of embedded Vertex AI SDK to analyze and identify any risks in the delivery comments.</li></ul><p>I choose Gemini Flash to implement this (you can choose what works for you from the <a href="https://cloud.google.com/vertex-ai/generative-ai/docs/learn/model-versions#stable-versions-available">available model list</a>) and I create a model generation configuration against a model key. To configure,</p><ul><li>Go to SPRO path “Configure Model Generation Parameters” as below.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BZ9isnlvSfwWoJS_" /></figure><ul><li>Enter Google Cloud key name and model id along with generation configuration (optional) against a Model Key.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*k5Y6jWDc1hXbGmof" /></figure><p>Next, I invoke Gemini Flash to determine any risks in the delivery comments using the Model Key configuration as shown in the code snippet below.</p><pre>DATA:<br>  lv_prompt            TYPE string,<br>  lv_delivery_comments TYPE string.<br><br>lv_delivery_comments = |{ &#39;Buyer grants seller a royalty-free, perpetual, irrevocable&#39;} | &amp;&amp;<br>                       |{ &#39;license to use any intellectual property developed in&#39;} | &amp;&amp;<br>                       |{ &#39;connection with the products&#39;} |.<br><br>lv_prompt = |{ &#39;Identify any risky clause in delivery instruction from a purchase order document.&#39;} | &amp;&amp;<br>            |{ &#39;Delivery Instruction -&#39;} | &amp;&amp; lv_delivery_comments.<br><br>TRY.<br>    DATA(lo_model) = NEW /goog/cl_generative_model( iv_model_key = &#39;gemini-flash&#39; ).<br><br>    DATA(lv_response) = lo_model-&gt;generate_content( lv_prompt<br>                               )-&gt;get_text( ).<br>    IF lv_response IS NOT INITIAL.<br>      cl_demo_output=&gt;display( lv_response ).<br><br>    ENDIF.<br>  CATCH /goog/cx_sdk INTO DATA(lo_cx_sdk).<br>    cl_demo_output=&gt;display( lo_cx_sdk-&gt;get_text( ) ).<br><br>ENDTRY.</pre><p>Once executed, Gemini responds with the risk analysis and ways to mitigate it similar to as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PVg0LNaUob6WAX4x" /></figure><p>Hurray….I was able to identify risks and mitigation recommendations using Gemini AI natively in my SAP application. But this response is in a paragraph format and I cannot use this as is to build follow on logic to create a blocked sales order for my rule engine.</p><p>So, I additionally instruct the AI model to generate the response in a format that is directly usable by me in the program in order to efficiently create the blocked order. For this, I use the method <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/invoke-gemini-models#provide_system_instructions_to_the_model">SET_SYSTEM_INSTRUCTIONS</a> as shown in the code snippet below to set string based specific instructions to the model to generate the response in JSON format having fields issue, issue category, explanation and recommendation.</p><pre>DATA:<br>  lv_prompt              TYPE string,<br>  lv_delivery_comments   TYPE string,<br>  lv_system_instructions TYPE string.<br><br>lv_delivery_comments = |{ &#39;Buyer grants seller a royalty-free, perpetual, irrevocable&#39;} | &amp;&amp;<br>                       |{ &#39;license to use any intellectual property developed in&#39;} | &amp;&amp;<br>                       |{ &#39;connection with the products&#39;} |.<br><br>lv_system_instructions = |{ &#39;You are a legal advisor for my company. Analyze the below delivery instruction on a&#39; } | &amp;&amp;<br>                         |{ &#39;purchase order from my customer and let me know if it could cause issues to my company&#39; } | &amp;&amp; cl_abap_char_utilities=&gt;newline &amp;&amp;<br>                         |{ &#39;Respond to me in plain text JSON format with 4 fields.&#39; } | &amp;&amp; cl_abap_char_utilities=&gt;newline &amp;&amp;<br>                         |{ &#39;Field 1 should be &quot;issue&quot; with possible values Yes or No.&#39; } | &amp;&amp; cl_abap_char_utilities=&gt;newline &amp;&amp;<br>                         |{ &#39;Field 2 should be &quot;issueCategory&quot; with possible values Indemnification Overreach, Unilateral Termination Clause, Confidentiality Overextension,&#39; } | &amp;&amp;<br>                         |{ &#39;Unreasonable Warranty, Ambiguous Governing Law, Unclear Dispute Resolution, Force Majeure Limitation, Unbalanced Liability,&#39; } | &amp;&amp;<br>                         |{ &#39;Intellectual Property Ambiguity, Compliance with Sanctions, Others or None.&#39; } | &amp;&amp; cl_abap_char_utilities=&gt;newline &amp;&amp;<br>                         |{ &#39;Field 3 should be &quot;explanation&quot; - use this field to give a short explanation for your response on Field 1.&#39; } | &amp;&amp; cl_abap_char_utilities=&gt;newline &amp;&amp;<br>                         |{ &#39;Field 4 should be &quot;recommendation&quot; - use this field to give a short recommendation of how to mitigate such issues.&#39; } | &amp;&amp; cl_abap_char_utilities=&gt;newline &amp;&amp;<br>                         |{ &#39;DO NOT INCLUDE BACKTICKS IN THE RESPONSE&#39; }|.<br><br>lv_prompt = |{ &#39;Identify any risky clause in delivery instruction from a purchase order document.&#39;} | &amp;&amp;<br>            |{ &#39;Delivery Instruction -&#39;} | &amp;&amp; lv_delivery_comments.<br><br>TRY.<br>    DATA(lo_model) = NEW /goog/cl_generative_model( iv_model_key = &#39;gemini-flash&#39; ).<br><br>    DATA(lv_response) = lo_model-&gt;set_system_instructions( lv_system_instructions<br>                               )-&gt;generate_content( lv_prompt<br>                               )-&gt;get_text( ).<br>    IF lv_response IS NOT INITIAL.<br>      cl_demo_output=&gt;display( lv_response ).<br><br>    ENDIF.<br>  CATCH /goog/cx_sdk INTO DATA(lo_cx_sdk).<br>    cl_demo_output=&gt;display( lo_cx_sdk-&gt;get_text( ) ).<br><br>ENDTRY.</pre><p>With proper instructions, I was able to get the model in JSON format as below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bkph3ndXDScTG9aU" /></figure><p>I can deserialize this into ABAP type having the same fields and write a business rule to look at the issue field.</p><ul><li>If “Yes”, create the sales order in block status, raise an alert (using Cloud Pub/Sub with ABAP SDK),</li><li>If “No”, create the sales order in unblocked status.</li></ul><p>I can additionally place the explanation and recommendation for the risks suggested by Gemini in the blocked Sales Order header text for the business user as shown below, to review and take action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gArNbqYxPe2Mq1Dy" /></figure><h4>Invocation using multimodal prompts</h4><p>In the above sections you saw invocation of a Gemini model to look at delivery comments text using a text based prompt and system instructions. The Gemini family of models consist of text as well as multimodal models which can accept other modalities of data other than text and can be used to analyze multimodal data using text based prompts. For example, Gemini Flash is a multimodal model and can accept images, videos, PDFs, etc., to generate response based on text based prompt and instructions.</p><p>Vertex AI SDK for ABAP supports invocation models with <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/invoke-gemini-models#pass_multimodal_input_to_the_model">multimodal inputs</a>. You can input the multimodal data either by,</p><ul><li>Providing the Google Cloud Storage Bucket URI of the file object using SDK method SET_FILE_DATA of class /GOOG/CL_GENERATIVE_MODEL, or</li><li>Providing the raw data of the file object in Base64 encoded format using SDK method SET_INLINE_DATA of class /GOOG/CL_GENERATIVE_MODEL.</li></ul><p>Staying close to SAP use cases, let’s see how we can input the purchase order from before with risky delivery comments directly to Gemini through an SAP program, and ask it to parse and analyze any risks. For this I just changed my input prompt slightly, we are not using Document AI parsed delivery instructions any more but asking Gemini to parse, find delivery comments, analyze and suggest risks and mitigation recommendations.</p><p><strong>Give GCS URI of the PDF</strong></p><p>Here I have used the method SET_FILE_DATA to input GCS URI of the purchase order PDF file.</p><pre>DATA:<br>  lv_prompt              TYPE string,<br>  lv_system_instructions TYPE string.<br><br>lv_system_instructions = |{ &#39;You are a legal advisor for my company. Analyze the delivery instruction on the input&#39; } | &amp;&amp;<br>                         |{ &#39;purchase order from my customer and let me know if it could cause issues to my company&#39; } | &amp;&amp; cl_abap_char_utilities=&gt;newline &amp;&amp;<br>                         |{ &#39;Respond to me in plain text JSON format with 4 fields.&#39; } | &amp;&amp; cl_abap_char_utilities=&gt;newline &amp;&amp;<br>                         |{ &#39;Field 1 should be &quot;issue&quot; with possible values Yes or No.&#39; } | &amp;&amp; cl_abap_char_utilities=&gt;newline &amp;&amp;<br>                         |{ &#39;Field 2 should be &quot;issueCategory&quot; with possible values Indemnification Overreach, Unilateral Termination Clause, Confidentiality Overextension,&#39; } | &amp;&amp;<br>                         |{ &#39;Unreasonable Warranty, Ambiguous Governing Law, Unclear Dispute Resolution, Force Majeure Limitation, Unbalanced Liability,&#39; } | &amp;&amp;<br>                         |{ &#39;Intellectual Property Ambiguity, Compliance with Sanctions, Others or None.&#39; } | &amp;&amp; cl_abap_char_utilities=&gt;newline &amp;&amp;<br>                         |{ &#39;Field 3 should be &quot;explanation&quot; - use this field to give a short explanation for your response on Field 1.&#39; } | &amp;&amp; cl_abap_char_utilities=&gt;newline &amp;&amp;<br>                         |{ &#39;Field 4 should be &quot;recommendation&quot; - use this field to give a short recommendation of how to mitigate such issues.&#39; } | &amp;&amp; cl_abap_char_utilities=&gt;newline &amp;&amp;<br>                         |{ &#39;DO NOT INCLUDE BACKTICKS IN THE RESPONSE&#39; }|.<br><br>lv_prompt = &#39;Identify any risky clause in delivery instruction from the input purchase order PDF document.&#39;.<br><br>TRY.<br>    DATA(lo_model) = NEW /goog/cl_generative_model( iv_model_key = &#39;gemini-flash&#39; ).<br><br>    DATA(lv_response) = lo_model-&gt;set_system_instructions( lv_system_instructions<br>                               )-&gt;set_file_data( iv_file_uri = &#39;gs://incoming-purchase-orders/5002000027.pdf&#39;<br>                               )-&gt;generate_content( lv_prompt<br>                               )-&gt;get_text( ).<br>    IF lv_response IS NOT INITIAL.<br>      cl_demo_output=&gt;display( lv_response ).<br><br>    ENDIF.<br>  CATCH /goog/cx_sdk INTO DATA(lo_cx_sdk).<br>    cl_demo_output=&gt;display( lo_cx_sdk-&gt;get_text( ) ).<br><br>ENDTRY.</pre><p>Output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NcojRTM7tPpBSXVL" /></figure><p><strong>Browse file to input raw data</strong></p><p>Here I have used the method SET_INLINE_DATA to input Base64 encoded raw data of the browsed purchase order PDF file from my desktop.</p><pre>DATA:<br>  lv_file        TYPE string,<br>  lv_file_length TYPE i,<br>  lt_bin_data    TYPE STANDARD TABLE OF char1024,<br>  lv_xfile       TYPE xstring,<br>  lv_raw_data    TYPE string.<br><br>lv_file = &#39;C:\Users\Guest\Desktop\5002000027.pdf&#39;.<br><br>CALL FUNCTION &#39;GUI_UPLOAD&#39;<br>  EXPORTING<br>    filename   = lv_file<br>    filetype   = &#39;BIN&#39;<br>  IMPORTING<br>    filelength = lv_file_length<br>  TABLES<br>    data_tab   = lt_bin_data.<br><br>CALL FUNCTION &#39;SCMS_BINARY_TO_XSTRING&#39;<br>  EXPORTING<br>    input_length = lv_file_length<br>  IMPORTING<br>    buffer       = lv_xfile<br>  TABLES<br>    binary_tab   = lt_bin_data.<br><br>CALL FUNCTION &#39;SCMS_BASE64_ENCODE_STR&#39;<br>  EXPORTING<br>    input  = lv_xfile<br>  IMPORTING<br>    output = lv_raw_data.<br><br>DATA:<br>  lv_prompt              TYPE string,<br>  lv_system_instructions TYPE string.<br><br>lv_system_instructions = |{ &#39;You are a legal advisor for my company. Analyze the delivery instruction on the input&#39; } | &amp;&amp;<br>                         |{ &#39;purchase order from my customer and let me know if it could cause issues to my company&#39; } | &amp;&amp; cl_abap_char_utilities=&gt;newline &amp;&amp;<br>                         |{ &#39;Respond to me in plain text JSON format with 4 fields.&#39; } | &amp;&amp; cl_abap_char_utilities=&gt;newline &amp;&amp;<br>                         |{ &#39;Field 1 should be &quot;issue&quot; with possible values Yes or No.&#39; } | &amp;&amp; cl_abap_char_utilities=&gt;newline &amp;&amp;<br>                         |{ &#39;Field 2 should be &quot;issueCategory&quot; with possible values Indemnification Overreach, Unilateral Termination Clause, Confidentiality Overextension,&#39; } | &amp;&amp;<br>                         |{ &#39;Unreasonable Warranty, Ambiguous Governing Law, Unclear Dispute Resolution, Force Majeure Limitation, Unbalanced Liability,&#39; } | &amp;&amp;<br>                         |{ &#39;Intellectual Property Ambiguity, Compliance with Sanctions, Others or None.&#39; } | &amp;&amp; cl_abap_char_utilities=&gt;newline &amp;&amp;<br>                         |{ &#39;Field 3 should be &quot;explanation&quot; - use this field to give a short explanation for your response on Field 1.&#39; } | &amp;&amp; cl_abap_char_utilities=&gt;newline &amp;&amp;<br>                         |{ &#39;Field 4 should be &quot;recommendation&quot; - use this field to give a short recommendation of how to mitigate such issues.&#39; } | &amp;&amp; cl_abap_char_utilities=&gt;newline &amp;&amp;<br>                         |{ &#39;DO NOT INCLUDE BACKTICKS IN THE RESPONSE&#39; }|.<br><br>lv_prompt = &#39;Identify any risky clause in delivery instruction from the input purchase order PDF document.&#39;.<br><br>TRY.<br>    DATA(lo_model) = NEW /goog/cl_generative_model( iv_model_key = &#39;gemini-flash&#39; ).<br><br>    DATA(lv_response) = lo_model-&gt;set_system_instructions( lv_system_instructions<br>                               )-&gt;set_inline_data( iv_data = lv_raw_data<br>                               )-&gt;generate_content( lv_prompt<br>                               )-&gt;get_text( ).<br>    IF lv_response IS NOT INITIAL.<br>      cl_demo_output=&gt;display( lv_response ).<br><br>    ENDIF.<br>  CATCH /goog/cx_sdk INTO DATA(lo_cx_sdk).<br>    cl_demo_output=&gt;display( lo_cx_sdk-&gt;get_text( ) ).<br><br>ENDTRY.</pre><p>Following similar patterns as above you can input GCS URIs and raw data for your images, videos and other modalities to the Gemini multimodal models using the SDK, from your SAP applications.</p><h4>Further control your model generation</h4><p>With Generative Model Invoker class /GOOG/CL_GENERATIVE_MODEL, you can additionally set more parameters to guide the model to generate responses as per your requirements.</p><ul><li>Utilize method <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/invoke-gemini-models#add_safety_settings">ADD_SAFETY_SETTINGS</a> to set the safety parameters to control the model response based on <a href="https://cloud.google.com/vertex-ai/docs/reference/rest/v1/HarmCategory">harm categories</a>, <a href="https://cloud.google.com/vertex-ai/docs/reference/rest/v1/SafetySetting#harmblockthreshold">threshold levels</a> and <a href="https://cloud.google.com/vertex-ai/docs/reference/rest/v1/SafetySetting#harmblockmethod">blocking methods</a> (refer to the <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/invoke-gemini-models#count_number_of_tokens_in_a_text_prompt">code sample</a>).</li><li>Utilize method <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/invoke-gemini-models#set_generation_configuration_for_the_model">SET_GENERATION_CONFIG</a> to override the generation configurations set against the model key in model generation configuration table /GOOG/AI_CONFIG for a specific invocation using the same model instance.</li><li>Utilize the method <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/invoke-gemini-models#set_response_mime_type">SET_RESPONSE_MIME_TYPE</a> to set the Mime Type in which you want the model to generate response in.</li></ul><h4>Keep track of your billing by counting input characters to the model</h4><p><a href="https://cloud.google.com/vertex-ai/generative-ai/pricing#gemini-models">Billing for the Gemini models</a> depends on the number of characters or tokens that you invoke it with, which can consist of both text and multimodal input data. The SDK also gives you an out of the method <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/invoke-gemini-models#count_number_of_tokens_in_a_text_prompt">COUNT_TOKENS</a> with Generative Model Invoker class /GOOG/CL_GENERATIVE_MODEL to get the total tokens and total billable characters in your input prompt. You can use this method to keep track of your project’s budget for invoking Gemini models. Here is a <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/invoke-gemini-models#find_number_of_tokens_and_billable_characters_in_a_prompt">code sample</a> to count tokens for your text inputs, below code snippet shows you how to count tokens for your multimodal input.</p><pre>DATA:<br>  lv_instruction TYPE string,<br>  lv_prompt      TYPE string.<br><br>lv_instruction = &#39;You are a Document Parser. Your job is to parse and summarize input documents with different Mime Types.&#39;.<br>lv_prompt      = &#39;Give me a summary of the purchase order in JSON format.&#39;.<br><br>TRY.<br>    DATA(lo_model) = NEW /goog/cl_generative_model( iv_model_key = &#39;gemini-flash&#39; ).<br>    DATA(lo_model_response) = lo_model-&gt;set_file_data( iv_mime_type = &#39;application/pdf&#39;<br>                                                       iv_file_uri  = &#39;gs://PO/po-multi-line.pdf&#39;<br>                                     )-&gt;count_tokens( iv_prompt_text         = lv_prompt<br>                                                      iv_system_instructions = lv_instruction ).<br>    DATA(lv_total_tokens) = lo_model_response-&gt;get_total_tokens( ).<br>    DATA(lv_total_billable_chars) = lo_model_response-&gt;get_total_billable_characters( ).<br>    WRITE:<br>          |{ &#39;Total tokens in the input -&#39; } | &amp;&amp; lv_total_tokens, /<br>          |{ &#39;Total billable characters in the input -&#39; } | &amp;&amp; lv_total_billable_chars.<br><br>  CATCH /goog/cx_sdk INTO DATA(lo_cx_sdk).<br>    cl_demo_output=&gt;display( lo_cx_sdk-&gt;get_text( ) ).<br><br>ENDTRY.</pre><p>Output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/0*5yk4JB2plail3-2T" /></figure><p>You can also use the method SET_INLINE_DATA in place or alongside method SET_FILE_DATA to input multimodal raw data to count the tokens and billable characters.</p><h3>Derive the most out of Gemini responses</h3><p>The <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/invoke-gemini-models#get_text_response">GET_TEXT</a> method of the Generative Model Invoker module gets you the response from the Gemini model for an invocation. But you can derive much more from the response instance.</p><ul><li>Utilize the method <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/invoke-gemini-models#get_safety_rating">GET_SAFETY_RATING</a> to get the safety rating of the model response.</li><li>Utilize the method <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/invoke-gemini-models#get_number_of_tokens_in_the_request_prompt">GET_PROMPT_TOKEN_COUNT</a> to get the number of tokens in the input prompt.</li><li>Utilize the method <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/invoke-gemini-models#get_number_of_tokens_in_the_models_response">GET_CANDIDATES_TOKEN_COUNT</a> to get the number of tokens in the model response.</li><li>Utilize the method <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/invoke-gemini-models#get_block_reason">GET_BLOCK_REASON</a> to get the reason for which the model did not generate a response for an input prompt.</li><li>Utilize the method <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/invoke-gemini-models#get_block_reason_message">GET_BLOCK_REASON_MESSAGE</a> to the reason in detail for which the model did not generate a response for an input prompt.</li><li>Utilize method GET_CITATIONS to get the citation source of the model response.</li></ul><h3>Error and exception handling</h3><p>Any errors returned from the model invocation or internal SDK errors are raised as exceptions and can be caught using ABAP SDK shipped exception class <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/on-premises-or-any-cloud/latest/developer#exceptions">/GOOG/CX_SDK</a>. Remember to encapsulate your code logic (like shown in the code snippets) in a TRY CATCH block with this class.</p><p>Also, the SDK has SLG based <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/on-premises-or-any-cloud/latest/install-config#application_logging">application logging functionality</a> which you can configure and use to log your errors, warnings and information messages. Refer to the blog on <a href="https://medium.com/google-cloud/application-logging-in-abap-sdk-for-google-cloud-6baf6a6afbb0">application logging with ABAP SDK</a> to know more.</p><h3>Get started today</h3><p>The Vertex AI SDK for ABAP is now available for developers to explore and integrate into their SAP projects. Whether you’re an experienced AI practitioner or just starting your AI journey, the SDK provides the tools and resources you need to harness Google AI’s potential within your SAP environment.</p><p>We’re excited to see the innovative solutions that developers will create using this powerful integration. Stay tuned for further updates, tutorials, and success stories as we continue to evolve the Vertex AI SDK for ABAP and empower businesses to achieve more with Google AI within their SAP systems.</p><h3>Ask your questions, tell us about your use cases</h3><p>The ABAP SDK for Google Cloud Community is now open! This is a place for you to ask questions, share knowledge, and collaborate with other ABAP developers who are using Google Cloud. We encourage you to get involved in the community and help us make the ABAP SDK for Google Cloud even better. We have a lot of exciting things planned for the future, and we want you to be a part of it.</p><p>Click below link to join and innovate with us.</p><p><a href="https://www.googlecloudcommunity.com/gc/forums/filteredbylabelpage/board-id/cloud-developer-tools/label-name/abap%20sdk?source=post_page-----e33c59226bd0--------------------------------">Developer Tools</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6005f18af0d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/invoke-gemini-ai-models-from-sap-applications-c6005f18af0d">Invoke Gemini AI models from SAP applications</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Harnessing Google AI’s Potential Within SAP: Introducing the Vertex AI SDK for ABAP]]></title>
            <link>https://medium.com/google-cloud/harnessing-google-ais-potential-within-sap-introducing-the-vertex-ai-sdk-for-abap-e33c59226bd0?source=rss-99fa7ef0c8a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/e33c59226bd0</guid>
            <category><![CDATA[sap]]></category>
            <category><![CDATA[vertex-ai]]></category>
            <category><![CDATA[abap-sdk-for-google-cloud]]></category>
            <category><![CDATA[abap]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[Devesh Singh]]></dc:creator>
            <pubDate>Fri, 13 Sep 2024 03:08:09 GMT</pubDate>
            <atom:updated>2024-09-13T03:08:09.009Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sCcyUrHtQc7Tzea6W-2ZxQ.jpeg" /></figure><p>In today’s rapidly evolving technological landscape, Artificial Intelligence (AI) is no longer a luxury but a necessity for businesses seeking to stay ahead of the curve. For organizations leveraging SAP systems, integrating AI capabilities seamlessly into their existing infrastructure can be a game-changer, but still remains a technological challenge for technology leaders and architects. Today, we’re thrilled to announce a significant step forward in this direction: <strong>the launch of the </strong><a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/overview"><strong>Vertex AI SDK for ABAP</strong></a>.</p><h3><strong>Bridging the Gap Between Google’s AI and SAP</strong></h3><p>The <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/overview">Vertex AI SDK for ABAP</a> represents a powerful bridge between Google Cloud’s cutting-edge Vertex AI platform and the heart of SAP systems — ABAP (Advanced Business Application Programming). This integration empowers developers to harness the full potential of <a href="https://cloud.google.com/vertex-ai/docs/start/introduction-unified-platform">Vertex AI</a> features directly within their SAP applications, opening up a world of possibilities for innovation and optimization.</p><h3><strong>Key Benefits</strong></h3><ul><li><strong>Seamless Integration</strong>: The SDK provides a user-friendly interface for incorporating Vertex AI’s powerful machine learning models into ABAP code, streamlining the development process and reducing time-to-market for AI-powered SAP solutions.</li><li><strong>Enhanced Capabilities</strong>: Developers can leverage Vertex AI’s extensive suite of pre-trained Gemini models along with Embedding models to tackle various use cases within SAP, including natural language processing, image recognition, predictive analytics, and more.</li><li><strong>Improved Efficiency</strong>: By automating tasks and providing intelligent insights, Vertex AI-powered SAP applications can boost operational efficiency, reduce manual errors, and enable data-driven decision-making.</li><li><strong>Innovation Catalyst</strong>: The SDK empowers developers to create new and innovative Vertex AI-driven solutions within SAP, unlocking new revenue streams and enhancing customer experiences.</li></ul><h3><strong>Use Cases</strong></h3><p>The potential applications of the Vertex AI SDK for ABAP are vast and span across various industries and business functions. It has specific modules that lets SAP customers and developers streamline, plan and execute their AI implementation journey natively from their ABAP environment. It allows customers to pick and choose the specific AI implementation steps that they would like to keep within their SAP box, thus giving them freedom to choose what works for them and derive the best out of Google’s Vertex AI platform.</p><p>Using the SDK customers can:</p><ul><li><strong>Build data ingestion pipelines:</strong> <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/invoke-gemini-models">Invoke Gemini models</a> with multimodal enterprise data from disparate systems to split and generate meaningful knowledge blocks, <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/generate-embeddings">convert the blocks to vector representation</a> in the form of Embeddings, <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/use-vector-search#create-manage-vector-index">organize your enterprise data through a Vector Index</a>.</li><li><strong>Build Retrieval Augmented Generation (RAG) based workflows:</strong> <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/use-vector-search#search_nearest_neighbors">Query your enterprise data</a> to get closest matches within milliseconds, augment the prompt to Gemini with additional enterprise context retrieved through Vector Search, get a reliable response from the model with enterprise context for efficient decision making.</li><li><strong>Augment model context with SAP function module calls:</strong> Enable <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/use-function-calling">auto invocation of a SAP function module</a> with the SDK to return back additional enterprise information to augment to the model’s context to generate a more grounded response.</li><li><strong>Manage your Feature Stores:</strong> <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/use-feature-store#sync_online_store">Sync your online Vertex AI Feature store</a> from your data sources, <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/use-feature-store#serve_features_from_an_online_store">serve your features</a> from the online store for real time applications, <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/use-feature-store#search_for_approximate_nearest_neighbors">perform similarity search</a> over the online store.</li><li><strong>Prototype your SAP use cases:</strong> <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/quick-prototyping-with-gemini">Use Generative Language API</a> in both free and paid pricing tiers to quickly prototype your use cases, adjust model parameters to achieve what works best for your problem statement, bring the prototyped setup to production ready applications using Vertex AI API.</li></ul><h3><strong>Get Started Today</strong></h3><p>The Vertex AI SDK for ABAP is now available for developers to explore and integrate into their SAP projects. Whether you’re an experienced AI practitioner or just starting your AI journey, the SDK provides the tools and resources you need to harness Google AI’s potential within your SAP environment.</p><p>We’re excited to see the innovative solutions that developers will create using this powerful integration. Stay tuned for further updates, tutorials, and success stories as we continue to evolve the Vertex AI SDK for ABAP and empower businesses to achieve more with Google AI within their SAP systems.</p><h3><strong>Additional Resources</strong></h3><ul><li><strong>Vertex AI SDK for ABAP Documentation:</strong> [<a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/overview">Link</a>]</li><li><strong>Install and configure Vertex AI SDK for ABAP:</strong> [<a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/install-configure-vertex-ai-sdk-abap">Link</a>]</li><li><strong>Run and explore Generative AI demos:</strong> [<a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/demos/demos-overview">Link</a>]</li></ul><p><strong>Let’s embark on this exciting journey together and unleash the transformative power of Vertex AI within SAP!</strong></p><h3>Ask your questions, tell us about your use cases</h3><p>The ABAP SDK for Google Cloud Community is now open! This is a place for you to ask questions, share knowledge, and collaborate with other ABAP developers who are using Google Cloud. We encourage you to get involved in the community and help us make the ABAP SDK for Google Cloud even better. We have a lot of exciting things planned for the future, and we want you to be a part of it.</p><p>Click below link to join and innovate with us.</p><p><a href="https://www.googlecloudcommunity.com/gc/forums/filteredbylabelpage/board-id/cloud-developer-tools/label-name/abap%20sdk?source=post_page-----965a4c1e936c--------------------------------">Developer Tools</a></p><h3><strong>FAQs</strong></h3><h4><strong>How do I get the Vertex AI SDK for ABAP?</strong></h4><p><strong>Answer </strong>— The Vertex AI SDK for ABAP comes embedded within <a href="https://cloud.google.com/solutions/sap/docs/release-notes#September_09_2024">ABAP SDK for Google Cloud Version V1.8</a> onwards.</p><ul><li>If you are on an older version of ABAP SDK, upgrade to the latest version V1.8.</li><li>If you have not yet installed the ABAP SDK, install the V1.8 version of ABAP SDK.</li></ul><p>Here is the <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/install-configure-vertex-ai-sdk-abap">link</a> to the installation and configuration of Vertex AI SDK for ABAP.</p><h4><strong>Can customers experiment without a Google Cloud account?</strong></h4><p><strong>Answer </strong>— Yes, the customers can <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/vertex-ai-sdk/latest/quick-prototyping-with-gemini">start with their prototyping journey</a> using Gemini API through Vertex AI SDK for ABAP without any Google Cloud account in free and paid tiers. The free tier of Gemini API is not available in all regions. For information about the regions where you can access the free and paid tiers of Gemini API, see <a href="https://ai.google.dev/gemini-api/docs/available-regions">Available regions for Google AI Studio and Gemini API</a>.</p><p>However, a Google Cloud project is needed to invoke the Vertex AI SDK for ABAP. Vertex AI pricing follows a pay-as-you-go model, which means that you’re charged based on the resources you consume. For information about pricing, see <a href="https://cloud.devsite.corp.google.com/vertex-ai/generative-ai/pricing">Vertex AI pricing</a>.</p><h4><strong>Do I need to build an end-to-end solution entirely in SAP?</strong></h4><p><strong>Answer </strong>— No, the customers can pick and choose the Vertex AI features that they would like to use for their implementations in SAP. The Vertex AI SDK for ABAP provides decoupled modules which gives independence to the customers to choose the modules that they would like to build in SAP, and in turn are able to harness the full potential of Vertex AI for enterprise use cases.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e33c59226bd0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/harnessing-google-ais-potential-within-sap-introducing-the-vertex-ai-sdk-for-abap-e33c59226bd0">Harnessing Google AI’s Potential Within SAP: Introducing the Vertex AI SDK for ABAP</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Transforming SAP use cases with Google’s Vertex AI from within ABAP]]></title>
            <link>https://medium.com/google-cloud/transforming-sap-use-cases-with-googles-vertex-ai-from-within-abap-5911713ed62d?source=rss-99fa7ef0c8a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/5911713ed62d</guid>
            <category><![CDATA[abap-sdk-for-google-cloud]]></category>
            <category><![CDATA[abap]]></category>
            <category><![CDATA[sap]]></category>
            <category><![CDATA[vertex-ai]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[Devesh Singh]]></dc:creator>
            <pubDate>Sun, 11 Feb 2024 11:52:01 GMT</pubDate>
            <atom:updated>2024-02-13T06:06:59.429Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PjyuhzOXPw7M-WA7.png" /></figure><p>This blog is a follow on to our previous blog <a href="https://medium.com/google-cloud/unleash-vertex-ai-power-from-abap-effortless-ai-integration-d9a7c110ae4c">“Unleash Vertex AI Power from ABAP: Effortless AI Integration”</a> which elaborates on how SAP developers can seamlessly invoke Google Cloud’s Vertex AI models from ABAP environment using <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/whats-new">ABAP SDK for Google Cloud</a>.</p><p>In this blog, I would delve into a specific SAP use case of order processing and showcase how you can bring the power of Generative AI with Vertex AI to your SAP applications using the SDK.</p><blockquote>“The goal of the blog is to show the art of the possibility with a reference architecture for SAP customers, developers and architects to take reference and build their own tailored architectures specific to their business use cases.”</blockquote><h3>What are we building</h3><p>Imagine a business where urgent orders come in on a daily basis and fulfillment of the orders within critical timelines is key to the success of the business. They receive orders through physical (paper based) and digital (PDFs) mediums but do receive a bulk of urgent orders through email messages where order details are just plain text in the email body. They use SAP for their order to cash process and would like to automate the order processing to increase fulfillment efficiency and reduce human errors.</p><p>The technical solution architects for the business would like to explore and use Google’s Generative AI to build the automation for urgent orders coming in as Gmail messages. They can write an SAP automation program to run at a frequency to,</p><ul><li>Poll the Gmail inbox for new order requests using ABAP SDK’s client library ABAP class for Gmail API,</li><li>For each new order request, read the email body text using the SDK,</li><li>Invoke the “text-bison” model of Vertex AI API using the SDK and pass the read email text having the order information, along with instructions to extract order attributes, as a prompt.</li><li>Read the API response to gather the read order attributes for each order,</li><li>Call SAP BAPI to create a Sales Order based on the read attributes.</li><li>Publish an order confirmation message to the enterprise using SDK’s client library class for Cloud Pub/Sub.</li></ul><p>Below is an example email of an urgent order received by the business from the procurement manager of one of the Google offices to replenish their pantry stock. I would be using the same in the blog to read and create order based on the above steps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5dYL_PdGVo2siJ3f" /><figcaption>Example email message for an urgent order request</figcaption></figure><p>Here is a high level architecture of the proposed solution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*p_Z3W-N06fNBIKbM" /><figcaption>High level reference architecture of the solution</figcaption></figure><blockquote>“Blog post linked <a href="https://medium.com/google-cloud/automating-sales-order-entry-in-sap-using-google-clouds-ai-services-5b513069cb80">here</a> can be referred for reference architecture for processing physical PDF based POs and blog post <a href="https://medium.com/google-cloud/abap-sdk-for-google-cloud-enables-google-workspace-apis-to-be-consumed-from-sap-applications-965a4c1e936c">here</a> can be referred for reference architecture for processing POs coming as PDF attachments in Gmail inbox.”</blockquote><h3>Before we begin</h3><p>Before starting, let’s recap on a few entities that we are going to work with in this blog.</p><ul><li>PaLM 2 for Text — The <a href="https://cloud.google.com/vertex-ai/docs/generative-ai/model-reference/text">PaLM 2 for Text</a> (text-bison, text-unicorn) foundation models are optimized for a variety of natural language tasks such as sentiment analysis, entity extraction, and content creation.</li><li>text-bison — <a href="https://cloud.google.com/vertex-ai/docs/generative-ai/start/quickstarts/quickstart-text">Text-bison</a> is a large language model (LLM) developed by Google AI. It’s a foundational model for GenAI that can understand and generate language.</li><li>ABAP SDK for Google Cloud — <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/whats-new">ABAP SDK for Google Cloud</a>, is a Google Cloud product that enables native bi-directional and real-time integration between SAP Applications and Google’s services. It has ABAP classes for each Google’s services embedded as client libraries to be invoked from the ABAP environment.</li></ul><p>In this blog we would use,</p><ul><li>Class /GOOG/CL_GMAIL_V1 to invoke Gmail API.</li><li>Class /GOOG/CL_AIPLATFORM_V1 to invoke Vertex AI API.</li><li>Class /GOOG/CL_PUBSUB_V1 to invoke Cloud Pub/Sub.</li></ul><h3>Prerequisites</h3><p>Before we start, let’s look at the below prerequisites needed for invoking the API.</p><ul><li>You have a Google Cloud account and project. Please keep the Project Id with you which is available in Google Cloud <a href="https://console.cloud.google.com/home/dashboard">Dashboard</a>.</li><li>Billing is enabled for your project. <a href="https://cloud.google.com/billing/docs/how-to/verify-billing-enabled">See how to confirm that billing is enabled for your project</a>.</li><li><a href="https://developers.google.com/gmail/api/guides">Gmail API</a> is enabled for your GCP project.</li><li><a href="https://cloud.google.com/vertex-ai/docs">Vertex AI API</a> is enabled for your GCP project.</li><li><a href="https://cloud.google.com/pubsub/docs/overview">Cloud Pub/Sub API</a> is enabled for your GCP project.</li><li>You have ABAP SDK for Google Cloud installed in your SAP system (<a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/install-config">installation guide</a>).</li></ul><h3>The solution</h3><h4>Setup client key and service map configurations</h4><p><a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/install-config#client_key_config">Client Key configuration</a> is required for connectivity to Google Cloud APIs through the SDK. For doing that, Login to SAP, goto SPRO &gt; ABAP SDK for Google Cloud &gt; Basic Settings &gt; Configure Client Key and add a new entry.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*42z2aCOvCUNYDABo" /><figcaption>Client Key Configuration</figcaption></figure><p><a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/install-config#service_mapping_config">Service Map configuration</a> is required for specifying region specific endpoints for any API that can have region specific endpoints. For doing that, Login to SAP, goto SPRO &gt; ABAP SDK for Google Cloud &gt; Basic Settings &gt; Configure Service Mapping and add a new entry.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/0*e23n_roohvQXvrzv" /><figcaption>Service Map Configuration</figcaption></figure><p>Below are sample entries that you can refer to setup client keys and service maps. Please replace the service account and project id in the below entry as per your environment.</p><p><strong>Setup client key for Vertex AI</strong></p><p>Ensure that the service account is assigned the role “Vertex AI User”.</p><blockquote><strong>Google Cloud Key Name:</strong> DEMO_VERTEX_AI</blockquote><blockquote><strong>Google Cloud Service Account Name:</strong> abap-sdk-dev@gcp-project.iam.gserviceaccount.com</blockquote><blockquote><strong>Google Cloud Scope:</strong> <a href="https://www.googleapis.com/auth/cloud-platform">https://www.googleapis.com/auth/cloud-platform</a></blockquote><blockquote><strong>Google Cloud Project Identifier:</strong> gcp-project</blockquote><blockquote><strong>Authorization Class:</strong> /GOOG/CL_AUTH_GOOGLE</blockquote><blockquote>Leave the other fields blank</blockquote><h4>Setup Service Map for Vertex AI</h4><p>Goto SM59 and create a new RFC destination with the following details: (Please refer to <a href="https://cloud.google.com/vertex-ai/docs/reference/rest/">this</a> <a href="https://cloud.google.com/vertex-ai/docs/reference/rest/">link</a> for region specific service endpoints. For the below example I am using “us-central1” endpoint).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*E89QUKY8eDdEpmLX" /><figcaption>RFC for Vertex AI with region specific endpoint</figcaption></figure><blockquote><strong>Google Cloud Key Name:</strong> DEMO_VERTEX_AI</blockquote><blockquote><strong>Google Service Name:</strong> aiplatform:v1</blockquote><blockquote><strong>RFC Destination: </strong>ZGOOG_VERTEXAI_V1 (or whichever RFC destination you have created for your setup)</blockquote><h4>Setup client key for Gmail</h4><blockquote><strong>Google Cloud Key Name: </strong>DEMO_GMAIL</blockquote><blockquote><strong>Google Cloud Project Identifier: </strong>gcp-project</blockquote><blockquote><strong>Authorization ass: </strong>/GOOG/CL_OAUTH_GOOGLE</blockquote><blockquote><strong>Auth Param 1 — </strong>&lt;Oauth 2.0 Client Profile&gt;</blockquote><blockquote>Leave the other fields blank</blockquote><p><em>“Refer to the </em><a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/authentication#oauth_with_client_credentials"><em>steps</em></a><em> here to create OAuth 2.0 Client Profile and configure authentication for Gmail using OAuth 2.0 Client Credentials based authentication.”</em></p><h4>Setup client key for Cloud Pub/Sub</h4><p>Ensure that the service account is assigned the role “Pub/Sub Admin”.</p><blockquote><strong>Google Cloud Key Name:</strong> DEMO_PUBSUB</blockquote><blockquote><strong>Google Cloud Service Account Name:</strong> abap-sdk-dev@gcp-project.iam.gserviceaccount.com</blockquote><blockquote><strong>Google Cloud Scope:</strong> <a href="https://www.googleapis.com/auth/cloud-platform">https://www.googleapis.com/auth/cloud-platform</a></blockquote><blockquote><strong>Google Cloud Project Identifier:</strong> gcp-project</blockquote><blockquote><strong>Authorization Class:</strong> /GOOG/CL_AUTH_GOOGLE</blockquote><blockquote>Leave the other fields blank</blockquote><h4>Polling Gmail for new order requests</h4><p>The first step is to poll for new order requests. A rule can be built in Gmail to tag each order request with a “Label”.</p><ul><li>Call method LIST_MESSAGES of SDK’s class /GOOG/CL_GMAIL_V1 to list the new orders by passing the Gmail inbox mail id and label as inputs.</li><li><a href="https://github.com/GoogleCloudPlatform/google-cloud-abap/blob/main/abap-sdk/ZGOOG_SDK_QUICKSTART/qs_gmail.md#list-messages-using-label-as-a-filter">GitHub guide</a> can be referred for a code snippet for listing messages from Gmail mailbox against labels.</li><li>Pass the client key as the one configured for Gmail in the client key configuration step of the blog.</li></ul><p>It is also possible to list the messages by specifying more than one label ids, for example if you would like to list all the email messages which are in your “Inbox” and are “Unread”, you can introduce below code snippet in the code sample before calling method “LIST_MESSAGES”.</p><pre>lo_client-&gt;set_overriding_uri(<br>  EXPORTING<br>    iv_uri = &#39;/gmail/v1/users/me/messages?labelIds=UNREAD&amp;labelIds=INBOX&#39; ).</pre><h4>Get Gmail message content</h4><p>The next step is to read the email body text for each new Gmail message/email listed from above step.</p><ul><li>Call method GET_MESSAGES of SDK’s class /GOOG/CL_GMAIL_V1 to get the content of each listed message.</li><li><a href="https://github.com/GoogleCloudPlatform/google-cloud-abap/blob/main/abap-sdk/ZGOOG_SDK_QUICKSTART/qs_gmail.md#get-content-of-an-email">GitHub guide</a> can be referred to for a code snippet to get content from a Gmail message.</li><li>Pass the client key as the one configured for Gmail in the client key configuration step of the blog.</li></ul><h4>Get order attributes by passing the content to Vertex AI model</h4><p>Each read email body text which has the order details is passed to Vertex AI API to get the order attributes. The text is sent to the API along with concise instructions to parse and send back order instructions in JSON format as a <a href="https://cloud.google.com/vertex-ai/docs/generative-ai/learn/introduction-prompt-design">prompt</a>.</p><p>Below is the prompt that we would be using for the blog.</p><pre>&quot;I will give you an email context, you identify the parameters from the email to match given cases as following, and return the results in json format, provide concise answers, no explanation. Give the Delivery date in DD.MM.YYYY format. <br>CASE 1. When a retailer order : {<br>&quot;parameters&quot;: {<br>&quot;IVendor&quot;:Vendor name,<br>&quot;IItem&quot;:Item name,<br>&quot;IBoxqty&quot;:Box qty,<br>&quot;ISendername&quot;: Sender name,<br>&quot;ISendercompany&quot;: Sender company,<br>&quot;ISenderdesignation&quot;: Sender designation,<br>&quot;ISenderaddress&quot;: Sender address,<br>&quot;IShippingaddress&quot;: Shipping address,<br>&quot;IDeliverydate&quot;: &quot;Deliverydate<br> } } <br>CASE 2. Others : None<br>Email Content: &lt;Email Content&gt;<br>Place the ordered items in JSON nest.&quot;</pre><ul><li>Call method PREDICT_MODELS of SDK’s class /GOOG/CL_AIPLATFORM_V1 to invoke Vertex AI text-bison model.</li><li>Code snippet below can be referred to pass the prompt to the API and get the response, pass the client key as the one configured for Vertex AI in the client key configuration step of the blog.</li><li>The ABAP types declarations are to prepare the request for and capture the response from Vertex AI PaLM 2 Text model as per documentation <a href="https://cloud.google.com/vertex-ai/docs/generative-ai/start/quickstarts/quickstart-text#try_text_prompts">here</a>.</li></ul><pre>* Types declarations<br>TYPES:<br>  BEGIN OF ty_instances,<br>    content TYPE string,<br>  END OF ty_instances.<br><br>TYPES:<br>     tt_instances TYPE STANDARD TABLE OF ty_instances WITH DEFAULT KEY .<br><br>TYPES:<br>  BEGIN OF ty_parameters,<br>    max_output_tokens TYPE i,<br>    temperature       TYPE f,<br>    top_k             TYPE i,<br>    top_p             TYPE f,<br>  END OF ty_parameters.<br><br>TYPES ty_categories TYPE string .<br>TYPES:<br>  BEGIN OF ty_scores,<br>    scores TYPE string,<br>  END OF ty_scores .<br>TYPES:<br>  tt_categories TYPE STANDARD TABLE OF ty_categories WITH DEFAULT KEY .<br>TYPES:<br>  tt_scores TYPE STANDARD TABLE OF ty_scores WITH DEFAULT KEY .<br><br>TYPES:<br>  BEGIN OF ty_safety_attributes,<br>    blocked    TYPE abap_bool,<br>    categories TYPE tt_categories,<br>    scores     TYPE tt_scores,<br>  END OF ty_safety_attributes .<br><br>TYPES:<br>  BEGIN OF ty_predictions,<br>    content           TYPE string,<br>    safety_attributes TYPE ty_safety_attributes,<br>  END OF ty_predictions .<br>TYPES:<br>  tt_predictions TYPE STANDARD TABLE OF ty_predictions WITH DEFAULT KEY .<br><br>TYPES:<br>  BEGIN OF ty_output,<br>    deployed_model_id  TYPE string,<br>    metadata           TYPE REF TO data,<br>    model              TYPE string,<br>    model_display_name TYPE string,<br>    model_version_id   TYPE string,<br>    predictions        TYPE tt_predictions,<br>  END OF ty_output.<br><br>* Data declarations<br>DATA:<br>  lv_p_projects_id   TYPE string,<br>  lv_p_locations_id  TYPE string,<br>  lv_p_publishers_id TYPE string,<br>  lv_p_models_id     TYPE string,<br>  ls_input           TYPE /goog/cl_aiplatform_v1=&gt;ty_001.<br><br>DATA:<br>      lv_email_text TYPE string.<br><br>CONSTANTS: lc_ob TYPE c VALUE &#39;{&#39;,<br>           lc_cb TYPE c VALUE &#39;}&#39;.<br><br>* Email content having order request<br>lv_email_text =  &lt;Read Gmail message content&gt;.<br><br>TRY.<br>    DATA(lv_raw) = VALUE string( ).<br>* Open HTTP Connection<br>    DATA(lo_client) = NEW /goog/cl_aiplatform_v1( iv_key_name = &#39;DEMO_VERTEX_AI&#39; ).<br><br>* Populate relevant parameters<br>    lv_p_projects_id = lo_client-&gt;gv_project_id.<br>    lv_p_locations_id = &lt;location id of the endpoint&gt;.<br>    lv_p_publishers_id = &#39;google&#39;.<br>    lv_p_models_id = &#39;text-bison&#39;.<br><br>* Call API method: aiplatform.projects.locations.publishers.models.predict<br>    CALL METHOD lo_client-&gt;predict_models<br>      EXPORTING<br>        iv_p_projects_id   = lv_p_projects_id<br>        iv_p_locations_id  = lv_p_locations_id<br>        iv_p_publishers_id = lv_p_publishers_id<br>        iv_p_models_id     = lv_p_models_id<br>        is_input           = VALUE #(<br>     parameters = NEW ty_parameters(<br>           max_output_tokens  = 256<br>           temperature = &#39;0.2&#39;<br>           top_k = &#39;40&#39;<br>           top_p  = &#39;0.8&#39; )<br>      instances = NEW tt_instances( ( content =<br>* Context to AI Model<br>       |I will give you an email context, you identify the parameters from the email to match given cases as following, and | &amp;&amp;<br>       |return the results in json format, | &amp;&amp;<br>       |provide concise answers, no explanation. Give the Delivery date in DD.MM.YYYY format. | &amp;&amp;<br>       |CASE 1. When a retailer order : | &amp;&amp; lc_ob &amp;&amp;<br>* Desired Output for an order email<br>|&quot;parameters&quot;: | &amp;&amp; lc_ob &amp;&amp;<br>|&quot;IVendor&quot;:Vendor name,&quot;IItem&quot;:Item name,&quot;IBoxqty&quot;:Box qty, &quot;ISendername&quot;: Sender name, &quot;ISendercompany&quot;: Sender company| &amp;&amp;<br>|, &quot;ISenderdesignation&quot;: Sender designation, &quot;ISenderaddress&quot;: Sender address, &quot;IShippingaddress&quot;: Shipping address, &quot;IDeliverydate&quot;: &quot;Deliverydate| &amp;&amp;<br>         lc_cb &amp;&amp; lc_cb &amp;&amp;<br>       |CASE 2. Others : None | &amp;&amp;<br>* Actual email content passed to AI Model. You can also try with different verbiage and evaluate the output<br>       |Email Content: | &amp;&amp; lv_email_text &amp;&amp; |Place the ordered items in JSON nest.| ) ) )<br>      IMPORTING<br>        es_raw             = lv_raw<br>        ev_ret_code        = DATA(lv_ret_code)<br>        ev_err_text        = DATA(lv_err_text)<br>        es_err_resp        = DATA(ls_err_resp).<br><br>    IF lo_client-&gt;is_success( lv_ret_code ).<br>      DATA(ls_output_llm) = VALUE ty_output( ).<br>* Deserializing API response to get model response<br>      /goog/cl_json_util=&gt;deserialize_json( EXPORTING iv_json        = lv_raw<br>                                                      iv_pretty_name = /ui2/cl_json=&gt;pretty_mode-extended<br>                                            IMPORTING es_data        = ls_output_llm ).<br>      cl_demo_output=&gt;new(<br>        )-&gt;begin_section( &#39;API Call Successful:&#39;<br>        )-&gt;write_text( &#39;Respose from model:&#39;<br>        )-&gt;write_text( ls_output_llm-predictions[ 1 ]-content<br>        )-&gt;display( ).<br>    ELSE.<br>      cl_demo_output=&gt;new(<br>        )-&gt;begin_section( &#39;API Call Unsuccessful:&#39;<br>        )-&gt;write_text( &#39;Error Message:&#39;<br>        )-&gt;write_text( lv_err_text<br>        )-&gt;display( ).<br><br>    ENDIF.<br><br>* Close HTTP Connection<br>    lo_client-&gt;close( ).<br><br>  CATCH /goog/cx_sdk INTO DATA(lo_exception).<br>    DATA(lv_error) = lo_exception-&gt;get_text( ).<br>    cl_demo_output=&gt;new(<br>     )-&gt;begin_section( &#39;Exception Occured:&#39;<br>     )-&gt;write_text( lv_error<br>     )-&gt;display( ).</pre><p>For the in mail order request below,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*H_lTWtOwktQQhwIF" /></figure><p>the above code snippet would give output with read order attributes in a JSON format as below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mhcJM_TgjLlv6NCI" /></figure><h4>Call SAP BAPI to create order</h4><p>Deserialise the JSON received in above step into a local ABAP type and then pass the same to SAP BAPI “BAPI_SALESORDER_CREATEFROMDAT2” to create a Sales Order.</p><h4>Publish order confirmation message to the enterprise</h4><p>An order confirmation message is published to a Cloud Pub/Sub topic for any follow on business process to ensue.</p><ul><li>Call method “PUBLISH_TOPICS” of class /GOOG/CL_PUBSUB_V1 to publish a message with sales order number to a Cloud Pub/Sub topic.</li><li><a href="https://github.com/GoogleCloudPlatform/google-cloud-abap/blob/main/abap-sdk/ZGOOG_SDK_QUICKSTART/qs_publish_messages.md">GitHub guide</a> can be referred along with the <a href="https://github.com/GoogleCloudPlatform/google-cloud-abap/blob/main/abap-sdk/ZGOOG_SDK_QUICKSTART/zr_qs_publish_messages.prog.abap">code snippet</a> to publish a message to a topic.</li><li>Pass the client key as the one configured for Cloud Pub/Sub in the client key configuration step of the blog.</li></ul><p>Below is a representation of the above steps to build automation for the business for processing urgent orders coming as Gmail texts using Google Cloud’s Vertex AI platform all made possible natively from your SAP automation application by ABAP SDK for Google Cloud.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RZ2OZ7PQnYt3uSpb" /><figcaption>Art of the possible flow diagram for order processing with Google’s Vertex AI and ABAP SDK for Google Cloud</figcaption></figure><p>Have a look at the below video to see the solution in action.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FRDZtpUwJbA8%3Flist%3DPLbUEAA0lFNT43Yy87JnZ3Q0WuxUCIV7XN&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DRDZtpUwJbA8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FRDZtpUwJbA8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/471f19ce62b71c038a71d721ffe6f58f/href">https://medium.com/media/471f19ce62b71c038a71d721ffe6f58f/href</a></iframe><h3>Summary and next steps</h3><p>This blog showed an art of the possible SAP relevant use case of leveraging Generative AI in a business use case to achieve operational efficiency. We also learnt how ABAP SDK for Google Cloud can be used to bring the power of Google’s Vertex AI directly to your ABAP environment and empowers SAP customers, developers and architects to build SAP applications and consume the AI capabilities natively from the applications.</p><p>We would be releasing more blogs talking about more reference architectures for you to refer and build solutions for your businesses.</p><h3>Join the community !!!!</h3><p>The ABAP SDK for Google Cloud Community is now open! This is a place for you to ask questions, share knowledge, and collaborate with other ABAP developers who are using Google Cloud. We encourage you to get involved in the community and help us make the ABAP SDK for Google Cloud even better. We have a lot of exciting things planned for the future, and we want you to be a part of it.</p><p>Click the link below to join and innovate with us.</p><p><a href="https://www.googlecloudcommunity.com/gc/forums/filteredbylabelpage/board-id/cloud-developer-tools/label-name/abap%20sdk?source=post_page-----d9a7c110ae4c--------------------------------">Developer Tools</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5911713ed62d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/transforming-sap-use-cases-with-googles-vertex-ai-from-within-abap-5911713ed62d">Transforming SAP use cases with Google’s Vertex AI from within ABAP</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ABAP SDK for Google Cloud enables Google Workspace APIs to be consumed from SAP applications]]></title>
            <link>https://medium.com/google-cloud/abap-sdk-for-google-cloud-enables-google-workspace-apis-to-be-consumed-from-sap-applications-965a4c1e936c?source=rss-99fa7ef0c8a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/965a4c1e936c</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[abap-sdk-for-google-cloud]]></category>
            <category><![CDATA[gcp-app-dev]]></category>
            <category><![CDATA[google-workspace]]></category>
            <category><![CDATA[sap]]></category>
            <dc:creator><![CDATA[Devesh Singh]]></dc:creator>
            <pubDate>Sat, 21 Oct 2023 01:29:30 GMT</pubDate>
            <atom:updated>2023-10-27T07:07:03.117Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pRBcYa_fk4PoOqt2s1sMtg.jpeg" /></figure><p><a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/whats-new">ABAP SDK for Google Cloud</a>, is a Google Cloud product that enables native bi-directional and real-time integration between SAP Applications and Google’s services. With the <a href="https://cloud.google.com/blog/products/sap-google-cloud/abap-sdk-for-google-cloud-gets-enhancements-and-new-features">latest release V1.5</a> of the SDK, <a href="https://developers.google.com/workspace">Google Workspace</a> APIs like <a href="https://developers.google.com/gmail">Gmail</a>, <a href="https://developers.google.com/sheets">Sheets</a>, <a href="https://developers.google.com/docs">Docs</a>, <a href="https://developers.google.com/drive">Drive</a> and <a href="https://developers.google.com/chat">Chat</a> are also available for SAP developers to consume natively from their SAP applications. To support Workspace APIs, a new authentication feature <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/authentication#oauth_with_client_credentials">OAuth 2.0 with client credentials</a> is also available in V1.5 to authenticate with the user’s own Google credentials.</p><p>Along with workspace APIs, V1.5 of the SDK now supports 40+ additional APIs in the areas of Google Vertex AI, Google Maps, and other Google Enterprise APIs (<a href="https://cloud.google.com/blog/products/sap-google-cloud/abap-sdk-for-google-cloud-gets-enhancements-and-new-features/">Launch Blog</a>). Be it calling a Generative AI model from your ABAP layer, pulling in order information from Gmail or Sheets, building delivery/shipment routing use cases using Maps or redacting sensitive information from texts, the opportunities for building robust next generation SAP applications with Google’s AI/ML services are limitless.</p><p>In this blog post, I would be focusing on invoking the Gmail API to first get a list of Purchase Order request emails from a Gmail mailbox based on filters such as “Labels”, then to get contents of the in mail order requests along with attachments having detailed order items, then use Cloud Document AI to parse the attachment to get PO entities, and then finally calling SAP BAPI to create Sales Orders from the entities extracted.</p><h3><strong>Before we begin</strong></h3><p>Before we start, let’s look at the below prerequisites needed for invoking the API.</p><ul><li>You have a Google Cloud account and project. Please keep the Project Id with you which is available in Google Cloud <a href="https://console.cloud.google.com/home/dashboard">Dashboard</a>.</li><li>Billing is enabled for your project. <a href="https://cloud.google.com/billing/docs/how-to/verify-billing-enabled">See how to confirm that billing is enabled for your project</a>.</li><li>Gmail API is enabled for your GCP project.</li></ul><figure><img alt="Gmail API should be enabled for your GCP project" src="https://cdn-images-1.medium.com/max/1024/0*4iFcFqDAMfCAdv2b" /><figcaption>Gmail API should be enabled for your GCP project</figcaption></figure><h3><strong>Setting up OAuth 2.0 Client</strong></h3><p>Google Workspace APIs use OAuth 2.0 Client Credentials based authentication, the foundation components to enable the same are embedded within the SDK. <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/authentication#oauth_with_client_credentials">Authentication setup guidelines</a> can be referred to setup Google Cloud console and SAP OAuth artifacts to enable the authentication for Gmail API. Below is the setup done for invoking Gmail API for this blog.</p><h4>Setup Client Credentials</h4><p>Create <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/authentication#oauth_create_credentials">OAuth Client ID Credentials</a> on Google Cloud console under the GCP project where you have enabled the Gmail API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qaHMkx1fw331PkWM" /><figcaption>Sample OAuth Client Credential in a GCP project</figcaption></figure><h4>Setup OAuth 2.0 Client Profile for Gmail API</h4><p><a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/authentication#oauth_setup_client_profile">Create an OAuth Client profile</a> with the provider type “/GOOG/ABAP_SDK” shipped with the SDK.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*py1TStZ8RNmIAJtDgvJLvQ.png" /><figcaption>OAuth Client Profile for Gmail setup in SAP</figcaption></figure><p>For this blog I have added all the scopes for Gmail API in the OAuth profile, you can also pick and choose the scopes from the link <a href="https://developers.google.com/identity/protocols/oauth2/scopes#gmail">here</a> for giving specific authorization to a user for a particular set of operations.</p><h4>Configure OAuth 2.0 Client</h4><p><a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/authentication#oauth_configure_client">Configure OAuth 2.0 Client profile</a> by,</p><ol><li>Going to SAP TCode “OA2C_CONFIG”, a WebDynpro application opens up, Click on “Create”.</li><li>Selecting the created “OAuth Client Profile” from the drop down and giving the “Client ID” from OAuth credentials created in Google Cloud console earlier, Click on “OK”.</li><li>Giving the “Client Secret” from the OAuth credentials created in Google Cloud console earlier and clicking on “Save”.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gS2m0yGcYi7w8xBC" /><figcaption>Setup OAuth Client ID Configuration</figcaption></figure><h4>Setup OAuth 2.0 Grant</h4><p><a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/authentication#oauth_request_token">Setup OAuth 2.0 Grant</a> by going to SAP TCode “OA2C_GRANT”, A WebDynpro application opens up, select the Client ID line item given in the OAuth config from before,</p><ul><li>Click on “Request OAuth 2.0 Tokens”, and sign in with your Google ID.</li><li>On the consent screen that opens up, click on “Allow”.</li><li>The WebDynpro application shows that the request is granted with the “Green” icon.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nF0SaY-FeREVPZC3" /><figcaption>Setup OAuth 2.0 Grant</figcaption></figure><h3><strong>Process POs from Gmail</strong></h3><h4>Setup Client Key configuration</h4><p>For invoking any Google API through ABAP SDK for Google Cloud, <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/install-config#client_key_config">client key configuration</a> is required to denote the connectivity and the authentication mechanism to be used. SPRO node</p><p>“Configure Client Key” under “Basic Settings” of node “ABAP SDK for Google Cloud” (shipped with the SDK) can be used to configure the client key table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zpI1R76YilABbhfX" /><figcaption>SPRO node shipped with the SDK to setup Client Key</figcaption></figure><p>For this blog, we would configure the client key to invoke Gmail API as below,</p><ul><li>Specify the Client Key name as “TEST_GMAIL”</li><li>Specify the Google Cloud project name</li><li>Specify the Google Cloud Service Account in email address format</li><li>Provide authorization class as “/GOOG/CL_OAUTH_GOOGLE”, which is shipped with the SDK to enable OAuth client credentials based authentication to Google Workspace APIs</li><li>Provide OAuth Client Profile prepared earlier with OAuth scopes for Gmail, this is used during authentication to derive user’s authorization to access different operations of the API</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*PY4QomQUyHZuVE5T" /><figcaption>Sample Client Key for Gmail</figcaption></figure><p>You can run the “Authentication Configuration Validation Tool” shipped with the SDK from the SPRO node shipped with the SDK to validate the configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o2C9X3od3QieKzkq3ryIfQ.png" /><figcaption>Authentication Configuration Validation tool run for the sample Client Key for Gmail API</figcaption></figure><h4>Solution in detail</h4><p>An SAP ABAP automation program can be written to run as a background job to run at a frequency and leverage client library classes of latest release of ABAP SDK for Google Cloud to,</p><p><strong>Call Gmail API to,</strong></p><ul><li>Poll and list the email messages with incoming PO Requests</li><li>Get message contents (email body and attachment details),</li><li>Get attachment data having PO items from the email messages.</li></ul><p>Methods of ABAP class “/GOOG/CL_GMAIL_V1” shipped with the SDK can be used to realize the above steps.</p><p><strong>Call Cloud Document AI API </strong>to pass the fetched attachment data to parse and get PO entities, methods of class “/GOOG/CL_DOCUMENTAI_V1” can be used to do this.</p><p><strong>Call SAP standard BAPI</strong> to create Sales Orders by passing the parsed PO entities.</p><p>Here is an example of a PO request from a vendor having a PDF attachment with Purchase Order details with a label “PODEMO” associated with it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qlZ4EtuwP_NFn5GV" /><figcaption>Purchase Order request in Gmail inbox with PO attachment in the form of a PDF file</figcaption></figure><h4>List Gmail messages with PO requests</h4><p>In the automation program logic,</p><ul><li>Call method “LIST_MESSAGES” of class “/GOOG/CL_GMAIL_V1” to get a list of emails from the Gmail account.</li><li>Email ID is a mandatory parameter to be passed as input under “IV_P_USER_ID”,</li><li>You can hardcode “me” as string input to by default pass your email id,</li><li>Otherwise pass the email id of the Gmail inbox in email id format.</li><li>Label ID can be passed in query parameter “IV_Q_LABELIDS”, pass label id as “PODEMO”.</li><li>Each email <a href="https://developers.google.com/gmail/api/reference/rest/v1/users.messages#Message">message</a> in Gmail is associated with a message id and a thread id to uniquely identify the message.</li><li>The method returns the messages in ABAP Type “TY_033” (<a href="https://developers.google.com/gmail/api/reference/rest/v1/users.messages/list#response-body">ListMessagesResponse</a>) with the unique message ids.</li><li>Here is a <a href="https://github.com/GoogleCloudPlatform/google-cloud-abap/blob/main/abap-sdk/ZGOOG_SDK_QUICKSTART/zr_qs_gmail_list_messages.prog.abap">code sample</a> to list all the emails with the “Label” in response captured in structure “LS_OUTPUT”.</li><li>“MESSAGES” field in the response structure holds the list of email message ids.</li></ul><p>It is also possible to list the messages by specifying more than one label ids, for example if you would like to list all the email messages which are in your “Inbox” and are “Unread”, you can introduce below code snippet in the code sample before calling method “LIST_MESSAGES”.</p><pre>lo_client-&gt;set_overriding_uri(<br>  EXPORTING<br>    iv_uri = &#39;/gmail/v1/users/me/messages?labelIds=UNREAD&amp;labelIds=INBOX&#39; ).</pre><h4>Get contents of the PO request</h4><p>In a loop iteration, for each email message from the list (LS_OUTPUT-MESSAGES[ ] from above step),</p><ul><li>Call method “GET_MESSAGES” of class “/GOOG/CL_GMAIL_V1” get the content of an email message as a <a href="https://developers.google.com/gmail/api/reference/rest/v1/users.messages#Message.MessagePart">multipart output</a> embedded in a <a href="https://developers.google.com/gmail/api/reference/rest/v1/users.messages#Message">message</a>.</li><li>Email ID is a mandatory parameter to be passed as input under “IV_P_USER_ID”,</li><li>You can hardcode “me” as string input to by default pass your email id,</li><li>Otherwise pass the email id of the Gmail inbox in email id format.</li><li>Message ID is a mandatory parameter to be passed under “IV_P_ID” and can be passed from the loop iteration of “LS_OUTPUT-MESSAGES[n]-ID”.</li><li>The method returns the content in ABAP Type “TY_037” (<a href="https://developers.google.com/gmail/api/reference/rest/v1/users.messages#Message">Message</a>) which has embedded type “TY_038” (<a href="https://developers.google.com/gmail/api/reference/rest/v1/users.messages#Message.MessagePart">MessagePart</a>) to hold the message parts.</li><li>Each email <a href="https://developers.google.com/gmail/api/reference/rest/v1/users.messages#Message">message</a> in Gmail is associated with a message id and a thread id to uniquely identify the message and the response .</li><li>Developers would have to do some post processing logic to extract the content out of the response data, here is a <a href="https://github.com/GoogleCloudPlatform/google-cloud-abap/blob/main/abap-sdk/ZGOOG_SDK_QUICKSTART/zr_qs_gmail_get_messages.prog.abap">code sample</a> to get contents of an email message.</li><li>Each attachment in a Gmail message is associated with an “Attachment ID” to uniquely identify the attachment, and the same is available in the field “ATTACHMENT_ID” of the “BODY” of the message part (Line 111 in the code sample).</li></ul><h4>Get contents of the PO attachment</h4><p>For each attachment id,</p><ul><li>Call method “GET_ATTACHMENTS” of class “/GOOG/CL_GMAIL_V1” to read the attachment data in a Base64 encoded string.</li><li>Email ID is a mandatory parameter to be passed as input under “IV_P_USER_ID”,</li><li>You can hardcode “me” as string input to by default pass your email id,</li><li>Otherwise pass the email id of the Gmail inbox in email id format.</li><li>Message ID is a mandatory parameter to be passed under “IV_P_MESSAGE_ID” and can be passed from the loop iteration.</li><li>Attachment ID is a mandatory parameter to be passed under “IV_P_ID” and can be passed from the loop iteration.</li><li>The method returns the attachment content in ABAP Type “TY_039” (<a href="https://developers.google.com/gmail/api/reference/rest/v1/users.messages.attachments#MessagePartBody">MessagePartBody</a>) as response under the field “DATA”.</li></ul><p>Developers would have to do some post processing logic to extract the attachment content out of the response data, here is a <a href="https://github.com/GoogleCloudPlatform/google-cloud-abap/blob/main/abap-sdk/ZGOOG_SDK_QUICKSTART/zr_qs_gmail_get_attachments.prog.abap">code sample</a> to get contents of an email attachment in Base64 encoded string.</p><h4>Parse contents of the PO attachment</h4><ul><li>The returned encoded data can be passed to Google Cloud’s Document AI using class “/GOOG/CL_DOCUMENTAI_V1” enabled in the SDK.</li><li>Method “PROCESS_PROCESSORS” can be used to parse the document and extract the entities, below is a code snippet as reference.</li></ul><pre>DATA:<br>   ls_input           TYPE /goog/cl_documentai_v1=&gt;ty_084.<br><br> TRY.<br><br>* Open HTTP Connection<br>     DATA(lo_client) = NEW /goog/cl_documentai_v1( iv_key_name = &#39;&lt;client_key&gt;&#39; ).<br><br>* Populate relevant parameters<br> ls_input-raw_document-content   = ls_output_attachment-data. &quot;from the code sample above<br> ls_input-raw_document-mime_type = &#39;application/pdf&#39;.<br><br>* Call API method: documentai.projects.locations.processors.process<br>     CALL METHOD lo_client-&gt;process_processors<br>       EXPORTING<br>         iv_p_projects_id   = &#39;GCP Project Name&#39;<br>         iv_p_locations_id  = &#39;Location ID&#39;<br>         iv_p_processors_id = &#39;Processor ID of the Purchase Order Parser&#39;<br>         is_input           = ls_input<br>       IMPORTING<br>         es_output          = DATA(ls_output)<br>         ev_ret_code        = DATA(lv_ret_code)<br>         ev_err_text        = DATA(lv_err_text)<br>         es_err_resp        = DATA(ls_err_resp).<br>     IF lo_client-&gt;is_success( lv_ret_code ).<br>       MESSAGE &#39;Success&#39; TYPE &#39;S&#39;.<br>     ELSE.<br>       MESSAGE lv_err_text TYPE &#39;E&#39;.<br>     ENDIF.<br><br>* Close HTTP Connection<br>     lo_client-&gt;close( ).<br><br>   CATCH /goog/cx_sdk INTO DATA(lo_exception).<br>* Handle exceptions<br> ENDTRY.</pre><h4>Create Sales Orders from POs</h4><ul><li>Prepare parameters of BAPI “BAPI_SALESORDER_CREATEFROMDAT2” by referring to the extracted entities from each Purchase Order attachment from above step.</li><li>Call the BAPI to create Sales Orders in the loop iteration.</li></ul><p>Below is a representation of the above steps to fetch PO requests from Gmail mailbox and then use Cloud Document AI to extract PO entities from attachments to create Sales Orders, all made possible natively from your SAP automation application by ABAP SDK for Google Cloud.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rIq72XHFmiw-FwLc" /><figcaption>Flow diagram for PO processing using ABAP SDK for Google Cloud</figcaption></figure><h3><strong>Opportunities for unlimited innovation</strong></h3><p>Taking an example of Gmail API, the blog showed how to invoke a Google Workspace API from your SAP application using ABAP SDK for Google Cloud. We also used Cloud Document AI during the same runtime to parse and extract PO entities from Gmail attachments. With ABAP SDK for Google Cloud V1.5, we bring many more opportunities of “amalgamation” scenarios to call Google’s services to realize your complex business scenarios. With our design approach of “Single Window of Interaction”, you can quickly instantiate and invoke Google APIs at any point in your logic flow. For example, the above storyline of PO processing can further be enhanced to,</p><ul><li>After parsing the PO attachment, Address Validation API can be called using the SDK to validate and correct the Sold-to party and Ship-to party addresses before using the same to look up the SAP sold to and ship to numbers, thus reducing errors.</li><li>Translation AI API can be called to translate the “Delivery Instructions” from foreign language to local language making it easier for delivery personnel to understand the same.</li><li>Cloud Pub/Sub API can be used to publish the “Order Confirmation” message to the enterprise to trigger any follow on business process.</li></ul><p>Have a look at the below video to see these in action.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fiz_L6UOKevI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Diz_L6UOKevI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fiz_L6UOKevI%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/761be6512fc18571fb3dedb8745ddb3a/href">https://medium.com/media/761be6512fc18571fb3dedb8745ddb3a/href</a></iframe><h3><strong>Conclusion and next steps</strong></h3><p>Hope the blog gave you a glimpse of capabilities of ABAP SDK for Google Cloud with respect to Workspace APIs. In this blog we focussed on Gmail API and started with a few configuration steps for OAuth and Client Key setup. This remains the same for other workspace APIs too.</p><h4><strong>Ready to start using ABAP SDK for Google Cloud?</strong></h4><p>Bookmark <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/whats-new">What’s new with the ABAP SDK for Google Cloud</a> for the latest announcements and follow <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/install-config">installation and configuration</a> instructions.</p><p><strong>Check out these blog posts to get started with ABAP SDK for Google Cloud</strong></p><ul><li>This <a href="https://blogs.sap.com/2023/09/06/evaluating-abap-sdk-for-google-cloud-using-abap-platform-trial-1909-on-google-cloud-platform/">blog</a>, explains how you can evaluate ABAP SDK for Google Cloud using ABAP Platform Trial 1909 on Google Cloud Platform.</li><li>Read this <a href="https://blogs.sap.com/2023/09/06/automating-sales-order-entry-in-sap-using-google-clouds-ai-services/">blog post</a> to get a sneak peek on how a business process such as Sales Order entry in SAP can be automated using ABAP SDK for Google Cloud with Google Cloud Storage.</li><li>This <a href="https://blogs.sap.com/2023/09/19/google-ai-powered-automated-order-shipment-routing-in-sap-using-abap-sdk/">blog</a> is an excellent start to understand how BigQuery ML which is a powerful machine learning service that lets you build and deploy models using SQL queries. you can now be accessed with ABAP SDK for Google Cloud.</li><li>Read this <a href="https://medium.com/google-cloud/data-loss-prevention-deidentification-with-abap-sdk-for-google-cloud-5a261879141a">blog post</a> to see how you can redact sensitive information from your SAP data using Data Loss and Prevention API.</li><li>Read this <a href="https://medium.com/google-cloud/secret-manager-with-abap-sdk-for-google-cloud-d508750d6f8a">blog</a> post to understand how to use Secret Manager with ABAP SDK.</li><li>Also check out blog post about ABAP SDK <a href="https://blogs.sap.com/2023/09/01/abap-sdk-for-google-cloud-code-wizard/">Code Wizard</a>, and on <a href="https://blogs.sap.com/2023/09/26/application-logging-in-abap-sdk-for-google-cloud/">Application logging</a> as some of the many <a href="https://blogs.sap.com/2023/09/06/abap-sdk-for-google-cloud-insider-story-of-engineering-excellence/">Engineering excellence</a> delivered as part of ABAP SDK.</li></ul><h3><strong>Join the community today !!!!</strong></h3><p>The ABAP SDK for Google Cloud Community is now open! This is a place for you to ask questions, share knowledge, and collaborate with other ABAP developers who are using Google Cloud. We encourage you to get involved in the community and help us make the ABAP SDK for Google Cloud even better. We have a lot of exciting things planned for the future, and we want you to be a part of it.</p><p>Click below link to join and innovate with us.</p><p><a href="https://www.googlecloudcommunity.com/gc/forums/filteredbylabelpage/board-id/cloud-developer-tools/label-name/abap%20sdk">Developer Tools</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=965a4c1e936c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/abap-sdk-for-google-cloud-enables-google-workspace-apis-to-be-consumed-from-sap-applications-965a4c1e936c">ABAP SDK for Google Cloud enables Google Workspace APIs to be consumed from SAP applications</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Application Logging in ABAP SDK for Google Cloud]]></title>
            <link>https://medium.com/google-cloud/application-logging-in-abap-sdk-for-google-cloud-6baf6a6afbb0?source=rss-99fa7ef0c8a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/6baf6a6afbb0</guid>
            <category><![CDATA[abap-sdk-for-google-cloud]]></category>
            <category><![CDATA[abap]]></category>
            <category><![CDATA[sap]]></category>
            <category><![CDATA[gcp-app-dev]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[Devesh Singh]]></dc:creator>
            <pubDate>Thu, 21 Sep 2023 11:13:54 GMT</pubDate>
            <atom:updated>2023-09-21T11:13:54.044Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/whats-new"><strong>ABAP SDK for Google Cloud</strong></a>, is a Google Cloud product that enables native bi-directional and real-time integration between SAP Applications and Google’s services. The SDK abstracts the complexities of integration with Google’s services through ABAP class based “𝐀𝐏𝐈 𝐬𝐭𝐮𝐛𝐬” and provides a <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/developer#single-window_of_interaction"><strong>“Single window of interaction”</strong></a> for SAP developers. With the ABAP SDK, customers can accelerate their digital transformation and achieve business goals faster.</p><p>ABAP SDK for Google Cloud has a robust <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/developer#logging"><strong>“Application Logging”</strong></a> module built in as a core foundation component to handle any errors/exceptions that can occur while calling the API stubs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7SXnhl1jkhBlFb2_TdMnbA.png" /><figcaption>ABAP SDK for Google Cloud building blocks</figcaption></figure><p>This blog post elaborates on how “Application Logging” is enabled in ABAP SDK for Google Cloud and the opportunities that SAP developers have to adjust and utilise it as per their use case demands. Application logging in the SDK is based on SAP standard artifacts which is a familiar paradigm for SAP developers and in line with the concept of “subconscious programming” of hiding the complex underlying features related to application logging in SAP.</p><h3>Application Logging in ABAP SDK for Google Cloud</h3><p>Generally application logging in SAP is achieved through <a href="https://help.sap.com/docs/SAP_NETWEAVER_750/addb96cd90c945dfb3182865363bbc47/4e21012c35d44180e10000000a15822b.html?locale=en-US"><strong>“SAP Business Application Logging”</strong></a> (BAL), which technically is a boilerplate logic of calling a set of standard BAL function modules one by one in a sequence. This boilerplate logic is repetitive if logging is to be achieved at more than one place.</p><p>Application logging in ABAP SDK for Google Cloud is enabled in a way to avoid the boilerplate logic and log errors/exceptions through “API-like” calls. Class “/GOOG/CL_LOGGER” enables this api call based “Logging Framework” and is embedded as a foundation component within the SDK.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ac5RiFPaRM5fyoJf" /><figcaption>API-like call based application logging avoids the boilerplate repetitive code</figcaption></figure><p>The logs capture the points of errors and failure during the execution of the foundation components and enable troubleshooting of the errors and exceptions occurring during the execution.</p><p>Application logging in SDK is designed to log below types of messages.</p><ul><li><strong>Error messages for local validation errors</strong> in the SDK foundation components — denoted by error code “461”.</li><li><strong>Error messages for error responses</strong> while making the API call — denoted by the standard <a href="https://www.rfc-editor.org/rfc/rfc9110.html#name-status-codes">HTTP Status Codes</a>.</li><li><strong>API stub name in which the error occurred</strong> to have visibility on point of error during troubleshooting.</li></ul><h4><strong>Log Configuration Table</strong></h4><p>Application logging in ABAP SDK for Google Cloud is driven by a log configuration table “/GOOG/LOG_CONFIG”, that can be leveraged to,</p><ul><li>Have a <strong>“Default” or business process specific</strong> logging configurations.</li><li>Defining <strong>level of logging</strong> for a configuration.</li><li>Setting the <strong>number of days</strong> the logs should be retained for a configuration.</li><li>Setting <strong>validity</strong> of a configuration through an “End Date”.</li><li><strong>Enable or disable</strong> an application logging configuration.</li></ul><h4><strong>SPRO node for log configuration</strong></h4><p>ABAP SDK for Google Cloud provides a set of tools and utilities under <strong>“SAP Reference IMG”</strong> as a SPRO node. This has options ranging from basic “Client Key” setup to tools like<a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/developer#code_wizard"> “Code Wizard”</a> and <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/developer#demo_programs">demo programs</a>.</p><p><strong>Log configuration table</strong> can be configured through this SPRO node by executing “Configure Logging Framework” under “Basic Settings” of the node “ABAP SDK for Google Cloud”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xyvnqbxvqK9LGzPNg-rBng.png" /><figcaption>SAP IMG node to setup Application Logging in ABAP SDK for Google Cloud</figcaption></figure><blockquote>“The SDK is shipped with a default configuration for application logging and also gives opportunities for SAP developers to setup their own business scenario specific logging configuration, below sections elaborate the default and custom setup opportunities.”</blockquote><h4>Default configuration</h4><p>A default configuration is shipped with the SDK with the field “IS_DEFAULT” set, along with a default log object and log sub object. All the application logs are logged against the default log object and log sub object in the shipped configuration unless adjusted by the customer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WGqNC-qA3mqI6qhL" /><figcaption>Default configuration in the Log Configuration Table</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HcS15NZl3gGbtsue" /><figcaption>Log Object and Log Subobject shipped with the ABAP SDK for Google Cloud</figcaption></figure><h4>Set a custom configuration as “Default”</h4><p>Customers can define their own log object and log sub object and set it as “default” by updating the same in the table with the field “IS_DEFAULT” set and unsetting the flag for the shipped configuration. Once done, the SDK would start taking into account the customer defined “Default” configuration instead of the shipped one. With the validations built in the SDK, at a time only one log configuration can be set as “Default”.</p><h4>Define level of logging</h4><p>Logging in ABAP SDK can be configured to log at log levels “Information”, “Warning” and “Error”. The field “MIN_LOGLEVEL” in the log configuration table has the dropdown option to choose the log level for a configuration.</p><ul><li>If the log level is chosen as <strong>“Information”</strong>, SDK would log all the “Information”, “Warning” and “Error” messages raised.</li><li>If the log level is chosen as <strong>“Warning”</strong>, SDK would skip “Information” messages, and would only log all the “Warning” and “Error” messages raised.</li><li>If the log level is chosen as <strong>“Error”</strong>, SDK would skip “Information” and “Warning” messages and only log all the “Error” messages raised.</li></ul><h4>Setting the number of days for which the logs should be retained</h4><p>For each configuration, the field “RETENTION_DAYS” in the configuration table can be set to denote the number of days for which the logs should be retained. The default setup is set to retain the logs for 10 days, but can be adjusted by the customer based on their business requirements.</p><h4>Setting validity of a log configuration</h4><p>For each configuration, the field “END_AT” in the configuration table can be set to denote the date till which the configuration is valid. No application logs are captured beyond the end date of the configuration. The default setup is set to be valid till “31.12.9999”, but can be adjusted by the customer based on their business requirements.</p><h4>Enable or disable application logging</h4><p>Customers can adjust the “END_AT” field for a configuration to activate/enable or deactivate/disable a log configuration based on their business requirement. For example, if the customer wants to disable application logging, they can set the “END_AT” date to a previous date and application logging would be disabled for that configuration.</p><h3><strong>Opportunities for SAP developers to utilise SDK’s logging framework</strong></h3><h4>Use the default configuration shipped with the SDK</h4><p>By default, the “Default” configuration shipped with the SDK would take effect and the logs would be captured under log object “ZGOOG” and log sub object “ZABAP_SDK” in BAL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2T0-aB-SEISjbfReQAcKLQ.png" /><figcaption>Log configuration table with the shipped “Default” configuration</figcaption></figure><p>SAP developers need not do any additional setup and can leverage logging through just instantiating and invoking the ABAP class for the required API. Below is a code snippet with Google’s <a href="https://cloud.google.com/pubsub">Cloud Pub/Sub</a> API as an example.</p><pre>TRY.<br>* Open HTTP Connection<br>     DATA(lo_pubsub_client) = NEW /goog/cl_pubsub_v1( iv_key_name = &#39;client_key&#39; ).<br>* Call API method<br>     CALL METHOD lo_pubsub_client-&gt;publish_topics<br>       EXPORTING<br>         iv_p_projects_id = &#39;Project ID&#39;<br>         iv_p_topics_id   = &#39;Topic ID&#39;<br>         is_input         = ls_input<br>       IMPORTING<br>         es_output        = DATA(ls_output)<br>         ev_ret_code      = DATA(lv_ret_code)<br>         ev_err_text      = DATA(lv_err_text)<br>         es_err_resp      = DATA(ls_err_resp).<br>​​* Close HTTP Connection<br>     lo_pubsub_client-&gt;close( ).<br>   CATCH /goog/cx_sdk INTO DATA(lo_exception).<br>* Handle exceptions<br>ENDTRY.</pre><p>An example log against the default setup shipped with the SDK for an invalid client key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ts-7HDVQefceW6To" /><figcaption>Application log with default configuration shipped with the SDK</figcaption></figure><h4>Setup and use own custom configuration</h4><p>SDK also gives an option to customers to setup their own self defined “Default” configuration by,</p><ul><li>Defining your own Log Object and Log Subobject (TCode — SLG0), for example create log object “ZLOG_OBJECT” and log sub object “ZLOG_SUB_OBJECT”.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ux70PhWgbO4AEJhz" /><figcaption>Developer defined log object and log subobject</figcaption></figure><ul><li>Uncheck the “IS_DEFAULT” field for the shipped default configuration.</li><li>Configure the defined own log object and log sub object in the Log Configuration table and set it as “Default”.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3nKweaNyk7TB9X9wdqn1Sw.png" /><figcaption>Log configuration table with developer defined log objects and set as “Default”</figcaption></figure><p>SAP developers can continue to leverage the same single window of interaction pattern of instantiating and calling the API specific SDK class method. An example log against the developer defined default setup for HTTP destination not maintained in Service Map table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cQEED9dywj625VFU" /><figcaption>Application log against developer defined log objects</figcaption></figure><blockquote>If you would like to have a specific configuration other than the default configuration for specific business processes, the SDK also gives an option to override the default configuration in the log configuration table (either shipped with the SDK or user defined), to log against specific log object and log sub object. For example, the requirement can be to use the log objects other than the default ones for a “Sales Order” specific business process.</blockquote><p>SAP developers can also,</p><ul><li>Define the business process specific Log Object and Log Subobject (using TCode — SLG0).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qaSISQOTravAL_Uw" /><figcaption>Developer defined log objects for a specific business process</figcaption></figure><ul><li>Configure the same in the log configuration table without checking the “IS_DEFAULT” checkbox.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UmIGY2f8qCEa8Irb" /><figcaption>Log configuration table with both “Default” and “Custom” configurations</figcaption></figure><ul><li>Pass the Log Object and Log Sub Object while instantiating the API stub.</li></ul><pre>TRY.<br>* Open HTTP Connection<br>     DATA(lo_pubsub_client) = NEW /goog/cl_pubsub_v1( iv_key_name   = &#39;client_key&#39;<br>                                              iv_log_obj    = &#39;ZSD&#39;      ”Overriding<br>                                              iv_log_subobj = &#39;ZSD_SALES_ORDERS&#39; ). ”Overriding<br>* Call API method<br>     CALL METHOD lo_pubsub_client-&gt;publish_topics<br>       EXPORTING<br>         iv_p_projects_id = &#39;Project ID&#39;<br>         iv_p_topics_id   = &#39;Topic ID&#39;<br>         is_input         = ls_input<br>       IMPORTING<br>         es_output        = DATA(ls_output)<br>         ev_ret_code      = DATA(lv_ret_code)<br>         ev_err_text      = DATA(lv_err_text)<br>         es_err_resp      = DATA(ls_err_resp).<br>​​* Close HTTP Connection<br>     lo_pubsub_client-&gt;close( ).<br>   CATCH /goog/cx_sdk INTO DATA(lo_exception).<br>* Handle exceptions<br>ENDTRY.</pre><p>Passing the log object and log sub object while instantiation of the API stub overwrites the “Default” configuration and logging is done against the passed log object and log sub object.</p><p>An example log against the developer defined overriding setup for HTTP destination not maintained in Service Map table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*O_hgbOaPMNbnmQe7" /><figcaption>Application log done against the custom overriding log objects passed by the developer during instantiation</figcaption></figure><h4><strong>Adding Contextual Information to logs</strong></h4><p>Logging framework in the SDK also adds contextual information to the logs denoting in which stub/module of the SDK the error/exception occurred. This gives additional visibility to SAP developers during troubleshooting to know the place where the actual error/exception was encountered.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p__dKEsxRDQsZwfC_qvYvg.png" /><figcaption>Name of the ABAP object logged the SDK along with the error</figcaption></figure><h3><strong>Summary</strong></h3><p>ABAP SDK for Google Cloud has a robust “API like” <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/developer#logging">application logging framework</a> embedded as a core component. It is based on SAP Business Application Logging and captures the points of errors and failure during the execution of the SDK’s foundation components and enables troubleshooting of the errors and exceptions. It is configurable and provides SAP developers with the opportunities to either use the default setup shipped with the SDK, or define their own default setup or override the default setup with a specific setup for a specific business process. It also adds contextual information of the placeholder where the error has actually occurred.</p><p>Want to hear more “Engineering Excellence” stories by the Google team implementing the SDK, take a look at the blog <a href="https://blogs.sap.com/2023/09/06/abap-sdk-for-google-cloud-insider-story-of-engineering-excellence/">“ABAP SDK for Google Cloud — Insider story of Engineering Excellence”</a>.</p><h3><strong>Next steps</strong></h3><p>I hope this blog has given you insights on the opportunities that SAP developers have to utilize logging framework when building SAP applications using ABAP SDK for Google Cloud.</p><p>If you are an ABAP developer and you want to try it out, you can follow the <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/install-config">installation and configuration guide</a> available in the public documentation of the SDK. The SDK is offered free of charge, but you will be charged for Google API usage. If you do not have a SAP system available, you can always follow this <a href="https://medium.com/google-cloud/installing-sap-netweaver-as-abap-developer-edition-7-52-trial-on-google-cloud-platform-6e8348a3a51e">article</a> to quickly set up the SAP NetWeaver AS ABAP Developer Edition 7.52 (Trial) on Google Cloud Platform and use this system to install the ABAP SDK for Google Cloud. Use embedded tools and utilities like <a href="https://blogs.sap.com/2023/09/01/abap-sdk-for-google-cloud-code-wizard/">“Code Wizard”</a> to quick start your development.</p><p>Below are some more blogs to fuel your innovation quotient where you will get a glimpse of how to develop enterprise-grade applications using the ABAP SDK to solve business problems -</p><ul><li><a href="https://blogs.sap.com/2023/09/06/automating-sales-order-entry-in-sap-using-google-clouds-ai-services/">Automating Sales Order Entry in SAP using Google Cloud’s AI services</a>,</li><li><a href="https://blogs.sap.com/2023/09/19/google-ai-powered-automated-order-shipment-routing-in-sap-using-abap-sdk/">Google AI-powered automated order/shipment routing in SAP</a>.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6baf6a6afbb0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/application-logging-in-abap-sdk-for-google-cloud-6baf6a6afbb0">Application Logging in ABAP SDK for Google Cloud</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Sales Order Entry in SAP using Google Cloud's AI services]]></title>
            <link>https://medium.com/google-cloud/automating-sales-order-entry-in-sap-using-google-clouds-ai-services-5b513069cb80?source=rss-99fa7ef0c8a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b513069cb80</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[abap]]></category>
            <category><![CDATA[gcp-app-dev]]></category>
            <category><![CDATA[abap-sdk-for-google-cloud]]></category>
            <category><![CDATA[sap]]></category>
            <dc:creator><![CDATA[Devesh Singh]]></dc:creator>
            <pubDate>Sun, 09 Jul 2023 12:00:08 GMT</pubDate>
            <atom:updated>2023-07-23T08:10:23.624Z</atom:updated>
            <content:encoded><![CDATA[<p>Google recently released <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/whats-new">ABAP SDK for Google Cloud</a>, providing bi-directional, real-time integration between SAP and Google Cloud services. SAP developers can easily leverage this SDK to integrate their SAP applications with Google Cloud services such as Vertex AI, Document AI, Translation AI, Pub/Sub, and more. With the ABAP SDK, customers can accelerate their digital transformation and achieve business goals faster.</p><p>This blog provides a walkthrough of an art of the possible use case for democratizing AI for SAP developers through ABAP SDK for Google Cloud. In this demo, we showcase a way to automate sales order entry in SAP which is a common business process with SAP customers, using Google’s AI services.</p><h3><strong>Problem Statement</strong></h3><p>A mass manufacturer of industrial fasteners receives a significant portion of their purchase orders in un-structured formats (e.g. hand written forms or PDFs sent as email attachments). Customer service reps at the company use SAP to manage Sales Orders and the challenges currently faced by them are,</p><ul><li><strong>Time-consuming and error-prone order entry:</strong> Manually entering orders is time-consuming and error-prone, which can lead to costly returns and decreased customer satisfaction.</li><li><strong>Language barriers:</strong> The company has a global customer base, and sometimes orders are placed in the local language. This can be difficult for customer service representatives to understand important shipping/handling instructions, and they may have to use third-party translation services, which can be costly.</li><li><strong>Incorrect delivery addresses:</strong> Delivery addresses in purchase order forms are not always correct, which can lead to unwanted delivery delays.</li></ul><p>The company is looking to address these challenges by automating the order entry process with Google’s AI services.</p><h3><strong>How ABAP SDK for Google Cloud can help</strong></h3><p>ABAP Developers supporting SAP ERP applications at the organization can now use the ABAP SDK for Google Cloud to solve the challenges listed above by:</p><ul><li>Loading the purchase order documents stored in<a href="https://cloud.google.com/storage"> <strong>Google Cloud Storage</strong></a> buckets,</li><li>Parsing the contents of the purchase order using <strong>DocumentAI purchase order parser</strong>,</li><li>Validating the delivery address using <a href="https://developers.google.com/maps/documentation/address-validation/overview"><strong>Address Validation API</strong></a>,</li><li>Translating delivery instructions from customer’s language to English using <a href="https://cloud.google.com/translate"><strong>TranslationAI API</strong></a>,</li><li>Sending a notification to the customer about successful creation of Sales Order through <a href="https://cloud.google.com/pubsub"><strong>Cloud Pub/Sub</strong></a>.</li></ul><p>Google Cloud’s services are enabled as ABAP client library classes within ABAP SDK for Google Cloud, and the SDK can be leveraged to invoke the APIs listed above directly from SAP modules for order processing.</p><blockquote>“ABAP SDK for Google Cloud abstracts the complexities of integration with Google’s services through these classes and provides a “Single-window of Interaction” for SAP developers. Customers need not invest time and effort in building complex SAP applications to consume Google’s services by following Google’s Discovery Document based REST API specifications and can directly consume the API resources using SDK’s client library classes in a simple two step approach — <br>1. Instantiate the client library class for Google’s service, and <br>2. Call the class’s method to invoke the API’s resource operation.”</blockquote><p>Below is a visual representation of the customer service representative’s user journey of the company for automatic order processing with Google’s AI services using ABAP SDK for Google Cloud.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S1G4RykAjFZbkK3pLC4AXg.jpeg" /><figcaption>User Journey of the Customer Service Representative</figcaption></figure><h3><strong>Prerequisites</strong></h3><p>Let’s look at some prerequisites before deep diving into the solution in detail.</p><ul><li>A Google Cloud service account with required IAM permissions to create, manage and access artifacts for Google’s Cloud Storage, Cloud Document AI, Address Validation, Translation AI, Cloud Pub/Sub Services.</li><li>SAP software installed as per guidelines <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/install-config#software_requirements">here</a>.</li><li>ABAP SDK for Google Cloud installed and configured in the SAP system as per guidelines <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/install-config">here</a>.</li></ul><h3><strong>Solution in detail with code snippets</strong></h3><p>Here is a high level architecture of the components and flow of the solution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LD6CstHnj5CVutJyWDyZTA.jpeg" /><figcaption>High level architecture diagram</figcaption></figure><p>An SAP ABAP program can be written to run as a background job to run at a frequency and leverage client library classes of ABAP SDK for Google Cloud to,</p><ul><li>Poll the GCS bucket for new Purchase Orders,</li><li>If a new PO is received,<br>(a) orchestrate the calls to the GCS bucket to list and read POs,<br>(b) parse and extract PO information,<br>(c) validate addresses,<br>(d) translate delivery text,<br>(e) create sales order by calling SAP standard BAPI,<br>(f) send notification to Cloud Pub/Sub.</li></ul><p>A Fiori Application can be built to introduce human review for documents in case of any parsing errors or incorrect addresses, the same can be “scanned” in foreground and corrected before clicking on a button to “Create” Sales Orders.</p><p>In case of errors within the library classes, ABAP SDK would log errors within SAP BAL, please refer to <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/install-config#application_logging">“Application Logging”</a> within ABAP SDK for more details.</p><p>Below are the SDK’s client library classes for the Google’s services used in the solution.</p><ul><li>Cloud Storage V1 — /GOOG/CL_STORAGE_V1</li><li>Cloud Document AI V1 — /GOOG/CL_DOCUMENTAI_V1</li><li>Address Validation V1 — /GOOG/CL_ADDRVALDN_V1</li><li>Cloud Translation V2 — /GOOG/CL_TRANSLATION_V2</li><li>Cloud Pub/Sub V1 — /GOOG/CL_PUBSUB_V1</li></ul><h3><strong>Code Snippets</strong></h3><p>Here are some code snippets to showcase implementation for each step using ABAP SDK for Google Cloud’s client library classes.</p><p><strong>List Purchase Orders in Cloud Storage Bucket<br></strong>Call method “LIST_OBJECTS” of class /GOOG/CL_STORAGE_V1 to list “Purchase Orders” in the Cloud Storage bucket and collect the list of file objects for Purchase Orders to be processed in an internal table.</p><pre>DATA lt_objects TYPE /goog/cl_storage_v1=&gt;ty_t_013.<br>TRY.<br>* Open HTTP Connection by instantiating client class for GCS<br>    DATA(lo_storage_client) = NEW /goog/cl_storage_v1( iv_key_name = &#39;client_key&#39; ).<br>* Call ABAP SDK&#39;s GCS client library class method to list file objects<br>    CALL METHOD lo_storage_client-&gt;list_objects<br>      EXPORTING<br>        iv_q_prefix = p_prefix<br>        iv_p_bucket = p_bucket<br>      IMPORTING<br>        es_output   = DATA(ls_output)<br>        ev_ret_code = DATA(lv_ret_code)<br>        ev_err_text = DATA(lv_err_text)<br>        es_err_resp = DATA(ls_err_resp).<br>* Collect list of file objects for further processing<br>    APPEND LINES OF ls_output-items TO lt_objects.<br>* Close HTTP Connection<br>    lo_storage_client-&gt;close( ).<br>  CATCH /goog/cx_sdk INTO DATA(lo_cx_sdk).<br>*Handle Exceptions<br>ENDTRY.</pre><p><strong>Get content of the Purchase Orders<br></strong>For each file object, call method “GET_OBJECTS” of class /GOOG/CL_STORAGE_V1 by passing the file names to get the content of the Purchase Orders, the content is returned in “XSTRING” format.</p><pre>DATA lv_content TYPE xstring.<br>TRY.<br>* Open HTTP Connection by instantiating client class for GCS<br>    DATA(lo_storage_client) = NEW /goog/cl_storage_v1( iv_key_name = &#39;client_key&#39; ).<br>    lo_storage_client-&gt;add_common_qparam( iv_name  = &#39;alt&#39; iv_value = &#39;media&#39; ).<br>* Call ABAP SDK&#39;s GCS client library class method to read file objects content<br>    lo_storage_client-&gt;get_objects(<br>      EXPORTING<br>        iv_p_bucket = p_bucket<br>        iv_p_object = lv_object_name<br>      IMPORTING<br>        ev_ret_code = DATA(lv_ret_code)<br>        ev_err_text = DATA(lv_err_text)<br>        es_err_resp = DATA(ls_err_resp)<br>        es_raw      = lv_content ).<br>* Close HTTP Connection<br>    lo_storage_client-&gt;close( ).<br>  CATCH /goog/cx_sdk INTO DATA(lo_cx_sdk).<br>*Handle Exceptions<br>ENDTRY.</pre><p><strong>Parse content of the Purchase Orders<br></strong>Parse each PO file content to get purchase order information.<br>(a) Transform the content of Purchase Order to Base 64 encoded string using SAP function module “SCMS_BASE64_ENCODE_STR”.<br>(b) Call method “PROCESS_PROCESSORS” of class /GOOG/CL_DOCUMENTAI_V1 to extract Purchase Order entities using the “Purchase Order” parser of Document AI API by passing file content in base 64 encoded string and mime type of the file (<a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/samples/gcs-retrieve-metadata-file">Code Sample</a> to get the mime type of the file).<br>(c) Entities of the document after parsing can be referenced from response structure LS_OUTPUT-DOCUMENT-ENTITIES.</p><pre>DATA ls_input TYPE /goog/cl_documentai_v1=&gt;ty_084.<br>DATA lv_output TYPE string.<br>DATA lv_project_id TYPE string.<br>* Call function module to convert file content in XSTRING format to Base 64 encoded string<br>CALL FUNCTION &#39;SCMS_BASE64_ENCODE_STR&#39;<br>  EXPORTING<br>    input  = lv_content<br>  IMPORTING<br>    output = lv_output.<br>TRY.<br>* Open HTTP Connection by instantiating client class for Document AI<br>    DATA(lo_docai_client) = NEW /goog/cl_documentai_v1( iv_key_name = &#39;client_key&#39; ).<br>    lv_project_id = lo_docai_client-&gt;gv_project_id.<br>    ls_input-raw_document-content   = lv_output.<br>    ls_input-raw_document-mime_type = p_mime_type.<br>* Call ABAP SDK&#39;s Document AI client library class method to process a PO document<br>    CALL METHOD lo_docai_client-&gt;process_processors<br>      EXPORTING<br>        iv_p_projects_id   = lv_project_id<br>        iv_p_locations_id  = p_location<br>        iv_p_processors_id = p_po_processor_id<br>        is_input           = ls_input<br>      IMPORTING<br>        es_output          = DATA(ls_output)<br>        ev_ret_code        = DATA(lv_ret_code)<br>        ev_err_text        = DATA(lv_err_text)<br>        es_err_resp        = DATA(ls_err_resp).<br>* Close HTTP Connection<br>    lo_docai_client-&gt;close( ).<br>  CATCH /goog/cx_sdk INTO DATA(lo_cx_sdk).<br>*Handle Exceptions<br>ENDTRY.</pre><p><strong>Validate Sold To and Ship To customer addresses<br></strong>For each Purchase Order information extracted,<br>(a) Call method “VALIDATE_ADDRESS” of class /GOOG/CL_ADDRVALDN_V1 to extract the standard address for the delivery address for Sold To and Ship To customers.<br>(b) SAP customer master table “KNA1” can then be queried to fetch the Sold To and Ship To customer numbers based on the standard addresses returned by the Address Validation API.</p><pre>DATA lv_project_id TYPE string.<br>DATA ls_input TYPE /goog/cl_addrvaldn_v1=&gt;ty_012.<br>DATA lv_address TYPE string.<br>TRY.<br>* Open HTTP Connection by instantiating client class for Address Validation<br>    DATA(lo_addrvaldn_client) = NEW /goog/cl_addrvaldn_v1( iv_key_name = &#39;client_key&#39; ).<br>    lv_project_id = lo_addrvaldn_client-&gt;gv_project_id.<br>    APPEND lv_address TO ls_input-address-address_lines.<br>* Call ABAP SDK&#39;s Address Validation client library class method to validate an address<br>    CALL METHOD lo_addrvaldn_client-&gt;validate_address<br>      EXPORTING<br>        is_input    = ls_input<br>      IMPORTING<br>        es_output   = DATA(ls_output)<br>        ev_ret_code = DATA(lv_ret_code)<br>        ev_err_text = DATA(lv_err_text)<br>        es_err_resp = DATA(ls_err_resp).<br>* Get valid standardized address from the API response<br>    DATA(lv_standardized_address) = ls_output-result-usps_data-standardized_address.<br>* Close HTTP Connection<br>    lo_addrvaldn_client-&gt;close( ).<br>  CATCH /goog/cx_sdk INTO DATA(lo_cx_sdk).<br>*Handle Exceptions<br>ENDTRY.</pre><p><strong>Translate Delivery Instructions<br></strong>For each Purchase Order information extracted,<br>(a) Call method “DETECT_DETECTIONS” of class /GOOG/CL_TRANSLATION_V2 to detect the language of the delivery instructions.<br>(b) If the language is not “English”, call method “TRANSLATE_TRANSLATIONS” of class /GOOG/CL_TRANSLATION_V2 to translate the delivery instructions to english.</p><pre>DATA lv_project_id TYPE string.<br>DATA ls_input_detect TYPE /goog/cl_translation_v2=&gt;ty_001.<br>DATA ls_detections TYPE /goog/cl_translation_v2=&gt;ty_t_003.<br>DATA lt_comments TYPE STANDARD TABLE OF string.<br>DATA ls_input_translate TYPE /goog/cl_translation_v2=&gt;ty_006.<br>DATA lv_delivery_comments TYPE string.<br>DATA lv_comments_language TYPE string.<br>TRY.<br>* Open HTTP Connection by instantiating client class for Translation AI<br>    DATA(lo_translate_client) = NEW /goog/cl_translation_v2( iv_key_name = &#39;client_key&#39; ).<br>    lv_project_id = lo_translate_client-&gt;gv_project_id.<br>    APPEND lv_delivery_comments TO ls_input_detect-q.<br>* Call ABAP SDK&#39;s Translation AI client library class method to detect language of delivery instructions<br>    CALL METHOD lo_translate_client-&gt;detect_detections<br>      EXPORTING<br>        is_input    = ls_input_detect<br>      IMPORTING<br>        es_output   = DATA(ls_output_detect)<br>        ev_ret_code = DATA(lv_ret_code)<br>        ev_err_text = DATA(lv_err_text)<br>        es_err_resp = DATA(ls_err_resp).<br>* Get language of delivery instructions from the API response<br>    ls_detections = ls_output_detect-data-detections[ 1 ].<br>    lv_comments_language = ls_detections[ 1 ]-language.<br>    IF lv_comments_language NE &#39;en&#39;.<br>    APPEND lv_delivery_comments TO lt_comments.<br>    ls_input_translate-q = lt_comments.<br>    ls_input_translate-format = &#39;text&#39;.<br>    ls_input_translate-target = &#39;en&#39;.<br>    ls_input_translate-source = lv_comments_language.<br>* Call ABAP SDK&#39;s Translation AI V2 client library class method to translate delivery instructions to English<br>    lo_translate_client-&gt;translate_translations(<br>      EXPORTING<br>        is_input  = ls_input_translate<br>      IMPORTING<br>        es_output = DATA(ls_output_translate) ).<br>* Get translated delivery instructions in English from the API response<br>    DATA(ls_translated_text) = ls_output_translate-data-translations[ 1 ].<br>    DATA(lv_translated_comments) = ls_translated_text-translated_text.<br>  ENDIF.<br>* Close HTTP Connection<br>    lo_translate_client-&gt;close( ).<br>  CATCH /goog/cx_sdk INTO DATA(lo_cx_sdk).<br>*Handle Exceptions<br>ENDTRY.</pre><p><strong>Create Sales Orders from POs<br></strong>Prepare parameters of BAPI “BAPI_SALESORDER_CREATEFROMDAT2” by referring to the extracted entities from Purchase Order parsing through Document AI, validated addresses of sold to and ship to customers and translated delivery instructions and call BAPI to create Sales Order.</p><p><strong>Publish an order confirmation message to a Cloud Pub/Sub topic<br></strong>For each Sales Order created,<br>(a) Take into account the sales order number returned by the BAPI.<br>(b) Call method “PUBLISH_TOPICS” of class /GOOG/CL_PUBSUB_V1 to publish a message with sales order number to a Cloud Pub/Sub topic.</p><pre>DATA lv_project_id TYPE string.<br>DATA ls_message    TYPE /goog/cl_pubsub_v1=&gt;ty_025.<br>DATA ls_input      TYPE /goog/cl_pubsub_v1=&gt;ty_023.<br>TRY.<br>* Open HTTP Connection by instantiating client class for Cloud PubSub<br>    DATA(lo_pubsub_client) = NEW /goog/cl_pubsub_v1( iv_key_name = &#39;client_key&#39; ).<br>    lv_project_id = lo_pubsub_client-&gt;gv_project_id.<br>    DATA(lv_msg) = | Sales Order { lv_sales_order_number } successfully created |.<br>    ls_message-data = cl_http_utility=&gt;encode_base64( unencoded = lv_msg ).<br>    APPEND ls_message TO ls_input-messages.<br>* Call ABAP SDK&#39;s Cloud Pub Sub client library class method to publish a notification<br>    CALL METHOD lo_pubsub_client-&gt;publish_topics<br>      EXPORTING<br>        iv_p_projects_id = lv_project_id<br>        iv_p_topics_id   = p_topic_name<br>        is_input         = ls_input<br>      IMPORTING<br>        es_output        = DATA(ls_output)<br>        ev_ret_code      = DATA(lv_ret_code)<br>        ev_err_text      = DATA(lv_err_text)<br>        es_err_resp      = DATA(ls_err_resp).<br>* Close HTTP Connection<br>    lo_pubsub_client-&gt;close( ).<br>  CATCH /goog/cx_sdk INTO DATA(lo_cx_sdk).<br>*Handle Exceptions<br>ENDTRY.</pre><h3><strong>An Example</strong></h3><p>Below is a demonstration of the above steps to extract information from a Purchase Order document GCS bucket and creating a Sales Order using Google Cloud’s AI services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h_z8yYxMhMSOMbzvqRayiw.png" /><figcaption>An example of automatic Sales Order Entry using ABAP SDK for Google Cloud</figcaption></figure><h3><strong>Human Review of documents in errors</strong></h3><p>A Fiori Application can be built to introduce human review for documents in case of any parsing errors or incorrect addresses, the same can be “scanned” in foreground and corrected before clicking on a button to “Create” Sales Orders.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*usvUkEmFXdMIkUanAgXKxQ.png" /><figcaption>Human review of documents in errors</figcaption></figure><h3><strong>Results &amp; Impact</strong></h3><p>By automating the order entry process, the company is able to achieve the following business benefits,</p><ul><li><strong>Reduce order processing time by 80%.</strong> On average, it used to take ~10 mins to create an order manually in the system. Using the ABAP SDK to integrate with Google Cloud Cloud services, customer service representatives are able to create the orders in 1–2 minutes.</li><li><strong>Reduce delivery errors and shipping costs</strong> ($xx) and <strong>improve time to delivery</strong> (xx days) through proactive address validation</li><li><strong>Improve order accuracy</strong> and <strong>reduce manual effort</strong> by translating customer delivery instructions accurately</li><li><strong>Provide near real-time order updates</strong> to customers using Cloud Pub/Sub.</li><li><strong>Reduce custom development effort and cost</strong> ($xx) by using in-house ABAP development skills.</li><li><strong>Reduce cost</strong> ($xx) by not using 3rd party middleware solutions or integration platforms, rather directly consuming Google Cloud services in ABAP.</li><li><strong>Reduce integration errors</strong> (xx%) by reducing the number of integration hops.</li></ul><h3><strong>Summary</strong></h3><p>ABAP SDK for Google Cloud makes it easier and convenient for SAP developers to connect to and use Google Cloud services natively from within their SAP ERP applications. This means that ABAP developers can use the language they are familiar with to access the power of Google Cloud, which can help them improve the performance, scalability, and security of their SAP ERP applications. ABAP SDK for Google Cloud provides “Single-window of interaction” for developers to consume Google Cloud services through client library classes and abstracts the complexities within the SDK’s foundation. SAP developers can just instantiate and call class methods to start their development journey without worrying about complexities such as authentication,etc..</p><p>Start your development journey with ABAP SDK for Google Cloud by downloading and installing the SDK free from the link <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/install-config#install_the">here</a>. <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/latest/quickstart">Quick Start Guides</a> and <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/samples/all-samples">Code samples</a> for enabled Google Services can be referenced from the <a href="https://cloud.google.com/solutions/sap/docs/abap-sdk/whats-new">public documentation</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b513069cb80" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/automating-sales-order-entry-in-sap-using-google-clouds-ai-services-5b513069cb80">Automating Sales Order Entry in SAP using Google Cloud&#39;s AI services</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>