Quantcast
Channel: SCN : All Content - BOPF Application Framework
Viewing all articles
Browse latest Browse all 309

Deep Insert on CDS BOPF

$
0
0

Hey Experts,

 

i'm trying to execute a deep insert on a CDS-View published via Gateway and SADL. The CDS-View has created a BO and contains a association which is represented as a node in the generated BO.

 

The root view, which is also exposed as odata-service via sadl and gateway looks as follows

@ObjectModel.compositionRoot: true
@ObjectModel.modelCategory: #BUSINESS_OBJECT
@ObjectModel.writeEnabled: true
@ObjectModel.writeActivePersistence: '*****/CUMT_CUMAT'
@ObjectModel.createEnabled: true
@ObjectModel.deleteEnabled: true
@ObjectModel.updateEnabled: true
define view....
association [1..1] to ****/cumt_i_Text as _text    on $projection.db_key = _text.parent_key   and _text.spras = $session.system_language
.....     @ObjectModel.foreignKey.association: '_text'     key db_key          ....
// assosiation     @ObjectModel.association.type:  [ #TO_COMPOSITION_CHILD ]     _text

The associated view (which represents the header text of the main object) looks as follows

@ObjectModel.writeEnabled: true
@ObjectModel.writeActivePersistence: '*****/CUMT_CUMTX'
@ObjectModel.createEnabled: true
@ObjectModel.deleteEnabled: true
@ObjectModel.updateEnabled: true
define view.....     key db_key     ....

Read requests including expand of the _text association are processed correctly. The create request on the root node is also processed correctly and the entry is written to the db-table.

 

But by calling a deep insert (insert data into root node and child node) a exception occurs in the method /BOBF/CL_SADL_MAPPER~GET_BOPF_ALTERNATIVE_KEY

ev_sadl_key_field_name = mt_fieldmapping[ KEY fieldname_bopf                                                 COMPONENTS fieldname_bopf = /bobf/if_conf_c=>sc_attribute_name_key ]-fieldname_sadl.

 

Payload is looks as follows:

<?xml version="1.0" encoding="UTF-8"?><atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">   <atom:content type="application/xml">     <m:properties>       <d:active>true</d:active>       <d:class>T_REEL</d:class>       <d:cuobj>000000000000000076</d:cuobj>       <d:kdmat>Test Deep</d:kdmat>       <d:kunn2 />       <d:kunnr>90000</d:kunnr>       <d:matnr>1</d:matnr>       <d:parvw />       <d:spart>10</d:spart>       <d:status />       <d:vkorg>5000</d:vkorg>       <d:vtweg>10</d:vtweg>     </m:properties>   </atom:content>   <atom:link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_text" type="application/atom+xml;type=entry" title="to_text">     <m:inline>       <atom:feed>         <atom:entry>           <atom:content type="application/xml">             <m:properties>               <d:shdescr>Folie Deep</d:shdescr>               <d:spras>DE</d:spras>             </m:properties>           </atom:content>         </atom:entry>       </atom:feed>     </m:inline>   </atom:link></atom:entry>

I haven't changed anything on the generated BO. Does anybody have an idea how deep inserts can be done on cds views which generated BOs?

 

System: SAP_BASIS 7.50 SPS01

 

Regards

Simon


Viewing all articles
Browse latest Browse all 309

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>