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

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.

Accepted Solutions (1)

Accepted Solutions (1)

roland_szajko
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Fernanda

I also think that the easiest and fastest way would be to build a routine for the key figure in the update rule (like Oliver suggested). The result would then be:


<your coding logic>

RESULT = y.

An alternative would be of course to migrate the 3.x dataflow to 7.0. This will give you much more flexibility.

br

Roland

Answers (2)

Answers (2)

Loed
Active Contributor
0 Kudos

Hi Fernanda,

May I know what is your source?

I would suggest to just add a DUMMY KF in your source as "temporary storage" of this DATA_PACKAGE-PMMTIMDIF..Then in transformation just directly map your DUMMY KF to your keyfigure PMMTIMDIF..

Regards,

Loed

Former Member
0 Kudos

Hello, the source is ECC. But they said i can not modify DataSources I have to make the proper modifications in the transformation only. Or, is it too complicated to add that DUMMY KF in my source?

Loed
Active Contributor
0 Kudos

Hi Fernanda,

Is it a customized extractor? If it is, it's just easy to add that DUMMY KF in the datasource..You can ask an abaper to do it or you can do it yourself..Who told you that you can't modify the source in ECC? Did you tell him your problem?

Regards,

Loed

Former Member
0 Kudos

I did, but apparently its easier to add a routine than to update the source. Actually I created a routine inside the key figure and it's working. ¡Thank you for the help!

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. ???