cancel
Showing results for 
Search instead for 
Did you mean: 

Time Approve - filter based on Approval status

Former Member
0 Kudos

Hi Firends,

We have enabled standard FIORI Time approval app and working fine. Now the question is , I need to make a changes to UI which allows the user to show the records only for "Approved" or "For Approval" based on user some selection or filter criteria on Approval Status column.

Some times manager  wants to see all Approved items rather then For Approval. So I need to provide a functionality where the manager can Sort or Filter with that specific status.

what is the easiest and best option for this changes? I am aware of the extension points view level and controller level. is there an easy way to sort the column data on FIORI UI using the sort functionality?

if sort is not possible, I may need to add a check box under neath or next to Approval Status , when the user select the check box I only show Approved, if they uncheck I show all of them , this can be a work around. Please suggest is there a better way to achieve this solution.

Attached screenshot.

Thanks

Krish

Accepted Solutions (1)

Accepted Solutions (1)

gill367
Active Contributor
0 Kudos

Extend the controller and view both

add the function like below in the controller.

handleChecked: function(oEvent) {

var h = false;

var e = oEvent.getParameters();

var oBinding = oEvent.getSource().getParent().getParent().getBinding("items");

if (e) {

h = e.selected;

}

if (h === true) {

var aFilters = [];

var oFilter = new sap.ui.model.Filter("a>STATUS_TEXT", "EQ", "Approved", "");

aFilters.push(oFilter);

oBinding.filter(aFilters);

} else {

oBinding.filter([]);

}

}

and view should have check box addition to the column like below

<Column demandPopin="true" id="S3StatusColumn" minScreenWidth="Tablet">

  <CheckBox text="Approved" tooltip="click to get only approved" enabled="{a>MainCheckBoxState}" id="HeaderCheckbox1" select="handleChecked" />

  <!--<header>-->

  <!-- <Label design="Bold" text="{i18n>TSA_APPR_STATUS}"/>-->

  <!--</header>-->

  </Column>

regards,

Sarbjeet Singh

Former Member
0 Kudos

Thanks Sarbjeet. I will add this code and post the result. Also I have question, Once the Time Sheet approved it should disappear from the list right ? why still sitting and showing as Approved?

is there any setting i need to make if I want to remove the approved items from the list?

Thanks

Krishna

gill367
Active Contributor
0 Kudos

HI Krish;

For allowing only pending approval entries to show you can use the BADI "HCM_IF_APPROVE_TIMESHEETS" its method GET_STATUS_FILTERS provides the required functionality.

Regards,

Sarbjeet Singh

Former Member
0 Kudos

Hi Sarbjeet,

I have added the code view level and controller function as well.

When I select the checkbox, all entries are disappearing. It is not filtering out based on the "For Approval" status. ( i know you have mentioned the code for  "Approved" ) .

When the user select "For Approval"  check box , wanted to show him only the items status with For Approval.

Attached screenshot.

here showing no data, it suppose to display as only related to For Approval status.

code from view:

  <Column demandPopin="true" id="S3StatusColumn" minScreenWidth="Tablet">

  <!--<header>-->

  <!-- <Label design="Bold" text="{i18n>TSA_APPR_STATUS}"/>-->

  <!--</header>-->

  <CheckBox text="For Approval" tooltip="click to get only approved" enabled="{a>MainCheckBoxState}" id="HeaderCheckbox1" select="handleChecked" />

From Controller method:

handleChecked: function(oEvent) {

var h = false;

var e = oEvent.getParameters();

var oBinding = oEvent.getSource().getParent().getParent().getBinding("items");

if (e) {

h = e.selected;

}

if (h === true) {

var aFilters = [];

var oFilter = new sap.ui.model.Filter("a>STATUS_TEXT", "EQ", "For Approval", "");

aFilters.push(oFilter);

oBinding.filter(aFilters);

} else {

oBinding.filter([]);

}

}

Thanks

Krish

gill367
Active Contributor
0 Kudos

HI

change the filter declaration to below and tr. I guess we dont need a> infront of the field.


var oFilter = new sap.ui.model.Filter("STATUS_TEXT", "EQ","For Approval", "");

Regards,

Sarbjeet Singh

Former Member
0 Kudos

Thank you.

Krish.

Answers (0)