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 07 1:26 PM
2024 Aug 07 3:30 PM
CDS view preview:
Class file to copy data after using the code cleaner:
CLASS zcl_mwn_travel_copy IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
insert zmwn_travel from
( select 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
from
/dmo/travel ).
ENDMETHOD.
ENDCLASS.
Distinct values for status (looks like there are no unexpected statuses)
2024 Aug 19 3:11 AM
Task 1 Completed!
The class
2024 Aug 07 3:37 PM
2024 Aug 07 4:02 PM - edited 2024 Aug 07 4:30 PM
Hi,
Please find the screenshots below:
2024 Aug 07 4:09 PM
I don't think you want to just copy the top 100 rows to your new table
2024 Aug 12 2:45 PM
Hello!
Below is my Solution
Data Preview:
Source Code:
Thanks!!
2024 Aug 07 4:10 PM
2024 Aug 08 10:11 AM
Please attach the screenshot of the new value mapping logic.
2024 Aug 30 7:54 AM
2024 Aug 07 4:14 PM - edited 2024 Aug 07 4:15 PM
CDS Data Preview:
Class logic (still needs improvement 🙃)
2024 Aug 07 4:40 PM - edited 2024 Aug 07 4:42 PM
CDS view entity
ABAP CLASS
2024 Aug 07 5:29 PM
Hello,
Interesting way to start the challenge, had fun!
Logic in the ABAP class:
Data preview of the CDS view entity : ZYSS_I_TRAVEL
Looking forward to the next challenge.
2024 Aug 07 5:37 PM
Hi Team,
Here is the Data Preview of CDS Entity:
ABAP Class:
Thank you!!!
Best Regards,
Bharani
2024 Aug 07 6:10 PM
My Solution -
Data Preview -
There is no other value in travel table, hence in the custom table, there is no entry for status = 'X'.
Logic:
2024 Aug 07 7:58 PM
CB9980002351
CDS View Preview:
Class Logic:
2024 Aug 07 8:16 PM
2024 Aug 07 8:41 PM
Data Preview:
Logic to fill db table:
2024 Aug 07 9:11 PM
CDS data preview
Class-method
2024 Aug 07 9:40 PM
CDS view Data Preview :
Data Generating Class:
2024 Aug 07 9:40 PM
Hello,
Thank you for the week 1 challenge. Below are my screenshots:
Data Preview of CDS view entity
Class Logic:
2024 Aug 07 9:53 PM - edited 2024 Aug 07 9:54 PM
My Solution:
2024 Aug 07 9:56 PM
Hi all,
Here is my solution for the task!
Data Preview of the CDS View Entity:
Code of the generator class:
CLASS zcl_p350812_generate_data DEFINITION PUBLIC FINAL CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_p350812_generate_data IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
DATA travels TYPE STANDARD TABLE OF zp350812_travel.
" Delete existing data in travel table
DELETE FROM zp350812_travel.
" Select data from demo table and apply mapping for status
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 @travels.
" Insert modified data into travel table
INSERT zp350812_travel FROM TABLE @travels.
out->write( |{ sy-dbcnt } records inserted into travel table.| ).
ENDMETHOD.
ENDCLASS.
2024 Aug 07 11:05 PM
2024 Aug 08 12:37 AM
2024 Aug 08 12:50 AM
Done 🙂
2024 Aug 08 1:21 AM
2024 Aug 08 2:31 AM
2024 Aug 08 4:23 AM
Done:
2024 Aug 08 6:04 AM
CDS View
And It's data
Copy Class
And Table
2024 Aug 08 6:58 AM
Hi @sheenamk ,
Task 1 is completed.
Screenshot:
1. Data preview of the CDS View Entity.
2.Logic in the ABAP class. In specific, the field ‘Status’ should only have values ( O, A or X ).
2024 Aug 08 7:10 AM
Data preview of the CDS view entity:
Logic in the ABAP class:
2024 Aug 08 7:46 AM - edited 2024 Aug 08 7:48 AM
Hi,
CDS View Entity:
Data preview of CDS View
Table
Class and logic
Distinct entries logic
2024 Aug 08 8:14 AM
2024 Aug 08 8:27 AM
Task 1, OK.
2024 Aug 08 8:35 AM
Ok 🙂
CDS View;
Class Logic;
2024 Aug 08 9:40 AM
Looking good !!
2024 Aug 08 1:55 PM
thanks you 🙂
2024 Aug 08 8:35 AM - edited 2024 Aug 08 8:39 AM
Hi @sheenamk ,
I completed this week's task.
Screenshots:
1.Data preview of the CDS View Entity
2.Logic in the ABAP class. The field ‘Status’ allows only ( O, A and X ).