12-20-2010 9:32 AM
Dear Experts,
I am new to User exit and workflow.
We have implemented the Workflow for PR Release mail intimation to the approver. The workflow is working fine and we are receiving the mail in the Workplace.
Now i want to read my Z-table for the mail id and other information before sending the mail to the approver.
I have created a Z-project and added enhancement M06B0001. There is a Exit EXIT_SAPLEBNF_001 in which i code my program under include ZXM06U12 and activate my project ,include and enhancement.
But this exit is not called at the time we save the PR and got a intimation in the workplace.
Please suggest if i need to perform some other settings to link it.
Thanks in advance.
Ankur Gupta
12-21-2010 11:07 AM
12-21-2010 11:32 AM
Hi,
May be i didn't understand your requirement clearly.
Why you want to read z-table for mail ID.
You can get the mail id for the user from std. tables like adr6.
Let me know your requirement in little more detail.
Regards,
Manica
12-21-2010 12:04 PM
Thanks Afzal and Manica for the reply,
Actually i want to read my Z-table to read the mail Ids of R1 and R2 but this User exit is not called in workflow.
Can you suggest some other exit for the purpose of reading the mail ids from my Z-table.
In case you want to ask some other detail please let me know.
Thanks & regards
Ankur
12-21-2010 12:24 PM
Hi,
You can extend the BO BUS2009 (for lineitem wise approval) or BUS2105 (for overall release) by creating subtype.
Write a method in it which will read the mail IDs for R1 & R2 from the z-table and call this method in your workflow to get the mail ID.
Use this mail IDs as per your requirement.
Hope i'm clear.
Regards,
Manica
12-21-2010 12:37 PM
Thanks a lot Manica,
I think now we are moving in right direction.
We are using BUS2105 (for overall release).
Can you please elaborate your suggestion and help me how to create subtype and method. I have already created the Z-table for mail ids.
<removed by moderator>
Thanks & Regards
Ankur
Edited by: Thomas Zloch on Dec 21, 2010 2:14 PM - please retain normal priority
12-21-2010 12:44 PM
Hi,
Go to SWO1. Enter BO as BUS2105. In application tool bar you'll find Subtype icon.
Click on it. Enter all fields with first character as Z or Y.
Save it. Now open your custom BO say ZBUS2105 and select methods. Click on create. It will give you a popup.
Hit yes and start writing your code to fetch mail IDs.
After you have fetched mail IDs, if its a single value use below syntax.
SWC_SET_ELEMENT CONTAINER 'MAILID' MAILID.
If its a internal table use SWC_SET_TABLE CONTAINER 'MAILID' MAILID.
After completing the coding, select your zmethod, click on edit in menu bar.
There Select Change Release Status --> Object type to implemented/released.
Again change Release status --> Object type component to implemented/released.
Regards,
Manica
12-22-2010 4:09 AM
Hi Manica
Thanks for reply.
I tried the steps suggested by you. But after completing my coding in my Z-method, I activate it and then select my zmethod, click on edit in menu bar.
Change Release Status --> Object type to implemented/released.
Change Release status --> Object type component to implemented/released.
But here implemented/released both are disabled.
Please suggest how to enable then. Did i miss any step.
Please help.
Thanks & Regards
Ankur
12-22-2010 4:30 AM
12-22-2010 4:54 AM
yes yes
I am so sorry, i was in display mode. I have performed the steps suggested by you.
I put a break point in my function module but it has not been called after the PR is created.
I want to read this function module as soon as the PR is created and my workflow is called so that the workflow can read the mail ids from my code and route a mail to the approver.
Please suggest.
Thanks & Regards
Ankur Gupta
12-22-2010 4:59 AM
Hi,
You have to put your function module in the method you have created.
Call this method as the first step in your workflow using a activity step.
So as soon as the workflow is started you get the mail IDs you want.
Use them wherever needed to send mail in workflow.
Regards,
Manica
12-22-2010 6:07 AM
Hi Manica,
Please look at the steps i performed to create a Subtype.
Tcode : SWO1. Enter BO as BUS2105. Clicked on Subtype icon.
Object Type : ZOBJ
Object Name : ZOBJ_NAME
Name : ZNAME
Description : Subtype
Program : ZBUS2105
Application : M
Save
Then I opened ZOBJ and select methods. Clicked on create and entered Method name as.ZMethod and function name as ZFunction.
After that i fetch the mail ids in my function module and added the line
SWC_SET_ELEMENT CONTAINER 'MAILID' MAILID
After completing the coding, I select ZMethod, click on edit in menu bar.
There Select Change Release Status --> Object type to implemented/released.
Again change Release status --> Object type component to implemented/released.
My ZFunction is in my ZMethod.
After that I run the Tcode SWDD. Enterd my Workflow name : WS20000077 and version 0001 to perform the Activity.
I clicked the 000004 Step in the Navigation Area for Overall Release of Requisition and went to Method tab.
Here, there are 3 criteria :
1. Secondary Call (Amodal Call),
2. Method Before Work item Execution (Modal Call)
3. Methods After Work item Execution (Modal Call).
Under each Criteria there is a table asking for Container Element, Object Category, Object Type, Method and Name.
I select the Container element as Purchase Requisition, Automatically the Object category is appearing as BOR Object and Object type as BUS2105. In methods search help i am not able to find my ZMethod.
Please suggest if i have done something wrong as I am not getting my ZMethod in the Method field.
Thanks for the support you have provided so far.
Regards
Ankur Gupta
12-22-2010 9:23 AM
Hi Manica,
I have performed all the steps suggested by you.
I have added my ZMethod in the Activity Method Before Work item Execution (Modal Call).
I put the break point in my ZFunction but still it has not been called.
As seen in SWO1, My ZMethod contains all the functions of BUS2105 and one of my ZFuntion. I have the doubt as i have not mentioned the name of my ZFunction in the workflow may be dats why my ZFunction has not been called.
Can you please suggest.
Thanks & Regards
Ankur Gupta
12-22-2010 8:34 AM
Hi Ankur,
Try using MEREQ001 this exit and FM may be this EXIT_SAPLMEREQ_005 or EXIT_SAPLMEREQ_010
After that write your code in particular exit once you find it.
Regards,
VG
12-22-2010 11:12 AM
Hi Varun
Thanks for your reply,
I Used the Exit EXIT_SAPLMEREQ_010 and but a break point. It is called at the time of saving the PR.
But how to fetch the Current PR no been created as i want to send the mail along with the PR number.
Please suggest.
Thanks & Regards
Ankur Gupta
12-23-2010 6:05 AM
Hi Ankur
You want to send the mail along with PR Number when PR gets saved.
That means u need PR no. before it gets generated.
Is dat you want or something else
put ur rqmt clearly..
Regards,
VG
12-23-2010 7:48 AM
Hi Varun
Yes i want to sent the mail to the Approver along with the PR number in order to approve it.
In case of any other detail please let me know.
Please suggest.
Thank & Regards
Ankur Gupta
12-23-2010 10:56 AM
Hi Ankur,
u want to read mail id from ur z-table.
den do one thing dat make one more field in z-table of like EBAN-BANFN.
when PR getting saved insert pr number into ur z-table.
once the pr number gets saved now fetch dis same pr number and mail-id from ur z-table.
write ur code in the EXIT dat i suggested u.
Regards,
VG
12-28-2010 9:32 AM
Hi varun
Thanks for the reply.
I am sorry for being late but can you please suggest the Exit name that can be used to store the PR number in Z table.
Thanks in advance.
Thanks & regards
Ankur Gupta
12-22-2010 11:16 AM
Hi,
You don't have to call it in Amodal methods tab.
You should call it in a separate activity step before the approval workitem.
For example, let us make your zmethod as first step in workflow.
Make sure your method is a background method.
Right click on the workflow, select create and select activity step.(Step with icon similar to PLAY button in audio devices).
Here enter your BO name, method, short description and select the background processing checkbox.
Also make sure you have delegated your z-object to std object.
You can do this in SWO6 tcode.
Enter object type as BUS2105 and delegation type as your z-object name.
Try doing this and let me know if you need anything else.
Regards,
Manica