Application Development and Automation 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: 
Read only

date logic required urgently

Former Member
0 Likes
1,390

hI all,

i need logic for the following

Basically, “15.06.2007” is the “Required delivery date for the plant”. This means that the stock should be there in the plant by “15.06.2007”.

We need to change the formula for the delivery date.

Formula: Delivery date = (15.06.2007 – LEAD TIME of the material)

Say, for example the lead time for the product is 8 (this varies for different materials). Then the delivery date should be:

Delivery date = (15.06.2007 – 😎

= 07.06.2007

So we need to create a PO for this material on 07.06.2007

Thanks

sanjeev

1 ACCEPTED SOLUTION
Read only

former_member673464
Active Contributor
0 Likes
1,365

hi..

Just subtract the number from the date.As date format automatically gives you the delivery date further.

eg:

data:

w_date type d,

w_required type d,

w_days type i.

w_date = sy-datum.

w_days = 10.

w_required = w_date - w_days.

write w_required.

regards,

veeresh

hI all,

i need logic for the following

Basically, “15.06.2007” is the “Required delivery date for the plant”. This means that the stock should be there in the plant by “15.06.2007”.

We need to change the formula for the delivery date.

Formula: Delivery date = (15.06.2007 – LEAD TIME of the material)

Say, for example the lead time for the product is 8 (this varies for different materials). Then the delivery date should be:

Delivery date = (15.06.2007 – 😎

= 07.06.2007

So we need to create a PO for this material on 07.06.2007

Thanks

sanjeev

10 REPLIES 10
Read only

former_member673464
Active Contributor
0 Likes
1,366

hi..

Just subtract the number from the date.As date format automatically gives you the delivery date further.

eg:

data:

w_date type d,

w_required type d,

w_days type i.

w_date = sy-datum.

w_days = 10.

w_required = w_date - w_days.

write w_required.

regards,

veeresh

Read only

Former Member
0 Likes
1,365

Hi,

You can do this using Minus(-) sign ....

DATE = Delivery_daete - 8.

Regards

Sudheer

Read only

Former Member
0 Likes
1,365

Hi,

Use the FM HR_99S_DATE_ADD_SUB_DURATION. This FM subtracts days, months, years from a particular date. Use this FM to change the formula and then you can create PO for this new date.

Hope this helps.

Regards,

Richa

Read only

Former Member
0 Likes
1,365

use this Fm

RP_CALC_DATE_IN_INTERVAL

pass i/p as date and sign as minus .

make use of this code .

pass ur lead days

data: date like sy-datum,

date1 like sy-datum.

date = sy-datum.

CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'

EXPORTING

date = date

days = 08 "take this as leadtime in days

months = 00

SIGNUM = '-'

years = 00

IMPORTING

CALC_DATE = date1. " new date

write:/ 'new date', date1.

regards,

Vijay

Read only

Former Member
0 Likes
1,365

Hi Sanjeev,

Convert the date to yyyymmdd format and then go ahead with you calculation. Then get the date back to the format it was in.

example:

v_date = 15.06.2007

l_date type sy-datum.

concatenate v_date6(4) v_date3(2) v_date+0(2) to l_date.

l_date = l_date - Lead time of material.

Then convert it back using concatenate by adding a with '.'

Regards,

George

    • reward points for helpful answers

Read only

Former Member
0 Likes
1,365

Hi

Find a Related User exit for PO where you can change this Required delivery date for the plant.

Fetch the LEAD TIME of the material from material master and

in that write the code for this formula for changing the delivery date as

Delivery date = (15.06.2007 – LEAD TIME of the material)

keep a break-point and check while creating the PO whether it is triggering it or not.

Reward points if useful

Regards

Anji

Read only

0 Likes
1,365

Hi Anji,

can u give me the field name as well as Table name

where i can find Lead time of material

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
1,365

Hi,

Use the following code.

PERFORM get_delivery_date using del_date lead_time

changing final_date.

FORM get_delivery_date using

p_del_date type dats p_lead_time type i .

changing

p_final_date type dats.

p_final_date = p_del_date - lead_time.

ENDFORM.

Regards,

Sesh

Read only

Former Member
0 Likes
1,365

Hi,

If 8 is num of days then you can directly write the statement like

Delivery date = current D t – 8

Now the required date is in "Delivery date".

Sudheer.A

Read only

Former Member
0 Likes
1,365

thanks