on 10-22-2015 8:35 PM
HI All,
I am working sap FIORI time entry version2. Users enter time in duration field as 7.5 and submit, dialog prompts stating confirm submission and press OK. The main screen shows up in Duration columns as 07:30 instead 7.5.
The question is when we enter time as 7.5 why SAP changing the format to 07:30 instead 7.5
I tried to make these changes and followed these steps:
1. Installed webide and imported the project, for safe side I have created dummy project and deployed and so far so good.
2. As per sap documentation , Extension Points in Views I have found 2 extension points view - S31.view.xml, controller -S1.controller.js .
3. looking at the view code , I did not see any thing other then XML tags and I don't think i can change any thing here to meet my requirement.
4. looking at the controller -S1.controller.js code, looks like there is so much logic in there to display the data on the UI, I think this is the place where text format is happening.
Need some input, to make the changes on the UI :
from the S1.controller.js code, How do I find the duration column, what corresponding field mapped to the back end column. looking at the underlying service HCM_TIMESHEET_MAN_SRV , the filed may be CATSHOURS .
can some one can look at the attached S1.controller.js code and help me where is the right spot to make that field (Duration) format changes?
Tried to debug in webIDE but not much luck. Any help would be grateful, Attached the screenshots.
Thanks
Krishna
HI Krish;
You need extend the application for this.
In the S3 controller check for the function loadList: function().
Inside this you will find this.formatTime() function call. The formatTime() function is also present in the same controller and this formats the time in the output format.
It looks something like this.
formatTime: function(t) {
var a = t * 60;
var h = Math.floor(a / 60).toString();
if (h.length === 1) {
h = "0" + h;
}
var m = (a % 60).toFixed(0);
if (m.length === 1) {
m = "0" + m;
}
var b = h + ":" + m;
return b;
},
Extend the S3 controller and implement this method in your extended custom application according to your requirement.
I replaced this function with the code
formatTime: function (t)
{
return t;
}
And it has done the thing.
Regards,
Sarbjeet Singh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Sarbjeet.
I just created the Extension Exten Controller and WebIDE created the all methods with the comments.
I have uncommented out the below method to put my custom code in.
Now the code looks as below:
formatTime:function(t) {
return t;
}
I will put the custom code in and update you.
Thanks
Krish
Hi Sarbjeet,
I am using SAP WebIDE cloud connected via cloud connector to deploy in SAP NW Gateway.
I am trying to see what values i am getting in debug in WebDIE but i am not able to do so.
I tried below lines in sapWebIDE to see what values I am getting in 't' but getting error as highlighted in screenshot.
tried inspect element , from chrome but not able to see the value of "t" , is there any other way where I can put a line which prints the value in logs ?
Thanks
Krish
When I am deploying the created extension project from SAP WebIDE, I am getting the below error:
Not only this project, any project i try to deploy to SAP UI5 ABAP repository I am getting the same error:
log says:
http://localhost:9090/file/kdoolmitta-OrionContent/ZHCM_TSH_MAN/pom.xml?parts=meta Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:9090/webidedispatcher/destinations/SBX/sap/bc/adt/filestor…content?type=folder&name... Failed to load resource: the server responded with a status of 403 (Forbidden)
resources/sap/watt/platform/config-preload.js:64 Cannot read property 'textContent' of undefined
Attached error:
Thanks
Krish
You could make an extension and add a datimepicker instead of the input field.
Kind regards,
Wouter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Kirhsna,
This is a std behaviour I feel and is correct.
7.5 is nothing but 7 hours and 30 minutes. And not 7 hours 50 minutes.
Regards,
Tejas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.