Procedure to Call Workflow Object from ABAP program in Se38

Hi All,
I have one scenario like i have to call one Workflow object from ABAP program in SE38.The scenario is like below.....
I have to select some records from database table.For example there are 100 records in the internal table.
For all that records i have to invoke Workflow for getting approval from the authorized persons. Once Approval has come to program, It will post one document in SAP and process ends.
Please suggest me how to move forward with this scenario.
Regards
Manas Ranjan Panda

Hi,
So you want to start a workflow from an ABAP, if an event exists for that particular workflow then the best way is to use fm SAP_WAPI_CREATE_EVENT,
to start a workflow from an ABAP you can use fm SAP_WAPI_START_WORKFLOW.
Kind regards, Rob Dielemans

Similar Messages

  • Call SXPG _ CALL _ SYSTEM from ABAP program

    Hi,
    Someone may help me?  I need to call the function module SXPG _ CALL _ SYSTEM from ABAP program for to encrypt a file.
    I created the command by SM49 , but I don't know how I can call it from ABAP program.
    Thanks
    Maria C

    Hi Maria.
    This is a possible code you can use:
    DATA: log LIKE TABLE OF btcxpm WITH HEADER LINE.
    Can contain STDOUT, STDERR
    commandname =
    CALL FUNCTION ‘SXPG_CALL_SYSTEM’
    IMPORTING
      COMMANDNAME = commandname
      PARAMETERS = parameters
    EXPORTING
    STATUS = status
      TABLES
      EXEC_PROTOCOL = log
    EXCEPTIONS
      NO_PERMISSION = 1
      COMMAND_NOT_FOUND = 2
      PARAMETERS_TOO_LONG = 3
      SECURITY_RISK = 4
      WRONG_CHECK_CALL_INTERFACE = 5
      PROGRAM_START_ERROR = 6
      PROGRAM_TERMINATION_ERROR = 7
      X_ERROR = 8
      PARAMETER_EXPECTED = 9
      TOO_MANY_PARAMETERS = 10
      ILLEGAL_COMMAND = 11
      OTHERS = 12.
    The following are the comments of the parameters taken from:
    http://help.sap.com/saphelp_40b/helpdata/en/fa/0971ee543b11d1898e0000e8322d00/content.htm
    Parameters
    IMPORTING Parameters
    Parameter name
    Use
    COMMANDNAME
    The name of the definition of the external command, as specified in the maintenance function (transaction SM69).
    PARAMETERS
    Arguments for the external command as specified by the definition in the R/3 System and by the calling program or user.
    These arguments are checked for impermissible characters, such as the ; under UNIX. Problems are registered with the SECURITY_RISK exception.
    EXPORTING Parameters
    Parameter name
    Use
    STATUS
    Returns the final status of the execution of the external command:
    · Value ‘O’: The external command was started and ran to end successfully.
    · Value ‘E’: An error occurred; the external command was not run successfully.
    Tables Parameters
    Parameter name
    Use
    EXEC_PROTOCOL
    Contains the STDOUT and STDERR output of the external command and any output from the target host system.
    Exceptions
    Exception name
    Meaning
    X_ERROR
    Reserved for future use.
    NO_PERMISSION
    The AUTHORITY-CHECK of the user’s authorization for the authorization object S_LOG_COM failed. The user is not authorized to carry out the command named with the specified arguments on the target system.
    COMMAND_NOT_FOUND
    Command name, as identified by COMMANDNAME and OPERATINGSYSTEM, has not been defined in the maintenance function (transaction SM69).
    PARAMETERS_TOO_LONG
    The combined argument string (ADDITIONAL_PARAMETERS and the DEFINED_PARAMETERS, as returned in ALL_PARAMETERS) exceeds the limit of 128 characters in length.
    SECURITY_RISK
    Either:
    · The command contains impermissible characters. These are characters with potentially dangerous properties, such as ; under UNIX.
    · The command definition specifies that an extra-check function module be run. This function module has rejected execution of the command.
    WRONG_CHECK_CALL_
    INTERFACE
    The command definition specifies that an extra-check function module is to be run. Either this function module is missing, or the interface defined for this function module does not match that of the standard R/3 function module SXPG_DUMMY_COMMAND_CHECK. For more information, please see SXPG_DUMMY_COMMAND_CHECK: Interface for Extra-Check Function Modules.
    TOO_MANY_PARAMETERS
    The command definition specifies that user-specified arguments for the external command are not allowed. However, an additional string of command arguments was specified.
    PARAMETER_EXPECTED
    The command definition includes the placeholder character ?, which signifies that additional user-defined arguments are required. However, no additional arguments string was supplied.
    PROGRAM_START_ERROR
    An error occurred while starting the external command. The R/3 system field SY-MSGV1 contains additional information on the problem.
    PROGRAM_TERMINATION_
    ERROR
    An error occurred while trying to obtain the return code of the external program. The R/3 system field SY-MSGV1 contains additional information on the problem.
    ILLEGAL_COMMAND
    The external command definition was modified "illegally". That is, the command was not modified by means of the maintenance function (transaction SM69).
    The modified command is registered in the system log in its substituted form. The message is registered under the system log ID "LC".
    OTHERS
    Catch any new exceptions added to this function module.
    Hope this will be useful.
    Sandro Lombardo

  • Calling GUI Scripting from ABAP program

    Is it possible to call GUI Scripting from ABAP and thus to use GUI Scripting as an alternative to CALL TRANSACTION?
    Is the class CL_JAVA_SCRIPT suitable to access GUI Scripting engine? Accessing ABAP data object would work as well in this case as i think. What SAP Logon and WAS releases are required? Is the 6.20 release sufficient for this case?
    I would appreciate if somebody could post an example.

    Hi,
    CL_JAVA_SCRIPT has nothing to do with SAPGUI Scripting.
    Calling SAPGUI Scripting API from ABAP could be possible for programmes experienced with OLE automation calls from ABAP coding.
    The hardest thing will be, to access the scripting engine handle as an entry point. Once you have a handle in your abap session, any api function can be invoked.
    Best regards
    Jens
    BTW: SAP testtool eCATT does call SAPGUI-Scripting from ABAP.

  • Call VB Script From ABAP Program

    Hi,
    I need to call a VBS program from an abap program.  This abap will run on both 4.6 and 4.0.
    I would be very grateful for any suggestions on how this can be done.
    Thanks and Kindest Regards
    Danielle

    data: commandline(1000).
    commandline = v_vbs_filename. "complete path of vbs file
      call function 'WS_EXECUTE'
           exporting
                commandline    = commandline
                program        = 'WSCRIPT.EXE'
           exceptions
                frontend_error = 1
                no_batch       = 2
                prog_not_found = 3
                illegal_option = 4
                others         = 5.
      if sy-subrc <> 0.
        raise execution_failed.
      endif.
    Raja

  • Call to WS from abap program

    Hi,
    I Create WS in BE1 (Server ) and i want to call it explicitly via Code from other backend BE2 (Client) .
    I followed  this procedure
    1. Create WS on the Target system (in the Server).
    2. Generate proxy on the client (in the client).
    3. Create logical port Via Lpconfig (in client).
    I use this code to call to the service :
    DATA:  lv_port_name          TYPE srt_lp_name,
           lv_text               TYPE string,
           lt_return             TYPE bapirettab.
    DATA: lref_client_proxy TYPE REF TO z_ser_test_perf,
          in TYPE  z_ser_tst_per,
          out TYPE z_ser_tst_per_r.
    * Get Default Logical Port for Proxy
    CONSTANTS: lc_proxy TYPE srt_lp_proxyclass VALUE 'ZHCO_SER_T_PER'.
    in-user = 'AST'.
    in-work_id = '00570538637'.
    CALL METHOD cl_srt_lp_maintenance=>get_default_port_by_proxy
      EXPORTING
        proxyclass = lc_proxy
      RECEIVING
        lp_name    = lv_port_name.
    TRY.
        CREATE OBJECT lref_client_proxy
          EXPORTING
            logical_port_name = lv_port_name.
      CATCH cx_ai_system_fault.
    ENDTRY.
    TRY.
        CALL METHOD lref_client_proxy->z_tst_performance
          EXPORTING
            input  = in
          IMPORTING
            output = out.
    catch CX_AI_SYSTEM_FAULT into lr_error.
    lv_message = lr_error->get_text( ).
      CATCH cx_ai_application_fault.
    ENDTRY.
    In the method lref_client_proxy- i get exception :
    SOAP:14 Unexpected element -el=definitions ns=http://schemas.xmlsoap.org/wsdl/
    Does anyone have an idea how to avoid this  exception?
    P.S.
    I also create logical port via Soamanager but the first and the second method don't find it (i saw the entry in table SRT_CFG_CLI_ASGN ) and when i call to the third method alone i get dump for null reference.
    Best Regards
    Nina
    Edited by: Nina C on May 5, 2009 10:33 PM

    hi , nina
    the null poitnexception is that u r referring to the logicl port while creatign the object
    dotn pass anything , just use
    create object  proxy name
    Data : l_proxy type ref to ZSTRCO_ZSTARWEB,
            lo_sys_exception   TYPE REF TO cx_ai_system_fault,
           out type ZSTRZSTAR_RESPONSE,
           in type ZSTRZSTAR,
           it_controller type PRXCTRLTAB,
           wa_controller type prxctrl.
           create object l_proxy.
            in-a =    8.
            in-b = 4.
          TRY.
           CALL METHOD l_proxy->zstar
             EXPORTING
               input  = in
             IMPORTING
               output = out
    .        CATCH cx_ai_system_fault into lo_sys_exception .
           ENDTRY.
    write : out-c.
    i never used logical port , i created it but never used
    just instantiate the object and pass the input an dout put paramters , the logical port will be picked form run time
    and u can test the proxy from se80
    1) just double click on th eproxy name in SE80 , u can select the package in which u created the pproxy  , then under enterprise services --> client proxy and ur proxy name
    just test from there u get a pop up of  test service consumer and select the logical port from  drop down and seelct the generate template data  and execute it , u will get a screen where the input values will be autmatically proposed and then u execute from there u wil get the output.
    2) seond method is when in SE80 when u select the proxy u can see  the prxy name in the prpoerties which will be        Proxy Class (generated) , then test this class  by using execute button  u get a screen where u haev to instantiate the class , give the logical port name and click the instance button, then ur method wil be shown execute it and u get ur input paramters just clikc them, give the values and come back and execute u will get the output
    hope it solves ur prob
    regards
    afzal

  • Is it possible to call COM objects from ABAP?

    Hi guys, is it possible?
    Can you also provide me a little sample code?
    Thanx a lot!
    Peter

    I think OLE is possible through ABAP
    as in
    INCLUDE OLE2INCL.
    DATA EXCEL TYPE OLE2_OBJECT.
    CREATE OBJECT EXCEL 'Excel.Application'.
    FREE   OBJECT EXCEL.
    i dnt know much about COM ..
    there maybe somthing similar to this
    hope this helps
    Award forum points to helpful answers

  • Calling oracle procedure from ABAP program

    There is a requirement to call the oracle stored procedure with some input parameter from ABAP program.
    Suppose we have order number which is entered by the user in ABAP program.
    This order number needs to be passed to oracle stored procedure as an input parameter in the same ABAP program.
    We can call the oracle stored procedure without parameter using the following syntax
    exec sql
    execute procedure <procedure name>
    end exec.
    But do not know how to execute the oracle stored procedure with some input parameter?

    Apologies , following is the correct code.
    This will definetly solve your problem.
    DATA scarr_carrid TYPE scarr-carrid.
    SELECT-OPTIONS s_carrid FOR scarr_carrid NO INTERVALS.
    DATA s_carrid_wa LIKE LINE OF s_carrid.
    DATA name TYPE c LENGTH 20.
    TRY.
        EXEC SQL.
          CREATE FUNCTION selfunc( input CHAR(3) )
            RETURNING char(20);
            DEFINE output char(20);
            SELECT carrname
                   INTO output
                   FROM scarr
                   WHERE mandt  = '000' AND
                         carrid = input;
            RETURN output;
            END FUNCTION;
        ENDEXEC.
        LOOP AT s_carrid INTO s_carrid_wa
                         WHERE sign = 'I' AND option = 'EQ'.
          TRY.
             EXEC SQL.
                EXECUTE PROCEDURE selfunc( IN  :s_carrid_wa-low,
                                           OUT :name )
              ENDEXEC.
              WRITE: / s_carrid_wa-low, name.
            CATCH cx_sy_native_sql_error.
              MESSAGE `Error in procedure execution` TYPE 'I'.
          ENDTRY.
        ENDLOOP.
        EXEC SQL.
          DROP FUNCTION selfunc;
        ENDEXEC.
      CATCH cx_sy_native_sql_error.
        MESSAGE `Error in procedure handling` TYPE 'I'.
    ENDTRY.
    Reward points if usefull.
    Thanks and regards,
    Veerendranath.

  • 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

  • Is it possible to call website from ABAP Program?

    Hi Experts,
           Is it possible to call website from ABAP Program?
    It is very Urgent Help me.
    Regards,
    Ashok.

    Hi,
    Check the following program:
    REPORT ZURL NO STANDARD PAGE HEADING.
    DATA: BEGIN OF URL_TABLE OCCURS 10,
    L(25),
    END OF URL_TABLE.
    URL_TABLE-L = 'http://www.lycos.com'.APPEND URL_TABLE.
    URL_TABLE-L = 'http://www.hotbot.com'.APPEND URL_TABLE.
    URL_TABLE-L = 'http://www.sap.com'.APPEND URL_TABLE.
    LOOP AT URL_TABLE.
      SKIP. FORMAT INTENSIFIED OFF.
      WRITE: / 'Single click on '.
      FORMAT HOTSPOT ON.FORMAT INTENSIFIED ON.
      WRITE: URL_TABLE. HIDE URL_TABLE.
      FORMAT HOTSPOT OFF.FORMAT INTENSIFIED OFF.
      WRITE: 'to go to', URL_TABLE.
    ENDLOOP.
    CLEAR URL_TABLE.
    AT LINE-SELECTION.
    IF NOT URL_TABLE IS INITIAL.
      CALL FUNCTION 'WS_EXECUTE'
           EXPORTING
                program = 'C:\Program Files\Internet Explorer\IEXPLORE.EXE'
                commandline     = URL_TABLE
                INFORM         = ''
              EXCEPTIONS
                PROG_NOT_FOUND = 1.
      IF SY-SUBRC <> 0.
         WRITE:/ 'Cannot find program to open Internet'.
      ENDIF.
    ENDIF.
    Regards,
    Bhaskar

  • Call to Java web service from abap program

    HI,
    I want to call to Java WS from abap program and i read some post how to do that in release of NW 6.4 but I want to know what is the simplest way to do that in release 7.0 .
    Many Thanks,
    Nina

    Hi Uwe,
    Thank you.
    I have WSDL or URL how i can call to them ,in the example that you send i don't find the place that it called.
    Do i have to create proxy for that ?
    BR
    Nina

  • Execute webdynpro from abap program and return to the caller program

    Guys,
    I have a question here.
    I know there is a way to call an abap webdynpro application from normal abap program by either using a class method, or use a function module WDY_EXECUTE_IN_PLACE by providing
    the webdynpro application or using CALL TRANSACTION statement.
    But, is there anyways that we can call the webdynpro application from abap program by supplying data to the webdynpro and display to the user from the portal, and then
    once the user do some manipulation on the data, can we transfer back the data to the caller abap program?

    hey ,
    you can pack any web-dynpro program in tranasaction code and run it from R/3 and not via portal  :
    search in " SAPTECHNICAL" how to do so  - for some reason i cant post a link here
    than you can use call transaction .
    regards
    ASA

  • Call Java Program from ABAP Program

    Dear all,
    In our scenario, we need to let ABAP call services provided by a standalone Java program. From online help I found some overview introduction and I'd make the called program a registered program in a RFC with type "T" (TCP/IP Connection). Can anybody give some concrete documentation? A step-by-step guide would be greatly appreciated.
    Best Regards
    Jerome

    check this thread
    Re: Calling Java API from ABAP using JCo

  • Calling external web service from ABAP Program

    Hi All,
    Can somebody point me to the documentation where how to call an external (3rd party) web service from ABAP program is explained?
    Thanks & Regards,
    -Smita

    which version of R/3 you are using. if you are on was 6.40 its very simple, there are delivered tools to generate client proxy for consuming webservice. if you are on wa 6.20 you can use cl_http_client to achieve the same. check out the following weblogs.
    /people/durairaj.athavanraja/blog/2005/07/12/send-sms-to-india-from-abap
    /people/thomas.jung3/blog/2005/05/13/calling-webservices-from-abap-via-https
    /people/thomas.jung3/blog/2004/11/17/bsp-a-developers-journal-part-xiv--consuming-webservices-with-abap
    Regards
    Raja

  • How do I get a variable, or object from ABAP STACK.

    Hey Gurus,
    How do I get a variable, or object from ABAP STACK.
    Example: I start my FM. I can see in the ABAP STACK the variable I need. I can see the object; I could use to get my variable. I need to use it in my FM; however I need to reference it in the run time. How do I do that?
    Is there a method I can use for reading ABAP STACK?
    Do I just use command: get reference of u2026?
    Does anyone have an example code?
    Basis version 7
    Thanks in advance
    Martin

    Ah, you mean you want to access a variable from another program in the call stack, yes?  You can do this using field symbols, but please don't try to change a value while doing this, it could really screw things up. 
    this example, is using two programs, where the second is accessing variables of the first program.  Basically just notice that we are using the program name and the variable name when assigning the field symbol.
    report zrich_0006 .
    tables: mara.
    parameters: p_matnr type mara-matnr..
    data: matnr type mara-matnr.
    data: imarc type table of marc with header line.
    matnr = p_matnr.
    select * from marc into table imarc up to 10 rows
                   where matnr = p_matnr.
    perform in in program zrich_0007.
    report zrich_0007 .
    *       FORM in                                                       *
    form in.
      data: field(50).
      data: xmarc type marc.
      field-symbols: <matnr>.
      field-symbols: <imarc> type marc_upl_tt.
    * Assign an individual variable
      field = '(ZRICH_0006)matnr'.
      assign (field) to <matnr>.
    * Assign an internal table
      field = '(ZRICH_0006)IMARC[]'.
      assign (field) to <imarc>.
    * Write out your data
      write <matnr>.
      loop at <imarc> into xmarc.
        write: / xmarc-werks.
      endloop.
    endform.
    Regards,
    Rich Heilman

  • Trigerring workflows in an ABAP program

    Can somebody please tell me the best way to trigger a workflow in an ABAP program. And if possible please send me some sample code how it can be done. I need it urgently so if possible please reply to this ASAP.
    Thanks in advance,
    Mohsin

    Check the following Code to trigger the Workflow form custom program.
    Data for workflow trigger
      DATA: objtype    LIKE  swetypecou-objtype,
            objkey     LIKE  sweinstcou-objkey,
            event      LIKE  swetypecou-event,
            event_container LIKE  swcont OCCURS 0 WITH HEADER LINE.
      objtype = 'ZBUS1001'. "Material [sub object of BUS1001]
      MOVE v_wfmatnr TO objkey. "V_WFMATNR is material number
      event = 'CreatePLMMaterial'."Custom Event defined in
    ZBUS1001 [Tcode SWO1]
      REFRESH event_container.
    *Following are the Event parameters required in the *Workflow
      swc_set_element event_container 'Attachment' v_wfattachment.
       swc_set_element event_container 'Material' v_wfmatnr.
      swc_set_element event_container 'TisGroup' v_wftisgroup.
      swc_set_element event_container 'SchDate' v_schdate.
      CALL FUNCTION 'SWE_EVENT_CREATE'
           EXPORTING
                objtype           = objtype
                objkey            = objkey
                event             = event
           TABLES
                event_container   = event_container
           EXCEPTIONS
                objtype_not_found = 1
                OTHERS            = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      COMMIT WORK.
    In TCode SWETYPV Create entry for Object type Event and Workflow ID.
    In my case Object type is ZBUS1001
    Event CreatePLMMaterial
    Rec type = <Workflow ID>

Maybe you are looking for