cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

RAP: Draft do not transfer keyvalue into DB-Table

adazip
Discoverer
0 Likes
1,027

Hi,
i'am a beginner in RAP and I have the little curisously problem:

I have an managed application in which I want to enter values like  /DMO/TEST or only TEST as a key value in a table. The application includes 5 Tables, and 3 works fine, but only two doesn't work correctly. 

 

 

define table /***/chcklink {

  key client         : abap.clnt not null;
  @AbapCatalog.foreignKey.screenCheck : false
  key modul          : /***/dt_modul not null
    with foreign key /**/chcksmod
      where client = /***/chcklink.client
        and modul = /***/chcklink.modul;
  key check_appl     : abap.char(12) not null;
  active             : abap_boolean;
... }

define table /***/chcklink_d {

  key client         : abap.clnt not null;
  key modul          : /***/dt_pbs_modul not null;
  key checkappl      : abap.char(12) not null;
  active             : abap_boolean;
...}

 

 

This table is a child of the main-view. 

When creating a new data record, everything works fine, the values are available as  key or simple table-value in the draft table and it will show on the screen correctly. However, if I save it, the values are no longer transferred to the persistent table. 

Example: in this case the key-value will be not trafnserfed. in an another case, one of 5 fields will be not tranfsered !?
Draft (create new entry):

adazip_0-1735838735086.png

/DMO/Test is the key-value. Its definied mandatory.

Values in draft-table:

adazip_1-1735838761940.png

--> now apply new associated entry

adazip_2-1735838809947.png

In the main-screen the new entry is visible, but the main-screen is still in edit-mode.

-->saving the main view / main object

Screen is changing from editable mode to readonly mode, and the new created Entry in the subtable disappears.

adazip_3-1735838886114.png

in the corresponging main-db-table is a new entry, without keyvalue. 

adazip_4-1735838900155.png

When i try to create a new entry, it will  produce a shortdump, cause dupplicate key (empty value as a key-value already exists )

All associated tables are definied simliar, but only this one doesn't work.

My question is now : Could someone tell me whats wrong ?

I've tried with an uuid and the missing field as a non-key-field, but without a solution.

thanks a lot

Adalbert

codings:

 

 

 

 

BHEV:
managed implementation in class /nnn/BP_R_CHCKSMOD unique;
strict ( 2 );
//strict;
with draft;

define behavior for /nnn/R_CHCKSMOD alias SMOD
//implementation in class /nnn/BP_R_CHCKSMOD unique
persistent table /nnn/chcksmod
draft table /nnn/chcksm000_d

lock master total etag Lastchangedat
etag master Lastchangedat

authorization master ( global, instance )
//authorization master ( instance )
{
  create ( precheck );
  update ( precheck );
  delete;

  draft action Edit ;
  draft action Activate optimized;
  draft action Discard;
  draft action Resume;
  draft determine action Prepare;

  field ( mandatory : create ) Modul;
  field ( readonly : update ) Modul;

  association _CHCKLINK { create ( features : instance ); with draft; }
...
}//********************************************************************************
define behavior for /nnn/R_CHCKLINK alias CHCKLINK
persistent table /nnn/chcklink
draft table /nnn/chcklink_d
lock dependent by _smod
authorization dependent by _smod
etag master Locallastchangedat
{
  update ( precheck );
  delete;

  association _smod { with draft; }

  field ( readonly  ) Modul;
  field ( mandatory : create ) CheckAppl;
  field ( readonly : update ) CheckAppl;

  mapping for /nnn/chcklink corresponding;
}

 

 

 

 

 

View Entire Topic
adazip
Discoverer

after checking my behavior def i've found the reason for my case:

...
 mapping for /nnn/chckmsgcfg corresponding;
...

If the field-definition in the db-table is different to the data definitions, the transfer of values doenst not work.

🙈