<mvc:View controllerName="com.sap.sales.orders.custom.VBA_CUST.controller.listView" xmlns:mvc="sap.ui.core.mvc"
xmlns:smartFilterBar="sap.ui.comp.smartfilterbar" xmlns:core="sap.ui.core" xmlns:smartTable="sap.ui.comp.smarttable" displayBlock="true"
xmlns="sap.m">
<Shell id="shell">
<App id="app">
<pages>
<Page id="page" title="Sales Orders">
<content>
<smartFilterBar:SmartFilterBar id="idSmartFilterBar" persistencyKey="configPortalPersistencyKey" considerSelectionVariants="true"
entitySet="ZAB_C_VBAK">
<!-- layout data used to make the table growing but the filter bar fixed -->
<smartFilterBar:layoutData>
<FlexItemData shrinkFactor="0"/>
</smartFilterBar:layoutData>
</smartFilterBar:SmartFilterBar>
<smartTable:SmartTable id="idHeaderSmartTable" ignoreFromPersonalisation="Accrual_period" entitySet="ZAB_C_VBAK"
smartFilterId="idSmartFilterBar" tableType="ResponsiveTable" useExportToExcel="true" useVariantManagement="true"
useTablePersonalisation="true" header="{i18n>ListTableTitle}" showRowCount="true" persistencyKey="configPortalSmartTablePersistencyKey"
enableAutoBinding="false" class="sapUiResponsiveContentPadding">
<smartTable:customToolbar>
<OverflowToolbar>
<ToolbarSpacer/>
<Title/>
<OverflowToolbarButton tooltip="Create" type="Transparent" icon="sap-icon://add" text="Create" press="onCreate"/>
</OverflowToolbar>
</smartTable:customToolbar>
</smartTable:SmartTable>
</content>
</Page>
</pages>
</App>
</Shell>
</mvc:View>
onCreate: function (oEvt) {
var oModel = this.getOwnerComponent().getModel();
var oPayload = {
vbeln: "9999",
erdat: "2018-09-27T00:00:00",
ernam: "ARJUN BISWAS",
vkorg: "ab01"
};
oModel.create("/ZAB_C_VBAK", oPayload, {
success: function (oData) {
sap.m.MessageToast.show("Created Successfully");
}.bind(this),
error: function (oErr) {
sap.m.MessageToast.show(JSON.parse(oErr.responseText).error.message.value);
}.bind(this)
});
},
@AbapCatalog.sqlViewName: 'ZAB_I_VBAK_CDS'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Implementation on VBAK'
@ObjectModel.compositionRoot: true
@ObjectModel.writeActivePersistence: 'vbak'
@ObjectModel.semanticKey: ['mandt','vbeln']
@ObjectModel.transactionalProcessingEnabled: true
@ObjectModel.createEnabled: true
@ObjectModel.updateEnabled: true
@ObjectModel.deleteEnabled: true
define view ZAB_I_VBAK
as select from vbak
{
key mandt,
key vbeln,
erdat,
erzet,
ernam,
angdt,
bnddt,
audat,
vbtyp,
trvog,
auart,
augru,
gwldt,
netwr,
waerk,
vkorg,
vtweg,
spart,
guebg,
gueen,
knumv,
vdatu,
vprgr,
kalsm,
vsbed,
ps_psp_pnr,
dat_fzau,
fkara,
awahr,
bstnk,
bstdk,
mahza,
mahdt,
kunnr,
stwae,
aedat,
kokrs,
kurst,
kkber,
knkli,
ctlpc,
cmwae,
cmfre,
cmnup,
cmngv,
amtbl,
agrzr,
abhod,
vzeit,
fmbdat
}
@AbapCatalog.sqlViewName: 'ZAB_C_VBAK_PRJ'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Consumption for VBAK'
@VDM.viewType: #CONSUMPTION
@UI.headerInfo: {
title.value: 'Sales Orders',
description.value: 'Sales Orders Details',
typeName: 'Sales Order',
typeNamePlural: 'Sales Order Items'
}
@OData.publish: true
@Search.searchable: true
@ObjectModel.semanticKey: ['vbeln']
@ObjectModel.transactionalProcessingDelegated: true
@ObjectModel.createEnabled: true
@ObjectModel.updateEnabled: true
@ObjectModel.deleteEnabled: true
define view ZAB_C_VBAK
as select from ZAB_I_VBAK
//association [0..*] to ZAB_C_VBAP as _VBAP on $projection.vbeln = _VBAP.vbeln
{
//key ZAB_I_VBAK.mandt,
@Search.defaultSearchElement: true
@UI.selectionField: {position: 10}
@UI.lineItem: [{criticality: 'HIGH',
iconUrl: 'www.google.com',
position: 10
}]
@UI.identification.position: 10
@UI.dataPoint.title: 'Sales Document Number'
key ZAB_I_VBAK.vbeln,
@UI.lineItem.position: 20
@UI.identification.position: 20
@UI.dataPoint.title: 'Sales Document Date'
@Semantics.systemDate.createdAt: true
ZAB_I_VBAK.erdat,
@UI.lineItem.position: 30
@UI.selectionField: {position: 20}
@UI.identification.position: 30
ZAB_I_VBAK.erzet,
@UI.lineItem.position: 40
@UI.selectionField: {position: 30}
@UI.identification.position: 40
@UI.dataPoint.title: 'Owner'
ZAB_I_VBAK.ernam,
@UI.selectionField: {position: 40}
@UI.identification.position: 50
ZAB_I_VBAK.angdt,
@UI.selectionField: {position: 50}
@UI.identification.position: 60
ZAB_I_VBAK.bnddt,
@UI.selectionField: {position: 60}
ZAB_I_VBAK.audat,
@UI.lineItem.position: 50
@UI.selectionField: {position: 70}
@UI.identification.position: 70
ZAB_I_VBAK.vbtyp,
ZAB_I_VBAK.trvog,
@UI.selectionField: {position: 90}
@UI.lineItem.position: 80
ZAB_I_VBAK.auart,
@UI.selectionField: {position: 100}
ZAB_I_VBAK.augru,
ZAB_I_VBAK.gwldt,
@UI.selectionField: {position: 80}
@UI.identification.position: 80
@UI.lineItem.position: 70
@UI.dataPoint.title: 'Net Value'
//@Semantics.quantity.unitOfMeasure: 'ZAB_I_VBAK.waerk'
ZAB_I_VBAK.netwr as Net_Value,
@UI.identification.position: 80
@Semantics.unitOfMeasure: true
ZAB_I_VBAK.waerk,
@UI.lineItem.position: 60
@UI.selectionField: {position: 110}
ZAB_I_VBAK.vkorg,
@UI.selectionField: {position: 120}
ZAB_I_VBAK.vtweg,
@UI.selectionField: {position: 130}
ZAB_I_VBAK.spart,
@UI.selectionField: {position: 140}
ZAB_I_VBAK.guebg,
@UI.selectionField: {position: 150}
@UI.lineItem.position: 90
ZAB_I_VBAK.gueen,
@UI.selectionField: {position: 160}
ZAB_I_VBAK.knumv,
@UI.selectionField: {position: 170}
ZAB_I_VBAK.vdatu,
@UI.lineItem.position: 100
ZAB_I_VBAK.vprgr,
ZAB_I_VBAK.kalsm,
ZAB_I_VBAK.vsbed,
@UI.selectionField: {position: 180}
ZAB_I_VBAK.ps_psp_pnr,
ZAB_I_VBAK.dat_fzau,
ZAB_I_VBAK.fkara,
ZAB_I_VBAK.awahr,
@UI.selectionField: {position: 190}
ZAB_I_VBAK.bstnk,
@UI.selectionField: {position: 200}
ZAB_I_VBAK.bstdk,
ZAB_I_VBAK.mahza,
@UI.selectionField: {position: 210}
ZAB_I_VBAK.mahdt,
@UI.selectionField: {position: 220}
ZAB_I_VBAK.kunnr,
@UI.selectionField: {position: 230}
ZAB_I_VBAK.stwae,
ZAB_I_VBAK.aedat,
ZAB_I_VBAK.kokrs,
@UI.identification.position: 90
ZAB_I_VBAK.kurst,
@UI.identification.position: 100
ZAB_I_VBAK.kkber,
ZAB_I_VBAK.knkli,
ZAB_I_VBAK.ctlpc,
ZAB_I_VBAK.cmwae,
ZAB_I_VBAK.cmfre,
ZAB_I_VBAK.cmnup,
ZAB_I_VBAK.cmngv,
ZAB_I_VBAK.amtbl,
ZAB_I_VBAK.agrzr,
ZAB_I_VBAK.abhod,
ZAB_I_VBAK.vzeit,
ZAB_I_VBAK.fmbdat
}
In the next screen, we can see the authorization class that has been generated for the BOPF.
method /BOBF/IF_LIB_AUTH_DRAFT_ACTIVE~CHECK_STATIC_AUTHORITY.
IF sy-uname eq 'ANY_USER_NAME'.
rv_failed = abap_true.
MESSAGE e001(ZARJ_1) INTO DATA(lv_message).
ENDIF.
" Message handling if authorization check failed
IF rv_failed = abap_true AND lv_message IS NOT INITIAL.
CALL METHOD /scmtms/cl_common_helper=>msg_helper_add_symsg(
CHANGING
co_message = eo_message ).
ENDIF.
endmethod.
METHOD /bobf/if_lib_auth_draft_active~check_static_authority.
IF is_ctx-activity EQ /bobf/cl_frw_authority_check=>sc_activity-create
OR is_ctx-activity EQ /bobf/cl_frw_authority_check=>sc_activity-change.
rv_failed = abap_true. " Deny access by default
ENDIF.
CASE is_ctx-activity.
WHEN /bobf/cl_frw_authority_check=>sc_activity-create.
" Check the creation of new instance here
AUTHORITY-CHECK OBJECT 'ZAUTH_CNFG' FOR USER sy-uname
ID 'ACTVT' FIELD is_ctx-activity. " '01'
IF sy-subrc = 0.
rv_failed = abap_false. " Grant deletion
ELSE. " Deny deletion
MESSAGE e008(YOUR_MESSAGE_CLASS) INTO DATA(lv_message).
ENDIF.
WHEN /bobf/cl_frw_authority_check=>sc_activity-change.
" Check the static UPDATE authorization here...
AUTHORITY-CHECK OBJECT 'ZAUTH_CNFG' FOR USER sy-uname
ID 'ACTVT' FIELD is_ctx-activity. " '02'
IF sy-subrc = 0.
rv_failed = abap_false. " Grant update
ELSE. " Deny update
MESSAGE e009(YOUR_MESSAGE_CLASS) INTO lv_message.
ENDIF.
ENDCASE.
" Message handling if authorization check failed
IF rv_failed = abap_true AND lv_message IS NOT INITIAL.
CALL METHOD /scmtms/cl_common_helper=>msg_helper_add_symsg(
CHANGING
co_message = eo_message ).
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 |
---|---|
12 | |
7 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |