-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Facing issue while creating Purchase Requisition using RAP FACADE for RAP610 On stack scenario #21
Comments
@anfisc - Could you please help me here for this error in RAP610 scenario?? |
Hi Andre, Just an update on this blog, I debugged the code and found that the data being passed was not correct and due to which exception was being raised. The main problem is that the failed or reported tables don't capture any errors that leads to an exception when CONVERY KEY statement is executed. This looks like an SAP bug to me.. Can u please check and guide me accordingly? I can see some other community posts with same query - https://community.sap.com/t5/technology-q-a/problem-in-rap-bo-i-purchaserequisitiontp/qaq-p/12736218 |
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:
Every EML operation that has field %CID (instance-generating
operations) should be supplied with a unique value in this field.
???APDOCU ABAPRAP_BO_CONTRACT
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.
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.
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.
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.
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.
**
"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.
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'
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
"purchase reqn account assignment
ENTITY purchaserequisitionitem
CREATE BY _purchasereqnacctassgmt
FIELDS (
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).
ENDMETHOD.
ENDCLASS.
The text was updated successfully, but these errors were encountered: