2024 Jul 31 11:30 AM - edited 2024 Jul 31 12:39 PM
This discussion thread is for you to ask your questions and discuss issues if you are participating in the August 2024 developer challenge. The topic is "ABAP Core Data Services"
Please use separate discussions created for the submission of your solutions. Keep this thread for your questions only.
2024 Aug 06 9:05 AM
2024 Aug 06 10:52 AM
Hi Vishal,
Tasks will be released every Wednesday. Kindly check this blog post for the timeline of the the task and the link to the discussion forum: https://community.sap.com/t5/application-development-blog-posts/sap-developer-challenge-abap-core-da...
2024 Aug 08 12:52 PM
Hi @Shilpa_Shankar ,
Why do we need to create a new table? why not use a projection consumption view to achieve the same thing?
2024 Aug 08 1:53 PM
Hi,
Yes, you can create a view directly consuming the table. We just wanted to start from the scratch of creating a Table and an ABAP class to get to know of ABAP Cloud concepts for the ones who are totally new.
2024 Aug 08 1:39 PM
Hi @Shilpa_Shankar ,
I have an error while processing authorization checks. I have check every back step and everything looks okey. Could it be Role collection from BTP cockpit?
2024 Aug 08 1:54 PM
When do you get this error? During which step of the challenge? See if you can get more information about the error log.
2024 Aug 08 3:33 PM
Hi @Shilpa_Shankar, thanks for your quick response.
I am facing an issue when trying to open a CDS view in ABAP Development Tools (ADT) in Eclipse. The error occurs when performing the Data Preview of the view I created. Below are the steps I followed and the error that appears:
Steps Followed
1.Create the Table ZANG_TRAVEL
@EndUserText.label: 'August developer challenge - "ABAP Core Data Services"'
@AbapCatalog.enhancement.category: #NOT_EXTENSIBLE
@AbapCatalog.tableCategory: #TRANSPARENT
@AbapCatalog.deliveryClass: #A
@AbapCatalog.dataMaintenance: #RESTRICTED
define table zang_travel {
key client : abap.clnt not null;
key travel_id : abap.numc(8) not null;
description : abap.char(40);
total_price : abap.dec(15,2);
currency_code : abap.cuky;
status : abap.char(1);
}
2.Create the ABAP Class to Generate and Update Data
CLASS zcl_anavarro_generate_data DEFINITION
PUBLIC
FINAL
CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES: if_oo_adt_classrun.
METHODS: generate_data,
update_status.
ENDCLASS.
CLASS zcl_anavarro_generate_data IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
me->generate_data( ).
me->update_status( ).
ENDMETHOD.
METHOD generate_data.
DATA: lt_travel TYPE TABLE OF zang_travel,
ls_travel TYPE zang_travel.
SELECT client, travel_id, description, total_price, currency_code, status
FROM /dmo/travel
INTO TABLE @lt_travel.
LOOP AT lt_travel INTO ls_travel.
INSERT INTO zang_travel VALUES @ls_travel.
ENDLOOP.
ENDMETHOD.
METHOD update_status.
DATA: lt_travel TYPE TABLE OF zang_travel,
ls_travel TYPE zang_travel.
SELECT client, travel_id, description, total_price, currency_code, status
FROM zang_travel
INTO TABLE @lt_travel.
LOOP AT lt_travel INTO ls_travel.
CASE ls_travel-status.
WHEN 'N' OR 'P'.
ls_travel-status = 'O'.
WHEN 'B'.
ls_travel-status = 'A'.
WHEN OTHERS.
ls_travel-status = 'X'.
ENDCASE.
MODIFY zang_travel FROM @ls_travel.
ENDLOOP.
ENDMETHOD.
ENDCLASS.
3.Create the CDS View ZANG_TRAVEL_CDS
@AbapCatalog.sqlViewName: 'ZANG_TRVL'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'August challenge'
define view ZANG_TRAVEL_CDS
as select from zang_travel
{
key travel_id as TravelId,
description as Description,
total_price as TotalPrice,
currency_code as CurrencyCode,
status as Status,
@Semantics.currencyCode: true
currency_code as Currency
}
Issue Encountered
When trying to open the CDS view in ADT and perform the Data Preview, the following error appears:
Error while processing authorization checks
The log shows:
Generated SQL: SELECT ZANG_TRVL~MANDT, ZANG_TRVL~TRAVELID, ZANG_TRVL~DESCRIPTION, ZANG_TRVL~TOTALPRICE, ZANG_TRVL~CURRENCYCODE, ZANG_TRVL~STATUS, ZANG_TRVL~CURRENCY FROM ZANG_TRVL
Finished query execution (took 194 ms)
The error occurs only when trying to view the data in the CDS view.
2024 Aug 08 4:43 PM
Hi!
I finally solved the problem. I created an ABAP Project in ABAP Development Tools (ADT) instead of an ABAP Cloud Project. I am going to investigate creating an ABAP Cloud Project because I want to use SAP BTP ABAP Environment or SAP S/4HANA Cloud system.
Thank you!
2024 Aug 08 9:53 PM
Hi @adrianng ,
From the syntax of your CDS View, it seems you choose defineView (which is obsolete) instead of defineViewEntity in your ABAP Cloud Project and see if it works.
Try recreating the proper one in the
2024 Aug 15 5:51 PM
A few comments about Task 2:
"Do not post screenshots of the CDS view entity."
It's interesting to note that many participants still share screenshots of their CDS views, a common habit. While this is not ideal for code review, it does highlight a few points worth discussing.
About the screenshots being shared:
One common issue I've noticed is the absence of cardinality specifications in associations, which often leads to warning messages in the CDS editor. While these warnings may seem minor—especially when the results appear correct—consider the impact this could have if additional languages are defined for your texts.
For instance, if Spanish or German translations were added, the entries could be duplicated. This scenario could introduce complexity and unexpected behavior later on.
I recommend revisiting "Using Associations in Path Expressions" to strengthen understanding. Additionally, examining built-in session variables, particularly system_language, might offer insights into avoiding this issue when working with multilingual data.
2024 Aug 17 8:57 PM - edited 2024 Aug 18 8:37 AM
while creating instance in SAP BTP trial account I am getting error like below
and it is coming as abap plan is : shared. Can you please help to resolve this so that I can move to Task1?
NOTE: The issue is resolved now
2024 Aug 21 4:01 PM
Hi Shilpa,
I am facing issue in Eclipse to login, the error is shown in the screenshot below,
Earlier also I faced, when I created a new instance with different email ID, it got worked but this time a new ID got created in eclipse & I am not able to access my package.
How to access my package of my previous objects? Is it possible to access it or need to re-create again?Can you pls guide on this?
Regards,
Lakshmi
2024 Aug 21 5:40 PM
Hi Lakshmi,
The error appears if the login user in BTP trial is not the one that you are using in ADT when you login to the system. Kindly clear the browser cache and try in incognito window or in another browser.
if you are able to login to BTP trial system in ADT, you can add the previously created package as favorite package. Right click on Favotite package and select Add Package.
2024 Aug 22 9:22 AM
Hi Shilpa,
I have done the above steps but still facing the same Issue. Secondly all my accounts are merged (Gmail & current employer) then also getting Error like "error occurred during the Service Instance logon"
So I deleted the existing instance & created with other email ID but it created a new C user ID. Please help me to get my packages.
Regards,
2024 Aug 22 10:01 AM
Hi Shilpa,
I had the first error: "You were successfully authenticated, but an error occurred during the Service Instance logon. Please ensure that you have a user for the Service Instance".
Unfortunately, the blog did not help:
Initial Configurations for ABAP in the Cloud – Cloud Foundry Environment | SAP Blogs.
In the current version when indicating US East (VA) instead of specifying:
https://api.cf.us10-001.hana.ondemand.com
pointed incorrectly to
https://api.cf.us10.hana.ondemand.com
I had to mark "Region" to the value "Other". From where I guessed. Here was the information.
I found a blog where we have to assign a role
But this role is not available in BTP trial account under user->Assign Roles:
Could you please suggest.
Regards,
2024 Aug 23 12:33 PM
Hi,
If you are using BTP Trial system, you cannot add SAP_BR_Developer. Kindly delete the instance and run the Booster to set up ABAP Environment. Download the service key and use it to create a new ABAP Cloud Project. If you remember your package you can add it to the favorites else create a new one. I also noticed that BTP Trial system has less objects than it had earlier. Probably it has been refreshed.
2024 Aug 22 1:10 PM - edited 2024 Aug 23 7:57 AM
I am stuck in below point for task 3. Please advise as I am not getting the values in FIORI app. @Shilpa_Shankar @sheenamk
c. Add annotations to provide a value help filter on the ‘Status text’ field based on Overall Status text.
@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'CDS View entity'
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType:{
serviceQuality: #X,
sizeCategory: #S,
dataClass: #MIXED
}
@ui.headerInfo.typeName: 'Travel'
@ui.headerInfo.typeNamePlural: 'Travels'
@Search.searchable: true
@ObjectModel.semanticKey: [ 'Description' ]
define view entity Ztravel_entity5 as select from ztravel_new5
association [0..1] to /DMO/I_Overall_Status_VH as _Status on _Status.OverallStatus = $projection.Status
{
@ui.lineItem: [{ position: 10 }]
@ui.selectionField: [{ position: 10 }]
key
travel_id as TravelId,
@ui.lineItem: [{ position: 20 }]
@Search.defaultSearchElement: true
@Search.fuzzinessThreshold: 0.90
description as Description,
@Semantics.amount.currencyCode: 'CurrencyCode'
@ui.lineItem: [{ position: 30 }]
total_price as TotalPrice,
currency_code as CurrencyCode,
@ui.lineItem: [{ position: 40 }]
concat_with_space( cast ( total_price as abap.char(25) ), currency_code, 1) as NewPriceCurrencyCode,
@ui.lineItem: [{ position: 50 }]
status as Status,
@ui.lineItem: [{ position: 60 }]
@ui.selectionField: [{ position: 20 }]
@Consumption.valueHelpDefinition: [{ entity: {name: 'zhelp_new5', element: 'overallStatus' } }]
_Status._Text.Text as overallStatusText,
_Status
}
2024 Aug 23 9:19 AM
Hi,
Post the data preview of zhelp_new5. The annotation syntax looks fine.
2024 Aug 23 9:27 AM
2024 Aug 23 9:35 AM
Try this,
@Consumption.valueHelpDefinition: [{ entity: {name: 'zhelp_new5', element: 'overallStatusText' } }]
2024 Aug 23 9:46 AM
2024 Aug 26 8:17 AM
Hi @Shilpa_Shankar , @sheenamk ,
Kindly help to resolve this so that I can submit my task.
2024 Aug 26 12:11 PM
Hi @diveshkalra ,
This is what you have to do:
1. Since you have 2 fields with Status and text, apply annotation @Consumption.valueHelpDefinition to the status field.
2. Use the annotation @ObjectModel.text.element: and map the ''text' field. This will give you dropdown with the available values.
2024 Aug 26 12:57 PM
Hi @Shilpa_Shankar ,
Could you please correct here and what exactly need to be put. I was trying from past few days and did not got the success. This is taking lot of time from my end. Also, these all are new concepts to me and thats why i am struggling here.
@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'CDS View entity'
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType:{
serviceQuality: #X,
sizeCategory: #S,
dataClass: #MIXED
}
@UI.headerInfo.typeName: 'Travel'
@UI.headerInfo.typeNamePlural: 'Travels'
@Search.searchable: true
@ObjectModel.semanticKey: [ 'Description' ]
define view entity Ztravel_entity5 as select from ztravel_new5
association [0..1] to /DMO/I_Overall_Status_VH as _Status on _Status.OverallStatus = $projection.Status
{
@UI.lineItem: [{ position: 10 }]
@UI.selectionField: [{ position: 10 }]
key
travel_id as TravelId,
@UI.lineItem: [{ position: 20 }]
@Search.defaultSearchElement: true
@Search.fuzzinessThreshold: 0.90
description as Description,
@Semantics.amount.currencyCode: 'CurrencyCode'
@UI.lineItem: [{ position: 30 }]
total_price as TotalPrice,
currency_code as CurrencyCode,
@UI.lineItem: [{ position: 40 }]
concat_with_space( cast ( total_price as abap.char(25) ), currency_code, 1) as NewPriceCurrencyCode,
@UI.lineItem: [{ position: 50 }]
@Consumption.valueHelpDefinition: [{ entity: { name: 'ZHELP_NEW5' , element: 'status'} } ]
status as Status,
@UI.lineItem: [{ position: 60 }]
@UI.selectionField: [{ position: 20 }]
_Status._Text.Text as overallStatusText,
_Status
}
2024 Aug 26 1:22 PM - edited 2024 Aug 26 1:25 PM
Hi,
use this annotation for Status. It'll take the text value from overallStatusText as it is mapped in the annotation @ObjectModel.text.element. Since you are using the standard view in Association you can use the same in valuehelpdefinition.
@Consumption.valueHelpDefinition: [{ entity: { name: '/DMO/I_Overall_Status_VH',element: 'OverallStatus' } }]
@ui.lineItem: [{ position: 90 }]
@ui.selectionField: [{ position: 90 }]
@ObjectModel.text.element: [ 'overallStatusText' ]
@ui.textArrangement: #TEXT_ONLY
status as Status,
2024 Aug 26 1:31 PM
Hi @Shilpa_Shankar ,
Now, values can be seen in drop down but while trying to select any of the values, it's not appearing.
2024 Aug 23 8:00 PM
Hello, I'm facing some troubles with Task 3 while providing a help filter on the 'Status text' field based on Overall Status.
I modify the metadata extension to provide the selection field [screenshot]
Also, I modify the projection view. Here comes the first question: What are the criteria for writing this annotation on the projection view instead of the metadata extension? (mine followed the tech bytes video) [screenshot]
While the CDS defining the Value Help is this [screenshot]
Value help is being shown, but no selection can be made; why? [screenshot]
Could you help me, please?
2024 Aug 24 6:38 PM
TASK3
For the Task 3: Can you please share your valueHelp definition part for Overall status. For me it is showing the dropdown but when I try to select one from the dropdown it is not applying the Filter automatically(same error shown by @Jorge_Cervantes ) I'm facing the same issue.
Request your help here as I have seen your validation screenshot and it seems it is working perfectly for you. Thanks in advance.
2024 Aug 27 7:20 PM
2024 Aug 26 1:08 PM - edited 2024 Aug 26 1:09 PM
Hi,
For the question on when metadata extension has to be used. It's a good practice to use metadata extension where you define all UI annotations. In the consumption view you define those annotations which helps you understand the behavior of the fields.
For the value help,
1. Since you have 2 fields with Status and text, apply annotation @Consumption.valueHelpDefinition to the status field.
2. Use the annotation @ObjectModel.text.element: and map the ''text' field. This will give you dropdown with the available values.
2024 Aug 25 8:09 AM
Hi @Shilpa_Shankar & @sheenamk ,
Regarding: Task 3.
The Value help on the status text field appears but fails to select on selection.
In the below snap the Status "Open(O)" is selected but it is not filtered.
Tech Details:
Annotation for the status text field
@UI:{ lineItem: [{ position: 40 }], identification: [{ position: 40}] }
@Consumption.valueHelpDefinition: [{
entity: {
name: '/DMO/I_Overall_Status_VH_Text',
element: 'overall_status'
}
}]
@EndUserText.label: 'Status Text'
CurrentStatus;
Service Type selected during Service Binding: ODATA V4 - UI.
Warm Regards,
Surya L
2024 Aug 26 6:43 AM
Hi @Shilpa_Shankar ,
Why do I see a warning message "The association "_Text" can modify the cardinality of the result set"
What do I need to do to eliminate this warning? Below is the example code I used, tried to use session variable for Language selection.
Thanks
Ajay
2024 Aug 26 1:02 PM
Hi Ajay,
Yes, the warning comes up as there is potential for the data to be altered like example if it has translations. To avoid this, you can filter out by specifying the language and add '1' to document the change cardinality. Check this link for more information: https://learning.sap.com/learning-journeys/acquire-core-abap-skills/using-associations-in-path-expre...
2024 Aug 29 11:55 AM - edited 2024 Aug 29 1:12 PM
Hi @Shilpa_Shankar / @sheenamk
Greetings!
TASK 4 - Object Page is empty
To display the Objet page, I have added the UI.Identification annotation in the Metadata extension.
The code snipet is added below.
Issue: The Object page is empty even when the Identification annotation is added. As you can see the Header part is visible whereas the Identification part is invisible.
Requesting your guidance
@Metadata.layer: #CUSTOMER
@UI.headerInfo: {
typeName: 'Trip',
typeNamePlural: 'Trips',
title: {
type: #STANDARD,
value: 'Description'
},
description: {
type: #STANDARD,
value: 'TravelId'
}
}
annotate entity ZV_S11_TRAVEL_BASE with
{
@UI: {
lineItem: [{ position: 01}],
identification: [{position: 01}]
}
@UI.selectionField: [{ position: 01}]
@EndUserText.label: 'Travel ID'
TravelId;
@EndUserText.label: 'Description'
@UI: {
lineItem: [{ position: 02}],
identification: [{position: 02}]
}
Description;
@EndUserText.label: 'Total Price'
@UI: {
lineItem: [{ position: 03}]
}
TotalPrice;
@EndUserText.label: 'Currency'
@UI: {
lineItem: [{ position: 04}]
}
CurrencyCode;
@EndUserText.label: 'Price with Currency'
@UI: {
lineItem: [{ position: 05}],
identification: [{position: 05}]
}
PriceWithCurrency;
@EndUserText.label: 'Status'
@Consumption.valueHelpDefinition: [{
entity: {
name: '/DMO/I_Overall_Status_VH_Text',
element: 'OverallStatus'
}
}]
@UI: {
lineItem: [{ position: 06}]
}
Status;
@EndUserText.label: 'Status Text'
@UI: {
lineItem: [{ position: 07}],
identification: [{ position: 07 }]
}
StatusText;
}
Warm Regards
Surya L
2024 Aug 29 12:12 PM
A facet implementation is missing. Use the reference link provided in Task 4 and then look for “Using Header Facets for Object Pages”
2024 Aug 29 1:10 PM
Hi Jorge,
Thanks for Responding.
I have added the Facet, even now the Identification part is empty.
Previously I have developed list reports without Facet in S4HANA 2022 (on prem) which was working fine.
Warm Regards
Styles
2024 Aug 29 1:25 PM - edited 2024 Aug 29 1:35 PM
In your metadata extension file, annotate your CDS view with @ui.facet and specify the required properties. Facets organize information on an object page.
purpose:#STANDARD
type:#IDENTIFICATION_REFERENCE
2024 Aug 29 4:39 PM
Thanks Mohammed!
Adding #IDENTIFICATION_REFERENCE worked!
2024 Aug 29 1:30 PM
Hi @Shilpa_Shankar
may i know why the column name is showing as overall status for both status code and status text, even though i haven't mentioned it in any place.