cancel
Showing results for 
Search instead for 
Did you mean: 

How to create an End Routine in a BW 3.x DataFlow?

Former Member
0 Kudos
521

Hello,

Im a newbie in ABAP and I need to create an End Routine in a DSO transformation, but since i'm working with a 3.x DataFlow, i do not have the option (button) to create an end or expert routine...the only button shown is 'Change Start Routine'.

The requirement is to calculate the time difference between three infoObjects (each mapped in the DataSource) and store the result in a key figure that is mapped only in the DSO.

This is the code i'm using; but since the key figure is not mapped in the DataSource, the Start Routine shows that it doesn't exist... so i came up with the idea of the End Routine and now i don't know what to modify in my code for it to work. I hard coded it and it works as it should, the problem is when i start mapping within DATA_PACKAGE, etc.

Thank you!

DATA:

   str(50) TYPE c,

   dat TYPE d,

   hora TYPE t,

   dat2 TYPE d,

   hora2 TYPE t,

   time_stamp2 TYPE timestamp,

   dst TYPE c,

   tz  TYPE ttzz-tzone,

   x type i,

   y type i.

   tz = 'PST'. "End of Global Declaration

tz = ''.

    str = DATA_PACKAGE-/BIC/PMMITTEXT.

    dat = DATA_PACKAGE-/BIC/PMMDOCDAT.

    hora = DATA_PACKAGE-TIME.

      dat2 = str+15(8).

      CONCATENATE str+24(2) str+27(2) str+30(2) into hora2.

      CONVERT DATE dat2 TIME hora2 DAYLIGHT SAVING TIME 'X'

            INTO TIME STAMP time_stamp2 TIME ZONE tz.

clear: dat2 , hora2.

      CONVERT TIME STAMP time_stamp2 TIME ZONE tz

        INTO DATE dat2 TIME hora2 DAYLIGHT SAVING TIME dst.

         CALL FUNCTION 'SWI_DURATION_DETERMINE'

            EXPORTING

                start_date = dat

                end_date = dat2

                start_time = hora

                end_time = hora2

            IMPORTING

                duration = x.

                y = x / 60.

         DATA_PACKAGE-PMMTIMDIF = y.       (This is the key figure)

clear: dat, dat2, hora, hora2, x, y, str, time_stamp2.

View Entire Topic
oliver_uy2
Active Participant
0 Kudos

One solution is to write an abap routine inside the update rule to the infoobject.

Former Member
0 Kudos

Thank you. Should I put the same code but inside the KF??? Just putting RESULT = y. ???