sap-samples / abap-platform-rap-workshops Goto Github PK
View Code? Open in Web Editor NEWThis repository contains materials for workshops about the ABAP RESTful Application Programming Model (RAP).
License: Apache License 2.0
This repository contains materials for workshops about the ABAP RESTful Application Programming Model (RAP).
License: Apache License 2.0
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:
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.
"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.
The OSPO bot created this issue by mistake - It did not have enough priviledge to check the vulnerability alerts, So I am closing this issue now. Sorry for any inconvenience.
When I execute unit test: "No authorization to access the resource /sap/bc/adt/abapunit/testruns."
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.
Following points are missing from the Exercise 2:
Title
Chapters
Ending
Following points are missing from the Exercise 3:
Chapters
The New Data Defintion dialogue opens. Here you have to enter the following values:
Name: ZRAP260_CE_PRODUCTS###
Following points are missing from the Exercise 4:
Chapters
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
Field Symbol is missing at declaration and afterwards in every place where it was used.
LOOP AT inventories ASSIGNING FIELD-SYMBOL().
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
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"
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.
A violation against the OSS Rules of Play has been detected.
Rule ID: rl-assigned_teams-3
Explanation: Does it have enough admins on GitHub? No
Find more information at: https://sap.github.io/fosstars-rating-core/oss_rules_of_play_rating.html
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) **
Only two DB tables got created with records filled in.
A violation against the OSS Rules of Play has been detected.
Rule ID: rl-assigned_teams-2
Explanation: Does it have an admin team on GitHub? No
Find more information at: https://sap.github.io/fosstars-rating-core/oss_rules_of_play_rating.html
A violation against the OSS Rules of Play has been detected.
Rule ID: rl-assigned_teams-1
Explanation: Does it have enough teams on GitHub? No
Find more information at: https://sap.github.io/fosstars-rating-core/oss_rules_of_play_rating.html
https://github.com/SAP-samples/abap-platform-rap-workshops/tree/main/rap6xx link to RAP600 doesn't work / code not available.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.