Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Code to find if system date is within 01 /2007 to 12/2007 and 01/08 to12/08

Former Member
0 Kudos

Hi , I have a simple requirement at BMW Orders to Cash Area to split up the data loads for "Orders Cube" on yearly basis. like "Orders Cube 2007" and "Orders Cube 2008" and previous year Cube "Orders Cube 2006 . I want to know the abap Code that i write in abap process type or if you can let me know how can i check using IF else functionality in Process chain.

I want to do the following

Check if LOad Date (SYSDATE) lies between TOO9B - BDATJ (20007) & TOO9B - POPER (01 TO 12)

Then use DTP to load the the "2007 order cube"

Else

Check if LOad Date (SYSDATE) lies between TOO9B - BDATJ (20008) & TOO9B - POPER (01 TO 12)

Then use DTP to load the the "2008 order cube"

Please help me with logic or any standard functionaility that can resolve the above

Then use DTP to load the the "2007 order cube"

I just come up with the below code but if you can correct it to put in the format of process chain abap code it will be helpful.

Thanks

soniya

RANGES: IT_TCODE FOR TOO9B - BDATJ

IT_TCODE-SIGN = 'I'

IT_TCODE-OPTION = 'EQ'

IT_TCODE-LOW = ''2007"

APPEND IT_TCODE.

IT_TCODE-SIGN = 'I'

IT_TCODE-OPTION = 'EQ'

IT_TCODE-LOW = '01'

APPEND IT_TCODE.

IT_TCODE-SIGN = 'I'

IT_TCODE-OPTION = 'EQ'

IT_TCODE-LOW = '12

APPEND IT_TCODE.

6 REPLIES 6

Former Member
0 Kudos

Hi Soniya,

Why dont u check the sysdate year and then process to the respective cube.

data: date like sy-datum.

data year(4) type c.

date = sy-datum.

year = sy-datum+0(4).

case year.

when '2007'.

..........

.......

when '2008'.

.......

.......

endcase.

Regards

SAB

0 Kudos

Hi syed, can you tell me th e revise code to include the even year like 2008,20010, 2012

in one case and other one with odd years like 2007,2009,2011

Thanks

Soniya

0 Kudos

HI,

check this..

<b>data: date like sy-datum.

data year(4) type c.

data typ type i.

date = sy-datum.

year = date+0(4).

typ = year MOD 2.

if typ = 1.

*ur code for odd years

write : 'ODD'.

else.

*ur code for even years

write 'even'.

endif.</b>

given data = '20080101'. for even years and check the result.

Regards

SAB

0 Kudos

Hi syed , great answer actually i have the requirement to load the 2008 or even year data in one cube and 2007 odd year data in odd cube so i will try this in process chain.

please tell me ur email or reply me when i tell you the results,

thanks

Soniya

0 Kudos

HI sonia,

my email is sabteam4u@yahoo.com

reply to both so i dont miss the results...

Regards

SAB

0 Kudos

Hi Syed your Code works great. Thanks for the help. But now Business change the requirement a bit can you help me to modify this code to say

1. Fiscal year 2007 or ODD fiscal years and not calendar 2007

2. Fiscal Yeat 2008 or Even Fiscal Year and Not Calendar 2008

I want the simple abap logic that with generate a success message in process chain for Even year and Else return Odd to go other path in process chain

Thanks

Sincerely

Soniya Kapoor