‎2011 Dec 20 8:25 AM
Dear All,
I have a requirement to trigger mail as soon as the Material Stock of Project is less than the Prescribed stock which is maintained in the table.
For this a ZTable and a ZProgram is created. How should it shot the mail continuously? Means suppose at 10 the stock of a material has reached below its decided qty then at 10:01 or at 10:02 it should trigger the mail to the mail id maintained for that material. I have no idea of user exit etc.
Please guide me in this matter.
Regards,
Bharti Jain
‎2011 Dec 20 9:04 AM
I HAVE WRITTEN THE BELOW LOGIC.
I have selected the materaial which is maintained in Z Table. Then based on those MATNR I fetched PRLAB from MSPR table. In my Z table there is a column containing Should be stock. Now I will check that PRLAB LT Should be Stock. In my Zprogram there is no Input Screen. Now how to fetch the stock every time in background. My objective is as stock changes then this Z program should run ,check stock and if true mail trigger .
Regards,
Bharti Jain
‎2011 Dec 20 8:37 AM
If you are creating a custom report to send email and check stock. Please schedule the report at an interval of 2mins or which is convenient to you.
It will check the stock and based on logic will keep sending email in background.
Nabheet
‎2011 Dec 20 8:49 AM
Thank You For Replying,
The stock is updated with some TCODES which I dont know . Then how my Z Program will know that the stock is less at the particular time . How can I do continuous scheduling for it? Please guide me .
Regards,
Bharti Jain
Edited by: Bharti Jain on Dec 20, 2011 9:49 AM
‎2011 Dec 20 8:51 AM
The logi to determine has to be coded and function will provide it and based on thaqt logic you can trigger. Background jobs to be sceduled can be defined in SM36 tcode.
Nabheet
‎2011 Dec 20 9:09 AM
Hi,
Do you know the table name where you can check material stock? IF yes then check if there is any filed of data type time which gives times stamp of record creation.
Subsequantly if you schedule your program for every two menutes then check data in table for records created in last 2 or 3 minutes and you can apply logic accrdingly to get the material details and email ID to trigger mails.
Hope it will give you little idea of how to do it.
‎2011 Dec 20 9:03 AM
Hi Bharti,
the best way is to write your code in User exit which will be called POST SAVE ...
Debug and search the enhancements/exits placed after save.
This will trigger the mail automatically when material stock in project is saved with less than ZTABLE value..
Regards,
Seemanthini
‎2011 Dec 20 9:04 AM
I HAVE WRITTEN THE BELOW LOGIC.
I have selected the materaial which is maintained in Z Table. Then based on those MATNR I fetched PRLAB from MSPR table. In my Z table there is a column containing Should be stock. Now I will check that PRLAB LT Should be Stock. In my Zprogram there is no Input Screen. Now how to fetch the stock every time in background. My objective is as stock changes then this Z program should run ,check stock and if true mail trigger .
Regards,
Bharti Jain
‎2011 Dec 20 9:07 AM
only way is u need to schedule the job every 10mins so that it will automaticallty run the program and check the stock and sends email. Basis person can help u regarding the scheduling if u are not aware of doing scheduling.
‎2011 Dec 20 9:37 AM
Hi Bharti,
I think your question with about PS Module.
1. Create Z Program
2. Write your selection case in your z program.
3. If there is any material stock level problem you append to your itab.
4. End of selection If There are any records your finally itab you can sending mail process
5. You setup job and schedule periodic time from SM36 (I Think period dont be short, maybe 5-10 min)
If your problem sending mail process from sap pleace again examine.
Best regards.