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 15 3:48 AM
Hello,
Here is my solution for the task1
1) CDS View and Entity contents
2) Program to copy entries to new custom z table
Thanks & Regards,
Kiran Angar
2024 Aug 15 7:55 AM
Here is my submission:
Preview of the CDS View Entity:
Logic in the ABAP class:
2024 Aug 15 10:25 AM
2024 Aug 15 10:28 AM
2024 Aug 15 10:30 AM
TASK 1.
2024 Aug 15 12:06 PM
Thank you for initiating these challenge series.
Task1:
2024 Aug 15 12:58 PM
My validation
Logic of ABAP Class
CLASS zcl_a19_travel DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
DATA: lt_data TYPE STANDARD TABLE OF YDAJ19_travel.
INTERFACES if_oo_adt_classrun .
PROTECTED SECTION.
PRIVATE SECTION.
METHODS: delete_data.
METHODS: Get_data.
METHODS: update_data.
ENDCLASS.
CLASS zcl_a19_travel IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
DATA: lt_zcl_YADj19_travel TYPE STANDARD TABLE OF YDAJ19_travel WITH EMPTY KEY.
FIELD-SYMBOLS <fs_travel> TYPE YDAJ19_travel.
me->delete_data( ).
me->get_data( ).
LOOP AT me->lt_data ASSIGNING <fs_travel>.
CASE <fs_travel>-status.
WHEN 'N'.
<fs_travel>-status = 'O'.
WHEN 'P'.
<fs_travel>-status = 'O'.
WHEN 'B'.
<fs_travel>-status = 'A'.
WHEN OTHERS.
<fs_travel>-status = 'X'.
ENDCASE.
ENDLOOP.
me->update_data( ).
ENDMETHOD.
METHOD update_data.
INSERT YDAJ19_travel from TABLE @me->lt_data.
ENDMETHOD.
METHOD delete_data.
* delete existing entries in the database table
DELETE FROM YDAJ19_travel.
ENDMETHOD.
METHOD get_data.
CLEAR me->lt_data.
SELECT client, travel_id, description, total_price, currency_code, status
FROM /dmo/travel
INTO TABLE @me->lt_data.
ENDMETHOD.
ENDCLASS.
***************
Status values available in the filter selection
2024 Aug 15 2:10 PM - edited 2024 Aug 15 2:18 PM
Hi,
Please find the screenshot
Class logic
Data preview
2024 Aug 15 3:26 PM - edited 2024 Aug 15 3:30 PM
2024 Aug 15 4:19 PM
My solution:
1. Data preview of CDS view entity:
2. Logic in the ABAP class. In specific, the field ‘Status’ should only have values ( O, A or X ).
2024 Aug 15 6:41 PM
Hallo,
Datapreview
ABAP Class
2024 Aug 16 5:59 AM
Entity data:
Class method:
2024 Aug 16 8:19 AM
Hi, I have completed the week-1 challenge. Please find the attached screenshots.
Regards,
Manoj Kumar Potharaju.
2024 Aug 16 11:22 AM
Hello,
please find preview of data from my CSD view:
logic from uploader class:
2024 Aug 16 11:42 AM
My Solution for Task 1
Class Logic:
CDS Data Preview:
2024 Aug 16 3:01 PM
Hi,
Screenshots of the Solutions:
Data preview of the CDS View Entity:
Logic in the ABAP class:
2024 Aug 16 7:51 PM
My Solution:
1. CDS Preview
2. ABAP Class
Always great to brush up the basics. 😉
2024 Aug 18 12:03 PM - edited 2024 Aug 18 12:16 PM
Done.
2024 Aug 18 8:57 PM
My Solution :
2024 Aug 19 3:12 AM
Task 1 Completed!
The class
2024 Aug 19 8:30 AM - edited 2024 Aug 19 10:02 AM
2024 Aug 19 10:40 AM
CDS View Entity
Class
2024 Aug 19 4:27 PM
Complete.
2024 Aug 19 4:34 PM
Completed.
2024 Aug 19 7:17 PM
Task-1 :
Class:
CDS Preview:
2024 Aug 19 7:25 PM
Task-1 :
Class:
CDS View Preview:
2024 Aug 19 8:47 PM - edited 2024 Aug 21 1:42 PM
My solution:
CLASS zms_cl_travel_copy DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zms_cl_travel_copy IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
DATA: lt_travel TYPE STANDARD TABLE OF zms_db_travel.
SELECT client, travel_id, description, total_price, currency_code,
CASE
WHEN status = 'N' THEN 'O'
WHEN status = 'P' THEN 'O'
WHEN status = 'B' THEN 'A'
ELSE 'X'
END AS status
FROM /dmo/travel
INTO TABLE @LT_travel.
IF lt_travel IS NOT INITIAL.
"Refresh the existing data if any.
DELETE zms_db_travel FROM TABLE @LT_travel.
"Populate the new data.
INSERT zms_db_travel FROM TABLE @LT_travel.
IF sy-subrc IS INITIAL.
DATA(lv_message) = |'Data inserted successfully!'- { sy-dbcnt }|.
out->write( lv_message ).
ENDIF.
ENDIF.
ENDMETHOD.
ENDCLASS.
2024 Aug 20 10:22 AM
My Solution:
2024 Aug 20 11:08 AM - edited 2024 Aug 20 11:11 AM
1. Data preview of the CDS View Entity
2. Logic in the ABAP class.
2024 Aug 20 2:13 PM
My solution -
2024 Aug 20 2:53 PM
TASK1 Solution
2024 Aug 20 7:21 PM
Solution below :
2024 Aug 21 2:33 PM
Task 1.
Class
CDS
CDS Data Preview
2024 Aug 22 5:21 AM
week 1 challenge
2024 Aug 22 12:46 PM
Hello!
My Solution:
The data preview of my database table:
The transformation class logic:
2024 Aug 22 4:04 PM
2024 Aug 23 8:52 AM
Here is my submission!
2024 Aug 24 2:29 PM
Hi Team,
Here are the screenshots for the task
2024 Aug 26 2:37 PM
Here is my solution:
1. Creation of my database table:
2. Defining class and writing logic:
3. Final output in the database table:
2024 Aug 26 5:18 PM
Hi, Task 1: I am unable to login to cloud project. So created a new project with new instance.