Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Questions re: "ABAP Core Data Services" developer challenge

Shilpa_Shankar
Developer Advocate
Developer Advocate
14,203

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.

42 REPLIES 42
Read only

0 Likes
13,161

Hi @Shilpa_Shankar ,

Any update on Task 1. How will it be notified?

Regards,

Vishal Solanki

Read only

0 Likes
13,107

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...

 

Read only

tamitdassharma
Active Participant
0 Likes
12,980

Hi @Shilpa_Shankar ,

Why do we need to create a new table? why not use a projection consumption view to achieve the same thing?

Read only

12,943

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.

Read only

adrianng
Explorer
0 Likes
12,967

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? 

adrianng_0-1723120681339.png

 

Read only

0 Likes
12,954

When do you get this error? During which step of the challenge? See if you can get more information about the error log.

Read only

0 Likes
12,926

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.

Read only

0 Likes
12,883

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!

Read only

0 Likes
12,853

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.

azaharescu_0-1723150291562.png

Try recreating the proper one in the 

Read only

Jorge_Cervantes1
Participant
12,462

A few comments about Task 2:

  1. "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.

  2. 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.

Jorge_Cervantes_0-1723740370435.png

 

Read only

Sayontan_Das
Participant
12,355

Hi @Shilpa_Shankar 

while creating instance in SAP BTP trial account I am getting error like below

Sayontan_Das_0-1723924614010.png

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

Read only

vslakshmi
Product and Topic Expert
Product and Topic Expert
0 Likes
12,119

Hi Shilpa,

I am facing issue in Eclipse to login, the error is shown in the screenshot below,

vslakshmi_0-1724251776110.png

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.

vslakshmi_1-1724252290771.png

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

Read only

0 Likes
12,091

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.

Read only

vslakshmi
Product and Topic Expert
Product and Topic Expert
0 Likes
12,022

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" 

vslakshmi_0-1724314003771.png

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,

 

Read only

vslakshmi
Product and Topic Expert
Product and Topic Expert
0 Likes
12,007

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

vslakshmi_1-1724316203413.png

I had to mark "Region" to the value "Other". From where I guessed. Here was the information.

vslakshmi_2-1724316272539.png

I found a blog where we have to assign a role

https://community.sap.com/t5/technology-blogs-by-members/sap-btp-abap-environment-and-adt-troublesho...

vslakshmi_3-1724316926115.png

But this role is not available in BTP trial account under user->Assign Roles:

vslakshmi_4-1724316983668.png

Could you please suggest.

Regards,

 

 

Read only

0 Likes
11,805

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.

Read only

diveshkalra
Explorer
0 Likes
11,976

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

 

}

Read only

0 Likes
11,872

Hi,

Post the data preview of zhelp_new5. The annotation syntax looks fine.

Read only

0 Likes
11,868

Hi @Shilpa_Shankar ,

PF data preview of ZHELP_NEW5.

diveshkalra_0-1724401655158.png

 

Read only

0 Likes
11,865

Try this,

@Consumption.valueHelpDefinition: [{ entity: {name: 'zhelp_new5', element: 'overallStatusText' } }]

Read only

0 Likes
11,862

Hi @Shilpa_Shankar ,

I tried with this well earlier but no luck.

diveshkalra_0-1724402757849.png

 

Read only

0 Likes
11,391

Hi @Shilpa_Shankar , @sheenamk ,

Kindly help to resolve this so that I can submit my task.

Read only

0 Likes
11,336

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.

Read only

0 Likes
11,319

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

 

}

Read only

0 Likes
11,305

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,

 

Read only

0 Likes
11,299

Hi @Shilpa_Shankar ,

Now, values can be seen in drop down but while trying to select any of the values, it's not appearing.

diveshkalra_0-1724675478266.png

 

Read only

Jorge_Cervantes1
Participant
0 Likes
11,766

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]

Jorge_Cervantes_0-1724438624920.png

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]

Jorge_Cervantes_1-1724438775995.png

While the CDS defining the Value Help is this [screenshot]

Jorge_Cervantes_2-1724439233464.png

Value help is being shown, but no selection can be made; why? [screenshot]

Jorge_Cervantes_3-1724439429358.png

Could you help me, please?

 

 

 

Read only

0 Likes
11,578

TASK3

@BH2408 @Sivaiah_Bhiragani 

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_Cervantes1  ) 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.

Read only

0 Likes
11,036

@Vara_reddy 

Please find the screen shot below.

Sivaiah_Bhiragani_0-1724782848334.png

 

Read only

0 Likes
11,317

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.

Read only

styles
Participant
0 Likes
11,504

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.

image.png

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

"Programming is not about what you know, it is about what you can solve"
Read only

Ajay19
Explorer
11,408

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.

Ajay19_0-1724650885313.png

Thanks

Ajay

 

Read only

11,318

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...

Read only

styles
Participant
0 Likes
10,833

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

"Programming is not about what you know, it is about what you can solve"
Read only

10,821

A facet implementation is missing. Use the reference link provided in Task 4 and then look for “Using Header Facets for Object Pages”

 

Read only

0 Likes
10,798

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.
Object PageObject PageSnippetSnippetWarm Regards
Styles

"Programming is not about what you know, it is about what you can solve"
Read only

10,794

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

 

 

Read only

0 Likes
10,712

Thanks Mohammed!
Adding #IDENTIFICATION_REFERENCE worked!

"Programming is not about what you know, it is about what you can solve"
Read only

DineshkumarR1
Explorer
0 Likes
10,792

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.

DineshkumarR1_0-1724934446122.pngDineshkumarR1_1-1724934533250.png