@EndUserText.label : 'Employee Master data'
@AbapCatalog.enhancementCategory : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table zpremployee {
key client : mandt not null;
key eid : sysuuid_x16 not null;
fname : abap.char(50);
lname : abap.char(50);
gender : abap.char(20);
dept : abap.char(50);
status : abap.char(1);
doj : abap.dats;
dob : abap.dats;
age : abap.char(3);
salary : abap.int8;
currency : abap.cuky;
ratings : abap.dec(10,2);
}
method zpremployeeset_get_entity.
* To fetch Single record based on the key in the URI
assign it_key_tab[ name = 'Eid' ] to field-symbol(<lfs>).
if <lfs> is assigned.
select SINGLE * from zpremployee into er_entity where eid = <lfs>-value.
endif.
endmethod.
method zpremployeeset_create_entity.
data : ls_employee TYPE ZCL_ZPR_EMPLOYEE_SRC_MPC=>TS_ZPREMPLOYEE.
io_data_provider->read_entry_data(
importing
es_data = ls_employee
).
IF ls_employee is NOT INITIAL.
ls_employee-eid = new cl_system_uuid( )->if_system_uuid~create_uuid_x16( ).
IF ls_employee-eid is NOT INITIAL.
INSERT zpremployee from ls_employee.
ENDIF.
ENDIF.
endmethod.
method zpremployeeset_update_entity.
data : ls_employee type zcl_zpr_employee_src_mpc=>ts_zpremployee.
io_data_provider->read_entry_data(
importing
es_data = ls_employee
).
if ls_employee is not initial.
if ls_employee-eid is not initial.
update zpremployee from ls_employee .
endif.
endif.
endmethod.
method zpremployeeset_delete_entity.
data : ls_employee type zcl_zpr_employee_src_mpc=>ts_zpremployee.
break-point.
assign it_key_tab[ name = 'Eid' ] to field-symbol(<lfs>).
if <lfs> is assigned.
ls_employee-eid = <lfs>-value.
if ls_employee is not initial.
delete zpremployee from ls_employee.
endif.
endif
endmethod.
method define.
super->define( ).
data: lo_ann_target type ref to /iwbep/if_mgw_vocan_ann_target, " Vocabulary Annotation Target
lo_collection type ref to /iwbep/if_mgw_vocan_collection, " Vocabulary Annotation Collection
lo_record type ref to /iwbep/if_mgw_vocan_record. " Vocabulary Annotation Record
me->vocab_anno_model->create_vocabulary_reference( iv_vocab_id = '/IWBEP/VOC_UI'
iv_vocab_version = '1')->create_include( iv_namespace = 'com.sap.vocabularies.UI.v1'
iv_alias = 'UI' ).
lo_ann_target = me->vocab_anno_model->create_annotations_target( iv_target = 'zpremployee' ). " Target: The Element a Vocabulary Annotation points to
lo_ann_target->set_namespace_qualifier( 'ZPR_EMPLOYEE_SRC_SRV' ).
lo_record = lo_ann_target->create_annotation( iv_term = 'UI.HeaderInfo' )->create_record( ). "UI.HeaderInfo Annotatoin
lo_record->create_property('TypeName')->create_simple_value( )->set_string( iv_value = 'Employee Details' ).
lo_record->create_property('TypeNamePlural')->create_simple_value( )->set_string( iv_value = 'Employees' ).
endmethod.
lo_collection = lo_ann_target->create_annotation( iv_term = 'UI.LineItem' )->create_collection( ). "UI.Lineitem Annotation
lo_record = lo_collection->create_record( iv_record_type = 'UI.DataField').
lo_record->create_property( 'Label' )->create_simple_value( )->set_string( iv_value = 'First Name' ).
lo_record->create_property( 'Value' )->create_simple_value( )->set_path( iv_value = 'Fname' ).
lo_record = lo_collection->create_record( iv_record_type = 'UI.DataField').
lo_record->create_property( 'Label' )->create_simple_value( )->set_string( iv_value = 'Last Name' ).
lo_record->create_property( 'Value' )->create_simple_value( )->set_path( iv_value = 'Lname' ).
lo_record = lo_collection->create_record( iv_record_type = 'UI.DataField').
lo_record->create_property( 'Label' )->create_simple_value( )->set_string( iv_value = 'Department' ).
lo_record->create_property( 'Value' )->create_simple_value( )->set_path( iv_value = 'Dept' ).
lo_record = lo_collection->create_record( iv_record_type = 'UI.DataField').
lo_record->create_property( 'Label' )->create_simple_value( )->set_string( iv_value = 'Date-of-join' ).
lo_record->create_property( 'Value' )->create_simple_value( )->set_path( iv_value = 'Doj' ).
lo_record = lo_collection->create_record( iv_record_type = 'UI.DataField').
lo_record->create_property( 'Label' )->create_simple_value( )->set_string( iv_value = 'Salary' ).
lo_record->create_property( 'Value' )->create_simple_value( )->set_path( iv_value = 'Salary' ).
lo_collection = lo_ann_target->create_annotation( iv_term = 'UI.Facets' )->create_collection( ). "Header Facets
lo_record = lo_collection->create_record( iv_record_type = 'UI.ReferenceFacet' ).
lo_record->create_property( 'ID' )->create_simple_value( )->set_string( 'GeneralInformation' ).
lo_record->create_property( 'Label' )->create_simple_value( )->set_string( 'General Information' ).
lo_record->create_property( 'Target')->create_simple_value( )->set_annotation_path( '@UI.Identification' ).
lo_record = lo_collection->create_record( iv_record_type = 'UI.ReferenceFacet' ).
lo_record->create_property( 'ID' )->create_simple_value( )->set_string( 'JOBID' ).
lo_record->create_property( 'Label' )->create_simple_value( )->set_string( 'Job Description' ).
lo_record->create_property( 'Target')->create_simple_value( )->set_annotation_path( '@UI.Identification' ).
lo_collection = lo_ann_target->create_annotation( iv_term = 'UI.Identification' )->create_collection( ). "UI.Identification Annotatoin
lo_record = lo_collection->create_record( iv_record_type = 'UI.DataField').
lo_record->create_property( 'Label' )->create_simple_value( )->set_string( iv_value = 'First Name' ).
lo_record->create_property( 'Value' )->create_simple_value( )->set_path( iv_value = 'Fname' ).
lo_record = lo_collection->create_record( iv_record_type = 'UI.DataField').
lo_record->create_property( 'Label' )->create_simple_value( )->set_string( iv_value = 'Last Name' ).
lo_record->create_property( 'Value' )->create_simple_value( )->set_path( iv_value = 'Lname' ).
lo_record = lo_collection->create_record( iv_record_type = 'UI.DataField').
lo_record->create_property( 'Label' )->create_simple_value( )->set_string( iv_value = 'Gender' ).
lo_record->create_property( 'Value' )->create_simple_value( )->set_path( iv_value = 'Gender' ).
lo_record = lo_collection->create_record( iv_record_type = 'UI.DataField').
lo_record->create_property( 'Label' )->create_simple_value( )->set_string( iv_value = 'Date-of-birth' ).
lo_record->create_property( 'Value' )->create_simple_value( )->set_path( iv_value = 'Dob' ).
*
lo_record = lo_collection->create_record( iv_record_type = 'UI.DataField').
lo_record->create_property( 'Label' )->create_simple_value( )->set_string( iv_value = 'Age' ).
lo_record->create_property( 'Value' )->create_simple_value( )->set_path( iv_value = 'Age' ).
lo_record = lo_collection->create_record( iv_record_type = 'UI.DataField').
lo_record->create_property( 'Label' )->create_simple_value( )->set_string( iv_value = 'Department' ).
lo_record->create_property( 'Value' )->create_simple_value( )->set_path( iv_value = 'Dept' ).
lo_record = lo_collection->create_record( iv_record_type = 'UI.DataField').
lo_record->create_property( 'Label' )->create_simple_value( )->set_string( iv_value = 'Date-of-join' ).
lo_record->create_property( 'Value' )->create_simple_value( )->set_path( iv_value = 'Doj' ).
lo_record = lo_collection->create_record( iv_record_type = 'UI.DataField').
lo_record->create_property( 'Label' )->create_simple_value( )->set_string( iv_value = 'Joining Status' ).
lo_record->create_property( 'Value' )->create_simple_value( )->set_path( iv_value = 'Status' ).
lo_record = lo_collection->create_record( iv_record_type = 'UI.DataField').
lo_record->create_property( 'Label' )->create_simple_value( )->set_string( iv_value = 'Salary' ).
lo_record->create_property( 'Value' )->create_simple_value( )->set_path( iv_value = 'Salary' ).
lo_record = lo_collection->create_record( iv_record_type = 'UI.DataField').
lo_record->create_property( 'Label' )->create_simple_value( )->set_string( iv_value = 'Currency' ).
lo_record->create_property( 'Value' )->create_simple_value( )->set_path( iv_value = 'Currency' ).
lo_record = lo_collection->create_record( iv_record_type = 'UI.DataField').
lo_record->create_property( 'Label' )->create_simple_value( )->set_string( iv_value = 'Ratings' ).
lo_record->create_property( 'Value' )->create_simple_value( )->set_path( iv_value = 'Ratings' ).
Enter the data that you want insert into data base and click on Create Button.
if you made any changes to existing record the i will shows the message as below.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
12 | |
10 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
2 | |
2 |