If we develop a RAP application based on it. Application will not let any user create another draft in the whole system. If it is based on GUID Keys, then we could have marked the key as a numbering field to draw automatic keys. In this case, the application already consumed default keys ( ' ' for CHAR, '00..0' for NUMC ) and returned the error below.
@EndUserText.label : 'Proc doc'
@AbapCatalog.enhancement.category : #EXTENSIBLE_CHARACTER_NUMERIC
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table zrkt_ekko {
key client : abap.clnt not null;
key object_id : zrk_pur_con_id not null;
description : zrk_description;
buyer : zrk_buyer_id;
supplier : zrk_sup_no;
sup_con_id : zrk_sup_con_id;
send_via : zrk_send_via_code;
comp_code : zrk_company_code;
stat_code : zrk_stat_code;
fiscl_year : zrk_fiscal_year;
valid_from : zrk_valid_from;
valid_to : zrk_valid_to;
created_by : abp_creation_user;
created_at : abp_creation_tstmpl;
last_changed_by : abp_locinst_lastchange_user;
last_changed_at : abp_lastchange_tstmpl;
locl_last_changed_at : abp_locinst_lastchange_tstmpl;
}
@EndUserText.label : 'Strcuture include for ZRKT_EKKO'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
extend type zrkt_ekko with zzrkt_exten_incld {
zztemp_guid : sysuuid_x16;
}
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: '##GENERATED Test proc doc'
define root view entity ZRKT_I_PROC_DOC
as select from zrkt_proc_doc as ProcDoc
{
key zztemp_guid as TempGuid,
object_id as ObjectID,
description as Description,
buyer as Buyer,
supplier as Supplier,
sup_con_id as SupConID,
send_via as SendVia,
comp_code as CompCode,
stat_code as StatCode,
fiscl_year as FisclYear,
valid_from as ValidFrom,
valid_to as ValidTo,
@Semantics.user.createdBy: true
created_by as CreatedBy,
@Semantics.systemDateTime.createdAt: true
created_at as CreatedAt,
@Semantics.user.localInstanceLastChangedBy: true
last_changed_by as LastChangedBy,
@Semantics.systemDateTime.lastChangedAt: true
last_changed_at as LastChangedAt,
@Semantics.systemDateTime.localInstanceLastChangedAt: true
locl_last_changed_at as LoclLastChangedAt
}
@AccessControl.authorizationCheck: #CHECK
@Metadata.allowExtensions: true
@EndUserText.label: 'Projection View for ZRKT_I_EKKO'
define root view entity ZRKT_C_EKKO
as projection on ZRKT_I_EKKO
{
key TempGuid,
objectid,
description,
buyer,
supplier,
supconid,
sendvia,
compcode,
statcode,
fisclyear,
validfrom,
validto,
locllastchangedat
}
unmanaged implementation in class ZRKT_BP_EKKO unique;
strict;
with draft;
define behavior for ZRKT_I_EKKO alias Ekko
//persistent table zrkt_ekko
draft table ZRKT_DT_EKKO
etag master LoclLastChangedAt
lock master total etag LastChangedAt
authorization master( global )
{
field ( readonly ) ObjectID;
field( numbering : managed , readonly) TempGuid;
field ( readonly ) CreatedAt,
CreatedBy,
LastChangedAt,
LoclLastChangedAt,
LastChangedBy;
create;
update;
delete;
draft action Edit;
draft action Activate;
draft action Discard;
draft action Resume;
draft determine action Prepare;
}
@EndUserText.label : 'Draft table for entity ZRKT_I_EKKO'
@AbapCatalog.enhancement.category : #EXTENSIBLE_ANY
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table zrkt_dt_ekko {
key mandt : mandt not null;
key tempguid : sysuuid_x16 not null;
objectid : zrk_pur_con_id;
description : zrk_description;
buyer : zrk_buyer_id;
supplier : zrk_sup_no;
supconid : zrk_sup_con_id;
sendvia : zrk_send_via_code;
compcode : zrk_company_code;
statcode : zrk_stat_code;
fisclyear : zrk_fiscal_year;
validfrom : zrk_valid_from;
validto : zrk_valid_to;
createdby : abp_creation_user;
createdat : abp_creation_tstmpl;
lastchangedby : abp_locinst_lastchange_user;
lastchangedat : abp_lastchange_tstmpl;
locllastchangedat : abp_locinst_lastchange_tstmpl;
"%admin" : include sych_bdl_draft_admin_inc;
}
METHOD create.
DATA ls_pur_con TYPE zrkt_proc_doc.
READ TABLE entities ASSIGNING FIELD-SYMBOL(<fs_entity>) INDEX 1.
IF sy-subrc EQ 0.
TRY.
cl_numberrange_runtime=>number_get(
EXPORTING
* ignore_buffer =
nr_range_nr = '01'
object = 'ZRK_NR_PR'
quantity = 1
* subobject =
* toyear =
IMPORTING
number = DATA(number_range_key)
returncode = DATA(number_range_return_code)
returned_quantity = DATA(number_range_returned_quantity)
).
CATCH cx_number_ranges.
"handle exception
ENDTRY.
DATA(max_id) = number_range_key - number_range_returned_quantity.
ls_pur_con-client = sy-mandt.
ls_pur_con-zztemp_guid = <fs_entity>-TempGuid.
ls_pur_con-object_id = |PC{ max_id }| .
ls_pur_con-description = <fs_entity>-Description .
ls_pur_con-buyer = <fs_entity>-Buyer .
ls_pur_con-supplier = <fs_entity>-Supplier .
ls_pur_con-sup_con_id = <fs_entity>-SupConId .
ls_pur_con-comp_code = <fs_entity>-CompCode .
ls_pur_con-stat_code = <fs_entity>-StatCode .
ls_pur_con-valid_from = <fs_entity>-Validfrom .
ls_pur_con-valid_to = <fs_entity>-ValidTo .
ls_pur_con-fiscl_year = <fs_entity>-FisclYear .
ls_pur_con-created_at = <fs_entity>-CreatedAt .
ls_pur_con-created_by = <fs_entity>-CreatedBy .
INSERT zrkt_proc_doc FROM @ls_pur_con.
ENDIF.
ENDMETHOD.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 |