Search
Search

Create routine to compare date and time in a transformation

Hi experts;

In a transformation from DSO ZIC_O04 to an InfoCube I have to do the following: Having, in day the difference between the hour / date of the Goods Receive with the Movement Type Z31 and early time of the batch assign to that Order with the Movement Time Z01, taking in consideration the Factory Calendar.

The record that is filling is the one assign to the one that have Z31 move type.

Steps:

1. Check what is the Bach (0BATCH) assign to the Order (0PRODORDER )with Movement Type Z31;

2. Check the Date (ZDATE) and Hour (ZTIME)

3. Check if exists a Bach (0BATCH) with Movement Type Z01;

a.If no RESULT = 0

b.If yes continueu2026

4. Check, for the Batch in 3b. what is the early day (ZDATE) with Movement Type Z01

5.Check for the day in 4. what is the early hour (ZTIME)

6.Check if day (ZDATE) in 4. is equal to Date in 2.

a.If YES: Hour 5. - Hour 2.

b.If NO: Check the Factory Calendar and make the Date 4. - Date 2. Use the following formula: 6B + ZTIME 4. - ZTIME 2.

7. Convert the result from 6. into days

Example:

Batch A1M0000427 A1M0000427 A1M0000427

PRODORDER LA10AA0580

0Material ZAL116DZA ZAL116DZA ZAL116DZA

0Movetype Z31 Z01 Z01

ZDATE 17.03.2008 19.03.2008 19.03.2008

ZTIME 16:44:11 18:31:42 18:26:38

RESULT 2,07

2,07 is equal to the 2 day difference (between 17.03.2008 and 19.03.2008 - early day) plus the difference between 18:26:38 (early hour of the early day of Z01) and 17.03.2008 (day and hour of Z31).

Can any one help me with the code?

PS: my ABAP know-how is very lowu2026