2024 Aug 07 12:53 PM - last edited on 2024 Aug 08 5:16 PM by thomas_jung
First of all, thanks for the overwhelming response to the ABAP Developer Challenge. Kudos to everyone who took time out of their busy schedule and finished the pre-requisite – Task 0 last week.
Now let us dive right into the challenge.
Task 1 - In this challenge, we will create a custom table and explore the creation of CDS view entity from it. This also includes writing a simple logic to generate data into this table and to replace the existing values in a specific field.
Follow the instructions carefully and share with us the screenshots of the items mentioned in the ‘Validation’ section of this discussion.
Note: As suggested in Task 0 , please ensure that you give a unique ID ( something that can relate to your SAP Community ID ) to all your development objects.
Please use this separate thread to ask your questions and discuss issues.
So, let’s get started:
Validation : Share a screenshot of the following items as a reply to this thread to gain credits:
Enjoy!!!!
2024 Aug 08 8:40 AM
Here's my solution:
2024 Aug 19 6:21 PM
Thanks!
2024 Aug 08 8:45 AM
Data preview CDS view entity:
data generator class:
2024 Aug 08 8:53 AM
Can anyone explain why client field is not added as part of select statement while moving the data to custom table?
2024 Aug 08 9:46 AM
The ABAP open SQL statements are designed to handle the client number automatically. This can be overwritten by using some special syntax, but its use is discouraged because it can lead to security issues.
2024 Aug 08 8:59 AM
Hello,
My solution:
2024 Aug 08 9:01 AM
1. CDS view preview
2. Logic in the class to update the data and status field
2024 Aug 08 9:01 AM
Hi ,
I completed Task 1,Please find the below screen shots.
Kind Regards,
Guru
2024 Aug 08 9:09 AM
Task 1 Completed!
CDS View output :
Class to update data in database table :
Waiting for Task 02.
2024 Aug 08 9:11 AM
Hello 😁,
Here is my submission for Task 1:
Kind regards, Oana
2024 Aug 08 9:14 AM
My Solution:
Data Preview:
Logic in ABAP Class:
2024 Aug 08 9:15 AM - edited 2024 Aug 08 9:18 AM
2024 Aug 08 9:22 AM
👍 💪
2024 Aug 08 9:22 AM
💪 👍
My class logic :
My CDS view:
2024 Aug 08 9:23 AM
Attaching the screen shots.
2024 Aug 08 9:35 AM
Done 💪
Class logic;
Data preview;
2024 Aug 08 10:10 AM
2024 Aug 08 10:11 AM
Table
Class to generate data:
CDS view entity
Output of CDS view:
2024 Aug 08 10:18 AM - edited 2024 Aug 08 10:24 AM
CDS view preview
ABAP Class
CLASS zcl_gv_travel_data_copy DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_gv_travel_data_copy IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
DATA lt_traveldt TYPE TABLE OF ztl_travel_data.
DELETE FROM ztl_travel_data.
SELECT travel_id,
description,
total_price,
currency_code,
CASE status
WHEN 'N' THEN 'O'
WHEN 'P' THEN 'O'
WHEN 'B' THEN 'A'
ELSE 'X'
END AS status
FROM /dmo/travel
INTO CORRESPONDING FIELDS OF TABLE lt_traveldt.
IF lt_traveldt IS NOT INITIAL.
INSERT ztl_travel_data FROM TABLE lt_traveldt.
IF sy-subrc = 0.
out->write( 'Travel data inserted' ).
ELSE.
out->write( 'No data inserted' ).
ENDIF.
ENDIF.
ENDMETHOD.
ENDCLASS.
2024 Aug 08 10:44 AM
Solution: ABAP Class and Preview
2024 Aug 08 10:52 AM
My solution.
2024 Aug 08 11:09 AM
Class
2024 Aug 08 11:37 AM
Hi @sheenamk,
Please find below my submission of week 1
CDS View data Preview
Data preview of database table
Class to update the table
Regards,
Sushmita
2024 Aug 08 12:24 PM
Hello all,
CDS data preview
Class
2024 Aug 08 12:36 PM
Borrowed heavily from:
Create Database Table and Generate UI Service | SAP Tutorials
Also followed @thomas_jung idea of mapping the domain to its description. Is there a technically elegant way of doing that?
2024 Aug 08 12:57 PM
2024 Aug 08 1:27 PM
Awesome!
2024 Aug 08 12:52 PM
Hello SAP abapers community!
Here is my Solution:
CDS view entity:
Data preview CDS entity:
Data class generator:
Custom table:
Best regards.
Jorman
2024 Aug 08 2:32 PM
Hi,
my solution:
2024 Aug 08 2:59 PM
My solution.
CDS View:
Class:
2024 Aug 08 3:13 PM
Task 1 - Completed!
Class
Data Preview of CDS View
2024 Aug 08 3:27 PM
2024 Aug 08 3:32 PM - edited 2024 Aug 08 3:36 PM
Data Preview:
Code:
2024 Aug 08 4:24 PM
2024 Aug 08 4:27 PM
Here is my code and output
2024 Aug 08 5:32 PM
This is my solution:
2024 Aug 08 6:22 PM
2024 Aug 08 7:04 PM
Data preview of the CDS View Entity
ABAP Class
2024 Aug 08 7:38 PM
My Solution:
2024 Aug 08 8:08 PM
Buen día,
Comparto mi solución:
Saludos