Skip to Content
0
Jul 06, 2009 at 03:25 PM

Defining last day of previous month in ABAP

459 Views

All,

I am a BW guy and hardly know ABAP. I have a requirement where I have to calculate last day of previous month and use it in the routines of the transformations.

I have decided to define the Last day of previous month in Start routine and then use the global variable in Transformations to calculate further.

The logic that i have used is outlined below.

Define G_DATE in global declaration for further use in Transformations.

In the Routine section,

Assign G_DATE to SY-DATUM

G_DATE + 6(2) = '01' (Replace last to field of date with '01' to establish first day of the current month)

G_DATE = G_DATAE - 1 (To get to last day of previous month)

My dilemma is to implement this in ABAP in Start routine of transformations. Please include the exact ABAP code that would be needed in Declarations and Routine section.

Thanks in advance.