cancel
Showing results for 
Search instead for 
Did you mean: 

Showing a wrong primary key on the preview by using late numbering

K1mo130
Explorer
0 Kudos

I am working on RAP framework and i implemented the table "I_MaintenanceNotification" on CDS view.

But i got a problem after creating the notification, i got a wrong primary key "300000111" on the result page, and the other elements are empty, but if i go to the homepage i could see my data that i filled it.

K1mo130_1-1711448852090.png

 

I just used the "late numbering" on the "Behavior Definition" so i could get a unique primary key, here's what i did on the "Behavior Definition":

managed implementation in class zbp_i_notification_k unique;
strict ( 2 );
with draft;

define behavior for ZR_NOTIFICATION_KTP alias Notification
with unmanaged save
draft table ZNotificationD
etag master Notification
lock master total etag Notification
late numbering
authorization master ( global )
{
  field (readonly) Notification;

  create;
  update;
  delete;

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

// the rest of mapping
}

 

and here's what i did on method "adjust_numbers" in "Behavior Implementation":

  METHOD adjust_numbers.

    READ ENTITIES OF zr_notification_ktp
        ENTITY Notification
        ALL FIELDS WITH CORRESPONDING #( mapped-notification )
        RESULT DATA(Notifications2)
        FAILED DATA(failed).

    SELECT MAX( Notification )
    FROM zr_notification_ktp
    INTO @DATA(lv_max).

    DATA(lv_new_key) = lv_max + 1.

    LOOP AT mapped-notification REFERENCE INTO DATA(map).
      map->Notification = lv_new_key.
    ENDLOOP.
  ENDMETHOD.

 

did i missed something?
thanks

Accepted Solutions (0)

Answers (0)