Call purchase requisition approval workflow in abap program

Hello,
I copied the standard workflow for the approvaI of a purchase requisition WS00000038 and i tested it. I create a purchase requisition in me51n. This is triggering the event releasestepcreated which starts my workflow. Everything goes ok.
Now, i want to call this workflow in ABAP. I do not know exactly how to do it. Here is the code I tried.
data: ls_objkey type SWR_STRUCT-OBJECT_KEY,
lt_mesage type table of SWR_MESSAG,
gt_container type table of swr_cont,
gs_container type swr_cont.
gs_container-element = 'ReleaseCode'.
gs_container-value = '01'.
append gs_container to gt_container.
gs_container-element = 'requisition'.
gs_container-value = '0010000362'.
append gs_container to gt_container.
gs_container-element = 'RequisitionHeader '.
gs_container-value = '0010000362'.
append gs_container to gt_container.
ls_objkey = '0010000362'.
CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'
EXPORTING
object_type = 'BUS2009'
object_key = ls_objkey
event = 'RELEASESTEPCREATED'
TABLES
input_container = gt_container
MESSAGE_LINES = lt_mesage.
As you can see i filled he RequisitionHeader, requisition and release code. I saw in the workflow that i copied, that these are import parameters. Requisition and release code are mandatory. 0010000362 is a purchase requisition that i created.
After i run the program i receive a work item in SBWP but it has the status error.
Can you help me?Perhaps anyone has done this. I think that i am not filling the correct data or something like that. Maybe you can look in the standard workflow WS00000038 and tell me what I should pass and how.
Thank you,
Efren

Hi Efren,
The Problem is, for the purchase requisition there is two key fields.
So when you pass the keyfiled to workflow it should be the concatenation of Purchanse requisition number and the item number.
You have to pass the object key as below.
ls_objkey = '00100003620010'.
Then only your business object will getting insatanciated.
Thanks,
Viji.

Similar Messages

  • Call workflow from ABAP program

    created a zbusiness object (ZPRODH)with
    one key field product hierarchy,
    one attribute level number and
    one method display.
    I tested that zobject and using this object created workflow to display product hierarchy ,it is displaying it. now I have to call it from one abap program.
    In the abap program I am calling the funcion module, I
    CALL FUNCTION 'SWW_WI_START_SIMPLE'
    EXPORTING
    TASK = TASK
    IMPORTING
    WI_ID = WI_ID
    TABLES
    AGENTS = AGENTS
    WI_CONTAINER = WI_CONTAINER.
    It is calling the workflow and subrc is 0, but not passing the value to the workflow. Because of that the method is not working, any idea?
    Thanks in advance

    ttpa,
    Please check this thread:
    Re: Workflow from abap program
    Also check that your Fm do requires any explicit commit or not?
    Hope it will help u
    Cheers
    Jai

  • Enable attachement link in Purchase requisition approval WF

    Dears ,
    How to enable attachment link in purchase requisition approval wf ,??

    hi
    In the workflow, you need setup the agent assingment(i.e organizationlal roles)

  • How to trigger GP workflow through ABAP Program.

    Hi All.
    i have one scnerio , i want to create BOM through Custom Ztransaction that will be developed in ABAP Modulepool.
    User will create BOM  from this ztransaction through  Transactional Iview in PORTAL,Once the user save transaction , i want to trigger a GP(Guided Procedure ) workflow,from ABAP Program.
    is it possible to trigger GP workflow?
    if yes how  to  do it , please suggest the way out.
    Regards,
    Shyam.

    Hi lingana,
    As u see in my requriment that, Workflow is not designed within SAP , But the Workflow will be designing
    in SAP Netweaver, its a GP Workflow. And Ztransaction(Developed by ABAP) will  be seen by user through portal  and
    he save transaction on PORTAL, In backend  ABAP program will run , and after meeting certain condition, it should create
    or(Initiate) GP workflow(process).
    So my question is , how ABAP Program will call GP workflow, How the connection will be made in between ABAP Code and GP workflow framework.
    If any doubt regarding requriment let me know,
    Regards,
    Shyam.

  • Overall purchase requisition's Workflow : mechanism of release code

    Hi all,
    i need to implement Overall purchase requisition standard workflow ; i need to have 2 actors for process's validation, so i set release code like this :
    01 - ACTOR1
    02 - ACTOR2
    The workflow is launched, the ACTOR1 received a work item in his workplace, whe he execute the work item, the transaction ME54N is launched. Well. But the ACTOR1 can  a decision for him but also for ACTOR2, why ? the process is not good for me. If ACTOR1 has taken a decision the workflow of release code 01 is finished. An other workflow is launched for release code 02, when the ACTOR2 go to the transaction ME54N he can take a decision for his relase code but he can also cancel the previous decision of ACTOR1, it's not good for me, can you explain to me ?
    Thanks for help.
    Cheers.

    Interesting solution using the user-exit.
    I just finished modifying the delivered overall purch req approval WF.  I needed to add a few fields for reporting so I created virtual attributes via delagation on BUS2105.  I created approval and initiator agent attributes and email addresses. It works fine and I don't have maintain any further code other than what is in my business object which I can use again and again.
    Many roads on the way to Rome

  • How To Call a Broadcasting Template within an ABAP program

    I was wondering if anyone knew how to call the Broadcast template via an ABAP program so it will execute?  The scenario that I have is we are doing validations via BW.  We put the data (for conversion reasons) through validation rules and then load a data target.  From this, there are 2 situations that could occur:
    1) There are errors
    2) There are not any errors
    If #1 is true, then I would like to execute the Query Broadcasting Template that I have created.  If #2 is true, then I would like to execute another process via the ABAP program.  In the past, I was successful using exception reporting via reporting agent, since I was able to call that program but the report did not look good at all.  Please let me know if there is a program that I could call in order to execute this broadcast that I have set up.
    Best Regards,
    Tim

    Hello,
    although this is an old threat, but do you have any hints on how to dynamically change the template when broadcasting?
    kind regards
    Murat

  • How to call a BW Query from an ABAP program?

    How to call a BW Query from an ABAP program?

    hi
    check this link
    /people/durairaj.athavanraja/blog/2005/04/03/execute-bw-query-using-abap-part-i
    /people/durairaj.athavanraja/blog/2005/04/03/execute-bw-query-using-abap-part-ii
    /people/durairaj.athavanraja/blog/2005/12/05/execute-bw-query-using-abap-part-iii
    hope this helps
    cheers

  • Is it possible to make a call to an Infotype from an ABAP program?

    Dear friends,
    I created a new infotype 9*** using transaction pm01 and it works fine. What i need to do is to make a call to this infotype from an abap program without going through transaction pa30. Is it possible to do that? Thank you in advance.
    Sincerely,
    hajar

    Hi,
    The HR_MASTERDATA_DIALOG might need some tweaking.. we use a custom Program on the lines of SAP's
    'perform rp_infotyp(sapfp50g)'  that is more user friendly.. let me know if u need more info..
    Good Luck,
    Suresh Datti

  • Urgent!!  How to call a custom transaction or an ABAP program in BSP?

    Urgent!!  How to call a custom transaction or an ABAP program in BSP?
    We are pretty new on BSP.  Would be very appreciated if any expert here give us the detailed steps on how to build up the application to just call a custom transaction (e.g., t-code: ztest) or an ABAP program.  Would we have to create a button or event handler to do that?  And the detailed steps?
    Thanks in advance and we will definately give you reward points!

    hi Durairaj,
    During the time to wait for your answer, we copied Bernd's code from your last link, but when activating it, get the 1st error msg:
    Field "CLIENT" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement. "DATA" statement."DATA" statement. The error shows up here:
    <td>
    <htmlb:inputField id = "client"
    value = "<%= client %>" />
    </td>
    Then we added Client to the page attribute and define it as type String, then get another error:
    The field "EVENT" is unknown, but there is a field with the similar name "EVENT_ID"."EVENT_ID". This error shows up at the beginning in the Event Handler:
    OnInputProcessing:
    code
    • event handler for checking and processing user input and
    • for defining navigation
    • event handler for data retrieval
    event = cl_htmlb_manager=>get_event( runtime->server->request ).
    IF event->name = 'button' AND event->event_type = 'click'.
    button_event ?= event.
    How to resolve this unknown Event error, need to define in Page Attribute tab? but with what type?
    Actually we only want to run an ABAP4 program in BSP, the code is complicated, could you show us an easy way of doing this in BSP?

  • Workflow email for Purchase Requisition Approval

    We have a requirement of sending email to the approvers for approving purchase requisition. Alongwith the email sent out to the approvers (to their Outlook/ Lotus Notes Inbox), we will also like to show the content of the line items of the purchase requisiton. i understand this can be done since in the past at other implementations, I have seen that the email contains the link to goto SAP Ibox and it also shows the content of the requistions.
    Our issue is that we are not being able to pass on the content of the requistion line items to the approvers inbox. Is there a setting to activate this in workflow or somewhere that we are missing? Any help will be greatly appreciated.
    VJ

    hi
    In the workflow, you need setup the agent assingment(i.e organizationlal roles)

  • Purchase Requisition Approval Customization

    Hi All,
    The standard purchase requisition notification only shows the project under the heading Cost Center and our client wanted the notification to show the full charge account which we achieved by modifying the standard oracle package PO_WF_REQ_NOTIFICATION
    Now we are upgrading from 11.5.9 to R12. Can somebody tell me how it can be achieved in R12?
    Thanks,
    Sonia

    Hi,
    Try these options,
    Method-1_
    Try to capture the org information before you start the WF and pass the Org Id as parameter in the workflow through WF code change.
    Method-2_
    You need to devide the WF activities into 2 parts.. 1 part for all orgs and the 2nd part is for specific org.. You need to define a node prior to "waiting Activity" for approval which will capture Org_id and progrmatically you need to decide which path to follow.
    Say Org_code="xyz"
    IF Node (Org_id !="xyz") --> Wait State of WF --> Next approver (This is for all orgs other than "xyz")
    IF Node (org_id ='xyz") --> without wait State of WF --> Next approver (This is for specific org only)
    Regards,
    S.P DASH

  • Purchase Requisition (PR) Workflow

    Hello all,
    I hope you can lend your thoughts/experience.
    I have been advised that a PR workflow (without the need of a user exit) can be designed to route notification to the approver based just on the structure in organizational management (OM).
    For example in OM users, John and Jane is assigned to Finance department while the approver for Finance department is Mary.
    When a PR is created by John or Jane, notification will be routed to Mary based on the structure in OM.
    To do the above, I have been advised that the I will still have to maintain the workflow configuration in MM but that I do not need to assign a position to the release group/release code.
    The problem is that if I do not assign a position, I cannot save. So this is a dead-end.
    My thoughts are that this requires implementation of user exit, M06B0001.
    I hope someone can help.

    Hi Richard,
    I have done many of the Purchase requisition workflows before and according to the customizing it is not mandatory to have a position or the user assigned to a release strategy. It becomed mandatory only if you have the value "1" in the Workflow column of the Release codes. If you do not have a 1 in that field then the event will be raised but it will not start the standard workflow. Once you have a workflow attached to the event "ReleaseStepCreate" and within the workflow you have an activity to release the PR based on the rule which searches for the manager of the user who created the PR you have the workflow ready. Just incase you need it the rule number is 00000168 and you can view it via transaction PFAC.
    Hope this helps,
    Sudhi

  • Initiating re-approval on price change durin purchase requisition approval

    Hello everyone,
    Must be a basic requirement for most people...can you please help us here?
    We have a requisition approval hierarchy (defined in AME). We want the functionality that whenever an approver updates the price (through the "Open Document" in notification), the purchase requisition should be sent for re-approval starting with the requestor. Is there any profile option or workflow attribute which can be used for this purpose? I believe PO has some such option for setting the tolerance percentage, but don't know whether iprocurement has similar one.
    Btw, we are using 11.5.10.2
    thanks in advance,
    abbas

    Hi
    For the the approval there is release strategy in purchase requistion ( with classifiaction .You can make use of this to put the approval .Now coming to ur Purchase requistion which are cretaed thru Mainatnace odere you need to cjheck the Field status for the document there you will the field valution price i just forgot the field status group.
    you can try this way
    regards
    sunny

  • Workflow vs Abap Program

    Hello Frienz,
    There is a typical business scenario with one of our client, I would like to get inputs from all of u..........
    Could u guys tells me is it possible to Call a Abap Program through a Workflow mail which has come to the supervisor's Lotus Notes Inbox for his/her action????????????????????
    Which means When supervisor opens the mail in LN is it possible to run a abap program when a radio button or any weblink is incorporated he or she clicks in the mail???????
    Requesting all of u to provide their valuable inputs.
    Regards
    Pavani G

    Hello Frienz,
    Thanks for all your valuable inputs................
    Sheeta / Manikya Raju: We had already tried the insertion of HTTP link but when we click on the link we r not able to run the program.......
    SAP HCM:
    1. S email received by supervisor is trigerred through Workflow only...........
    2. Unfortunately our LN Guy has not got any idea abt this..........
    Will very much appreciate for your quick response
    Regards
    Pavani G
    Edited by: G Pavani on Jul 28, 2009 2:04 PM

  • Workflow from abap program

    I created one workflow with a zbusines object. I did not create any event for the business object. only key fields and method.
    now my question is, how can I call or trigger the workflow from the abap program. please adive

    Hi Mat,
    u can use FM SAP_WAPI_START_WORKFLOW.
    Please find sample coding
    data: z_bus2080 type swc_object.
    data: begin of bus2080_key,
    id like viqmel-qmnum,
    end of bus2080_key.
    data: wf_cont type SWR_CONT occurs 0 with header line.
    parameters: qmnum like viqmel-qmnum.
    bus2080_key-id = qmnum.
    swc_create_object z_bus2080 'BUS2080' bus2080_key.
    Populate first container element - object type BUS2080
    clear wf_cont.
    move: 'BUS2080' to wf_cont-element,
    z_bus2080 to wf_cont-value.
    append wf_cont.
    Populate second container element - char variable USERNAME
    clear wf_cont.
    move: 'USERNAME' to wf_cont-element,
    sy-uname to wf_cont-value.
    append wf_cont.
    Call WAPI function
    CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
    EXPORTING
    TASK = 'WS94600159' "<-- Your workflow ID
    LANGUAGE = SY-LANGU
    IMPORTING
    RETURN_CODE =
    WORKITEM_ID =
    TABLES
    INPUT_CONTAINER = wf_cont
    MESSAGE_LINES =
    MESSAGE_STRUCT =

Maybe you are looking for

  • Touch-up tool causes font issue in Acrobat 9 and X

    While I edit text using the Edit Document Text tool (formerly TouchUp Text) the font style are getting changed, for example If i select the Uppercase style text using Document Text Tool after exit the selection and trying to save as  the doucment som

  • Acknowledgements being requested - to be stopped

    Hi I have the following scenario - idoc text file from subsystem --> XI --> Idoc xml --> BPM --> Idoc adapter --> R3 To convert the idoc text file into an idoc xml - we are running RSEINB00 program on the Integration server . The receiver of this ido

  • No aggragation when combining reports

    Hello all, I combined 2 reports with each other in answers. The first one is a dim with 2 different fact values from 2 different fact tables and the second one is the dimension with a 2 columns with null values Now I got something like: A -1 - 1 A -

  • FSG - Need to determine the first periode value in year

    Hi can anyone help me please i need to create a column or row in FSG with the first period balance value in years for example of the template is: parameter period is Mar-12 Amount Balance of Jan-12 10,000 Balance of current period 12,000 thanks Lim J

  • After Effects CC Rendering Issues.

    Hey guys, I'm rendering DSLR footage out of After Effects for editing and grading. I have every clip in it's own comp with the Neat Video denoising plugin applied and some film grain, and I'm rendering every comp individually as DNxHD. The problem is