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: 

how to calculate dates?

Former Member
0 Kudos

hi ,

     i will give a short description about my project and what i need from you,In my project the user enters the detail(like expiry date , name, place of issue) of his document which he wants to be notified when the expiry date  of the document is with in 30 days.

Example : if his documents expiry date is 12.12.12 the system should sent a notification to him on 12.11.12 that means before 30 days of expiry.

How can i achieve the above scenario?How to trace 30 days and sent notification? As i am a very first beginner of SAP ABAP please explain me in detail.

                                                      

                                                                                   THANKS IN ADVANCE,

                                                                                                                                                           -NAVEEN

Moderator message: very basic, obviously insufficient research -> question status removed

Message was edited by: Thomas Zloch

7 REPLIES 7

Venkat_Sesha
Advisor
Advisor

anup_deshmukh4
Active Contributor
0 Kudos

Hello Mohmaed ,

In that case you will have to wrte a Program to send a email / Notification and schedule it in background ( the program will send the notifaction with respect to the current date ). on daily basis  coz. to my understanding yor documents expiry should be checked daily,

an You can have direct operation on dates or calculation is No effort.

Hope this helps,

anup Deshmukh

Former Member
0 Kudos

Hi ,

follow the below steps .

1.create a program and execute ii in background every day 

2. calculate the 30 th date of give date   and compare it current date

3.write logic to send mail and execute it if date matches.

Ashish

Former Member
0 Kudos

Hi Naveen,

For this just add 30 days to you date variable like below.

data:lv_date type sy-datum.

lv_date = sy-datum + 30.

write lv_date. It will give after 30 days to the current date .So you will get the date,now how you are going notify him ,through mail or a message.

If it is mail,search with how to send mail through attachment,one of the using FM for this is.

  SO_NEW_DOCUMENT_ATT_SEND_API1

You can try with other FMs.

Thanks ,

Lavanya.

0 Kudos

Hi Lavanya Bollam,

                           

                          I tried your method but its not working. Here is my code

PBO of screen one:

    DATA:lv_date TYPE sy-datum.

    lv_date = sy-datum + 30.

    IF lv_date = zdatecal-datefrom.

    MESSAGE e000(basic_10).

*   saved

    ELSE.

   MESSAGE e001(basic_10).

*  not saved

    ENDIF.

                                   Is this coding is correct??

vinoth_aruldass
Contributor

Former Member
0 Kudos

Hi,

1) Create a report with date as an input field in the selection screen.

2) Use the FM RP_CALC_DATE_IN_INTERVAL to calculate the date from the sy-datum by adding 01 month. Always use the function modules provided by SAP for date related calculations.

3) Pass the fetched date( in the above step) to your table and fetch the data.

4) Use the FM SO_NEW_DOCUMENT_SEND_AP1 for mailing functionality. You will find the details, to use this FM over the web. Just search for the FM.

5) Schedule this program in background (SM36) using Job Wizard.

Hope this works for you..!!!