SAP ABAP Archives - ERP Q&A https://www.erpqna.com/category/erp/sap-abap/ Trending SAP Career News and Guidelines Wed, 26 Aug 2026 12:45:23 +0000 en-US hourly 1 https://wordpress.org/?v=7.1 https://www.erpqna.com/wp-content/uploads/2026/05/cropped-erpqna-32x32.png SAP ABAP Archives - ERP Q&A https://www.erpqna.com/category/erp/sap-abap/ 32 32 ABAP Cloud Developer Certification: One Task, One System, 67 Percent https://www.erpqna.com/abap-cloud-developer-certification-c-abapd/?utm_source=rss&utm_medium=rss&utm_campaign=abap-cloud-developer-certification-c-abapd Tue, 25 Aug 2026 00:00:00 +0000 https://www.erpqna.com/?p=95362 C_ABAPD is delivered as one guided activity inside a working ABAP environment, scored on whether you completed the task. This guide explains what a System-Based Assessment involves, walks the seven blueprint areas, and sets a realistic build-time schedule for the 67 percent bar.

The post ABAP Cloud Developer Certification: One Task, One System, 67 Percent appeared first on ERP Q&A.

]]>

C_ABAPD is the code for SAP Certified – Backend Developer – ABAP Cloud, an associate-level credential that no longer works the way SAP certification used to. It is delivered as a System-Based Assessment: one guided, hands-on activity carried out inside a working ABAP development environment, scored on whether you completed the task correctly. The cut score is 67 percent, delivery is in English, and the credential is currently offered as a Beta Version while SAP calibrates it.

That format change is the whole story of this exam, and most of the guidance still online was written for the older approach. This guide explains what a System-Based Assessment involves, walks the seven blueprint areas ABAP Cloud covers, sets out why the RESTful Application Programming Model and Core Data Services catch experienced developers out, and gives a realistic timeline built on hands-on build time rather than reading hours.

What Is the ABAP Cloud Developer Certification?

C_ABAPD certifies that you can build business applications with modern, cloud-ready ABAP as a mentored member of a project team. It covers language fundamentals, object-oriented design, database access through ABAP SQL and Core Data Services, transactional applications built with the RESTful Application Programming Model, and Clean Core extensibility for SAP S/4HANA Cloud. It centres on the SAP BTP ABAP environment.

The word “mentored” is doing real work in that description. This is an associate credential, and SAP is explicit that the target profile is someone who contributes effectively to an implementation project under guidance rather than someone who architects it. The scope is wide, but the expected depth is that of a capable contributor.

“The modern version of the development model is ABAP Cloud, which has been developed from the outset according to the guiding principles of openness and comprehensive support for the business logic.”

Sonja Liénard, Senior Vice President and Head of ABAP Platform, SAP

The skills transfer further than the exam’s stated environment. Because the courses behind it are written to apply across deployments, what you learn for the SAP BTP ABAP environment carries over to SAP S/4HANA Cloud and to SAP S/4HANA 2020 and later. That makes the credential useful to developers working on private-edition and on-premise projects as well. The same assessment model now governs the C_CPI integration developer exam.

What Does a System-Based Assessment Actually Involve?

A System-Based Assessment, or SyBA, hands you a single guided activity and a working ABAP development environment, and asks you to complete real development tasks inside it. You are scored on whether the task was carried out correctly. It is not a recall exercise, and it is not a fixed bank of items you can memorise your way through.

How SAP certification changed when it moved to performance-based assessment for C_ABAPD

What changes for the candidate

Three things change immediately. First, you cannot pass by recognising correct answers, because there are no answers to recognise. Second, speed matters differently: you are producing working results under time pressure rather than reading and selecting. Third, tooling fluency becomes part of the exam. Knowing where things live in the development environment is no longer preparation for the test, it is the test.

The practical consequence is that reading is now the smallest part of preparation. Developers with real coding experience generally find the assessment manageable. Those who studied by reading alone tend to struggle at the moment they are asked to produce something that runs. The full format description sits on the C_ABAPD exam page if you want the specifics before committing.

Why SAP made the change

SAP completed its move to performance-based certification in early 2026, replacing recall-driven assessment across its portfolio with formats that measure applied capability. For a developer credential that shift is unusually well matched: writing ABAP is a doing skill, and an assessment that watches you do it is a more honest measure than one that asks you to describe it.

What Do the Seven Blueprint Areas Cover?

C_ABAPD publishes seven blueprint areas and no percentage weightings. They run from language core through object orientation, database access, data modeling, RAP and Clean Core extensibility, finishing with code quality, testing and AI-assisted development. Each area builds on the ones before it, which is why the recommended course order matters.

The seven areas

  • ABAP Language Core and Development Environment – tooling setup, data objects and types, control structures, string and character processing, date and time handling, internal tables, software structure, transport logistics and debugging.
  • Object-Oriented ABAP – local and global classes, instances, methods, encapsulation, inheritance, interfaces, factory methods, and defining and raising your own exception classes.
  • Database Access, ABAP SQL and Code Pushdown – SELECT statements, joins, expressions, built-in functions, sorting and aggregation, and moving calculation into the database layer.
  • Data Modeling with the ABAP Dictionary and Core Data Services – tables, domains, data elements, structures and table types, then CDS views with annotations, associations, path expressions, input parameters and metadata extensions.
  • ABAP RESTful Application Programming Model – the architecture, analysing a business object, adding behaviour with the Entity Manipulation Language, and improving the experience of the resulting OData service.
  • Clean Core Extensibility for SAP S/4HANA Cloud – key-user, developer and side-by-side extensibility, released APIs, ABAP Cloud reuse services, and adapting or replacing legacy custom code during a conversion.
  • Code Quality, Testing and AI-Assisted Development – the ABAP Test Cockpit, ABAP Unit, runtime profiling, SQL trace analysis, documentation, and using Joule to generate unit tests and accelerate work.

Because no weightings are published, treat all seven as live and let the reported difficulty rather than assumed weight guide your time. In practice that means the middle of the list, data modeling and RAP, deserves the largest share.

Why Do RAP, CDS and Code Pushdown Catch People Out?

Candidates consistently report the RESTful Application Programming Model, CDS data modeling and code pushdown as the hardest parts of C_ABAPD. All three share a property that makes them difficult in a hands-on assessment: a decision made early changes results much later, so a small modeling mistake surfaces as a broken service rather than as a wrong answer.

RAP is an end-to-end skill

RAP is not a topic you can revise in pieces. A working transaction needs a CDS data model, a behaviour definition, logic added through the Entity Manipulation Language, and an exposed service, all consistent with each other. Studying each element separately produces a candidate who recognises all four and can assemble none. The official RAP documentation is the reference, but reading it is not preparation. Building one complete transaction is.

CDS rewards precision

Associations, annotations and path expressions are unforgiving in a way that procedural ABAP is not. An association defined at the wrong cardinality or an annotation applied at the wrong level produces something that compiles and behaves wrongly. That is exactly the failure mode a System-Based Assessment surfaces and a recall exam never would.

Code pushdown is a judgement call

Pushing logic down into ABAP SQL and CDS views reduces data transfer between application server and database, and the exam expects you to know when that is worth doing. The trap is treating pushdown as always correct. Some logic belongs in the application layer, and choosing well is the skill being measured.

What Does Clean Core Extensibility Mean in Practice?

Clean Core extensibility means extending SAP S/4HANA Cloud without modifying the standard core, so upgrades stay clean and cheap. C_ABAPD asks you to evaluate three extensibility routes, key-user, developer and side-by-side, to work with released APIs and ABAP Cloud reuse services, and to adapt or replace legacy custom code during a system conversion.

Choosing the route is the exam question

All three routes work for many requirements, and the assessment cares which one you pick. Key-user extensibility suits configuration-level change made by a business expert. Developer extensibility suits ABAP built inside the system against released APIs. Side-by-side suits anything that genuinely belongs outside the core, typically on SAP BTP. Reaching for developer extensibility because it is familiar is the classic mistake.

The legacy code problem

The conversion objective is where this area gets practical. Existing custom code frequently touches things that are no longer released, and the exam expects you to know how to identify that, find the released alternative, and decide between adapting and rewriting. This is judgement work that only reads as obvious once you have done it on a real system.

Where Does Joule Fit Into an ABAP Exam?

Joule is SAP’s generative AI developer assistant, and C_ABAPD names it inside the code quality and testing area. You are expected to be able to use it to generate unit tests, explain existing code and accelerate routine work. It sits alongside the ABAP Test Cockpit, ABAP Unit, runtime profiling and SQL trace analysis rather than replacing any of them.

Assisted, not automated

SAP’s own position on AI-generated code is that plausible-looking output can carry subtle errors, so it pairs agent testing with human review and leaves the judgement calls to the developer. That framing is the right one to bring into the assessment: the tooling can accelerate you, and you are still accountable for what runs.

The wider tooling picture has moved quickly. SAP has published an ABAP server for the Model Context Protocol so AI agents can interact with ABAP systems through an open standard, and from Q2 2026 ABAP development became possible in Visual Studio Code alongside Eclipse. Neither is examined directly, but SAP’s own account explains why an AI-assisted development area exists on an ABAP blueprint at all.

For the exam itself, the useful skill is narrow and concrete: generating a unit test you then read critically, rather than generating an implementation you hope is right. Anyone mapping the whole track rather than a single area will find the ABAP Cloud preparation guide a useful overview of how the pieces connect.

What Score Do You Need and What Does Beta Version Mean?

The published cut score for C_ABAPD is 67 percent, which sits above the 60 percent floor common to SAP associate credentials. The assessment is a single hands-on activity, delivered in English, on the SAP BTP ABAP environment. It is currently offered as a Beta Version, which is an early-release state rather than a retirement or replacement.

Detail Value
Credential SAP Certified – Backend Developer – ABAP Cloud (Beta Version)
Exam code C_ABAPD
Level Associate
Format System-Based Assessment (SyBA), one activity
Passing score 67 percent
Language English
Product focus SAP BTP, ABAP environment

Reading the 67 percent correctly

A cut score set above the usual associate threshold is a statement about breadth. SAP tunes each threshold to the competency it wants certified, and 67 percent says a passing developer should be dependably capable across the whole ABAP Cloud scope rather than strong in two areas. On a single-activity assessment that translates into consistent execution rather than a good run in a favourite topic.

What Beta changes

During a Beta release SAP is still calibrating content, scoring and result timing, so results are often confirmed after a review period rather than immediately. The credential is no less valuable once earned; it simply means the registration details deserve a careful read, and that SAP’s own credential page is the authority for any change in status.

How Long Does C_ABAPD Preparation Really Take?

Plan for two to three months alongside a job. The recommended learning journey runs roughly 48 hours across four courses, and hands-on build time has to be added on top of that, not carved out of it. Front-load the language and object-oriented basics, then spend the bulk of your time actually building, because the assessment measures what you can do in the system.

The four SAP courses behind C_ABAPD in the order they build: S4D400, S4D401, S4D430 and S4D426
  1. Start with S4D400 to build the core ABAP foundation: tooling, data objects, control logic, local classes and a first look at database access and RAP.
  2. Move to S4D401 for the analysis and testing tools, type handling, character processing, code pushdown, internal-table performance, authorisation checks and exception classes.
  3. Take S4D430 for data modeling, defining Dictionary objects first and then building CDS views with associations, annotations and pushdown.
  4. Finish the courses with S4D426 for Clean Core extensibility on SAP S/4HANA Cloud, practising the choice between key-user, developer and side-by-side routes.
  5. Build one complete RAP transaction end to end, pairing a CDS model with a behaviour definition, adding logic, exposing the service and testing it.
  6. Break something on purpose and fix it using the ABAP Test Cockpit, ABAP Unit, profiling and SQL trace, since diagnosis under time pressure is what the assessment rewards.
  7. Rehearse full scenario simulations against the clock so that producing verified, working results feels routine rather than rushed.

Prior ABAP experience is not a formal requirement, and the learning journey starts from basic programming, so a determined newcomer can build the foundation. It does make a real difference though, and candidates without a coding background should budget extra practical time rather than extra reading. SAP publishes an official sample repository, and the RAP100 exercise repository is the fastest way to build a working transaction without designing one from scratch.

Candidates who prepared for the earlier version of this credential will find the scope familiar and the method different. The write-up on an earlier C_ABAPD route is still useful for the topic map, provided you read it knowing the assessment method has changed.

Frequently Asked Questions

What format is the C_ABAPD exam?

C_ABAPD is a System-Based Assessment consisting of one guided hands-on activity. You carry out real development tasks inside a working ABAP environment and are scored on whether each task was completed correctly. It measures whether you can write, model and test code rather than whether you can recognise a correct description.

What is the passing score for the ABAP Cloud developer certification?

The published cut score is 67 percent, which sits above the 60 percent floor common to SAP associate credentials. Because the assessment is hands-on, reaching it depends on executing tasks reliably in the system rather than on scoring well in a familiar topic area.

Is prior ABAP experience required for C_ABAPD?

No, it is not a formal prerequisite, and the recommended learning journey starts from basic programming. In practice it makes a substantial difference, because the assessment favours anyone who has already written, tested and debugged code in the environment. Newcomers should budget extra hands-on time.

Which topics do candidates find hardest on the ABAP Cloud exam?

The RESTful Application Programming Model, CDS data modeling and code pushdown. All three share the same difficulty: an early modeling decision changes results later, so a small mistake surfaces as a broken service. Practising them together works better than studying each in isolation.

What does it mean that C_ABAPD is a Beta Version?

Beta means the credential is in an early release phase while SAP finalises and calibrates it. Content, scoring and result timing can differ from a fully released exam, and results are often confirmed after a review period. The credential is no less valuable once earned.

Which SAP product does the ABAP Cloud certification focus on?

The SAP BTP ABAP environment, which is part of the ABAP Platform. The skills carry across to SAP S/4HANA Cloud and to SAP S/4HANA 2020 and later, because the underlying courses are written to apply across those deployments rather than to a single one.

How long should I plan to prepare for C_ABAPD?

Two to three months alongside a job is realistic. The recommended learning journey is roughly 48 hours across four courses, and hands-on build time has to be added on top. Most of that time should go on building CDS views, RAP services and extensions rather than on reading.

Is Joule tested on the C_ABAPD exam?

Yes, within the code quality and testing area. You are expected to be able to use SAP’s generative AI developer assistant to generate unit tests, explain code and accelerate routine work. It sits alongside the ABAP Test Cockpit, ABAP Unit and profiling rather than replacing them.

What is Clean Core extensibility?

Extending SAP S/4HANA Cloud without modifying the standard core, so upgrades stay straightforward. The exam asks you to choose between key-user, developer and side-by-side extensibility, to use released APIs and ABAP Cloud reuse services, and to adapt legacy custom code during a conversion.

Is the ABAP Cloud developer certification worth it?

It is worth it if you write ABAP professionally and want a current credential that reflects how SAP now assesses developers. Because it is performance based, it says something a recall-era certificate could not: that you produced working code in a live environment under time pressure.

Conclusion

C_ABAPD is best understood as a change of method rather than a change of scope. The seven blueprint areas cover the ABAP Cloud stack you would expect, but the System-Based Assessment means preparation has to be built around producing working results rather than around recognising correct ones. RAP, CDS and code pushdown are where that difference bites hardest, and they are also where the reported difficulty concentrates.

Work the four courses in order, then spend the larger share of your time building one complete transaction and breaking it deliberately. Two to three months alongside a job is realistic, and running full scenario simulations against the clock is the surest way to know whether 67 percent is within reach. If you are weighing the effort against the return, independent salary data gives an honest sense of where the role sits in the market.

Rating: 5 / 5 (2 votes)

The post ABAP Cloud Developer Certification: One Task, One System, 67 Percent appeared first on ERP Q&A.

]]>
Quick Start with SAP HANA PAL: Basic Example Implementation https://www.erpqna.com/quick-start-with-sap-hana-pal-basic-example-implementation/?utm_source=rss&utm_medium=rss&utm_campaign=quick-start-with-sap-hana-pal-basic-example-implementation Sun, 07 Dec 2025 04:32:52 +0000 https://www.erpqna.com/?p=94942 What is PAL in SAP? In SAP, PAL stands for Predictive Analysis Library. It’s a collection of built-in, pre-delivered machine learning and statistical algorithms that run directly inside SAP HANA (in-memory database). Instead of exporting data to an external ML tool (like Python, R, etc.), PAL allows you to do predictive analytics inside HANA itself, […]

The post Quick Start with SAP HANA PAL: Basic Example Implementation appeared first on ERP Q&A.

]]>
What is PAL in SAP?

In SAP, PAL stands for Predictive Analysis Library.

It’s a collection of built-in, pre-delivered machine learning and statistical algorithms that run directly inside SAP HANA (in-memory database). Instead of exporting data to an external ML tool (like Python, R, etc.), PAL allows you to do predictive analytics inside HANA itself, close to the data.

Key Capabilities

  • In-Database Predictive Processing: PAL enables running ML/statistical algorithms within the HANA database itself, eliminating the need to export data to external tools. This delivers high performance and reduces data latency.
  • Rich Algorithm Portfolio: PAL provides a wide spectrum of built-in algorithms: classification (decision trees, logistic regression, Naïve Bayes), regression (linear, polynomial), clustering (k-means, DBSCAN), time-series forecasting (ARIMA, exponential smoothing), association rules, anomaly detection, and more.
  • SQL/Script-Based Invocation: All PAL algorithms are exposed as SQL Script procedures. Developers can embed calls directly in SQL or stored procedures, enabling seamless integration with existing database logic without switching environments.

SAP HANA’s SQL Script is an extension of SQL. It includes enhanced control-flow capabilities and lets developers define complex application logic inside database procedures. However, it is difficult to describe predictive analysis logic with procedures.

Why PAL was introduced

For example, an application may need to perform a cluster analysis in a huge customer table with 1T records. It is impossible to implement the analysis in a procedure using the simple classic K-means algorithms, or with more complicated algorithms in the data-mining area. Transferring large tables to the application server to perform the K-means calculation is also costly.

Prerequisites

  • ADT (ABAP Development Toolkit)
  • ABAP GUI Logon with system access

Segmentation Analysis

  • Open ABAP Perspective:

Window → Perspective → Open Perspective → ABAP

  • Create an ABAP Project:

Use the left panel → Create ABAP Project → connect to your SAP system

  • Define AMDP Procedures:

Create AMDP procedures to define input/output structures for the PAL algorithm

Create an ABAP Report:

  1. Fetch the required data
  2. Set algorithm parameters
  3. Call the AMDP procedure to run the PAL algorithm
  4. Display or store the results

Predefined PAL Algorithms Available in SAP HANA

The Predictive Analysis Library (PAL) defines functions that can be called from within SQL Script procedures to perform analytic algorithms. This release of PAL includes classic and universal predictive analysis algorithms in ten data-mining categories:
Clustering

  • Classification
  • Regression
  • Association
  • Time Series
  • Preprocessing
  • Statistics
  • Social Network Analysis
  • Recommender System
  • Miscellaneous

Checking PAL Installation

To confirm that the PAL procedures were installed successfully, you can check the following three public views:

  • sys.afl.areas
  • sys.afl_packages
  • sys.afl_functions

These views are granted to the PUBLIC role and can be accessed by anyone.
To check the views, run the following SQL statements:

SELECT * FROM "SYS"."AFL_AREAS" WHERE AREA_NAME = 'AFLPAL';
SELECT * FROM "SYS"."AFL_PACKAGES" WHERE AREA_NAME = 'AFLPAL';
SELECT * FROM "SYS"."AFL_FUNCTIONS" WHERE AREA_NAME = 'AFLPAL';

Example for Classification Algorithm

AMDP class: It acts as a bridge between ABAP and SAP HANA PAL. It allows us to define the input and output structures and call the PAL algorithms directly from ABAP, enabling in-database predictive analytics without moving data outside HANA.

CLASS cl_demo DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC .

  PUBLIC SECTION.
    INTERFACES : if_amdp_marker_hdb.

    TYPES : BEGIN OF ty_input,
              From_node TYPE c LENGTH 30,
              To_node   TYPE c LENGTH 30,
            END OF ty_input,

            tt_input TYPE STANDARD TABLE OF ty_input WITH EMPTY KEY,

            BEGIN OF ty_param,
              name       TYPE c LENGTH 60,
              intargs    TYPE i,
              doubleargs TYPE f,
              stringargs TYPE c LENGTH 100,
            END OF ty_param,

            tt_param TYPE STANDARD TABLE OF ty_param WITH EMPTY KEY,

            BEGIN OF ty_result,
              node TYPE c LENGTH 30,
              rank TYPE f,
            END OF ty_result,

            tt_result TYPE STANDARD TABLE OF ty_result WITH EMPTY KEY,

            BEGIN OF ty_user_count,
              role_name  TYPE string,
              user_count TYPE i,
            END OF ty_user_count,

            tt_user_count TYPE STANDARD TABLE OF ty_user_count WITH EMPTY KEY,

            BEGIN OF ty_scaling_input,
              data_id    TYPE i,
              count TYPE i,
              rank TYPE f,
            END OF ty_scaling_input,

            tt_scaling_input TYPE STANDARD TABLE OF ty_scaling_input WITH EMPTY KEY,

            BEGIN OF ty_scaling_param,
              name       TYPE c LENGTH 30,
              intargs    TYPE i,
              doubleargs TYPE f,
              stringargs TYPE c LENGTH 30,
            END OF ty_scaling_param,

            tt_scaling_param TYPE STANDARD TABLE OF ty_scaling_param WITH EMPTY KEY,

            BEGIN OF ty_res,
              data_id    TYPE i,
              count TYPE i,
              rank TYPE f,
            END OF ty_res,

            tt_res TYPE STANDARD TABLE OF ty_res WITH EMPTY KEY,

            BEGIN OF ty_model,
              id            TYPE i,
              model_content TYPE c LENGTH 5000,
            END OF ty_model,

            tt_model TYPE STANDARD TABLE OF ty_model WITH EMPTY KEY,

            BEGIN OF ty_statistics,
              stat_name  TYPE c LENGTH 256,
              stat_value TYPE c LENGTH 1000,
            END OF ty_statistics,

            tt_statistics TYPE STANDARD TABLE OF ty_statistics WITH EMPTY KEY,

            BEGIN OF ty_placeholder,
              param_name   TYPE c LENGTH 256,
              int_value    TYPE i,
              double_value TYPE f,
              string_value TYPE c LENGTH 1000,
            END OF ty_placeholder,

            tt_placeholder TYPE STANDARD TABLE OF ty_placeholder WITH EMPTY KEY.



    METHODS : run_pagerank
      IMPORTING
        VALUE(it_data)   TYPE tt_input
        VALUE(it_param)  TYPE tt_param OPTIONAL
      EXPORTING
        VALUE(it_result) TYPE tt_result,

      run_scaling
        IMPORTING
                  VALUE(it_input)       TYPE tt_scaling_input
                  VALUE(it_param)       TYPE tt_scaling_param OPTIONAL
        EXPORTING
                  VALUE(it_res)         TYPE tt_res
                  VALUE(it_model)       TYPE tt_model
                  VALUE(it_statistics)  TYPE tt_statistics
                  VALUE(it_placeholder) TYPE tt_placeholder
        RAISING   cx_amdp_error.

ENDCLASS.

CLASS cl_demo IMPLEMENTATION.

  METHOD run_pagerank BY DATABASE
   PROCEDURE FOR HDB
   LANGUAGE SQLSCRIPT OPTIONS READ-ONLY.

    CALL _SYS_AFL.PAL_PAGERANK(:it_data, :it_param, :it_result);

  ENDMETHOD.


  METHOD run_scaling BY DATABASE
     PROCEDURE FOR HDB
     LANGUAGE SQLSCRIPT OPTIONS READ-ONLY.

    CALL _SYS_AFL.PAL_SCALE(:it_input, :it_param, :it_res, :it_model, :it_statistics, :it_placeholder );

  ENDMETHOD.
ENDCLASS.

To execute PAL algorithms in SAP HANA, we create an ABAP report program. This program calls the methods defined in the AMDP class, fetches the required data, sets the necessary algorithm parameters, runs the predictive procedures, and captures the results for analysis or further processing.

REPORT zpal_demo.

DATA: lt_input               TYPE cl_demo=>tt_input,
      ls_input               LIKE LINE OF lt_input,
      lr_table               TYPE REF TO cl_salv_table,
      lt_param               TYPE cl_demo=>tt_param,
      ls_param               LIKE LINE OF lt_param,
      lt_result              TYPE cl_demo=>tt_result,           
      lt_scale_input         TYPE cl_demo=>tt_scaling_input,
      lt_scale_param         TYPE cl_demo=>tt_scaling_param,
      lt_scale_result        TYPE cl_demo=>tt_res,
      lt_scale_stcs          TYPE cl_demo=>tt_statistics,
      lt_scale_model         TYPE cl_demo=>tt_model,
      lt_scale_placeholder   TYPE cl_demo=>tt_placeholder,
      lr_pagerank            TYPE REF TO cl_demo,
      lr_scaling             TYPE REF TO cl_demo.

   START-OF-SELECTION.

  SELECT FROM (Data source)
        FIELDS * INTO TABLE (lt_final).

  "Run pagerank clustering
  CREATE OBJECT lr_pagerank.
  TRY.
      CALL METHOD lr_pagerank->run_pagerank
        EXPORTING
          it_data   = CONV #( lt_final )
          it_param  = lt_param
        IMPORTING
          it_result = lt_result.
    CATCH cx_amdp_version_mismatch INTO DATA(ls_error).
      CALL METHOD ls_error->get_text
        RECEIVING
          result = DATA(ls_txt).

  ENDTRY.

    "Parameters
  APPEND VALUE #( name = 'SCALING_METHOD' intargs = 0 doubleargs = 0 stringargs = '' ) TO lt_scale_param.
  APPEND VALUE #( name = 'Z-SCORE_METHOD' intargs = 0 doubleargs = 0 stringargs = '' ) TO lt_scale_param.
  APPEND VALUE #( name = 'NEW_MAX'        intargs = 0 doubleargs = '1.0' stringargs = '' ) TO lt_scale_param.
  APPEND VALUE #( name = 'NEW_MIN'        intargs = 0 doubleargs = '0.0' stringargs = '' ) TO lt_scale_param.
  APPEND VALUE #( name = 'DIVISION_BY_ZERO_HANDLER' intargs = 0 doubleargs = 0 stringargs = '' ) TO lt_scale_param.

  CREATE OBJECT lr_scaling.
  TRY.
      CALL METHOD lr_scaling->run_scaling
        EXPORTING
          it_input       = lt_scaling_input
          it_param       = lt_scale_param
        IMPORTING
          it_res         = lt_scale_result
          it_model       = lt_scale_model
          it_statistics  = lt_scale_stcs
          it_placeholder = lt_scale_placeholder.

    CATCH cx_amdp_error INTO DATA(ls_scale_error).
      CALL METHOD ls_scale_error->get_text
        RECEIVING
          result = DATA(ls_scale_txt).
      CALL METHOD ls_scale_error->get_longtext
        RECEIVING
          result = DATA(ls_long_txt).

  ENDTRY.

Note: While creating the parameter table, make sure to refer carefully to the official PAL documentation for the specific algorithm you are using. The structure and fields of the parameter table may differ based on the algorithm requirements, so modify it accordingly before execution.

The official PAL documentation will be attached at the end of this article for reference.

Example for including ISLM into Embeddings

*ISLM Connectivity
   DATA(lo_vector_api) =  cl_aic_islm_embed_api_factory=>get( )->create_instance( 'EMBEDDING' ).

Common error we face while working with PAL procedures:
Could not execute ‘CALL SYS.AFLLANG_WRAPPER_PROCEDURE_CREATE (‘area_name’, ‘function_name’, ‘schema_name’, …’ SAP DBTech JDBC: [259]: invalid table name: Could not find table/view SIGNATURE_TABLE in schema PA0001: line 2 col 34 (at pos 107).

How to Resolve this problem?.

The above-mentioned error usually occurs when the mandatory fields in the parameter table are missing or incorrectly defined.

Each PAL algorithm has its own official SAP documentation that specifies the required parameter fields and their data types. It’s important to refer to the respective document while creating the parameter table to avoid such errors.

Conclusion

SAP HANA PAL enables performing machine learning directly inside the HANA database, ensuring faster processing and real-time insights. With algorithms like clustering, classification, and regression, it helps build intelligent, data-driven applications seamlessly integrated within the SAP environment.

Rating: 5 / 5 (1 votes)

The post Quick Start with SAP HANA PAL: Basic Example Implementation appeared first on ERP Q&A.

]]>
Writing Clean Code and Best Practices in SAP ABAP https://www.erpqna.com/writing-clean-code-and-best-practices-in-sap-abap/?utm_source=rss&utm_medium=rss&utm_campaign=writing-clean-code-and-best-practices-in-sap-abap Thu, 28 Aug 2025 09:20:38 +0000 https://www.erpqna.com/?p=90059 Clean code is not just about writing code that works; it’s about writing code that is readable, maintainable, and efficient. In the context of SAP ABAP, adhering to clean code principles and best practices can significantly enhance the quality of your programs. Here are some key points to keep in mind: 1. Use Meaningful Names […]

The post Writing Clean Code and Best Practices in SAP ABAP appeared first on ERP Q&A.

]]>
Clean code is not just about writing code that works; it’s about writing code that is readable, maintainable, and efficient. In the context of SAP ABAP, adhering to clean code principles and best practices can significantly enhance the quality of your programs. Here are some key points to keep in mind:

1. Use Meaningful Names

Choose clear, descriptive names for variables, methods, and classes. Avoid abbreviations and aim for names that convey the purpose and intent of the code.

2. Write Small and Focused Methods

Keep your methods small and focused on a single task. This makes the code easier to understand, test, and maintain. Aim for methods that do one thing and do it well.

3. Avoid Hardcoding Values

Hardcoding values makes the code inflexible and harder to maintain. Use constants or configuration tables instead, so changes can be made easily without modifying the code.

4. Comment Judiciously

Write comments that explain why a piece of code exists, not what it does. Good code should be self-explanatory, but comments can provide context and rationale for complex logic.

5. Follow Consistent Formatting

Maintain a consistent coding style and format throughout your ABAP programs. This includes indentation, spacing, and naming conventions. Consistent formatting improves readability and helps in code reviews.

6. Use Modularization Techniques

Break down complex processes into smaller, reusable components using subroutines, function modules, or methods. Modularization promotes code reuse and simplifies debugging.

7. Handle Exceptions Properly

Implement proper error handling using TRY-CATCH blocks. Ensure that your code gracefully handles exceptions and provides meaningful error messages to users.

8. Optimize Database Access

Minimize the number of database accesses and use efficient queries. Retrieve only the data you need and avoid nested SELECT statements. Use indexes and buffering where appropriate.

9. Avoid Using Obsolete Constructs

Stay updated with the latest ABAP syntax and features. Avoid using obsolete constructs and embrace modern ABAP features such as inline declarations, new string operations, and expressions. Those modern constructs are exactly what the SAP ABAP Cloud certification expects you to use.

10. Test Your Code Thoroughly

Write unit tests to validate your code’s functionality. Regular testing helps catch bugs early and ensures that your code behaves as expected in different scenarios.

11. Document Your Code

Provide clear and concise documentation for your programs. This includes explaining the purpose, usage, and any special considerations of your code. Good documentation aids future maintenance and onboarding of new developers.

12. Engage in Code Reviews

Participate in code reviews to share knowledge and ensure adherence to coding standards. Peer reviews help identify potential issues and foster a culture of continuous improvement.

    By following these clean code principles and best practices, you can create ABAP programs that are robust, efficient, and easy to maintain. Clean code is a key factor in the long-term success of any software project, and SAP ABAP is no exception.

    Rating: 3 / 5 (2 votes)

    The post Writing Clean Code and Best Practices in SAP ABAP appeared first on ERP Q&A.

    ]]>
    12 Tips for Beginners Starting with SAP ABAP Programming https://www.erpqna.com/12-tips-for-beginners-starting-with-sap-abap-programming/?utm_source=rss&utm_medium=rss&utm_campaign=12-tips-for-beginners-starting-with-sap-abap-programming Wed, 27 Aug 2025 09:20:38 +0000 https://www.erpqna.com/?p=90055 Welcome to Our SAP ABAP Programming Guide! Are you starting your journey into the world of SAP ABAP programming? You’ve come to the right place! In this post, we’ve compiled 12 essential tips to help you navigate the initial steps of learning ABAP. Whether you’re a complete beginner or have some basic knowledge, these insights […]

    The post 12 Tips for Beginners Starting with SAP ABAP Programming appeared first on ERP Q&A.

    ]]>
    Welcome to Our SAP ABAP Programming Guide!

    Are you starting your journey into the world of SAP ABAP programming? You’ve come to the right place! In this post, we’ve compiled 12 essential tips to help you navigate the initial steps of learning ABAP. Whether you’re a complete beginner or have some basic knowledge, these insights will provide a solid foundation to build your skills and confidence in working with ABAP.

    What Is SAP ABAP?

    SAP ABAP (Advanced Business Application Programming) is a high-level programming language developed by SAP for building applications on the SAP platform. If you’re planning a career in SAP development, mastering ABAP is a crucial step. It allows you to create customized reports, interfaces, forms, and more within SAP’s ERP environment.

    12 Tips for Beginners Starting with SAP ABAP Programming

    1. Understand the Basics of SAP

    Before diving into ABAP, familiarize yourself with the fundamentals of SAP. Learn about SAP modules, the ERP system, and how different components interact.

    2. Learn the Syntax and Structure

    Start by understanding the basic syntax and structure of ABAP. Get comfortable with keywords, data types, and basic programming constructs.

    3. Use the ABAP Development Tools (ADT)

    Get accustomed to using ABAP Development Tools in Eclipse. It’s essential for efficient development and offers features like syntax highlighting, code completion, and debugging tools. It is also the environment assumed throughout the ABAP Cloud developer certification.

    4. Understand Data Dictionary Objects

    Learn how to work with Data Dictionary (DDIC) objects such as tables, views, data elements, and domains. These are crucial for database interactions in ABAP.

    5. Practice Modularization Techniques

    Master the use of subroutines, function modules, methods, and classes to write modular and reusable code. This will make your programs more maintainable and efficient.

    6. Get Familiar with Internal Tables

    Internal tables are a key feature in ABAP for handling data in-memory. Practice creating, populating, and manipulating internal tables.

    7. Understand ALV Reports

    Learn how to create and customize ALV (ABAP List Viewer) reports. ALV provides a flexible way to output data with features like sorting, filtering, and layout customization.

    8. Explore Open SQL

    SAP ABAP uses Open SQL for database operations. Learn the basics of SELECT, INSERT, UPDATE, and DELETE statements, and how to handle database transactions.

    9. Practice Debugging

    Get comfortable with the debugging tools in ABAP. Knowing how to effectively debug your code is crucial for identifying and fixing issues.

    10. Learn About BAPIs and RFCs

    BAPIs (Business Application Programming Interfaces) and RFCs (Remote Function Calls) are essential for integrating different SAP systems. Understand how to use them to enable communication between systems.

    11. Get Hands-On with Enhancements and Exits

    Learn about user exits, BADI (Business Add-Ins), and enhancement spots to customize and extend standard SAP functionality.

    12. Engage with the SAP Community

    Join the SAP community through forums, blogs, and SAP’s official website. Engaging with experienced professionals can provide valuable insights and help you stay updated with the latest developments.

    Conclusion

    Starting your SAP ABAP journey may feel overwhelming at first, but with the right approach, it becomes manageable and rewarding. Use these 12 tips as a checklist to gradually develop your skills and build a strong ABAP foundation. Whether you aim to become a technical consultant, developer, or SAP solution architect, understanding ABAP deeply enhances your career potential.

    Rating: 5 / 5 (1 votes)

    The post 12 Tips for Beginners Starting with SAP ABAP Programming appeared first on ERP Q&A.

    ]]>
    CDS Abstract Entity and ABAP RESTful Application Programming Model: Input parameter modelling https://www.erpqna.com/cds-abstract-entity-and-abap-restful-application-programming-model-input-parameter-modelling/?utm_source=rss&utm_medium=rss&utm_campaign=cds-abstract-entity-and-abap-restful-application-programming-model-input-parameter-modelling Tue, 24 Jun 2025 09:20:40 +0000 https://www.erpqna.com/?p=88510 1. Using Abstract Entities for Non-Standard RAP BO Operations. This short overview of abstract entities concept in the context of non-standard RAP business object operations. It outlines their purpose, advantages, and implementation strategies, emphasizing their role in enhancing modularity and flexibility in data modeling. Purpose Abstract entities are Core Data Services (CDS) constructs specifically designed […]

    The post CDS Abstract Entity and ABAP RESTful Application Programming Model: Input parameter modelling appeared first on ERP Q&A.

    ]]>
    1. Using Abstract Entities for Non-Standard RAP BO Operations.

    This short overview of abstract entities concept in the context of non-standard RAP business object operations. It outlines their purpose, advantages, and implementation strategies, emphasizing their role in enhancing modularity and flexibility in data modeling.

    Purpose

    Abstract entities are Core Data Services (CDS) constructs specifically designed to model complex input parameters for non-standard RAP BO operations(actions and functions).

    Database Independence

    One of the key features of abstract entities is their independence from database persistence. They are particularly suited for parameter modeling and give possibility to redefine parameters on next modelling level.

    Reusability

    Abstract entities promote reusability across multiple operations. This characteristic enables developers to adopt a more modular approach, allowing the same abstract entity to be utilized in different contexts without the need for redundant definitions.

    Parameter Flexibility

    These entities support complex structures, including multi-level nested components. This flexibility allows for more sophisticated data representations and enhances the capability to handle intricate business logic.

    Binding

    Unlike traditional entities, abstract entities are not bound to specific BO nodes. They provides greater adaptability in how they are integrated into various operations.

    Improved Separation of Concerns

    By decoupling input parameter modeling from the actual business logic, abstract entities facilitate a clearer separation of concerns. This simplification in design leads to more maintainable and understandable code, as the focus can be placed on each aspect of the application independently.

    In conclusion, abstract entities serve as a powerful tool for modeling complex input parameters in non-standard RAP BO operations.

    ABAP RESTful Application Programming Model, SAP S/4HANA Cloud, ABAP Development, SAP NetWeaver Application Server for ABAP, SAP S/4HANA

    2. Implementation details.

    I want to highlight how to effectively use abstract entities in ABAP development. One of their key applications is for typing, particularly for action parameters in RAP actions. Let’s begin with a straightforward example.

    We make a simple abstract entity with four fields.

    @EndUserText.label: 'ABSTRACT ENTITY'
    define root abstract entity ZPRU_ABS_ENTITY
    {
        ABSTRACTENTITYNAME : char40;
        SURNAME : char40;
        AGE : int4;
        EMAIL : char40;
        
        CHILD : composition [ * ] of ZPRU_ABS_CHILD;
        CHILD_2: composition [ * ] of ZPRU_ABS_CHILD_2;
    }

    Next, I created a RAP business object with a root entity view (the specifics of which aren’t important for this example) and defined the ‘sendEntity’ action with an input parameter of type ZPRU_ABS_ENTITY.

    Let’s have a look at action definition:

    managed implementation in class zbp_pru_root_entity unique;
    strict ( 2 );
    
    define behavior for ZPRU_ROOT_ENTITY alias ROOT
    persistent table zpru_dn
    lock master
    authorization master ( instance )
    {
      create;
      update;
      delete;
      field ( readonly ) dn_no, freq, prod;
    
      //Flat
      action sendEntity parameter ZPRU_ABS_ENTITY;
      // Deep
      action sendEntity2 deep parameter ZPRU_ABS_ENTITY;
      // Deep Table
      action sendEntity3 deep table parameter ZPRU_ABS_ENTITY;
    
    }

    Right now, let’s check RAP business object implementation class.

    CLASS lhc_root DEFINITION INHERITING FROM cl_abap_behavior_handler.
      PRIVATE SECTION.
    
        METHODS get_instance_authorizations FOR INSTANCE AUTHORIZATION
          IMPORTING keys REQUEST requested_authorizations FOR root RESULT result.
    
        METHODS sendentity2 FOR MODIFY
          IMPORTING keys FOR ACTION root~sendentity2.
    
        METHODS sendentity FOR MODIFY
          IMPORTING keys FOR ACTION root~sendentity.
    
        METHODS sendentity3 FOR MODIFY
          IMPORTING keys FOR ACTION root~sendentity3.
    
    ENDCLASS.
    
    CLASS lhc_root IMPLEMENTATION.
    
      METHOD get_instance_authorizations.
      ENDMETHOD.
    
      METHOD sendentity2.
        DATA(lv_deep_field_from_abs_entity) = keys[ 1 ]-%param-child[ 1 ]-abstractchildname.
      ENDMETHOD.
    
      METHOD sendentity.
        DATA(lv_field_from_abs_entity) = keys[ 1 ]-%param-abstractentityname.
      ENDMETHOD.
    
      METHOD sendentity3.
        DATA(lv_deep_table_field) = keys[ 1 ]-%param[ 1 ]-child[ 1 ]-abstractchildname.
      ENDMETHOD.
    
    ENDCLASS.

    Derived type:

    ABAP RESTful Application Programming Model, SAP S/4HANA Cloud, ABAP Development, SAP NetWeaver Application Server for ABAP, SAP S/4HANA

    As a result, you’ll see the KEYS table, where each row contains a %PARAM component. This component is typed as the structure ZPRU_ABS_ENTITY.

    The next step is to demonstrate the use of the ‘deep parameter AbstractBDEF’ and the ‘deep table parameter AbstractBDEF’ in defining a BDEF action parameter.

    To do this, we need to extend the abstract entity by adding a BDEF of type Abstract with a hierarchy.

    First, I added the ‘root’ keyword to the abstract entity:

    ABAP RESTful Application Programming Model, SAP S/4HANA Cloud, ABAP Development, SAP NetWeaver Application Server for ABAP, SAP S/4HANA

    One important note: when adding a BDEF to an abstract entity, we initiate the creation of an abstract business object. As a result, we need to construct this business object in a way that’s quite similar to how we build standard RAP business objects. This is why we use keywords like ‘root’, ‘composition’, and ‘association to parent.’

    I also created a new abstract entity, ZPRU_ABS_CHILD. Then, I added mutual associations between ZPRU_ABS_ENTITY as the root and ZPRU_ABS_CHILD as the child.

    ABAP RESTful Application Programming Model, SAP S/4HANA Cloud, ABAP Development, SAP NetWeaver Application Server for ABAP, SAP S/4HANA

    ABAP RESTful Application Programming Model, SAP S/4HANA Cloud, ABAP Development, SAP NetWeaver Application Server for ABAP, SAP S/4HANA

    Then, I’ve created BDEF with ZPRU_ABS_ENITY as root entity and Abstract implementation type:

    ABAP RESTful Application Programming Model, SAP S/4HANA Cloud, ABAP Development, SAP NetWeaver Application Server for ABAP, SAP S/4HANA

    Let’s overview new abstract BDEF:

    abstract;
    strict ( 2 );
    with hierarchy;
    
    define behavior for ZPRU_ABS_ENTITY alias ABS
    {
      association CHILD;
      association CHILD_2;
    }
    
    define behavior for ZPRU_ABS_CHILD alias CHILD
    {
    
      association ROOT;
    
    }
    
    define behavior for zpru_abs_child_2 {
    
    association third_level;
    
    }

    There are 3 main points:

    1. add keyword ‘with hierarchy’ to make BDEF opt to deep expanding.
    2. recreate RAP BO composition tree, add root entity and child entity.
    3. explicitly mark association to ZPRU_ABS_CHILD.

    Finally, I’ve added addition keyword ‘deep’ to action definition to expand action parameter type.

    ABAP RESTful Application Programming Model, SAP S/4HANA Cloud, ABAP Development, SAP NetWeaver Application Server for ABAP, SAP S/4HANA

    Let’s have a look into typing:

    ABAP RESTful Application Programming Model, SAP S/4HANA Cloud, ABAP Development, SAP NetWeaver Application Server for ABAP, SAP S/4HANA

    %PARAM typing:

    ABAP RESTful Application Programming Model, SAP S/4HANA Cloud, ABAP Development, SAP NetWeaver Application Server for ABAP, SAP S/4HANA

    You can notice that to component %PARAM a new nested table with the name CHILD has been added. It’s an effect of keyword ‘deep’ in action parameter definition. Component CHILD has type of table due to cardinality [ * ] in definition of composition in abstract root entity ZPRU_ABS_ENTITY.

    Last topic is about addition ‘deep table’ to action parameter definition.

    Let’s add it:

    ABAP RESTful Application Programming Model, SAP S/4HANA Cloud, ABAP Development, SAP NetWeaver Application Server for ABAP, SAP S/4HANA

    Hence, let’s check what has been changed in typing:

    ABAP RESTful Application Programming Model, SAP S/4HANA Cloud, ABAP Development, SAP NetWeaver Application Server for ABAP, SAP S/4HANA

    As you can see component %PARAM became table, before it was a structure. This is the effect of keyword ‘table’ in action parameter definition.

    Lastly, the same principles apply to typing action output parameters. However, one key difference is that we can’t use the ‘deep’ addition when defining output parameters. As a result, the %PARAM component will be incorporated into the output’s derived type as a structure.

    A table with summarizing:

    ABAP RESTful Application Programming Model, SAP S/4HANA Cloud, ABAP Development, SAP NetWeaver Application Server for ABAP, SAP S/4HANA
    Rating: 5 / 5 (1 votes)

    The post CDS Abstract Entity and ABAP RESTful Application Programming Model: Input parameter modelling appeared first on ERP Q&A.

    ]]>
    Handle Asynchronous task in background job from a stateless UI application using RAP business object https://www.erpqna.com/handle-asynchronous-task-in-background-job-from-a-stateless-ui-application-using-rap-business-object/?utm_source=rss&utm_medium=rss&utm_campaign=handle-asynchronous-task-in-background-job-from-a-stateless-ui-application-using-rap-business-object Sat, 07 Jun 2025 09:20:40 +0000 https://www.erpqna.com/?p=91078 Requirement: An application built using BAS on BTP for an RAP business object has a requirement of triggering an asynchronous task in the background when a button is clicked. Example: ( this example will be used to explain the implementation ) when the button is clicked, the user uploads an excel file with data and […]

    The post Handle Asynchronous task in background job from a stateless UI application using RAP business object appeared first on ERP Q&A.

    ]]>
    Requirement: An application built using BAS on BTP for an RAP business object has a requirement of triggering an asynchronous task in the background when a button is clicked. Example: ( this example will be used to explain the implementation ) when the button is clicked, the user uploads an excel file with data and on click of OK, the data needs to be saved but as it is a large amount of data it will take some time, so the UI shouldn’t be waiting for a response from the backend.

    Challenge: background processing framework has been introduced by SAP from Cloud 2311 version. Without this framework, it is not possible to trigger an asynchronous task from a stateless UI.

    Solution: To simulate similar functionality we can use existing ABAP artifacts like RFC and submitting program in background job.

    Overview: In this example, I have implemented the following:

    • a new action with parameters is defined in the behavior definition. The key of the RAP object will hold the keys of the table that need to be changed. The new values to be updated are passed by the UI as parameters to the action
    action (features : instance) upload_file  parameter ZSD_ABS_CONTRACTUAL_INDATA;
    • an RFC function module is created that accepts the data from the file in the form of an internal table
    • Above RFC function module is called from the RAP action implementation ( with the addition destination ‘NONE’ as otherwise commit cannot be done from the FM to schedule the job ).
    METHOD upload_file.
    
        DATA: gt_return   TYPE STANDARD TABLE OF zsds_soitem_message,
              lt_sch_data TYPE zsdt_soschdata.
    
        IF NOT keys[] IS INITIAL.
          LOOP AT keys INTO DATA(ls_keys).
            APPEND INITIAL LINE TO lt_sch_data ASSIGNING FIELD-SYMBOL(<ls_sch_data>).
            <ls_sch_data>-vbeln = ls_keys-salesdocument.
            <ls_sch_data>-posnr = ls_keys-salesdocumentitem.
            <ls_sch_data>-del_dt = COND #( WHEN ls_keys-%param-newcontractualdt IS NOT INITIAL
                                           THEN ls_keys-%param-newcontractualdt ).
            <ls_sch_data>-email = cond #( WHEN ls_keys-%param-email IS NOT INITIAL
                                           THEN ls_keys-%param-email ).
    
          ENDLOOP.
    
          CALL FUNCTION 'ZSD_DEL_DATE_UPD_FILE' DESTINATION 'NONE'
            EXPORTING
              it_sch_data   = lt_sch_data
            EXCEPTIONS
              error_message = 99.
    
        ENDIF.
    
      ENDMETHOD.
    • The function module calls the ‘JOB_OPEN’ and ‘JOB_CLOSE’ function modules to submit another program via a background job.
    • The program runs asynchronously as a job and updates the data and also sends an email with the results to the email-id ( the parameter email in the previous screenshot )
    • Email functionality has been implemented so the user is informed of the success or failure of the task as the UI doesn’t wait for a response and simply displays a message that the data will be updated in background.
    • The button and the popup that allows the user to upload an excel file:

    Conclusion: The above approach can be used to call an asynchronous task from an RAP object for OP SAP versions. With SAP Cloud 2311, it will also be possible to update the UI once the asynchronous task is completed using event driven actions.

    Rating: 5 / 5 (1 votes)

    The post Handle Asynchronous task in background job from a stateless UI application using RAP business object appeared first on ERP Q&A.

    ]]>
    ABAP RAP: Excel upload through custom action popup (No UI5 Extension, No Object Page workaround) https://www.erpqna.com/abap-rap-excel-upload-through-custom-action-popup-no-ui5-extension-no-object-page-workaround/?utm_source=rss&utm_medium=rss&utm_campaign=abap-rap-excel-upload-through-custom-action-popup-no-ui5-extension-no-object-page-workaround Mon, 30 Dec 2024 09:20:45 +0000 https://www.erpqna.com/?p=93806 A frequent business requirement involves enabling mass changes to business objects via Excel uploads executed through a custom action popup. Historically, achieving this functionality has necessitated various workarounds, often involving UI5 extensions, third-party solutions, or Object Page manipulations, all of which present specific implementation challenges. The existing workaround approaches present several drawbacks: However, SAP has […]

    The post ABAP RAP: Excel upload through custom action popup (No UI5 Extension, No Object Page workaround) appeared first on ERP Q&A.

    ]]>
    A frequent business requirement involves enabling mass changes to business objects via Excel uploads executed through a custom action popup. Historically, achieving this functionality has necessitated various workarounds, often involving UI5 extensions, third-party solutions, or Object Page manipulations, all of which present specific implementation challenges.

    The existing workaround approaches present several drawbacks:

    • Custom UI Extensions: Require specialized UI5 development expertise.
    • Third-Party Solutions: Introduce risks related to licensing compliance and potential security vulnerabilities.
    • Object Page Manipulations: Involve complex, multi-step processes, such as creating a dummy object page, facilitating file upload, temporarily storing the file data in a table field, and requiring a final user action (a button press) to initiate processing. This temporary data storage is often unnecessary, complicating the data model.

    However, SAP has recently introduced ABAP / CAP annotations that offer a cloud-ready solution, potentially eliminating approximately 95% of the development effort typically associated with integrating an Excel upload into the backend. This innovation allows developers to prioritize implementing core business logic over developing reusable technical artifacts.

    I will now detail the implementation steps.

    A business requirement to manage mass processing listings for a library was selected to demonstrate this use case. The implementation requires several steps, with steps 3 through 6 being the special or additional configurations needed, while all others are considered routine.

    Implementation Steps

    1. A database table for the listing entity is created. This involves fields such as Id, Title, Type, and Author.

    @EndUserText.label : 'Library Listings'
    @AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
    @AbapCatalog.tableCategory : #TRANSPARENT
    @AbapCatalog.deliveryClass : #A
    @AbapCatalog.dataMaintenance : #RESTRICTED
    define table zrk_lib_listings {
    
      key client            : abap.clnt not null;
      key listing_uuid      : sysuuid_x16 not null;
      id                    : abap.numc(10);
      title                 : abap.char(40);
      type                  : abap.char(5);
      author                : abap.char(40);
      publisher_studio      : abap.char(40);
      isbn_ean              : abap.char(40);
      language_code         : abap.lang;
      publication_year      : abap.numc(4);
      description           : abap.char(40);
      totalcopies           : abap.int2;
      available_copies      : abap.int2;
      location_shelf_id     : abap.char(40);
      lending_duration_days : abap.int2;
      status                : abap.char(40);
      cover_image_url       : abap.char(100);
      local_created_by      : abp_creation_user;
      local_created_at      : abp_creation_tstmpl;
      local_last_changed_by : abp_locinst_lastchange_user;
      local_last_changed_at : abp_locinst_lastchange_tstmpl;
      last_changed_at       : abp_lastchange_tstmpl;
    
    }

    2. A RAP Business Object (BO) is generated, followed by the requisite UI artifacts. The specific RAP BO scenario (Managed, Unmanaged, Draft, or Non-Draft) is noted as not influencing the core Excel upload use case. The RAP Generator is used to simplify the demonstration.

    3. A root abstract entity is created for the file to be uploaded. (This entity is highly reusable and can be applied across different RAP BOs).

    @EndUserText.label: 'Abs. Entity For Attachment'
    define root abstract entity ZRK_D_FILE_STREAM
    {
      @Semantics.largeObject.mimeType: 'MimeType'
      @Semantics.largeObject.fileName: 'FileName'
      @Semantics.largeObject.contentDispositionPreference: #INLINE
      @EndUserText.label: 'Select Excel file'
      StreamProperty : abap.rawstring(0);
      
      .hidden: true
      MimeType : abap.char(128);
      
      .hidden: true
      FileName : abap.char(128);   
    }

    4. The abstract behavior definition for the file entity is implemented.

    abstract;
    strict(2);
    with hierarchy;
    define behavior for ZRK_D_FILE_STREAM {
    }

    5. A second abstract entity is created to serve as an action parameter. This entity includes an association to the file abstract entity (from Step 3).

    @EndUserText.label: 'Action Param for Uploading Excel'
    define root abstract entity ZRK_D_UPLOAD_EXCEL
    {
    // Dummy is a dummy field
    @UI.hidden: true
    dummy : abap_boolean;
         _StreamProperties : association [1] to ZRK_D_FILE_STREAM on 1 = 1;
        
    }

    6. The abstract behavior definition for the action parameter is implemented, including the association to the earlier entity.

    abstract;
    strict ( 2 );
    with hierarchy;
    define behavior for ZRK_D_UPLOAD_EXCEL //alias <alias_name>
    {
    association _StreamProperties with hierarchy;
    }

    7. An action is defined on the RAP BO Behavior definition, with the parameter specified in Step 5.

    static action ExcelUpload deep parameter ZRK_D_UPLOAD_EXCEL ;
    managed implementation in class ZRK_BP_R_LIB_LISTINGS unique;
    strict ( 2 );
    with draft;
    extensible;
    define behavior for ZRK_R_LIB_LISTINGS alias Listings
    persistent table ZRK_LIB_LISTINGS
    extensible
    draft table ZRK_LIB_LSTNGS_D
    etag master LocalLastChangedAt
    lock master total etag LastChangedAt
    authorization master( global )
    {
      field ( readonly )
       ListingUUID,
       LocalCreatedBy,
       LocalCreatedAt,
       LocalLastChangedBy,
       LocalLastChangedAt,
       LastChangedAt;
    
      field ( numbering : managed )
       ListingUUID;
    
    
      create;
      update;
      delete;
    
      draft action Activate optimized;
      draft action Discard;
      draft action Edit;
      draft action Resume;
      draft determine action Prepare;
    
      static action ExcelUpload deep parameter ZRK_D_UPLOAD_EXCEL ;
    
      mapping for ZRK_LIB_LISTINGS corresponding extensible
      {
        ListingUUID = listing_uuid;
        ID = id;
        Title = title;
        Type = type;
        Author = author;
        PublisherStudio = publisher_studio;
        IsbnEan = isbn_ean;
        LanguageCode = language_code;
        PublicationYear = publication_year;
        Description = description;
        Totalcopies = totalcopies;
        AvailableCopies = available_copies;
        LocationShelfID = location_shelf_id;
        LendingDurationDays = lending_duration_days;
        Status = status;
        CoverImageUrl = cover_image_url;
        LocalCreatedBy = local_created_by;
        LocalCreatedAt = local_created_at;
        LocalLastChangedBy = local_last_changed_by;
        LocalLastChangedAt = local_last_changed_at;
        LastChangedAt = last_changed_at;
      }
    
    }

    8. The business logic is implemented to read the Excel content. A released API, XCO_CP_XLSX , is used for this demonstration.

    METHOD ExcelUpload.
        TYPES : BEGIN OF ty_sheet_data,
                  id                  TYPE zrk_r_lib_listings-id,
                  title               TYPE zrk_r_lib_listings-title,
                  type                TYPE zrk_r_lib_listings-Type,
                  author              TYPE zrk_r_lib_listings-author,
                  PublisherStudio     TYPE zrk_r_lib_listings-PublisherStudio,
                  IsbnEan             TYPE zrk_r_lib_listings-IsbnEan,
                  LanguageCode        TYPE zrk_r_lib_listings-LanguageCode,
                  PublicationYear     TYPE zrk_r_lib_listings-PublicationYear,
                  description         TYPE zrk_r_lib_listings-Description,
                  Totalcopies         TYPE zrk_r_lib_listings-Totalcopies,
                  AvailableCopies     TYPE zrk_r_lib_listings-AvailableCopies,
                  LocationShelfID     TYPE zrk_r_lib_listings-LocationShelfID,
                  LendingDurationDays TYPE zrk_r_lib_listings-LendingDurationDays,
                  status              TYPE zrk_r_lib_listings-Status,
                END OF ty_sheet_data.
    
        DATA lv_file_content   TYPE xstring.
        DATA lt_sheet_data     TYPE STANDARD TABLE OF ty_sheet_data.
        DATA lt_listing_create TYPE TABLE FOR CREATE zrk_r_lib_listings.
    
        lv_file_content = VALUE #( keys[ 1 ]-%param-_streamproperties-StreamProperty OPTIONAL ).
    
        " Error handling in case file content is initial
    
        DATA(lo_document) = xco_cp_xlsx=>document->for_file_content( lv_file_content )->read_access( ).
    
        DATA(lo_worksheet) = lo_document->get_workbook( )->worksheet->at_position( 1 ).
    
        DATA(o_sel_pattern) = xco_cp_xlsx_selection=>pattern_builder->simple_from_to(
          )->from_column( xco_cp_xlsx=>coordinate->for_alphabetic_value( 'A' )  " Start reading from Column A
          )->to_column( xco_cp_xlsx=>coordinate->for_alphabetic_value( 'N' )   " End reading at Column N
          )->from_row( xco_cp_xlsx=>coordinate->for_numeric_value( 2 )    " *** Start reading from ROW 2 to skip the header ***
          )->get_pattern( ).
    
        lo_worksheet->select( o_sel_pattern
                                         )->row_stream(
                                         )->operation->write_to( REF #( lt_sheet_data )
                                         )->set_value_transformation(
                                             xco_cp_xlsx_read_access=>value_transformation->string_value
                                         )->execute( ).
    
        lt_listing_create = CORRESPONDING #( lt_sheet_data ).
    
        MODIFY ENTITIES OF zrk_r_lib_listings IN LOCAL MODE
               ENTITY Listings
               CREATE AUTO FILL CID FIELDS ( Id Title Type author PublisherStudio IsbnEan LanguageCode PublicationYear description Totalcopies AvailableCopies LocationShelfID LendingDurationDays status )
               WITH lt_listing_create
               " TODO: variable is assigned but never used (ABAP cleaner)
               MAPPED DATA(lt_mapped)
               " TODO: variable is assigned but never used (ABAP cleaner)
               REPORTED DATA(lt_reported)
               " TODO: variable is assigned but never used (ABAP cleaner)
               FAILED DATA(lt_failed).
    
        " Communicate the messages to UI - not in scope of this demo
        IF lt_failed IS INITIAL.
          APPEND VALUE #( %msg = new_message_with_text( severity = if_abap_behv_message=>severity-success
                                                        text     = 'Listings have been uploaded - please refresh the list!!' ) )
                 TO reported-listings.
        ENDIF.
      ENDMETHOD.

    9. The action is utilized on the projection behavior and subsequently exposed in the metadata extension.

    use action ExcelUpload;
    projection implementation in class ZRK_BP_C_LIB_LISTINGS unique;
    strict ( 2 );
    extensible;
    use draft;
    use side effects;
    define behavior for ZRK_C_LIB_LISTINGS alias Listings
    extensible
    use etag
    {
      use create;
      use update;
      use delete;
    
      use action Edit;
      use action Activate;
      use action Discard;
      use action Resume;
      use action Prepare;
    
      use action ExcelUpload;
    
    }
    .lineItem: [{ type:#FOR_ACTION , dataAction: 'ExcelUpload' , label: 'Upload Excel' }]

    10. The service binding is published, and the application is then ready for execution.

    Note:

    This feature is currently functional on the BTP ABAP Environment. However, an issue appears to exist with metadata generation on S/4HANA 2023 On-Premise deployments, even though the objects are syntactically correct. It is anticipated that this constraint will be addressed in the S/4HANA 2025 release, making the full feature set available on the S/4HANA On-Premise version following a brief waiting period.

    Rating: 5 / 5 (3 votes)

    The post ABAP RAP: Excel upload through custom action popup (No UI5 Extension, No Object Page workaround) appeared first on ERP Q&A.

    ]]>
    SAP RAP Unmanaged scenario example-Simplified https://www.erpqna.com/sap-rap-unmanaged-scenario-example-simplified/?utm_source=rss&utm_medium=rss&utm_campaign=sap-rap-unmanaged-scenario-example-simplified Thu, 04 Jul 2024 11:24:06 +0000 https://www.erpqna.com/?p=86138 SAP RAP (ABAP RESTful Application Programming Model) has two main flavors: managed and unmanaged. Let’s focus on the unmanaged version. Unmanaged SAP RAP refers to a development approach where developers have more control over the data persistence and business logic compared to the managed approach. Here are some key aspects Overall, unmanaged SAP RAP provides […]

    The post SAP RAP Unmanaged scenario example-Simplified appeared first on ERP Q&A.

    ]]>
    SAP RAP (ABAP RESTful Application Programming Model) has two main flavors: managed and unmanaged. Let’s focus on the unmanaged version.

    Unmanaged SAP RAP refers to a development approach where developers have more control over the data persistence and business logic compared to the managed approach. Here are some key aspects

    1. Custom Logic: In unmanaged RAP, developers write their own custom logic for handling data retrieval, manipulation, and persistence. This gives more flexibility in how data is processed and stored.
    2. Direct Database Access: Developers can directly access the database tables and define their own data models using Core Data Services (CDS) views or ABAP classes.
    3. Explicit Service Definition: Unlike managed RAP, where service definitions are automatically generated based on annotations, unmanaged RAP requires developers to explicitly define service implementations and behaviors.
    4. Manual CRUD Operations: CRUD (Create, Read, Update, Delete) operations need to be implemented explicitly in unmanaged RAP, giving full control over how data is managed.
    5. Integration with Existing Systems: Unmanaged RAP is often used when integrating with existing systems or when there is a need for complex business logic that cannot be easily handled by the managed approach.
    6. Flexibility: Developers have more freedom to implement complex validation rules, authorization checks, and other custom requirements directly in the application logic.

    Overall, unmanaged SAP RAP provides a more hands-on approach to application development compared to the managed approach, allowing developers to leverage their expertise in ABAP programming and database handling while building modern RESTful APIs.

    Top of Form

    In this example, we will show a simple application for Employee build with RAP Unmanaged flavors.

    Development steps.

    To be summarized below object will be created for Unmanaged scenario.

    Table ZT01_EMPLOYEE

    Base CDS View Z_I_EMPLOYEES_U

    Consumption CDS view Z_C_EMPLOYEES_U

    Behavior Definition

    Bottom of Form

    Behavior definition

    Implement the Create method

    Implement Update Method

    Implement Delete Method

    Implement Adjust_Numbers method.

    Implement Save method.

    Test

    1. Open the Application.

    2. Click on Create. Give Input value and Create.

    3. New Record got created.

    4. Select any Row , click on Edit.

    5. Change the value and Save.

    6. Record will be updated.

    7. Select the Rows and click on Delete.

    8. Records will be deleted.

    9. In the Database table also you can see the records.

    So, all the CRUD operation is successful using RAP Unmanaged flavors.

    Rating: 0 / 5 (0 votes)

    The post SAP RAP Unmanaged scenario example-Simplified appeared first on ERP Q&A.

    ]]>
    ABAP RESTful Application Programming Model (RAP) https://www.erpqna.com/abap-restful-application-programming-model-rap/?utm_source=rss&utm_medium=rss&utm_campaign=abap-restful-application-programming-model-rap Sat, 29 Jun 2024 10:52:44 +0000 https://www.erpqna.com/?p=85983 Introduction The SAP landscape has evolved significantly, with businesses seeking simpler, more efficient solutions that offer excellent user experiences. Many organizations remain deeply embedded in the SAP ecosystem, primarily focusing on ABAP over other languages. So, is it possible to develop feature-rich applications without other frontend languages? Yes, leveraging ABAP with RAP (ABAP Restful Application […]

    The post ABAP RESTful Application Programming Model (RAP) appeared first on ERP Q&A.

    ]]>
    Introduction

    The SAP landscape has evolved significantly, with businesses seeking simpler, more efficient solutions that offer excellent user experiences. Many organizations remain deeply embedded in the SAP ecosystem, primarily focusing on ABAP over other languages. So, is it possible to develop feature-rich applications without other frontend languages? Yes, leveraging ABAP with RAP (ABAP Restful Application Programming) makes it possible.

    Restful Application Programming is an ABAP programming model for creating business applications and services in an AS ABAP or BTP ABAP environment. RAP offers a standardized way of developing applications using Core Data Services (CDS), the modernized extended ABAP language, OData protocol, and the concept of business objects and services. RAP applications can only be created through ABAP development tools (ADT) and it’s available in SAP BTP ABAP Environment, SAP S/4 HANA Cloud, and AS ABAP >=7.56.

    Before digging deeper into RAP, let’s explore CDS, annotations, and business services. To illustrate these concepts, let’s create a simple read-only list report application.

    Developing an OData Service for simple list reporting

    An OData service follows the best practices for developing and consuming RESTful APIs. This service can be used in SAP Fiori applications and can also be exposed as Web APIs. Below are the steps for creating a simple list report application:

    Let’s explore each step in detail by creating the application.

    Sample requirement: Create a read-only list report application which shows purchase order information.

    • Create an interface CDS view which takes data from Purchase Order Header (EKKO) and Item (EKPO).

    • Create two interface CDS views for showing master data of purchase order type and material details.

    • Make an association between the purchase order type CDS view and material details CDS view from the purchase order header/item CDS view. The associated views will act as Search Help in the list report after applying the annotations.

    • Create a consumption view on top of the Purchase Order Header/Item interface view (ZI_PURCHASE_ORDER_RVN).

    The UI annotations needed for the application are written in the consumption CDS View or Metadata Extensions.

    Now, we have the data model and the required annotations to manifest semantics for it. The next step is to create the OData service and binding the service.

    To define a service, we first need to create a service definition. In service definition, we specify the CDS entities that need to be exposed. In this example, the gateway client is replaced by the service definition and service binding.

    As a last step, create the service binding for service definition.

    Set the binding type as OData V2 – UI, since this is an OData V2 service.

    After publishing the service, the exposed entity and associated entities will be visible. Click on the entity and click the preview button to see the preview of the application.

    Purchasing Doc Type Search Help

    Material Search Help

    Conclusion

    This blog serves as an introduction to developing OData services for simple list reporting using the ABAP Restful Application Programming (RAP) model. By following the steps outlined, you can create a read-only list report application that showcases purchase order information. We have covered the basics of creating CDS views, defining and binding OData services, and incorporating annotations for enhanced functionality.

    Rating: 0 / 5 (0 votes)

    The post ABAP RESTful Application Programming Model (RAP) appeared first on ERP Q&A.

    ]]>
    Going international – Caveats in custom ABAP programs https://www.erpqna.com/going-international-caveats-in-custom-abap-programs/?utm_source=rss&utm_medium=rss&utm_campaign=going-international-caveats-in-custom-abap-programs Sat, 22 Jun 2024 11:32:50 +0000 https://www.erpqna.com/?p=85794 In this blog-post i want to mention some caveats when implementing SAP for new countries or regions. Primary focus is the ABAP developer perspective, the translation and not the customizing topics. Regional Differences Due to business and legal requirements SAP implementations often use different: for different countries and regions. So one of the first tasks […]

    The post Going international – Caveats in custom ABAP programs appeared first on ERP Q&A.

    ]]>
    In this blog-post i want to mention some caveats when implementing SAP for new countries or regions. Primary focus is the ABAP developer perspective, the translation and not the customizing topics.

    Regional Differences

    Due to business and legal requirements SAP implementations often use different:

    • G/L accounts
    • Chart of accounts
    • Cost centers
    • Tax codes
    • Currency codes
    • Organization structures (sales organization, purchase org., plants, company codes etc.)

    for different countries and regions.

    So one of the first tasks is to search for hard coded G/L accounts, chart of accounts, cost centers, tax codes, currency codes, sales organizations, purchase organizations, plants and company codes in custom ABAP programs and replace the findings by appropriate variables or customizing tables.

    Currency Codes

    Replacing hard coded currency codes should be pretty simple. Most transactional data tables have both fields (amount beside and currency code) and the currency code is part of the company settings in table T001, too. So instead of hardcoding the currency code it`s better to read the currency code from the transactional data table where applicable or from the T001-table. If hard coded currency codes are used to decide whether a currency conversion must be performed the decision can be simply omitted as the currency conversion between the same currency leads to the same result.

    Calculations done with currency values

    Special care must be taken in custom programs, which calculate differences or ratios between two currency values. If the program simply subtract or divides those two values, you will get wrong results when the first value has a different currency than the other. In one of my projects we had this issue, because the programs were built at the time, where SAP was implemented for only one country and all values were in the same currency.

    Translation

    Translation API

    Translating all objects with transaction SE63 is quite impractical as you need to go through every single object. Under the hood the transaction SE63 uses a API, which can be used to build your own more practical translation program. This API (translation API) consists of the following parts:

    • the table LXE_ATTOB, which contains the types of translation objects
    • the function module LXE_OBJ_OBJECTS_GET, which reads the translation objects for a given object type and collection. In case of ABAP development objects the collection is the package.
    • the function module LXE_OBJ_TEXT_PAIR_READ to read the text pairs
    • the function module LXE_OBJ_TEXT_PAIR_WRITE to write the text pairs
    • the function module LXE_OBJ_CREATE_TRANSPORT_ENTRY to append the translation object to a workbench request

    The GitHub repository https://github.com/SAP-Easy-Translation/abap_client is a example, how the translation API could be used to select the text pairs from a range of packages and edit or review these text pairs in a more practical way.

    Other language dependent texts

    The translation needs to cover all language dependent texts. Beside the obvious ABAP development objects (Dictionary-Objects, Text-Elements in programs and classes, T100-Messages, Forms etc.) there are a few more language dependent texts:

    • Descriptions for customizing objects (custom sales documents types, Sales order reasons, Delivery note types, Invoice types, Conditions, Purchase Order Types, Material groups etc.)
    • Report variant descriptions
    • Queries build with transaction SQ01
    • SapScript Standard Texts maintained in transaction SO10

    You shouldn’t forget to translate these objects, too.

    Customizing objects

    The descriptions of the customizing objects can be edited directly in the maintenance views or by selecting the object types TADC, TADE, TADG, TADS, TADW, TAIC, TAIE, TAIG, TAIS and TAIW in the translation transaction SE63.

    Report variant descriptions

    Report variant descriptions can be found under the object types VARI (system variants) and VARX (local report variants).

    Queries

    Queries can be translated in the transaction SQ02 by going to the menu Environment -> Language comparison.

    and by entering the Query and the user group or the InfoSet in the next screen.

    Both query and InfoSet should be translated and after the translation you should regenerate the Query program (Transaction SQ01 -> Menu -> Query -> More functions -> Generate program).

    SapScript Standard Texts

    SapScript Standard Texts are translated in transaction SO10. Enter Text name, Text ID and the target language and press the “Create”-Button or “Change”-Button to translate the text.

    SapScript Standard Texts are not automatically added to a workbench request. The program RSTXTRAN must be called to achieve this.

    Form Printing

    When you print SapScript forms or SmartForms, make sure to activate UPE (Unicode Printing Enhancement) as described in note 1812076. Otherwise you will get hashmarks (#) for characters, which are not included in the character set of the printer.

    Conclusion

    This blog post should show you some of the caveats when implementing SAP for new countries or regions. However there some more cultural differences between regions. Some asian countries like Thailand have two different calendars (buddhist calendar and gregorian calendar) and in some countries like Japan the fiscal year is different from the calendar year. These differences should be keept in mind when dealing with issues or when adapting custom ABAP code for new countries or regions.

    Rating: 0 / 5 (0 votes)

    The post Going international – Caveats in custom ABAP programs appeared first on ERP Q&A.

    ]]>