JCO : Function Module to be executed

Hi all
   I have a z Function Module in my R/3 System. I want to execute it through JCo.
My z function module  is importing 4 fileds and exports a RETURN Value and a TABLE.
1.How do i Call this Z function module using DIRECT methd?
2.How do i pass the Values of the IMPORTING Paramters?  
3.How do i get the RETURN value and TABLES contents ?
Could anybody help me out in this task in SAP JCo ???
Thanks
Kay

Try posting this question in the Java forum: Java Development
This is not the correct place.

Similar Messages

  • JCO Function Module Listener

    I have created a JCO Function Module Listener to be triggered after a BAPI in R/3 is called.
    I have made the following modifications to the modification-config.xml:
         <function-module-listener>
         <param name="fmevent:ZBAPISDORDER_GETDETAILEDLIST" value="com.xxx.listeners.ZBAPISDORDER_GETDETAILEDLIST_Listener" />
         </function-module-listener>
    The default BAPI implementation has been changed with a new BAPI. I have made the configuration changes to refer to the new BAPI and the new BAPI also is getting called. Should I register for Function Module listener to the Original one or to the modified BAPI name..
    When I execute this BAPI, the Function Module listener class is not getting called. I have a debug statement to write to the logs at the start of the "connectionEvent" method and seems this itself is not getting called.
    Should I register this class to be notified for events..
    Please letme know if there are any configuration to be made from the SAP side or from SAP J2EE Engine to get this done.
    Thanks & Regards,
    D.Vinodh

    Vinodh
    <b>Should I register for Function Module listener to the Original one or to the modified BAPI name..</b>
       --> I hope it should registered for Modified One !!!
    Thanks
    Jack
    Allot points if it helps !!!

  • Function module/BAPI for executing VD51/VD52 transactions

    Hi
    Warm greetings to all,
    I require a function module/BAPI for executing VD51/VD52 transactions. Can anyone help on this
    Sreekanth

    Hi Sreekanth,
    Use this.
    There is an FM which is used by standard transaction
    'RV_CUSTOMER_MATERIAL_UPDATE' .
    Ex Code -
    CALL FUNCTION 'RV_CUSTOMER_MATERIAL_UPDATE'
    IN UPDATE TASK
    TABLES
    XKNMT_TAB = XKNMT
    YKNMT_TAB = YKNMT
    TCATALOG_TAB = LT_CATALOG.
    commit work.
    Regards,
    Vijay

  • Need to track Function modules called when executing a transaction

    Hi All,
              Is there a way through which i can track function modules called, while executing a Transaction. Kindly provide pointers to it.
    Thanks in advance.
    Regards,
    Navin.

    Goto SE80 Transaction and use Program name for corresponding Transaction Use Find operation like Call Function .. then you will get list of FM ..
    There is no other option .
    reward Points if it is helpful
    Thanks
    Seshu

  • Rule creation with Function module to be executed.

    Hi there,
    I have been trying to create a function module and then use it in a rule... I have declared ACTOR_TAB, AC_CONTAINER, but still I get an error with the below statement.
    swc_get_element ac_container 'PERNR' pernr.
    The error I get is as below:
    The field "PERNR" cannot be changed.
    Note that, I have also declared PERNR as an import parameter for the function module....
    Help on this would be great.
    Thanks.
    Sukumar.

    FUNCTION ZHR_TEST.
    ""Local Interface:
    *"  IMPORTING
    *"     REFERENCE(LV_PERNR) TYPE  PERNR_D OPTIONAL
    *"     REFERENCE(LV_REINR) TYPE  REINR OPTIONAL
    *"     REFERENCE(BEGDA) TYPE  BEGDA DEFAULT SY-DATUM
    *"     REFERENCE(ENDDA) TYPE  ENDDA DEFAULT SY-DATUM
    *"  TABLES
    *"      ACTOR_TAB STRUCTURE  SWHACTOR OPTIONAL
    *"      AC_CONTAINER STRUCTURE  SWCONT OPTIONAL
    *"  EXCEPTIONS
    *"      NOBODY_FOUND
      include <cntn01>.
      data: result_tab like swhactor occurs 0 with header line.
      refresh: actor_tab.
      clear:   result_tab.
      swc_get_element ac_container 'PERNR' lv_pernr.
    Still it does not work. It keeps showing the error.
    Thanks,
    Sukumar.

  • Function module with UPDATE TASK

    All,
    Have a look at the below code. While debugging the control is not going inside the function module called using <b>call function ...... in update task</b> statement.
    I believe the function module is not executed immediately, but is scheduled for execution in a special work process (update work process). For this purpose, the name of the function module including the passed actual parameters is stored as a log record in the database table VBLOG. If the statement is executed during the update task, the addition IN UPDATE TASK is ignored.
    The actual execution is triggered by the statement COMMIT WORK which is not happening in this case. The formal parameters of the function module receive the values of the actual parameters from table VBLOG. How can I read the entries in VBLOG? Why the function module is not executed? Please suggest.
    PERFORM bte_publish ON COMMIT LEVEL 9.
    * syncron update
        COMMIT WORK AND WAIT.
    *       Publish business transaction events. The function module have
    *       to call as last update module!
    FORM bte_publish.
      IF NOT gvt_nodes IS INITIAL.
        CALL FUNCTION 'CUSTOMER_HIERARCHY_THROW_BTE' IN UPDATE TASK
             EXPORTING
                  ffi_valid_on    = knvh-datab
                  fti_event_list  = gvt_nodes
                  fti_event_listx = gvt_nodesx.
      ENDIF.
    ENDFORM.                               " BTE_PUBLISH
    Thanks,

    Right Naren. But I need to check inside the update function module, whether it is calling the BTE function module I had configured and the code which I had put in it. Any ideas?
    The COMMIT WORK is returning 4 and hence I believe it is not popping up another debuggin session in which the update FM runs.
    Thanks,
    Message was edited by: Somen

  • Passing request table to Jco function

    Hello Experts,
      We have one requirement where we need to pass the table data from the BLS to SAP Jco Function Module call.  For example we are reading the material numbers from the oracle database and then we need to pass these material numbers to SAP Function Module as a table to read the further details from SAP for the given material numbers. 
      We wrote a custom function module in SAP which accepts the material number as table.  Is it possible to pass the table request parameter to Function Module?  If possible how can we do this?  I tried to pass the XML document to Function Module table, but no luck.
    Thanks
    Mohan

    Mohan,
    in the BLT, configure the JCO action to use you custom function. After pressing enter, MII reads the xml structure of the function (if the connection MII to SAP is working). In the further processing of the BLT, you can fill the RFC table which you can see in the link editor using your query results and the link editor types "AppendXML" or "AppendAfter".
    The following thread might help: [RFC call with multiple input|http://forums.sdn.sap.com/click.jspa?searchID=34070350&messageID=8134561].
    Michael

  • Error while transporting Function module.

    Hi guys,
    A z fun. Module was already created by some user on client 150.I changed,Activated it on client 180 ,but when I transport it to production I get the follow Error when I checked in "SMTS" .Please guide.
       Generation of programs and screens
       Transport request___: SA3K9A14WH
       System______________: SMP
       tp path             : tp
       Version and Release: 305.12.19 46D
       Generation of programs and screens for transport request SA3K9A14WH
       Only generates programs with LOAD versions
       Start on 27.10.09 at 04:20:54
       Ended on 27.10.09 at 04:20:54
       No. of programs  /Min/Avg/Max (sec): 1   0 0 0
       Generation of programs and screens
       End date and time : 20091027042054
       Ended with return code:  ===> 8 <===
    Selection for import                     2009.10.27 04:20:33    (0) Successfully completed
    Import                                   2009.10.27 04:20:38    (0) Successfully completed
    Check versions                           2009.10.27 04:20:42    (0) Successfully completed
    Generation of programs and screens       2009.10.27 04:20:54    (8) Ended with errors
    ment System
    Checks at operating system level         2009.10.27 13:18:14    (0) Successfully completed
    Export                                   2009.10.27 13:18:33    (0) Successfully completed
    unknown
    Selection for import                     2009.10.27 13:18:33    (0) Successfully completed

    Guys I did that ,but still get the following eror.Now I can open the function module but when Executed gets error No.2
    Error  NO1 :In Transport Request
    SA3K9A14WN              RFC Wty (G-ERP)
      SMP Production System
                 Selection for import                     2009.10.27 06:09:40    (0) Successfully completed
                 Import                                   2009.10.27 06:09:47    (0) Successfully completed
                 Check versions                           2009.10.27 06:09:52    (0) Successfully completed
                 Generation of programs and screens       2009.10.27 06:10:04    (8) Ended with errors.
    *Error  NO2 :In "SE37"
    Error generating the test frame

  • Problem when creating sapscript from within function module

    Hi,
    I created a function module which retrieves some master data, creates a sapscript for displaying the data and finally converts the sapscript to an otf. Afterwards the otf is converted to a pdf file.
    The problem is that the pdf file is created but it is empty!
    Here is a piece of the code:
    FUNCTION zhr_display_jobdescrpdf.
    * To access the SAP script output in OTF format.
    struct-tdgetotf = 'X'.
    struct-tdprogram = SY-REPID.
    CALL FUNCTION 'OPEN_FORM'
         EXPORTING
    *           APPLICATION        = 'TX'        " this is SapScript Appl
              device             = 'PRINTER'   " allow output to printer
              dialog             = 'X'         " printer dialog requested
              form               = 'ZHR_JOB_DESCR'       " name of form (SE71)
              language           = 'E'
              OPTIONS            = struct
    CALL FUNCTION 'START_FORM'
    EXPORTING
    *   ARCHIVE_INDEX          =
       form                   = 'ZHR_JOB_DESCR'
       language               = 'E'
    *   STARTPAGE              = ' '
    *   PROGRAM                = ' '
    *   MAIL_APPL_OBJECT       =
    *   IMPORTING
    *   LANGUAGE               =
    CALL FUNCTION 'WRITE_FORM'
         EXPORTING
           element                        = 'TEXT'
           function                       = 'SET'
           type                           = 'BODY'
           window                         = 'MAIN'
    CALL FUNCTION 'END_FORM'
    * IMPORTING
    * RESULT =
    EXCEPTIONS
    CALL FUNCTION 'CLOSE_FORM'
    * IMPORTING
    * RESULT =
    * RDI_RESULT =
    TABLES
    otfdata = datab[]
    EXCEPTIONS
    ENDFUNCTION.
    The content of datab[] is:
    1     //     XHPLJIIID    0700 0000000000
    2     IN     01EZHR_JOB_DESCR   MAIN
    3     OP     DINA4   P 144  240 1683811906000010000100001
    4     IN     02MAIN
    5     EP
    6     //
    So none of the variables that are used in the sapscript were transferred, although they are filled with the correct values when I put a breakpoint on the function 'write_form'. It looks like the sapscript can't access variables that are declared in a function module.
    Putting all the code for creating the sapscript in a report is not an option because then I have to use export/import to/from memory for retrieving the otf data and this doesn't work with the sap portal where the function is called.
    Did anyone had the same or similar problem?
    Greetings,
    Frederik

    Hi,
    Yes my problem is already solved.
    I created a report which creates the sapscript and in my function module I just execute that report.
    So problem solved :-).
    Greetings;
    Frederik

  • RFC Function module is not working in program while Background

    Hi All,
    we have a one program in BI  system which is calling RFC function module. it is executing the program in foreground very well. Same program we have executed in background , it is not working at all. Thiis RFC function module exists in R/3 4.6c system.

    Hello Raju,
    Transactional call of a remote-capable function module specified in func using the RFC interface. You can use the addition DESTINATION to specify an individual destination in dest. If the destination has not been specified, the destination NONE is used implicitly. Character-type data objects are expected for func and dest.
    When the transactional call is made, the name of the called function, together with the destination and the actual parameters given in parameter list, are registered for the current SAP LUW in the database tables ARFCSSTATE and ARFCSDATA of the current SAP system under a unique transaction ID (abbreviated as TID, stored in a structure of type ARFCTID from the ABAP Dictionary, view using transaction SM58). Following this registration, the program making the call is continued by way of the statement CALL FUNCTION.
    When executing the COMMIT WORK statement, the function modules registered for the current SAP LUW are started in the sequence in which they were registered. The statement ROLLBACK WORKdeletes all previous registrations of the current SAP LUW.
    If the specified destination is not available for COMMIT WORK, an executable called RSARFCSE is started in the background. This attempts to start the functional modules registered for an SAP LUW in their destination, every 15 minutes up to a total of 30 times. You can make changes to these parameters using transaction SM59. If the destination does not become available within the given time, this is noted in the database table ARFCSDATA as a CPICERR entry. By default, this entry in database table ARFCSSTATE is deleted after 8 days.
    Thanks and Regards,
    SAP Shori

  • Difference between Function module in Update task

    Hi folks,
    What is the difference between
    1. A function module calling in 'update task'( if attributes not set for update mode).
    2.A function module's attributes set to update mode, but while calling not specified 'Update task'.
    Please clarify this doubt.
    Thanks in advance.
    Bhavani

    CALL FUNCTION func IN UPDATE TASK.
    Additions:
    1. ... EXPORTING  p1 = f1     ... pn = fn
    2. ... TABLES     p1 = itab1  ... pn = itabn
    Effect
    Flags the function module func for execution in the update task. It is not executed at once, but the data passed with EXPORTING or TABLES is placed in a database table and a subsequent COMMIT WORK then causes the function module to be executed by the update task. Update function modules must be flagged as such in the Function Builder
    The return value is not set.
    Addition 1
    ... EXPORTING p1 = f1 ... pn = fn
    Effect
    Values of fields and field strings specified under EXPORTING are passed from the calling program to the function module. In the function module, the formal parameters are defined as import parameters. In the interface definition, default values must be assigned to all import parameters of the update function module.
    Addition 2
    ... TABLES p1 = itab1 ... pn = itabn
    Effect
    TABLES passes references to internal tables. All table parameters of the function module must have values.
    Note
    With update function modules, both import parameters and exceptions are ignored when the call is made.
    Administration transaction
    Related
    COMMIT WORK, SET UPDATE TASK LOCAL
    regards,
    kartikey.

  • Function modules in Update task

    Hi Folks,
    What is the difference between
    1.If a function module contains in attributes 'Update mode ' and run( without 'update task - keyword).
    2.call function ' fun2' in update task.
    In this case, do we need to set the attributes must be 'Update task'?
    Please help me.
    Thanks in advance
    Bhavani

    From F1 Help...
    <i>
    This statement registers the update function module specified in update_function. update_function must be a character-type field, which during execution of the statement contains the name of an update function module in uppercase letters.
    <b>An update function module is a function module, for which in the Function Builder the property update module is marked. The registration of an update function module is an essential part of the update task.</b>
    The function module is not executed immediately, but is scheduled for execution in a special work process (update work process). For this purpose, the name of the function module including the passed actual parameters is stored as a log record in the database table VBLOG. If the statement is executed during the update task, the addition IN UPDATE TASK is ignored.
    </i>
    Regards,
    Rich Heilman

  • Questions regarding update function module

    Hello experts,
    I am on customer site to help them investigate one issue: they have a background job which runs periodically.
    In the report database table A is changed firstly ( new entries are inserted ), then a update function module is called via keyword CALL FUNCTION ... IN UPDATE TASK.
    Inside the function module database table B is updated. ( existing entries are updated )
    Customer issue:
    sometimes they find A is updated as expected, however B remains unchanged at the same time.
    customer could not find exact steps to reproduce the issue. However the issue does exist there and occur from time to time.
    the issue could only be reproduced in their production system, but works perfectly well in dev & Q system. It is difficult to debug in their production system for trouble shooting.
    After analyzing related code, I have one doubt: according to ABAP help on CALL FUNCTION aaa IN UPDATE TASK, I know the function module aaa is called in a new update work process. I wonder whether there is any possibility there this issue might be caused because the update function module fails to get called at all? ( perhaps due to heavy system load so no free update function module could serve the table B update ? )
    If update function module fails to execute, is there any system utility to record this? That is to say, will it be recorded in such as SM13 or SM21?
    Looking forward to your expertise on this topic!
    Best regards,
    Jerry

    Hello friends,
    Thanks a lot for your interests on this issue. I update all my findings:
    1. issue background: this issue occurs in SAP CRM Channel manageement Solution, software component CRM-CHM-POS.
    2. due to some limitations, the table CMSD_CI_HISTORY and history table are not updated in the same LUW. Instead the first one is updated in normal work process while the other is done in update work process. Since I am not the original developer I didn't know the whole complex scenario ( I did see this is done delibrately in note 1764006 - CMS:Sell In Release creating PB with zero available quantity ).
    So for the moment we have to accept this design.
    3. during our testing ,we ensure COMMIT WORK is always called.
    4. So why sometimes the first table update fails, however there is no hint at all for this failure in the system like ST22 and SM21 ?? ( forget SM13, since it is updated in normal work process ).
    The root cause is the flaw of SAP code below.
    The code has planned to raise exception if insertion failed due to duplicate records to be inserted.
    Unfortunately, the fact is if we use "INSERT db FROM TABLE xxx" to insert records into database and some record already exists with the same key, it will result in a termination but SY-SUBRC is STILL 0; Just compare it with single insertion using "INSERT db FROM <work area>", in the same error situation, processing does not terminate, and SY-SUBRC is set to 4.
    As a result in this case even the insertion fails, line 29 will never be executed as sy-subrc is always 0. Since the insertion fails and the exception is caught without any notification, so customer sufferred because they do not know what has happened.
    Best regards,
    Jerry

  • Regarding the function module 'DYNP_VALUES_READ'

    Hi,
         There are two input fields on my popup screen.
    1. Plant
    2. OrderNo.
    I have created F4 help for the order no. But i want to capture the plant value so that i can get order no based on the plant.
    For that, i have written the below code. The internal table tl_dynpfields is not getting filled after the function module  'DYNP_VALUES_READ'  gets executed.
    Can anyone tell me what mistake i am commiting.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_pro1
    TYPES : BEGIN OF tp_dynpfields,
              fieldname  LIKE dynpread-fieldname,
              stepl      LIKE dynpread-stepl,
              fieldvalue LIKE dynpread-fieldvalue,
              fieldinp   LIKE dynpread-fieldinp,
              END OF tp_dynpfields.
      DATA : wl_dynpfields TYPE tp_dynpfields,
             tl_dynpfields TYPE STANDARD TABLE OF tp_dynpfields.
      wl_dynpfields-fieldname = 'P_PLANT1'.
      APPEND wl_dynpfields TO tl_dynpfields.
      CALL FUNCTION 'DYNP_VALUES_READ'
        EXPORTING
          dyname                         = sy-repid
          dynumb                         = '0200'
        TABLES
          dynpfields                     = tl_dynpfields
       EXCEPTIONS
         invalid_abapworkarea           = 1
         invalid_dynprofield            = 2
         invalid_dynproname             = 3
         invalid_dynpronummer           = 4
         invalid_request                = 5
         no_fielddescription            = 6
         invalid_parameter              = 7
         undefind_error                 = 8
         double_conversion              = 9
         stepl_not_found                = 10
         OTHERS                         = 11.
    Thanks,
    Ibrahim

    Hey,
    i got the value.
    thanks

  • Function module L_TO_CREATE_MULTIPLE and commit

    Hi,
    Does anyone knows if in one report I call function module L_TO_CREATE_MULTIPLE with parameter I_COMMIT_WORK = SPACE and if in the main report after the call of the function module i do a commit command that allows that the transfer order is created ? And are the tables received if the call of L_TO_CREATE_MULTIPLE correct with the information of the created transfer order ?
    Or in other way if I really want to create the transfer order, I must pass the parameter I_COMMIT_WORK = 'X' ?
    Thanks in advance,
    Paulo Sousa

    Hi Paulo,
    The main Idea here is COMMIT should get called once the callto Function module L_TO_CREATE_MULTIPLE is executed so it really doesn't makes different if you call L_TO_CREATE_MULTIPLE with I_COMMIT = 'X'
    or you call L_TO_CREATE_MULTIPLE with I_COMMIT = SPACE and later to this call to Function module do COMMIT WORK, both are effectively same.
    One thing that needs to be taken care is if you are calling L_TO_CREATE_MULTIPLE in LOOP you have to do COMMIT after each call.
    Hope this helps!
    Regards
    Shital

Maybe you are looking for

  • How do I install fonts from Type On Call into Win 8.1

    I have been using Trade Gothic Condensed as my default Excel font for many years. Each time I get a new computer I have been able to install the font in the new OS. I am having trouble doing that with Win 8.1. It says it is installed but does not app

  • Error while updating any SAP / Customised AddOn Master Data Form in SAP B1

    Hello Experts, I am facing a unique Problem in my addon .I have created two Master Tables Forms and entered the data in that two forms and the entry is done alright. But while updating that Master data system is throwing an error "Conversion Failed w

  • XL reporter error occurred while executing report! Rows: 25203 Columns: 30

    An error occurred while executing report! Rows: 25203 Columns: 30 Unspecified error One user gets this error when trying to run a custom XL report. It works for other users(on different PCs). The user can run other XL reports successfully.

  • Alert message from Payload

    Hi,while configuring alerts, i want to specify the alert message from my incoming payload. As i was looking on into alert message, only plain text is accepting.  Please do advise me in this regard. B.Anandhakrishnan

  • Auto linking from In Design to a Folio?!

    Hi Guys We recently just signed up to DPS and had our first day of training yesterday. However, my production guys made it very clear that we needed links in our editions to be picked up automatically. We were told that a script existed that would do