Function module - object - workflow(complicated to explain:))

Hello,
I have a problem.
I created in se37 the function ZRR_ACTORS. I have as the import parameter PRNUMBER with type BAPIEBANC-PREQ_NO. As an export parameter i have RECIPIENT with type BAPIEBANC-REASON_BLOCKING( i have not found an appropriate type for the recipient that works in a function module for the object, so i used this..i do not think that is the problem).
The code is:
data:begin of gs_eban,
  menge type eban-menge,
  preis type eban-preis,
  end of gs_eban,
  gt_eban like table of gs_eban,
  gv_sum type i,
  gv_aux  type SWD_MRCPNT.
select menge preis from eban into TABLE gt_eban where banfn = prnumber.
loop at gt_eban into gs_eban.
  gv_sum = gv_sum + gs_eban-menge * gs_eban-preis.
  endloop.
if gv_sum > 20.
    select single recipient from zteam_approvers into gv_aux where zuser = 'xxxx.
    else.
    select single recipient from zteam_approvers into gv_aux where zuser = 'yyyy'.
      endif.
recipient = gv_aux.
As you probably see, i am sending this function the purchase requisition number. In the function I am calculating the value of the purchase requisition. If the value is bigger then 20 i want the recipient to be the email adress of the user xxxx. Else the other email. zteam_approvers is a table with users and their emails.
When i test this function everything is ok.
I created subtype for object BUS2015(purchase requisition), called ZBUS2015. Here i created a method which uses the function ZRR_ACTORS. I released it and after that i selected in swo1 BUS2015 and delegated ZBUS2015. So now when i test object BUS2015, i can use method ZRR_ACTORS which contains the function module ZRR_ACTORS.
If i test this object, the method ZRR_ACTORS works fine. I give the method the number of the purchase requisition and it returns me the user xxxx or yyyy.
Now, i created a workflow. In this workflow i want to send an email to the user xxxx or yyyy. So i have to execute the function ZRR_ACTORS. I create an activity(zrr_activity) in the new workflow. In it, i create a new task(zrr_task) in the activity with object category BUS2105 and method ZRR_ACTORS. I am setting this method as a background method, because after the execution of the function i want to create a Send email step, with the recipient being the one of the emails.
My problem is the binding. In the workflow container i set the PRNUMBER as an import parameter and the Recipient as an export parameter.
In the binding of the step(zrr_activity) i set the following bindings:
Workflow                           STEP
&PRNUMBER&  ->  &PRNUMBER&
&BUS2105&  ->  &_WI_OBJECT_ID&
&RECIPIENT&  <-  &RECIPIENT
If i click in the activity, in the task i created(zrr_task), in the object method i set the bindings:
Task                                 Method
&PRNUMBER&  ->  &PRNUMBER
&RECIPIENT&  <-  &RECIPIENT&
I run the workflow. Now i enter the PRNUMBER 0010000420, but it remains 10000420 (maybe this i because of the type PREQ_NO.) and execute.The task has the status In Process. I click on Workflow log, then on list with technical details, and then in the container, i see the Recipient is empty.
So, i think the function did not work properly. What do you think?
Thank you very much,
Efren
Edited by: Efren23 on May 30, 2011 7:31 PM

Hi Efren,
Go to transaction ST22 and check for any dump.
The work item is in process, so there will be a dump in the system.
The Function module parameters could be a problem.
ST22 transaction will give you details about the dump.
Thanks,
Viji.

Similar Messages

  • Requirement to call Function Module in Workflow

    Hi,
    I have been assigned to task wherein i have a requierement like this . I have created a workflow with step user decision with 2 options. Now the thing is that when user select one of option i need to call function module and based on result from
    workflow i need to done further processing. Since there is no event to trigger workflow i am using function module
    SAP_WAPI_START_WORKFLOW to trigger workflow .
    Kindly suggest me how would i call Function module in workflow. i.e. What are the ways( or by which step type facilitate
    me to call FM ) by which i should call FM and do further processing based on result.
    Thanks
    Parag

    Follow the below steps inorder to call a fucntion module from the workflow
    1. First you have to create either a business class or a Business object.... from SWO1 txn..
    2. Create a method in the BOR and while created the system will prompt a message that would you like to create by using any FM here you need to specify the name of the FM that you want to use in the workflow...
    3. ONce the method is created and the code will be generated automaticlaly by the system.. and then you have to create a standard task from PFTC txn..
    4. Once the task is created then you have to use the same task in the workflow.. by creating a activity step ...
    That's all..

  • Type RAW not accepted in function module for workflow

    Hi,
    this is a crazy thing for me:
    I like to start a workflow from a report.
    Usually will use the function module SWU_START_WORKFLOW".
    Usually this is no problem.
    Here is my current problem:
    One of the elements I have to transfer to workflow is defined with
    ZELEMENT like SXMSMGUID.
    SXMSMGUID is from type RAW.
    This type is not supported in the container element transfer.
    Tried to transfer it as CHAR.
    ZELEMENT type c,
    ZELEMENT = SXMSPEMAS-MSGGUID.
    So put the RAW element into a char element.
    Error in function module:
    Program error: ASSIGN with length 0 in program "SAPLSWA8".
    Error analysis
        An ASSIGN statement in the program "SAPLSWA8" contained a field symbol with
        length 0. This is not possible.
        length 0.
        This is not possible.
    I need that element to be transferred to the workflow.
    But how to solve that problem?
    How to move the RAW element readable into a char element (This type usually is no problem in the FM)
    Any ideas are welcome!
    Best regards
    Dirk

    ya i know that ..But I wanted to create a simple one..moreover the problem is not with bdc....It is with the function module interface..
    Also I want to ask a question that I had to define all the parameters (in the function module ) by data declaration statements in the function group top include..
    If i dont do that say the first error is when i write loop at idoc_contrl ..idoc_contrl is not declared by a data statement..So IO had to write a data statement:
    Idoc_contrl type table of edidc..I have seen that in other function modules (idoc inbound processing)  no such data declaration is done..

  • Check function modules in Workflows

    Hi,
    The requirement is that, I need to trigger a workflow based on a condition ,if the condition is true then WF 1 has to be triggerred if not then WF2 has to be trigerred, the requirement is that i need to implement check FMs for this, can anybody send me sample code on how to do this? and give me the step by step approach of how to configure this in the transaction SWETYPV and SWB_COND. please its urgent.
    Regards
    Narendiran Rathinavelu

    Hi,
    First create the two workflows. When you create a workflow if the WF is error free an automatic entry is made in the view of the tcode SWETYPV . now goto the tcode SWB_COND here goto the dropdown business objects and select all object types and then click the button in the application toolbar create new start condition.when u do that a new screen appears.Here u will find all the workflow templates.Click the template which u want to add a new condition to trigger.when u click it a new screen appears here u add the condition to trigger the workflow.
    Hope this helps.
    Reward useful answers.
    Regards,
    Shrita.

  • AVL in Function modul for WorkFlow

    I am doing an ALV in FM for a WF and I have three possible action there.
    VALID
    REFUSE
    CANCEL
    I want to put a value in my FM export parameter called action and end the FM.
    Then the WF use the parameter action to know which action have been chosen.
    But when I do exit or leave screen I return to the ALV.
    When I code leave program I terminate the FM without passing the value.
    Do you have any solution for me ?
    Thanks for help.
    Bertrand
    *&      Form  alv_user_command
    Gestion commande écran choix des métiers
    FORM alv_user_command  USING ucomm    LIKE sy-ucomm
                                 selfield TYPE slis_selfield.
      CLEAR w_action.
      CASE sy-ucomm.
        WHEN '&VAL'.
          w_action = 1.
          exit.
        leave screen.
         leave program
        WHEN '&REF'.
          w_action = 2.
        WHEN '&BACK'.
          w_action = 0.
      ENDCASE.
    ENDFORM.                    "alv_user_command

    Hi,
    you can try this..
    *& Form alv_user_command
    Gestion commande écran choix des métiers
    FORM alv_user_command USING ucomm LIKE sy-ucomm
    selfield TYPE slis_selfield.
    CLEAR w_action.
    CASE sy-ucomm.
    WHEN '&VAL'.
    w_action = 1.
    selfield-exit = 'X'.
    WHEN '&REF'.
    w_action = 2.
    WHEN '&BACK'.
    w_action = 0.
    ENDCASE.
    ENDFORM. "alv_user_command
    Now you can get what you want with selfield-exit = 'X'.
    Regards
    Vijay

  • How to use a BAPI function module in programs?

    Hi,
    I have developed a BAPI enabled Function module & object type in 4.7. I want to use it to retrieve data from table T001 in 4.7 and display the output in 5.0. I am not able to get the data into 5.0. Please suggest me how to do this.
    A program example would be appreciated.

    Hi Prabhu,
    Firstly to say Bapis are version independent though the version is changed it does nt effect .. But as u said u want to fetch the data frm 4.7 tht too from table t005 observe tht the table data is not independent it is dependent tht is the reason why u r able to call the bapi but not able to display the data here . hope u know the procedue to call it in editor ...So now try it and check tht wether data is present in tht 5.0 version table ...t005 . thn it will be solved..if at all it is not working thn it might be problem with the bapi business object u created might be wrong check...
    Regards,
    Sana.
    reward if useful ...

  • Function Module Call CONVERT_OTF_AND_FAX

    Hi,
    Could someone please explain how to use this FM, it is unable to generate a fax for me and I always get a conversion error in SOST, following is the code. I have searched this forum and internet and usage in standard SAP includes but still could not find a good example for this function module with all the parameters explained.
    So far I was able to get till this point, please let me know if I am missing anything -
    REPORT y_bcs_example_6.
    DATA:it_otf LIKE soli OCCURS 0 WITH HEADER LINE.
    DATA: la_fax  TYPE itcpp,
          l_faxok,
          lt_otf  TYPE TABLE OF itcoo.
    la_fax-tddevice = 'TELEFAX'.
    la_fax-tdgetotf = 'X'.
    la_fax-tdcover  = space.
    la_fax-tdimmed  = 'X'.
    la_fax-tdteleland = 'US'.
    la_fax-tdtelenum  = 'XXX-XXX-XXXX'.
    CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
      EXPORTING
        rqident              = '81228'
        desired_type         = 'OTF'
      TABLES
        buffer               = it_otf
      EXCEPTIONS
        no_such_job          = 1
        job_contains_no_data = 2
        selection_empty      = 3
        no_permission        = 4
        can_not_access       = 5
        read_error           = 6
        type_no_match        = 7
        OTHERS               = 8.
    CALL FUNCTION 'CONVERT_OTF_AND_FAX'
      EXPORTING
        faxoptions         = la_fax
        user               = sy-uname
    IMPORTING
       fax_ok             = l_faxok
    *   OFFICE_OBJID       =
    *   MSGID              =
    *   MSGNO              =
    *   MSGV1              =
    *   MSGV2              =
    *   MSGV3              =
    *   MSGV4              =
      TABLES
        otf                =  it_otf
    COMMIT WORK.

    I have found that I cannot publish a spool to any printer and expect CONVERT_OTFAND_FAX to do the OTF conversion and fax. Only some specific printers can be used for FAX ( I am still a bit fuzzy on how this works), I used LP01 to generate the spool and then used the function module CONVERT_OTF_AND_FAX to generate the output.
    The following code worked -
    DATA: it_otf LIKE soli OCCURS 0,
          la_fax  TYPE itcpp,
          l_faxok.
    la_fax-tddevice = 'TELEFAX'.
    la_fax-tddest   = 'LP01'.
    la_fax-tdcopies = 1.
    la_fax-tdgetotf = ''.
    la_fax-tdcover  = space.
    la_fax-tdimmed  = 'X'.
    la_fax-tddelete = 'X'.
    la_fax-tdteleland = 'US'.
    la_fax-tdtelenum  = 'XXX-XXX-XXXX'.
    CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
      EXPORTING
        rqident              = XXXX
        desired_type         = 'OTF'
      TABLES
        buffer               = it_otf
      EXCEPTIONS
        no_such_job          = 1
        job_contains_no_data = 2
        selection_empty      = 3
        no_permission        = 4
        can_not_access       = 5
        read_error           = 6
        type_no_match        = 7
        OTHERS               = 8.
    CALL FUNCTION 'CONVERT_OTF_AND_FAX'
      EXPORTING
        faxoptions         = la_fax
        user               = sy-uname
    IMPORTING
       fax_ok             = l_faxok
      TABLES
        otf                =  it_otf
    COMMIT WORK.

  • Select Statement or Function Module

    Hi all,
    I have lakhs of records in my database.When I am using the SAP standard function module C1F2_SUBSTANCES_READ for retreiving data it is taking time.I know all the data base tables .Shall I use to retreive data using select statements instead of the mentioned SAP standard function module.Could any one please explain which is best method to retrieve huge data and also explain reason?
    Thanks and Regards,
    Kanth

    Hi Shiva,
    If your Sure about exactly what data you want to fetch from the database, I would follow the below process.
    1) I would search if there is any standard function module or Bapi to do this... The reason why i do this is becuase as SAP has created those standard function modules or Bapi, the first advantage would be the program has good performance ( Moreever it also depends on how do you handle that in your program ).
    Moreover it handles varies business functionalities and authorizatiions etc..
    2)  If i dont find any standard function module or Bapi then if the data what you are selecting from database if it is used multiple times then i would create a zbapi or Zfunctionmodule and inlude my code in it... ( Here this custom function module can be used in many program : ie : modulerization ).
    Regards
    Satish Boguda

  • How to use Check Function Module???

    Hi Friends,
    How to use Check Function Module in Workflow???
    My requirement is to trigger the workflow at the last line item of the Material Document.
    Rewards for sure for helpful answer.
    -Satish

    Hi Satish,
    You know, the real power of forums like these is the search functionality. First you locate the correct forum, you succeeded in that and then you locate the search field and type in your question. In your case "check function module"
    I suggest you do this right away and be amazed at all of the answers about his topic. Maybe you'll even find some topic about exactly the same issue with a different solution than check function modules and on top of that you learn something this way. Talk about win-win situation
    Kind regards, Rob Dielemans

  • Function module in table TADIR

    Hi,
    Table TADIR is a repository for all objects. However if I try to locate any function module(Object type = FUNC) in this table I dont get any entries. Why does this happen? Is there any other table which keeps a list of all function modules?
    Thanks,
    Saurabh

    hi,
    check this table TFDIR...
    <b>ENLFDIR</b> Additional Attributes for Function Modules -- this table contains FUNCTIONAL GROUP OF the particular function module..and other details
    <b>reward points if it is useful..</b>

  • How to findout the Function module for a particular object

    Hello friends,
       Related to my thread, there was one thread in the forum,to find out the function module for a particular object.I tried the solution provided my our experts but couldn't got the results.Thats why i am putting this thread again.
      I want to find out the function modules used for the particular object, i.e. Production order.
       solution i tried is, first go to T.C SE37, then in function module field put the object name like Production order and enter, than it will show another screen, there also put object name in function module field and than press enter, it will show all the function modules available for that object.
        So could you guys help me out to find out where i am wrong in the process of finding out the function module for a particular object.
                           Plz don't bother abt the point.Helpful answers will definitely get awarded.
                                Thanking you guys for your valuable support till now and hoping to get in future too.

    Dear
    When the problem is solved please give points too. Otherwise why people will help others, give time and share their valuable knowledge. This will build up self confidence.
    If not solved and closing, then mention the difficulties what u exactly looking for. Simpy closing is not enough because who ever is providing solution will not able to know the real problem.
    How to give points I believe u already know that and need not explain.
    I had seen many times this problem with others too. Even if the problem is totally resolved they give 2 in stead of 10.
    Edited by: BNR on Sep 21, 2008 6:10 PM

  • Function module to find list of workflows for a document

    Hi
    Is there any standard function module where I can get list of active workflows for a document ?
    example : for business object FIPP I have a document number, fiscal yr and co code. I need to get like of workflow instances for it.
    what we do in SWI6 or in display transaction - services for objects - workflow overview.
    I need find function module as I need to call it in a user exit.
    thanks
    bhakti.

    Hi,
    Concatenate the fields in the following order:
    1. SourceCompanyCode
    2. DocumentNo
    3. FiscalYear
    Use
    CATID = 'BO'
    TYPEID = 'FIPP'
    INSTID = Concatenated value
    in SWW_WI2OBJ to find TOP_WI_ID. Use this TOP_WI_ID  as an input Parameter TOP_WI_ID of table SWWWIHEAD.
    This will give you all workitems for your Document.
    Regards
    Gautam
    Edited by: gautam maini on Jul 7, 2011 2:23 PM

  • ABAP Object or function module?

    Hello all!
    I have to create a reusable routine. This routine should be select data from Z table for to get data with a parameter ID. I will pass a ID and expect result a internal table with some parameter values.
    So, my question is: What i use for to do that? ABAP Object or function module?
    I think that so easy to use function module. Why i should to use ABAP objects? What is positive points in use object and not function module?
    For me, both do the same thing... i don't see any difference. Just object is more complicated.
    Please, tell me why should i use object??
    Edited by: Rodrigo Kenji Matsunaga on Dec 10, 2009 5:51 PM

    I would go with Class.
    Read through this discussion:
    Needing Evidence on the Advantages of ABAP OO
    Class would provide you a flexibility of inheritance. E.g. if you want to use the same data selection with little modification in your other applications, you can inherit some other class form this class. Redefine the method, call the Super's method and change the output before sending back to the caller.
    Regards,
    Naimesh Patel

  • Workflow Agent Function Module

    I am trying to develop a workflow for the approval of CATS time entries. Users will enter their time data and specify a receiving maintenance work order (CATSD-RAUFNR). The approver of the CATS time entry should be the user ID identified in the Partner tab of the maintenance work order identified in the CATS record.
    I am trying to determine the agent in a workflow task based on a default rule for agent assignment. My idea was to capture the work order number (stored in table AUFK) from the CATS entry, then reference plant maintenance partners table (IHPA) to get the user id to use as the agent in the workflow.
    I have developed a function module that works when testing it in the function builder, but when I try to test it in the "Maintain Rule" transaction (PFAC_CHG), it does not work. Can anyone let me know how to make this code work in the Maintain Rule simulation?
    Here is my code for the function module:
    FUNCTION Z_GET_WO_PARTNER.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(ORDER_NUMBER) TYPE  AUFNR OPTIONAL
    *"  TABLES
    *"      ACTOR_TAB STRUCTURE  SWHACTOR
    *"      AC_CONTAINER STRUCTURE  SWCONT
    *"  EXCEPTIONS
    *"      NOBODY_FOUND
    *INCLUDE .
    TYPES:  BEGIN OF PLANT_MAINT,
              OBJECT     TYPE  IHPA-OBJNR,
              PARTFUNC   TYPE  IHPA-PARVW,
              PARTNER    TYPE  IHPA-PARNR,
            END OF PLANT_MAINT.
    TYPES:  BEGIN OF ORDER_MASTER,
              ORDER      TYPE  AUFK-AUFNR,
              OBJECTN    TYPE  AUFK-OBJNR,
            END OF ORDER_MASTER.
    DATA: WA_MAINT  TYPE  PLANT_MAINT.
    DATA: WA_ORDER  TYPE  ORDER_MASTER.
    DATA: ITABIHPA TYPE STANDARD TABLE OF PLANT_MAINT.
    DATA: ITABAUFK TYPE STANDARD TABLE OF ORDER_MASTER.
    DATA: PARTNERVAR  TYPE  STRING.
    DATA: OBJN TYPE STRING.
    Get object number from order master
    SWC_GET_ELEMENT AC_CONTAINER 'OrderNumber' ORDER_NUMBER.
    CLEAR: ACTOR_TAB.
    REFRESH: ACTOR_TAB.
    SELECT SINGLE AUFNR OBJNR FROM AUFK INTO WA_ORDER
         WHERE AUFNR = ORDER_NUMBER.
    IF SY-SUBRC NE 0.
        RAISE nobody_found.
    ENDIF.
    OBJN = WA_ORDER-OBJECTN.
    *get Partner field (system user id) from Plant Maintenance: Partners table
    SELECT SINGLE OBJNR PARVW PARNR FROM IHPA INTO WA_MAINT
              WHERE OBJNR = OBJN AND PARVW = '§G'.
    IF SY-SUBRC NE 0.
        RAISE nobody_found.
        ELSE.
            ACTOR_TAB-OTYPE  =  'US'.
            ACTOR_TAB-OBJID  =  WA_MAINT-PARTNER.
            APPEND ACTOR_TAB.
    ENDIF.
    ENDFUNCTION.
    (sorry about the poor ABAP code...)

    To my guess, the function module interface is incorrect. The function module should contain only the following interface:
    ""Local Interface:
    *"  TABLES
    *"      ACTOR_TAB STRUCTURE  SWHACTOR
    *"      AC_CONTAINER STRUCTURE  SWCONT
    *"  EXCEPTIONS
    *"      NOAGENT_FOUND
    You seem to be passing an order number. you need pass container elements using the table AC_Container and cannot send it directly. For further information, look at the following tutorial:
    http://www.****************/Tutorials/Workflow/Rules/Create.htm
    Hope this helps
    SS

  • How to call a function module from a workflow ? ?

    hi all,
    i have to call a function module from an workflow, i got a hint from someone that i have to enhance an object and then write and methode, in this methode i can call that function module. I dont know even how to go for it.
    Can anyone suggest that how to go for it ?
    thanks.
    raman khurana.

    Hi Raman Khurana,
    Please  go through the links it might be helpful , notsure
    http://help.sap.com/saphelp_nw2004s/helpdata/en/c5/e4af8b453d11d189430000e829fbbd/content.htm
    http://www.abapcode.info/2007/07/standard-function-module-text.html
    http://it.toolbox.com/wiki/index.php/SAP_Workflow
    Regards,
    Sreekar.Kadiri.

Maybe you are looking for

  • How to pass price list of a minisite dynamically in istore

    Hi All, I am trying to diplay limited UOM in drop down box based on price list. I have hard coded the price list in the jsp page "ibeCCtdLeafSctSsI.jsp" and on the basis of it getting the price and unit of measure in drop down box. What are the UOM i

  • Using read text fm in smartforms

    hi experts,               I have captured a text using Read_text Fm .now i need to use it inside a smartforms .how to do . i have used that code inside a program line . and in text i have called the field. declaration in form interface text type char

  • %HA_EM-3-LOG: NAC-RADIUS-FAIL-OPEN-DEAD: All RADIUS servers are dead changing the nac-enforcement ACL to permit all

    We just implemented ISE 802.1x in couple of our  Cisco 4507 switches  and we are seeing the following error in the log. %HA_EM-3-LOG: NAC-RADIUS-FAIL-OPEN-DEAD: All RADIUS servers are dead changing the nac-enforcement ACL to permit all I paste it in

  • VKOA screen is editable

    Hi Experts, This could be a basis issue. When I open TCode VKOA in production, the fields are editable, even through the client is set as 'not modifiable'. However, this problem is not there in quality. Any idea what can be the reason for this? Regar

  • Problem with backup before updating

    So, I plug in my iPod touch 3G, press update. It says there isn't enough space for a backup (48GB needed). I proceed to move my entire music folder to my other hard drive, assuming this will be fine because it will backup my whole iPod, music library