Coder Social home page Coder Social logo

sap-samples / abap-platform-rap-workshops Goto Github PK

View Code? Open in Web Editor NEW
181.0 181.0 83.0 150.3 MB

This repository contains materials for workshops about the ABAP RESTful Application Programming Model (RAP).

License: Apache License 2.0

ABAP 94.07% ABAP CDS 5.93%
abap abap-restful rap rap-workshop sample sample-code workshop

abap-platform-rap-workshops's People

Contributors

anfisc avatar btbernard avatar carinetd avatar julieplummer20 avatar karlojkessler avatar mervey45 avatar niloofar-flothkoetter avatar volkerdrees avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

abap-platform-rap-workshops's Issues

RAP110 ex.1 - class ZDMO_GEN_RAP110_SINGLE_2 does not exist

I am doing the exercise below on an SAP BTP ABAP instance (US EAST) which is just created using Booster.

Exercise 1.1: Generate your package Package --> step-2 Search for ZDMO_GEN_RAP110_SINGLE_2

However, there is only "ZDMO_GEN_RAP110_SINGLE" and not "ZDMO_GEN_RAP110_SINGLE_2".

Can you please advise if I can still proceed?

Thanks and Merry Christmas.

Sunny

Facing issue while creating Purchase Requisition using RAP FACADE for RAP610 On stack scenario

Hi team,

I need help.. I am working on RAP 610 scenario and facing issue while running the test class created for creation of Purchase requisition. I am getting following runtime error - Could you please review and help??
I am using S/4HANA on Prem 2023 system, created package with ABAP on cloud SW component version to develop this Embedded Steampunk scenario.

Convert Key statement is going into runtime error -

LOOP AT mapped-purchaserequisition ASSIGNING FIELD-SYMBOL().
CONVERT KEY OF i_purchaserequisitiontp FROM -%pid TO DATA(ls_ctr).
-PurchaseRequisition = ls_ctr-PurchaseRequisition.
ENDLOOP.

Runtime error details:

**Header Information

Short Text An RAP contract has been violated.
Runtime Error BEHAVIOR_CONTRACT_VIOLATION
Program ZCL_TEST_PR_OPERATIONS========CP
Date/Time 07.02.2024 01:47:03 (System)
User MOB31
Client 800
Host S4DEV_S4D_21

What happened?
Error in the ABAP application program.

The current ABAP program "ZCL_TEST_PR_OPERATIONS========CP" had to be terminated because it found a
statement that could not be executed.
An RAP contract has been violated: "CC/C:CONVERT_KEY_NOT_MAPPED".

Affected Behavior Definition / Entity: "R_PURCHASEREQUISITIONTP". Operation / Value: "15C3CA10B0E61EDEB1A5959BF6188D74".
Error analysis
The reason for the runtime error (see the list below) is: (2)
Runtime errors in connection with contract violations can occur for the
following reasons: (0) This contract violation always causes an error
to occur. (1) It is required by the "strict” specification in the
current BO. (2) It is required by the "strict” specification in the BO
that is called. (3) The contract violation occurs in Restricted ABAP.
(4) The corresponding checkpoint group is set to "error". (5) The
violation occurs in a BO enhancement in Restricted ABAP.
The ABAP program must be corrected.

Additional information about the various contract violations:

  • "MISSING_CID":
    Every EML operation that has field %CID (instance-generating
    operations) should be supplied with a unique value in this field.
    ???APDOCU ABAPRAP_BO_CONTRACT
  • "EMPTY_UPDATE":
    Every EML-UPDATE operation should supply at least one non-key field for
    every update record. In the %CONTROLS structure of every update record,
    at least one flag should therefore be set for a non-key field.
  • "DUPLICATE_UPDATE", "DUPLICATE_DELETE", "DUPLICATE_EXECUTE":
  • "AUGM_RELATING":
    A “Modify Augmenting” statement that performs operations on instances
    that are not already included in the original request should relate
    these instances to instances from the original request using the
    RELATING addition, since otherwise responses cannot be assigned.
  • "AUGM_OVERWRITE":
    A “Modify Augmenting” statement must not overwrite any fields from the
    original request. This means that the same %CONTROL flag must not be
    set for the same instance in both the original change and in the
    "Augmenting" change.
  • "DERIVED_TYPE_CONFLICT":
  • "CONVERT_KEY_NOT_MAPPED":
    In the "ADJUST_NUMBERS" phase, a BO with "Late Numbering" must return
    the mapping of all assigned temporary keys (PIDs) to final keys so that
    these can be retrieved using the CONVERT KEY statement.
    ???APDOCU ABENBDL_LATE_NUMBERING
    statement that performs operations on instances that are not already
    included in the original request should relate these instances to
    instances from the original request using the RELATING addition, since
    otherwise responses cannot be assigned.

In case of contract violation "AUGM_OVERWRITE": A “Modify Augmenting”
statement must not overwrite any fields from the original request. This
means that the same %CONTROL flag must not be set for the same instance
in both the original change and in the "Augmenting" change.
Information on where terminated
The termination occurred in ABAP program or include "ZCL_TEST_PR_OPERATIONS========CP", in "IF_OO_ADT_CLASSRUN~MAIN". The
main program was "SAPMSSY1".

In the source code, the termination point is in line 121 of include "ZCL_TEST_PR_OPERATIONS========CM001".
include "ZCL_TEST_PR_OPERATIONS========CM001".**

Source Code of the class:

CLASS zcl_test_pr_operations DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .

PUBLIC SECTION.

INTERFACES if_oo_adt_classrun .

PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.

CLASS zcl_test_pr_operations IMPLEMENTATION.

METHOD if_oo_adt_classrun~main.
DATA: purchase_requisitions TYPE TABLE FOR CREATE I_PurchaserequisitionTP,
purchase_requisition TYPE STRUCTURE FOR CREATE I_PurchaserequisitionTP,
purchase_requisition_items TYPE TABLE FOR CREATE i_purchaserequisitionTP_PurchaseRequisitionItem,
purchase_requisition_item TYPE STRUCTURE FOR CREATE i_purchaserequisitiontp\purchaserequisition_purchaserequisitionitem,
purchase_reqn_acct_assgmts TYPE TABLE FOR CREATE I_PurchaseReqnItemTP_PurchaseReqnAcctAssgmt,
purchase_reqn_acct_assgmt TYPE STRUCTURE FOR CREATE I_PurchaseReqnItemTP_PurchaseReqnAcctAssgmt,
purchase_reqn_item_texts TYPE TABLE FOR CREATE I_PurchaseReqnItemTP_PurchaseReqnItemText,
purchase_reqn_item_text TYPE STRUCTURE FOR CREATE I_PurchaseReqnItemTP_PurchaseReqnItemText,
delivery_date TYPE I_PurchaseReqnItemTP-DeliveryDate.

delivery_date = cl_abap_context_info=>get_system_date(  ) + 14.
  • DATA n TYPE i.
    **
  • n += 1.
    "purchase requisition
    purchase_requisition = VALUE #( %cid = 'My%CID_1'
    purchaserequisitiontype = 'NB'
    PurReqnDescription = CONV string( cl_abap_context_info=>get_system_time( ) + 1 ) ) .
    APPEND purchase_requisition TO purchase_requisitions.
"purchase requisition item
purchase_requisition_item = VALUE #(
                                   %cid_ref = 'My%CID_1'
                                   %target  = VALUE #(  (

                                         %cid                            = 'My%ItemCID_1'
                                         plant                           = '4111'
                                         purchaserequisitionitemtext     = 'Test Released APIs 123'
                                           accountassignmentcategory     = 'Q'
                                         requestedquantity               =  '10'
                                         baseunit                        = 'TO'
                                         purchaserequisitionprice        = '200.00'
                                         purreqnitemcurrency             = 'USD'
                                          Material                        = '000000000000000063'
                                         materialgroup                   = '01'
                                         purchasinggroup                 = '001'
  •                                         purchasingorganization          = '4111'
                                           DeliveryDate                    = delivery_date
    
    
    
                                                   ) ) ).
    

    APPEND purchase_requisition_item TO purchase_requisition_items.

    "purchase requisition account assignment
    purchase_reqn_acct_assgmt = VALUE #(
    %cid_ref = 'My%ItemCID_1'
    %target = VALUE #( (
    %cid = 'My%AccntCID_1'

  •                                                  CostCenter = 'JMW-COST'
                                                    GLAccount  = '0000300000'
                                                    quantity   = '10' ) ) ) .
    

    APPEND purchase_reqn_acct_assgmt TO purchase_reqn_acct_assgmts .

    "purchase requisition item text
    purchase_reqn_item_text = VALUE #(
    %cid_ref = 'My%ItemCID_1'
    %target = VALUE #( (
    %cid = 'My%TextCID_1'
    textobjecttype = 'B01'
    language = 'E'
    plainlongtext = 'Commandline test via F9'
    ) ) ) .
    APPEND purchase_reqn_item_text TO purchase_reqn_item_texts.

    "EML deep create statement

    "purchase reqn
    MODIFY ENTITIES OF i_purchaserequisitiontp ENTITY purchaserequisition
    CREATE FIELDS ( purchaserequisitiontype PurReqnDescription )
    WITH purchase_requisitions
    "purchase reqn item
    CREATE BY _purchaserequisitionitem
    FIELDS ( plant
    purchaserequisitionitemtext
    accountassignmentcategory
    requestedquantity
    baseunit
    purchaserequisitionprice
    purreqnitemcurrency
    Material
    materialgroup
    purchasinggroup

  •           purchasingorganization
             DeliveryDate
            )
    WITH purchase_requisition_items
    

    "purchase reqn account assignment
    ENTITY purchaserequisitionitem

    CREATE BY _purchasereqnacctassgmt
    FIELDS (

  •      CostCenter
                 GLAccount
                 Quantity
    
  •               BaseUnit
                 )
        WITH purchase_reqn_acct_assgmts
    "purchase reqn item text
    

    CREATE BY _purchasereqnitemtext
    FIELDS ( plainlongtext )
    WITH purchase_reqn_item_texts

    REPORTED DATA(reported)
    MAPPED DATA(mapped)
    FAILED DATA(failed).

    LOOP AT mapped-purchaserequisition INTO DATA(mapped_pr).
    out->write( |{ mapped_pr-%pid }| ).
    ENDLOOP.

COMMIT ENTITIES
BEGIN RESPONSE OF i_purchaserequisitiontp
FAILED DATA(failed_late)
REPORTED DATA(reported_late).

    LOOP AT mapped-purchaserequisition ASSIGNING FIELD-SYMBOL(<mapped>).
     CONVERT KEY OF i_purchaserequisitiontp FROM <mapped>-%pid TO DATA(ls_ctr).
      <mapped>-PurchaseRequisition = ls_ctr-PurchaseRequisition.
    ENDLOOP.

    IF sy-subrc = 0.
      out->write( | PurchaseRequisition:  { ls_ctr-PurchaseRequisition } | ).
    ELSE.
      out->write( | Error PurchaseRequisition sy-subrc:  { sy-subrc } | ).
    ENDIF.
COMMIT ENTITIES END.

ENDMETHOD.

ENDCLASS.

abap-platform-rap-workshops/managed_extensibility/

Hello

In the managed extensibility exercise while creating the class zcl_generate_dev268_0001 for generating the RAP BO I get a syntax error: Type zcl_rap_xco_cloud_lib is unknown. Type: zcx_rap_generator is unknown.

RAP generator fails to create artifacts - /dmo/cl_gen_rap400_artifacts

Hello,

Facing issues while executing class - /dmo/cl_gen_rap400_artifacts to generate required artifacts for continuing ex1.
This ends up with certain errors:


** Generation for the RAP400 Workshop (20211018 073633 UTC) **


  • Group ID (suffix): 0000
  • Package: ZRAP400_TRAVEL_0000 (superpackage: ZLOCAL)
  • Transport Request: TRLK901538
    No etag master field found in Travel. etag_master mapped as .
    Class name:
    /DMO/CX_RAP_GENERATOR
    Source position:
    Line 219 of VALIDATE_BO in /DMO/CL_RAP_NODE
    Stack trace:
    CX_XCO_RUNTIME_EXCEPTION constructor [method] Line: 15
    /DMO/CX_RAP_GENERATOR constructor [method] Line: 1
    /DMO/CL_RAP_NODE validate_bo [method] Line: 219
    /DMO/CL_RAP_NODE finalize [method] Line: 94

Only two DB tables got created with records filled in.

  • Thanks.

Error: Exercise 4.3: discarding Draft leads to an error

The creation of a new travel entry with early numbering and setting its status works well, but discarding the draft leads to the following error: "The entity CDS~ZRAP100_C_TRAVELTP_### with key 0000XXXX does not exist

Getting Error in Exercise 1.2. when generating in Eclipse

Prerequisites:
SAP S4/HANA 2022 on Premise
Eclipse 2022/03

When i am trying to generate the repository objects out of the new table i am getting following error:
"Invalid XML format of the response. Usually this is a programming error, but occasionally this is caused by an outdated client. Details: Content ist nicht zulässig in Prolog."

The a follow-up popup with an additional error message appears, but i think this is just a side effect:
"An error has occurred. See error log for more details.
class java.lang.reflect.InvocationTargetException cannot be cast to class com.sap.adt.communication.resources.ResourceException (java.lang.reflect.InvocationTargetException is in module java.base of loader 'bootstrap'; com.sap.adt.communication.resources.ResourceException is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @6a0a0f12)"

In the tutorial you say that it should also work for onPrem. So i wonder what i am doing wrong.

RAP100 - Objects of the SAPB_MAIN package are not available

Hi Team,

first of all, thanks for these great RAP examples.
I am actually using my own ABAP server - see this link: https://blogs.sap.com/2023/07/31/abap-platform-trial-1909-available-now/

My problem is that in order to create the first database, there are needed a few data elements of the SAPB_MAIN package.
For example: ABP_CREATION_USER

Is there any way to import those objects, in order to execute these exercises on this system?

Thanks and Regards,
Florin

Excercise 1: Authentication error after generating the service binding

Excercise 1:
After publishing the service I am not able to see any data in the application. Pressing "Go" in the Travel App leads to the following error: "No authorization to access service group 'ZRAP100_UI_TRAVEL_O4_ZN1'"

Also it get: "You do not have start authorization for R3TR G4BA ZRAP100_UI_TRAVEL_O4_ZN1, return code 4"

RAP620 Formatting

Following points are missing from the Exercise 2:
Title

  • Exercise 2: Adapt the generated code
  • Introduction and Hyperlink and bulletpoints for the chapters

Chapters

  • Exercise 2.X ... is missing
  • Hyperlink to top of the page

Ending

  • Summary and Hyperlink to the next Exercise

Following points are missing from the Exercise 3:
Chapters

  • Exercise 3.X ... is missing (the same in the Introduction Hyperlinks to each Chapter)

The New Data Defintion dialogue opens. Here you have to enter the following values:
Name: ZRAP260_CE_PRODUCTS
###

  • Typo - ZRAP260 instead ZRAP620

Following points are missing from the Exercise 4:

  • Introduction

Chapters

  • Exercise 3.X ... is missing
  • (the same in the Introduction Hyperlinks to each Chapter)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.