"crossNavigation": {
"inbounds": {
"toCats": {
"signature": {
"parameters": {
"PersonnelNumber": {},
"Keydate": {},
"Scenario": {}
},
"additionalParameters": "allowed"
},
"semanticObject": "Timesheet",
"action": "change"
}
}
}
handleToCats: function(oEvent) {
//Get personal number of selected employee
var sPernr = oEvent.getSource().getBindingContext().getProperty("Pernr");
if (sPernr) {
// Get keydate
var dKeydate = this.getView().getModel("local").oData.startDate;
// get a handle on the global XAppNav service
if (sap.ushell) {
var oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");
oCrossAppNavigator.isIntentSupported(["Timesheet-change"])
.done(function(aResponses) {})
.fail(function() {
MessageToast.show(this.getModel("i18n").getResourceBundle().getText("intentIssue"));
});
// generate the Hash to display the to CATS
var sHash = (oCrossAppNavigator && oCrossAppNavigator.hrefForExternal({
target: {
semanticObject: "Timesheet",
action: "change"
},
params: {
"PersonnelNumber": sPernr,
"Keydate": dKeydate,
"Scenario": S_SCENARIO
}
})) || "";
//Generate a URL for the Cats application
var sUrl = window.location.href.split('#')[0] + sHash;
//Navigate to Cats app
sap.m.URLHelper.redirect(sUrl, false);
} else {
MessageToast.show(this.getModel("i18n").getResourceBundle().getText("intentIssue"));
}
}
},
onAfterRendering: function() {
if (!this.oApplication.pernr) {
var sComponentId = sap.ui.core.Component.getOwnerIdFor(this.getView());
var oStartUpParameters = sap.ui.component(sComponentId).getComponentData().startupParameters; //Get pernr from the cross app nav
// Read parameters from custom app
var oParameters = this.getOwnerComponent().getComponentData().startupParameters;
if (oParameters.PersonnelNumber) {
this.oApplication.pernr = oParameters.PersonnelNumber[0];
} else {
if (oStartUpParameters.pernr) {
this.oApplication.pernr = oStartUpParameters.pernr[0];
}
}
this.initializeView();
this.updateData();
}
}
IF lv_pernr IS INITIAL.
**********************************************************************
* Fallback case
**********************************************************************
CALL METHOD lo_hcm_assignments_api->GET_ASSIGNMENTS
EXPORTING
IV_APPLICATION = gc_app_name
IMPORTING
ET_ASSIGNMENTS = lt_assignments
ET_MESSAGES = lt_messages.
IF lt_assignments IS NOT INITIAL.
READ TABLE lt_assignments INTO ls_assignments INDEX 1.
lv_pernr = ls_assignments-pernr.
ENDIF.
ELSE.
**********************************************************************
* Check if Pernr is valid or not
**********************************************************************
* Checks if entry is present for the entered pernr
CALL METHOD lo_hcm_assignments_api->VALIDATE_PERNR
EXPORTING
IV_PERNR = LV_PERNR
IV_APPLICATION = gc_app_name
IMPORTING
ET_MESSAGES = lt_messages.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
10 | |
7 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |