Calling a custom tcode using abap class from workflow

Hi Experts,
I have a requirement of calling a custom tcode from my workflow.
For this i have created a class zcl_test ( has if_workflow ) .
I created a method ztest which will call the tcode.
CALL TRANSACTION 'ZTX'.  ( My tcode just has 1 input field, for testing purpose )
Then i created a task in whichi hv used this abap class and method.
But the tcode does not run when i execute the workflow.
Please help.
Thank You,
Radhika Vadher.

Radhika Vadher 
use the sample code to get the data from the task container into the ABAP class
DATA :
         w_ref        TYPE  REF TO      if_swf_run_wim_internal,
         w_ref_cnt  TYPE  REF TO      if_wapi_workitem_context,
          w_wi_ref   TYPE  REF TO      if_swf_ifs_parameter_container.
TRY.
    CALL METHOD cl_swf_run_wim_factory=>find_by_wiid
      EXPORTING
        im_wiid     = w_wiid
      RECEIVING
        re_instance = w_ref.
  CATCH cx_swf_run_wim_enq_failed .
  CATCH cx_swf_run_wim_read_failed .
  CATCH cx_swf_run_wim .
ENDTRY.
CALL METHOD w_ref->get_workitem_context
  RECEIVING
    re_ctx = w_ref_cnt.
CALL METHOD w_ref_cnt->get_wi_container
  RECEIVING
    re_container = w_wi_ref.
and the w_wi_ref is having a method GET use that method to get the values of the task container into the ABAP class.

Similar Messages

  • How to use ABAP Class to modify Web Query Result ??

    Hi all !
    We are using Web Templates to display our Query.
    What I would like to do ( and seems a really important issue for our users! ) is to have a "PAGE BREAK" everytime the value of a charateristics change in the report
    For Example :
    -Page 1-
    Division     Project
       A               1
                        2
                        3
    -Page 2-
    Division     Project
       B               1
                        2
                        3
    and so on....
    I read threads about using ABAP CLASS but no example what so ever...
    We are presently under BW 3.1 but are considering upgrading to 7.0 by the end of the year so if there is a solution to my problem on either version i'd like to know.
    If anyone has any information about how I can do this it would be most appreciated
    Thx
    JB.

    Hi Yong,
    Ravi is right, first check the blogs by Jocelyn, and if you still have specific questions you can ask them. I have used ABAP classes in workflow and I know Mike Pokraka tries to use classes exclusively.
    Regards,
    Martin

  • ALV using ABAP Classes and Objects

    Hi All,
    I am trying to print the values in my internal table using ALV, using ABAP classes and objects. Here the title for columns are picked based on the title specified in the data element. I want to set the title of my columns by my own. how to achieve this ?. Please provide me a sample code if possible.
    thanks & regards,
    Navneeth.K

    Hello Navneeth
    The following sample report shows how to build and modify a fieldcatalog (routine <b>BUILD_FIELDCATALOG_KNB1</b>).
    *& Report  ZUS_SDN_ALVGRID_EVENTS
    REPORT  zus_sdn_alvgrid_events.
    DATA:
      gd_okcode        TYPE ui_func,
      gt_fcat          TYPE lvc_t_fcat,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_grid1         TYPE REF TO cl_gui_alv_grid.
    DATA:
      gt_knb1          TYPE STANDARD TABLE OF knb1.
    PARAMETERS:
      p_bukrs      TYPE bukrs  DEFAULT '2000'  OBLIGATORY.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
            IMPORTING
              e_row_id
              e_column_id
              es_row_no
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_hotspot_click.
    *   define local data
        DATA:
          ls_knb1     TYPE knb1,
          ls_col_id   TYPE lvc_s_col.
        READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row_id-index.
        CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
        CASE e_column_id-fieldname.
          WHEN 'KUNNR'.
            SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
            SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
            CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
          WHEN 'ERNAM'.
    *        SET PARAMETER ID 'USR' FIELD ls_knb1-ernam.
    *        NOTE: no parameter id available, yet simply show the priciple
            CALL TRANSACTION 'SU01' AND SKIP FIRST SCREEN.
          WHEN OTHERS.
    *       do nothing
        ENDCASE.
    *   Set active cell to field BUKRS otherwise the focus is still on
    *   field KUNNR which will always raise event HOTSPOT_CLICK
        ls_col_id-fieldname = 'BUKRS'.
        CALL METHOD go_grid1->set_current_cell_via_id
          EXPORTING
            is_row_id    = e_row_id
            is_column_id = ls_col_id.
      ENDMETHOD.                    "handle_hotspot_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT        * FROM  knb1 INTO TABLE gt_knb1
             WHERE  bukrs  = p_bukrs.
    * Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent                      = cl_gui_container=>screen0
          ratio                       = 90
        EXCEPTIONS
          OTHERS                      = 6.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Create ALV grid
      CREATE OBJECT go_grid1
        EXPORTING
          i_parent          = go_docking
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Set event handler
      SET HANDLER:
        lcl_eventhandler=>handle_hotspot_click FOR go_grid1.
    * Build fieldcatalog and set hotspot for field KUNNR
      PERFORM build_fieldcatalog_knb1.
    * Display data
      CALL METHOD go_grid1->set_table_for_first_display
        CHANGING
          it_outtab       = gt_knb1
          it_fieldcatalog = gt_fcat
        EXCEPTIONS
          OTHERS          = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Link the docking container to the target dynpro
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = syst-repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * ok-code field = GD_OKCODE
      CALL SCREEN '0100'.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE gd_okcode.
        WHEN 'BACK' OR
             'END'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  BUILD_FIELDCATALOG_KNB1
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_fieldcatalog_knb1 .
    * define local data
      DATA:
        ls_fcat        TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
          i_structure_name             = 'KNB1'
    *     I_CLIENT_NEVER_DISPLAY       = 'X'
    *     I_BYPASSING_BUFFER           =
    *     I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        EXCEPTIONS
          inconsistent_interface       = 1
          program_error                = 2
          OTHERS                       = 3.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      LOOP AT gt_fcat INTO ls_fcat
              WHERE ( fieldname = 'KUNNR'  OR
                      fieldname = 'ERNAM' ).
        ls_fcat-hotspot = abap_true.
        ls_fcat-scrtext_s  = '<short text>'.  " short text of column
        ls_fcat-scrtext_m = '<medium text>'.  " medium text of column
        ls_fcat-scrtext_l   = '<long text>'.  " longtext text of column
        ls_fcat-tooltip      = '...'.  " ALV control: Tool tip for column header
        ls_fcat-coltext    = '...'.   " ALV control: Column heading
        MODIFY gt_fcat FROM ls_fcat.
      ENDLOOP.
    ENDFORM.                    " BUILD_FIELDCATALOG_KNB1
    Regards
      Uwe

  • Function module equivalent to SWE_EVENT_CREATE while using ABAP classes

    Hi there,
    I used to use SWE_CREATE_EVENT to fire the events linked to my BOR objects, in order to start certain workflows.
    Now I am using ABAP classes within the WorkFlows, and the name of the classes MUST (in my case) be longer than 10 characters, and SWE_EVENT_CREATE is cutting the name so it does not work
    Do you know any FM equivalent to start an event from a ABAP class (SE24) object?
    I have tried to use SAP_WAPI_START_WORKFLOW, but I cannot find the way to include my object in the container. Any ideas on this point would be welcome as well
    Thanks so much,
    Miguel

    Thanks for such a quick reply,
    You were right. I actually did follow Jocelyn's blogs, but somehow I skipped the raising event section.
    Just for information, the URL with the solution to this problem is:
    /people/jocelyn.dart/blog/2006/07/27/raising-abap-oo-events-for-workflow
    Have a good one

  • Urgent: how to import or transport abap class from dev to q

    How to import/transport custom abap class from dev to q.
    Any suggestions points will be awarded.
    Thanks in advance.
    MK

    hi M K,
    try SE24, your class, and go to menu 'Go to' -> object directory entry,
    click pencil icon and give your package name, will raise request.
    SE10 to release and STMS from prod to import.
    hope this helps.

  • Hide a specific cell using ABAP classes

    Hi Experts,
    Is there a way to hide a specific cell using ABAP classes for reports?
    Marcelo

    Hello Thomas Daly
        I never saw a way to grant permission to a List, the only way I ever saw a list get its permissions is thru
    the group site it resides in, the Discussion Board is the problem in this case (it has preconfigure permissions but they seem more like properties that you select the value from RadioButtons).  However, ms-addnew gets rid of the Add new link but it
    gets rid of the one in the Discusson Board too because Discussion Board falls in the category of List.
        In other words ms-addnew in the master got rid of all of the Add new items, link etc as hoped but now
    I can't add to the Discussion Board.
        I am alright with a hack (I am open to any suggestions) that would work if it works but, the List's I am referring to are all "Links" in the Quick Launch so I dont know how you would be able to apply the jquery, how would you apply the
    jquery to a Links in a Quick Launch?
        Thank you
        Shabeaut

  • Can a transaction be called in background dynamically using ABAP program??

    Hi Experts,
    Can a transaction be called in background dynamically using ABAP program without BDC???
    Regards,
    Mansi.

    u can create job dynamically through programming..Try this sample code..
    data: jobname like tbtcjob-jobname value
                                 ' TRANSFER TRANSLATION'.
    data: jobcount like tbtcjob-jobcount,
          host like msxxlist-host.
    data: begin of starttime.
            include structure tbtcstrt.
    data: end of starttime.
    data: starttimeimmediate like btch0000-char1.
    Job open
      call function 'JOB_OPEN'
           exporting
                delanfrep        = ' '
                jobgroup         = ' '
                jobname          = jobname
                sdlstrtdt        = sy-datum
                sdlstrttm        = sy-uzeit
           importing
                jobcount         = jobcount
           exceptions
                cant_create_job  = 01
                invalid_job_data = 02
                jobname_missing  = 03.
      if sy-subrc ne 0.
                                           "error processing
      endif.
    Insert process into job
    SUBMIT zreport and return               << Here it is a static call but u can make it dynamic
                    with p_param1 = 'value'
                    with p_param2 = 'value'
                    user sy-uname
                    via job jobname
                    number jobcount.
      if sy-subrc > 0.
                                           "error processing
      endif.
    Close job
      starttime-sdlstrtdt = sy-datum + 1.
      starttime-sdlstrttm = '220000'.
      call function 'JOB_CLOSE'
           exporting
                event_id             = starttime-eventid
                event_param          = starttime-eventparm
                event_periodic       = starttime-periodic
                jobcount             = jobcount
                jobname              = jobname
                laststrtdt           = starttime-laststrtdt
                laststrttm           = starttime-laststrttm
                prddays              = 1
                prdhours             = 0
                prdmins              = 0
                prdmonths            = 0
                prdweeks             = 0
                sdlstrtdt            = starttime-sdlstrtdt
                sdlstrttm            = starttime-sdlstrttm
                strtimmed            = starttimeimmediate
                targetsystem         = host
           exceptions
                cant_start_immediate = 01
                invalid_startdate    = 02
                jobname_missing      = 03
                job_close_failed     = 04
                job_nosteps          = 05
                job_notex            = 06
                lock_failed          = 07
                others               = 99.
      if sy-subrc eq 0.
                                           "error processing
      endif.
    Regards,
    JOy.

  • How to use CustomItem class from MIDP2.0 in MIDP1.0

    Hello,
    I am using MIDP1.0 and now I want to use CustomItem class from MIDP2.0.
    Is it possible to use the classes from MIDP2.0 in MIDP1?

    Hello,
    I am using MIDP1.0 and now I want to use CustomItem class from MIDP2.0.
    Is it possible to use the classes from MIDP2.0 in MIDP1?

  • Reg : Using ABAP OO in Workflow

    Hi All,
    I have very simple question and this is the place where I am still lacking in workflow?
    1. How do I identify when to use ABAP class and when to use BOR in workflow?
    2. How do I identify which class to be used? Do we have any similar to BOR (SWO3) for ABAP class as well?
    3. Anything to be kept in mind while working with ABAP classes?
    Thanks & Regards,
    Raj

    How do I identify when to use ABAP class and
    when to use BOR in workflow?
    Upto my knowledge it depends on your thinking, but personnaly I feel that instead of creating a BOR, It is very easy to maitain Business classes ( When a class is used in workflow then we call it as Business Class , because it handles the business process )..
    How do I identify which class to be used?
    Do we have any similar to BOR (SWO3) for ABAP class as well?
    When ever you find a interface IF_WORKFLOW in the class definition under interface tab then you can make use of that class in the workflow  steps.
    Anything to be kept in mind while working with ABAP classes?
    [Check the blog series of Joycelin|http://www.sdn.sap.com/irj/scn/advancedsearch?query=joycelin+]

  • Include in ABAP class for Workflow

    Hi,
    In order to use BOR macros inside ABAP class, (From SAP help) came to know that we need to use include <cntn02> .
    How to add this include to ABAP class for workflow?
    Regds,
    Akshay

    Hi Akshay,
    Slight difference, I said "keeping the class clean of BOR <i>code</i>". By all means use BO's in the class: basically create a ZCL_MATERIAL, and use BUS1001 as an attribute (I use a naming convention BO_* for these). As long as it's the right type (SIBFLPORB I think - no system handy right now), and the key values are populated correctly the system will instantiate it as necessary. So in WF I can refer to ZCL_MATERIAL.BO_MATERIAL whenever I need any of the BO's functionality.
    You are correct though, creating a proper business class which you can instantiate such as material does involve a fair bit of effort and coding to set up. e.g. my last project I ended up creating one ZBOR subtype because all I needed was one new attribute - definitely not worthwhile creating a new class for. (USR01.zEmailAddress for what it's worth).
    I've said before somewhere, it's not without pain, so if you're under time pressure etc, then it may be better to do whatever's quickest. There's nothing wrong with using BOR macros, it will still work for quite a few versions. I just meant to say that pure class(y) code is a preferred way to go if it makes sense to do so. This is not always the case.
    Hope that helps,
    Mike

  • ABAP Classes in Workflow

    I am planning to use ABAP classes instead of BOR Objects in Workflow and would appreciate
    1) any elaborate documentation on the use of ABAP classes in workflow (SAP help has very limited documentation)
    2) comparision of using either approach with advantages of using ABAP classes over the use of BOR Objects and limitations of using ABAP classes,if any.
    3) any examples of ABAP classes used in Projects
    Thanks for your help.
    Saurabh

    Hi,
    check the wiki, in the design and development part are listed all of Jocelyn darts blogs about OO in workflow:
    <a href="https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/2.DesignandDevelopment&">https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/2.DesignandDevelopment&</a>
    regards, Rob Dielemans

  • Launching webdynpro ABAP application from workflow task  (without UWL)

    Hello,
    How can i start webdynpro ABAP application from workflow without portal?
    Workflow and webdynpro ABAP are located on the same system.
    I assume it must be possible without transaction SWFVISU.
    thanks
    Regards
    Paul

    First you need to define a external service then you have to generate a task from this external service and then you need to include this task id in you workflow for a ACTIVITY step then this step can be either background or can be assigned to any agent
    you have to make use the below two Txn
    WF_HANDCUST and WF_EXTSRV

  • Calling CRM ABAP class from SAP Jco

    Hi,
    In CRM,  there is a class interface called CL_CRM_DOCUMENTS with static methods. I need to make call to these methods from my Java application that uses JCo. Is it possible to call ABAP methods from JCo? Any help in this regard will be highly appreciated.
    Thanks,
    Praneeth

    Hello Praneeth,
    CL_CRM_DOCUMENTS problem  -- URGENT!!
    Activity Mgmt - Attachment
    See if this helps.
    regards,
    Muralidhar Prasad.C

  • Create an event using abap class (transaction swetypv)

    Hi,
    I’m trying to create an event by using an abap class.
    The purpose is to update po reqs using BAPI_REQUISITION_CHANGE upon saving a sales order. The exit is called on saving a sales order MV45AFZZ.
    In MV45AFZZ the method cl_swf_evt_event is called and the object type, event, objkey and obj cat is exported.
    Object Type = ZBUS203200
    Event = Z_TRAD_ORDER_CHANGE_OO
    I created my class ZCL_UPDATE_PUR_REQ (by copying CL_SWF_RUN_WIM_HANDLER
    And using interface name BI_EVENT_HANDLER_STATIC )
    In /nswetypv I assigned Class ZCL_UPDATE_PUR_REQ
    to Object Type ZBUS203200
    And Event Z_TRAD_ORDER_CHANGE_OO.
    All that works fine except for passing in the objectkey.
    In Class ZCL_UPDATE_PUR_REQ
    Method BI_EVENT_HANDLER_STATIC~ON_EVENT
    When I go to create a parameter for object key, I get the message
    ‘Parameters/exceptions of inherited methods or events cannot be changed’.
    Has anyone any suggestions for how I can get the object key into the method call BI_EVENT_HANDLER_STATIC~ON_EVENT?
    Thanks
    Ann

    Hi Johann,
    You don't need a class to do the job if you are on a 6.10 or higher system. Use command CALL TRANSFORMATION to create an XML from an internal table.
    Regards,
    John.

  • Create an event using abap class

    Hi,
    I’m trying to create an event by using an abap class.
    The purpose is to update po reqs using BAPI_REQUISITION_CHANGE upon saving a sales order.  The exit is called on saving a sales order MV45AFZZ.
    In  MV45AFZZ the method cl_swf_evt_event is called and the object type, event, objkey and obj cat is exported.
    Object Type    = ZBUS203200              
    Event          = Z_TRAD_ORDER_CHANGE_OO  
    I created my class ZCL_UPDATE_PUR_REQ (by copying CL_SWF_RUN_WIM_HANDLER    
    And using interface name BI_EVENT_HANDLER_STATIC   )
    In /nswetypv I assigned Class  ZCL_UPDATE_PUR_REQ
    to     Object Type     ZBUS203200                 
    And   Event              Z_TRAD_ORDER_CHANGE_OO.
    All that works fine except for passing in the objectkey.
    In Class ZCL_UPDATE_PUR_REQ 
    Method  BI_EVENT_HANDLER_STATIC~ON_EVENT
    When I go to create a parameter for object key, I get the message
    ‘Parameters/exceptions of inherited methods or events cannot be changed’.
    Has anyone any suggestions for how I can get the object key into the method call BI_EVENT_HANDLER_STATIC~ON_EVENT?
    Thanks
    Ann

    Hi Johann,
    You don't need a class to do the job if you are on a 6.10 or higher system. Use command CALL TRANSFORMATION to create an XML from an internal table.
    Regards,
    John.

Maybe you are looking for

  • Mesage Adobe Dreamweaver CC has stopped working

    I am on Windows 7.  Other apps like Adobe illustrator or fireworks open fine.  My Dreamweaver icon on Creative Cloud app list, had an update, which said windows 8 only.  I just ran a complet update of creative cloud app itself, no problems.  Previous

  • Reverse a cancelled invoice document

    Had a user accidentally cancel an accounting document linked to a outbound delivery following the goods issue process. Apparently, the document was put back into a queue and reprocessed, which is fine for us, but is there a way to reverse the cancell

  • Select a range of sibling nodes??

    Given the following XML <ROWSET> <ROW> <FAAAAA1>1</FAAAAA1> <FAAAAA2>2</FAAAAA2> <FAAAAA3>3</FAAAAA3> <FAAAAA4>4</FAAAAA4> <FAAAAA5>5</FAAAAA5> </ROW> </ROWSET> What is the XSLT syntax to select elements FAAAAA2 to FAAAAA4???

  • WGB with AP1310 and LAP with WLC in 4.1

    I make a WGB with a autonomous AP1310 and an LAP manage by a WLC2006 in 4.1 version. The bridge is up and working, but it's very strange: - The bridge is up and i can always ping the IP of the BRI interface of the 1310. - When the bridge go up, i see

  • Bug in Procedure testing

    SQL Developer 3.1.0.7 I created a new procedure with a package. Everything compiles ok, no errors. When I try to "run" the procedure, there is no capability to enter paraameters (in my case 2 parameters are needed). I checked this functionality in 1.