Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to read CDS view association data with ABAP code

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to use ABAP code to read CDS view association data, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

I have the following CDS view, whose data comes from CRMD_ORDERADM_H, defines an association named _ statushelp, and points to another CDS view Z_C_Status_Valuehelp. The view exposes two fields, STATUS_KEY and STATUS_TEXT.

Now my requirement is that I only need to read once in the ABAP code, which can read not only the guid field in the main view, but also the two fields STATUS_KEY and STATUS_TEXT exposed by association view Z_C_Status_Valuehelp.

Solution

(1) create a new data type that contains a total of 3 fields to be read for two view.

(2) read the data using the following code:

DATA: lt_data TYPE tt_Data. SELECT guid,\ _ STATUSHELP-STATUS_KEY AS STATUS_KEY,\ _ STATUSHELP-STATUS_TEXT AS STATUS_TEXT FROM ZORDER_SYS_STATUS WHERE ZORDER_SYS_STATUS~GUID = 'FA163E8EAB031EE6A99F824537D112A4' AND ZORDER_SYS_STATUS~STAT =' I1002' AND\ _ STATUSHELP-STATUS_KEY IS NOT NULL INTO TABLE @ lt_data.

Thank you for reading this article carefully. I hope the article "how to read CDS view association data with ABAP code" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report