
Fill structures to put on hold
LOOP AT li_reqlineitm INTO lwa_reqlineitm.
* STATUS
CLEAR lwa_wi_status.
lwa_wi_status-path_id = ls_results-path_id.
lwa_wi_status-path_seq = ls_results-path_seq.
lwa_wi_status-stage_id = ls_results-stage_seqnr.
lwa_wi_status-stage_config_id = ls_results-stage_config_id.
lwa_wi_status-stage_is_first = abap_true.
lwa_wi_status-stage_is_last = abap_true.
lwa_wi_status-wi_id = ls_request_output_data-wi_group.
lwa_wi_status-line_item_id = '001'.
* Item data
CLEAR lwa_lineitem.
lwa_lineitem-req_id = lwa_reqlineitm-req_id.
lwa_lineitem-itemnum = lwa_reqlineitm-itemnum.
lwa_lineitem-valid_from = lwa_reqlineitm-valid_from.
lwa_lineitem-valid_to = lwa_reqlineitm-valid_to.
lwa_lineitem-prov_action = lwa_reqlineitm-prov_action.
lwa_lineitem-line_item_type = lwa_reqlineitm-prov_item_type.
lwa_lineitem-line_item_display = lwa_reqlineitm-item_name.
IF NOT lo_line_item_data IS BOUND.
CREATE DATA lo_line_item_data TYPE grac_s_request_msmp_lineitem.
ASSIGN lo_line_item_data->* TO <fs_item>.
ENDIF.
<fs_item> = lwa_lineitem.
lwa_wi_status-line_item_data = lo_line_item_data.
ENDLOOP.
* Put the request ON HOLD
CASE ls_request_output_data-status.
WHEN 'ON HOLD'.
TRY.
* Salida de datos
ls_request_output_data-status = 'ON HOLD'.
er_entity = ls_request_output_data.
CALL METHOD cl_grfn_msmp_approval_api=>hold_instance
EXPORTING
it_wi_status = it_wi_status
iv_user = lv_uname
it_app_msgs = it_app_msgs
iv_header_data = lo_header
iv_admin_mode = abap_false.
CATCH cx_grfn_msmp_wrong_call .
CATCH cx_grfn_msmp_locked .
CATCH cx_grfn_msmp_concurrent_change .
CATCH cx_grfn_msmp.
ENDTRY.
myNEWButton: {},buttonList: [{sId: "Forward",sI18nBtnTxt: "On Hold",onBtnPressed: function(e) {l.handleonHold();}}, {sId: "Release",sI18nBtnTxt: "Release",onBtnPressed: function(e) {l.handleRelease();}
handleonHold: function() {
var that = this;
var D = "";
var that = this;
var oModel = that.getView().getModel();
var D = "";
D = new sap.m.Dialog({
title: 'Confirm',
type: 'Message',
content: new sap.m.Text({
text: 'Are you sure you want to keep the request "On Hold"?'
}),
beginButton: new sap.m.Button({
text: "OK",
press: function() {
var oModel = that.getView().getModel();
var bindingContext = that.getView().getBindingContext();
var object = bindingContext.getObject();
var RequestNumber = bindingContext.getProperty("RequestNumber");
var Approver = bindingContext.getProperty("Approver");
var WorkItemGroup = bindingContext.getProperty("WorkItemGroup");
object.Status = 'ON HOLD';
oModel.update("/Requests(WorkItemGroup='" + WorkItemGroup + "',Approver='" + Approver + "',RequestNumber='" + RequestNumber +
"')", object, null,
function(oResponse) {
//Function for success
sap.m.MessageBox.success("Request is kept on hold successfully", {
actions: [sap.m.MessageBox.Action.OK],
onClose: function(oAction) {
if (oAction === sap.m.MessageBox.Action.OK) {
D.close();
}
}
});
//that.setBtnEnabled("Release", false);
});
}
}),
endButton: new sap.m.Button({
text: 'Cancel',
press: function() {
D.close();
}
}),
afterClose: function() {
D.destroy();
}
});
// oModel.refresh();
D.open();
},
handleonHold: function() {
var that = this;
var D = "";
var that = this;
var oModel = that.getView().getModel();
var D = "";
D = new sap.m.Dialog({
title: 'Confirm',
type: 'Message',
content: new sap.m.Text({
text: 'Are you sure you want to keep the request "On Hold"?'
}),
beginButton: new sap.m.Button({
text: "OK",
press: function() {
var oModel = that.getView().getModel();
var bindingContext = that.getView().getBindingContext();
var object = bindingContext.getObject();
var RequestNumber = bindingContext.getProperty("RequestNumber");
var Approver = bindingContext.getProperty("Approver");
var WorkItemGroup = bindingContext.getProperty("WorkItemGroup");
object.Status = 'ON HOLD';
oModel.update("/Requests(WorkItemGroup='" + WorkItemGroup + "',Approver='" + Approver + "',RequestNumber='" + RequestNumber +
"')", object, null,
function(oResponse) {
//Function for success
sap.m.MessageBox.success("Request is kept on hold successfully", {
actions: [sap.m.MessageBox.Action.OK],
onClose: function(oAction) {
if (oAction === sap.m.MessageBox.Action.OK) {
D.close();
}
}
});
//that.setBtnEnabled("Release", false);
});
}
}),
endButton: new sap.m.Button({
text: 'Cancel',
press: function() {
D.close();
}
}),
afterClose: function() {
D.destroy();
}
});
// oModel.refresh();
D.open();
},
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.