Skip to Content
avatar image
Former Member

SAP FIORI My Timesheet2 Version duration format issue

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

TimeEntry1.PNG (10.3 kB)
iementry2.png (24.5 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Oct 26, 2015 at 07:47 AM

    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


    4.PNG (20.6 kB)
    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Sarbjeet Singh

      Sarbjjet.

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

      Marked thread as answered.

      Thanks

      Krishna

  • Oct 24, 2015 at 06:34 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 25, 2015 at 01:37 AM

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

    Kind regards,

    Wouter

    Add comment
    10|10000 characters needed characters exceeded