cancel
Showing results for 
Search instead for 
Did you mean: 

SAP FIORI My Timesheet2 Version duration format issue

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

gill367
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Thanks Sarbjeet.

I Am adding the code as pee your input, will post you if I get stuck or need any further help.

thanks

krish

gill367
Active Contributor
0 Kudos

Hi Krish;

Please update us once it is working and close the thread accordingly. 

Regards,

Sarbjeet Singh

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

This issue is resolved.

Some how the ADT service logon on data is set with some user id  with out password.

Basis helped to remove the userid from the service and deployment works as expected.

Thanks

Krishna

Former Member
0 Kudos

Sarbjjet.

Thank you , I have used the recommended extension to put my custom logic and working as expected.

Marked thread as answered.

Thanks

Krishna

Answers (2)

Answers (2)

WouterLemaire
Active Contributor
0 Kudos

You could make an extension and add a datimepicker instead of the input field.

Kind regards,

Wouter

Former Member
0 Kudos

Hi Wouter,

Thanks for the reply. You mean on the time entry screen do you want me to change Inputfield to datimepicker? how changing this filed helps me to change the duration format on main screen?

Thanks

Krishna

WouterLemaire
Active Contributor
0 Kudos

Indeed , that way you'll have the same format for the input as on your main view.

Putting everything to the original format is also a solution

kind regards,

Wouter

WouterLemaire
Active Contributor
0 Kudos

It would change the format of the input screen. So you can leave the other screen as-is .

Changing the main screen to the normal format is also a solution.

Kind regards,

Wouter

former_member182874
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi Tejas,

SAP Changed this behavior in version2, version 1 it was displayed as 7.5

We are planning to go live sooner and realized that time format is changed from 7.5 to 07:30 in version2.

Client wanted to keep the  duration format same as version 1.

Thanks

Krihsna

former_member182874
Active Contributor
0 Kudos

You mean version 1 it was 7.30. Ok if this is standard behaviour in the app, proceed with the extension of the UI , as directed by Wouter.

Regards,

tejas

Former Member
0 Kudos

HI Tejas,

no, in version 1 it used to be 7.5

in version2 sap changed to 07:30

Thanks

krish