Skip to Content
author's profile photo Former Member
Former Member

which function call a workflow ?

Hi guru,

I have the workflow WS000XXXXX and Zprogram. In Zprogram I want call workflow , how to do ? Could you please give me the sample code to do it.

Please help me.

Thank you so much all.

karen.

Moderator message: please do more research before posting.

Message was edited by: Thomas Zloch

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 11, 2012 at 09:20 AM

    Hii Karen,

    There is a FM to Trigger Workflow.

    INCLUDE <cntain>.

    DATA : swr_cont LIKE swr_cont OCCURS 0 WITH HEADER LINE,

    gt_attach LIKE soattlsti1 OCCURS 0 WITH HEADER LINE,

    msg_lines LIKE swr_messag OCCURS 0 WITH HEADER LINE,

    gv_ret TYPE syst-subrc,

    gv_wid LIKE swr_struct-workitemid.

    REFRESH : swr_cont.

    swr_cont-element = 'BELNR'. " Invoice Number

    swr_cont-value = lv_belnr.

    APPEND swr_cont.

    swr_cont-element = 'GJAHR'. " Fiscal Year

    swr_cont-value = lv_gjahr.

    APPEND swr_cont.

    CALL FUNCTION 'SWU_START_WORKFLOW'

    EXPORTING

    task = 'WS000XXXXX '

    language = sy-langu

    user = sy-uname

    IMPORTING

    return_code = gv_ret

    workitem_id = gv_wid

    TABLES

    container = swr_cont

    message_lines = msg_lines

    attachment_list = gt_attach.

    If gv_wid is not initial means worklfow is successfully triggered.

    Regards,

    Ashwath.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 11, 2012 at 09:56 AM

    Hi Karen,

    You can use this function module to start the workflow

    CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'

    EXPORTING

    task = <workflow_id>

    LANGUAGE = Language

    DO_COMMIT = 'X'

    IMPORTING

    RETURN_CODE = l_rc

    WORKITEM_ID = l_wiid

    TABLES

    INPUT_CONTAINER = lt_container

    MESSAGE_LINES = lt_msg_lines

    MESSAGE_STRUCT = lt_msg_struc.

    SWE_EVENT_CREATE - to create the event.

    You can Refer this link for more information.

    http://help.sap.com/SAPHELP_NW04S/helpdata/en/c5/e4af8b453d11d189430000e829fbbd/frameset.htm

    Regards,

    Ramya Ramasamy

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.