on 05-22-2022 1:27 PM
hello Guys,
My requirement is to get partner data and its contracts and then get the corresponding appointment dates of those contracts in SAP CRM tables. So now I have created CDS to retrieve the partner and contract details, and now I have to retrieve the dates from the appointment table. The problem is I need to retrieve multiple dates for each contract how can I achieve this in CDS view.
eg: My current CDS will retrieve something like this (not exactly like below but just for explanation purpose 🙂 )
but now for each contract, I need to retrieve dates that are stored in the SCAPPTSEG table with appointment types as below,
Now I would like to get the dates in different columns for each item, the output should look like this.
Can we do it in the same CDS view?
Note: The date types are not dynamic. For each contract, only 5 types of dates need to retrieve.
After assigning the values using CASE for the new fields, I tried GROUP BY, but it won't work, since I need to show multiple fields it's not grouping into a single line.
I have fixed the issue by creating another CDS view and inner join with my existing view.
Code for the second view to get the status
as select from crmd_link as link
left outer join scapptseg as app on app.appl_guid = link.guid_set
{ link.guid_hi as linkguid,
max ( case app.appt_type when 'ISTCONTSRTTS' then substring(cast(app.tst_from as abap.char(17) ), 1, 8 ) end ) as START_TIMESLICE,
max ( case app.appt_type when 'ISTCONTENDTS' then substring(cast(app.tst_from as abap.char(17) ), 1, 8 ) end ) as END_TIMESLICE,
max ( case app.appt_type when 'ISTRUNTMEND' then substring(cast(app.tst_from as abap.char(17) ), 1, 8 ) end ) as CONTRACT_END_TERM }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.