cancel
Showing results for 
Search instead for 
Did you mean: 

Original GI date should display closest day when Saturday and Sunday comes

Former Member
0 Kudos

Hi Guys,

I am getting Original GI Date as After deducting Transit time from Original Delivery Date.

But i want to fullfill the below requiremnt also.

the Original GI Date should be then the working day defined in the calendar of the shipping point. Thus if the calculation gives Original GI Date to be Sunday 4.3.2012 then it should changed to the closest previous working date which is Friday 2.3.2012 (calendar 'YT').

Any one help me how to execute the above requiremnt.

regards

reddy.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Pass your GI date to below given FM, it will return you the day of the week.

CALL FUNCTION 'DATE_COMPUTE_DAY'

EXPORTING

DATE = GI_DATE

IMPORTING

DAY = day_of_week_num

EXCEPTIONS

OTHERS = 8.

the value returned by this FM in day_of_week_num will be between 1 to 7, 1 representing Monday and 6 = Saturday and 7 = sunday.

Now if your working days are from monday to friday then simply check the value returned by this FM is it is 6 then you can subtract 1 for last friday or add 2 for next monday and in the same fashion if value returned is 7 then subtract 2 for last friday and add 1 for next monday in GI date.

For adding and subtracting value from GI date you can use FM RP_CALC_DATE_IN_INTERVAL. And if you need to check some settings related to Factory calander then you can use FM DATE_CONVERT_TO_FACTORYDATE.

Regards,

Durgesh.