Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8150

Duration calculation using FM

$
0
0

Hi,

 

I have two source timestamp fields of DEC-15 type in PSA having data in format 20.140.305.225.959.

Using FM which delivers output in seconds, I am trying to calculate difference through below code and put result in an Integer type infoObject.

This code is in field level routine from data source to DSO.

 

DATA:

assg1 TYPE TIMESTAMP,

rsld1 TYPE TIMESTAMP,

diffasrs TYPE I.


assg1 = SOURCE_FIELDS-ZZ_ASSIGNED.

rsld1 = SOURCE_FIELDS-ZZ_RESOLVED.

 

CALL FUNCTION 'CCU_TIMESTAMP_DIFFERENCE'

      EXPORTING

        TIMESTAMP1 = assg1

        TIMESTAMP2 = rsld1

      IMPORTING

        DIFFERENCE = diffasrs.

 

    IF SY-SUBRC = 0.

      RESULT = diffasrs.

    ENDIF.

 

This doesn't work. Is there any mistake in this code?

 

I also tried with something like:

DATA:

assg(18) TYPE c,

assg1 TYPE TIMESTAMP,

rsld(18) TYPE c,

rsld1 TYPE TIMESTAMP,

diffasrs TYPE I.

 

assg = SOURCE_FIELDS-ZZ_ASSIGNED.

rsld = SOURCE_FIELDS-ZZ_RESOLVED.

 

REPLACE ALL OCCURRENCES OF '.' IN assg WITH ''.

CONDENSE assg NO-GAPS.

assg1 = assg.

 

REPLACE ALL OCCURRENCES OF '.' IN rsld WITH ''.

CONDENSE rsld NO-GAPS.

rsld1 = rsld.

 

CALL FUNCTION 'CCU_TIMESTAMP_DIFFERENCE'

      EXPORTING

        TIMESTAMP1 = assg1

        TIMESTAMP2 = rsld1

      IMPORTING

        DIFFERENCE = diffasrs.

 

    IF SY-SUBRC = 0.

      RESULT = diffasrs.

    ENDIF.

 

but this also doesn't work.

 

could somebody please help??

 

Thanks

Ahmad


Viewing all articles
Browse latest Browse all 8150

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>