Asynchronous function module - why RFC ?

Hi,
I am using CALL FUNCTION ... STARTING NEW TASK ... DESTINATION 'NONE' to start an asynchronous process.
For this to work, the called function module must be unfortunately RFC enabled.
Actually I do not want that anybody external can call this. Can I find out, if I was called from "outside"? Otherwise I create a potential security hole?
Regards,
Bruno

A sound security concept is the cure for many problems.
In this special case it is much easier said than done...  ;-(
STARTING NEW TASK automatically uses DESTINATION 'NONE' even if you do not code the destination extention, therefore the FM must be RFC-enabled.
FM RFC_WITHIN_SAME_SYSTEM checks that the caller is within the same SID, which is what the internal destination NONE is.
To use security for this you must consider that internal destinations do not check object S_RFC by default. But real external callers will encounter the check. This means that to use authorizations based security you must have all your users (everything from end users to the RFC connections users into this system) as having explicit and restircted RFC authorizations which also do not include the function group which this FM belongs to.
Additionally the field is 40 char long (as are the object names) but the authority-check statement truncates the function group name at the 15th character as it can only deal with 16 char.
An finally, anyone who does not know the object is very likely to pop a * value into it when it turns up, and it will ... 
In this case I also think that FM RFC_WITHIN_SAME_SYSTEM is the more reliable solution. After all, SAP also use it for exactly this purpose.
Cheers,
Julius

Similar Messages

  • Wait in Asynchronous Function Module

    Hello,
    We are creating calling Asynchronous function module in the Delivery User Exist to create Invoice. Invoice creation needs to wait until delivery change is commited. For this purpose, we have placed ENQUEUE_SLEEP FM in the asynchronous FM with a wait time of 1 second. We have written a logic in such a way that ENQUEUE_SLEEP is called in a loop causing a delay of one second until delivery can be locked successfully.
    But we cant let it wait for one second. Delivery should be locked as soon as delivery is committed in the main program. How can we achieve this in asynchronously called FM.
    Thanks

    >
    Rohit Malik wrote:
    > I am following the exact approach of calling remote enabled FM in background task in seperate unit to create invoice.
    Bear in mind that asynch RFC(aRFC) & RFC as BACKGROUND TASK(transactional RFC or tRFC) are completely different. While the former is generally used for parallel processing, the latter is used to maintain the "atomicity" of an SAP LUW.
    tRFC calls are registered in special DB tables(ARFCSSTATE & ARFCSDATA) & are executed once the COMMIT WORK statement is executed in the particular LUW.
    Further read available on the F1 help.
    BR,
    Suhas

  • Problem in converting a function module in RFC

    hi All,
    when i m converting a function module in RFC it is showing a error message ,
    Generic Types are not allowed in RFC.
    How can i handel this.
    Regards,
    Susheel Joshi

    Hi Susheel,
    RFC module interface parameters (import, export , tables) can only refer to data dictionary types. Hence if you currently have one of the parameters referring to a type defined in your function group main include or in a type pool, you need to create a SE11 data dictionary structure/ table type for that and then change the data type reference.
    Cheers,
    Aditya

  • Commit for Asynchronous Function Module

    Halo Experts,
    I am working on an Perfomance Optimization project . I am trying to optimize the program by scehduling the individual methods inside the program via asynchronous function modules . By this way I can run this independent methods parallely ( and not sequentailly) . for eg
    if the program has
    me->m1( ).
    me->m2( ).
    me->m3( )
    if m2 and m3 are independent of each other I schedule them parallely by
    me->run_m2_m3_parallely(  ) see the below code
    CALL FUNCTION 'ZM2'
        STARTING NEW TASK 'FUNC1'
        DESTINATION 'NONE'
        CALLING ZCLASS=>set_flag_4_m2 ON END OF TASK.
    CALL FUNCTION 'ZM3'
        STARTING NEW TASK 'FUNC2'
        DESTINATION 'NONE'
        CALLING ZCLASS=>set_flag_4_m3 ON END OF TASK.
      WAIT UNTIL l_m2_flag = 'X' AND
                 l_m3_flag = 'X'.
    the FMs ZM2 and ZM3 are updating Z Database tables( say ZM2  and  ZM3 ) . Do I need an explicit commit work for Individual FMs or a single commit work for both the FMs.
    How can I roll back both the updates to the database if a dump occurs ?
    How should the commit work statement be in this case ?
    Regards
    Arshad

    I think you can solve your issue by using the KEEPING TASK addition.
    In your ZCLASS=>set_flag_4_m2 method try this:
    METHOD set_flag_4_m2.
      RECEIVE RESULTS FROM FUNCTION 'ZM2 ' KEEPING TASK.
    ENDMETHOD.
    METHOD set_flag_4_m3.
      RECEIVE RESULTS FROM FUNCTION 'ZM3 ' KEEPING TASK.
    ENDMETHOD.
    And after your wait you can try to do this:
    WAIT UNTIL l_m2_flag = 'X' AND
                 l_m3_flag = 'X'.
    * In set_func2_commited you must receive results from BAPI_tRANSACTION_COMMIT and set global flag g_func2_commit
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        STARTING NEW TASK 'FUNC2'
        DESTINATION 'NONE'
        CALLING ZCLASS=>set_func2_commited ON END OF TASK.
    * In set_func3_commited you must receive results from BAPI_tRANSACTION_COMMIT and set global flag g_func3_commit
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        STARTING NEW TASK 'FUNC3'
        DESTINATION 'NONE'
        CALLING ZCLASS=>set_func3_commited ON END OF TASK.
    WAIT UNTIL g_func3_commit EQ 'X' and g_func2_commit EQ 'X'.

  • Unable to send table to function module using RFC

    Hi all,
    I'm trying to send a table from XI to a function module using RFC. I tested the process first using indivdual parameters. At this point there were no problems. Now I changed the import parameter of
    the FM into a table and imported the changes into XI. I changed the Message mapping and tested it with multiple records. When I run the process XI calls the FM but the FM doesn't receive any data. I tested this by puting a break-point in the FM. There are no errors in the XML Messages Monitor. I found this message in the Communication Channel Monitoring:
    Short Log:
    Server 0 10_39293 Receiver channel 'CC_BackendIn' for party '', service 'BS_Backend' (internal name 'RfcClient[CC_BackendIn]')
    Client data: {jco.client.lang=EN, jco.client.snc_mode=0, jco.client.client=610, jco.client.passwd=******, jco.webas.ignore_jdsr_error=1, jco.client.user=Admin, jco.client.sysnr=10, jco.client.ashost=192.168.51.8}
    Repository data: {jco.client.lang=EN, jco.client.snc_mode=0, jco.client.client=610, jco.client.passwd=******, jco.webas.ignore_jdsr_error=1, jco.client.user=Admin, jco.client.sysnr=10, jco.client.ashost=192.168.51.8}
    Current pool size: 0, maximum pool size : 1
    Channel History
    - OK: 2009-02-18 01:35:14 CET: Message processed for interface MIIA_BapiIn
    Any ideas?
    Thanks for your help!
    Regards,
    Ivo van Ee

    Hi everyone,
    thanks for your prompt response! I tested the mapping in XI and didn't find any error here. So I concentrated on the receiver side. There were some communication channels running on the server that were generating errors. I stopped alle the communication channels and started just the two communication channels for this process. This time the table was successfully exported to the function module! Problem solved. Still not sure what caused the problem in the first place, but everything is working fine now.
    Thanks for your help.
    Regards,
    Ivo

  • How to create IDOC from Function module or RFC

    Hi all,
            I have tested one inbound IDOC for Time Upload to CAT2 using basic type "CATS_INSERT01"  in WE19 through function module BAPI_IDOC_INPUT1 .It works well.
    Now i need to create this IDOC once the sale order gets created thru BAPI.
    For creation of Sale order i wrote one RFC in which i will call the Standard Sale Order Bapi.My question is once the Sale order gets created in that RFC How do i trigger the IDOC for CATS upload.

    Hi,
    Which SAP product of wich release of which SP are you using ?
    The procedure is documented in help.sap.com and in blogs and SDN forum messages.
    It means that the use of the SEARCH button should give plenty of answers...
    >When I check "Local object" checkbox I get a message "Test objects cannot be created in foreign >namespaces"
    As usual, begin your choosen name with an "Z".
    Regards,
    Olivier

  • How to make this function module as RFC to get data from different system?

    Hi
    I am trying to use following function module . This function module is used to copy data from one cube to another cube within same system however I need a this should happen across two different system. How can I use this function module to make it remote call to different system and do the same function what it is doing ?
    Name of function module -
    RSDRT_INFOCUBE_DATA_COPY
    Any help would be really helpful
    AG

    HI,
      let us say you want to copy the data of a cube in system A to a cube in system B .
      1) create a RFC function module in system B (in this function module  call the function module RSDRI_CUBE_WRITE_PACKAGE to update the data), this RFC function module should have same parametersa as RSDRI_CUBE_WRITE_PACKAGE .
    2) write a program in system A .. read the data from the infocube using the function module RSDRI_INFOPROV_READ and call the RFC function module in system B that you have created..
    for the details of the parameters to pass to these two function modules use the RSDRT_INFOCUBE_DATA_COPY and get the required code
    Thanks
    mahesh

  • Function module  VS RFC

    any body can help me to know the difference between function module and remote function module...?

    hi,
    function module: is a function module it is available with in sap system only.
    RFC
    A remote function call is a procedure for data interchange between a client and server. Typically the client calls a server program and the server returns the results via a TCP/IP connection. Remote function calls may be associated with SAP software and ABAP programming and provide a way for an external program (written in languages such as PHP, ASP Java, or C, C++) to use data returned from the server. Data transactions are not limited to getting data from the server, but can insert data into server records as well.
    A remote function call (RFC) is the call of a function module that runs in an external system to the calling program. Although it is possible to call a function module in the same system as an RFC, normally RFCs are used when the caller and the called function module run in different systems.
    In the SAP system, these functions are provided by the RFC interface system. The RFC interface system enables function calls between two SAP systems, or between a SAP system and an external system.

  • Function Module with RFC for accessing tables

    Hello All
    I am programming using ABAP in Solution Manager system. I have to take data from tables(T001W and T001K) from a R/3 Server. Is there a function module which extracts data from tables via RFC ?
    Thanks
    Tharani.

    Hi,
    Check thes FM's:
    RFC_GET_TABLE_ENTRIES
    TABLE_ENTRIES_GET_VIA_RFC
    GET_TABLE_RFC
    or develop a RFC enabled FM to get the required data in R/3 and call it from your program
    example :
    data: wtab type BDSEL_STAT occurs 0 with header line.
    data: tab type BDI_ENTRY occurs 0 with header line.
    name = T001W.
    CALL FUNCTION 'TABLE_ENTRIES_GET_VIA_RFC'
    destination dest
    EXPORTING
    LANGU = SY-LANGU
    TABNAME = name
    TABLES
    SEL_TAB = wtab
    NAMETAB =
    TABENTRY = tab
    EXCEPTIONS
    INTERNAL_ERROR = 1
    TABLE_HAS_NO_FIELDS = 2
    TABLE_NOT_ACTIV = 3
    NOT_AUTHORIZED = 4
    OTHERS = 5 .
    Regards
    Laxman
    Message was edited by: Laxmana Kumar

  • Function module with RFC enable

    Hello ABAPers,
    Im a new comer in ABAP and I would like to have a basic knowledge in RFC using a function module/function group..
    I have this project in Travel Dept...I need to connect on a different system using SAP connector...meaning...I will logon to SAP and connect to another system which is VB.net and has a back-end of SQL 2000. After connection I need to select or search a data to that table...for me to get the ticket number.
    Before I tried to connect from VB.net to SAP...and successfully used the SAP connector...now I need the vice versa version of this approach..
    Can anyone help me? please....
    Thanks in advance...Will reward points
    aVaDuDz

    For Basic Understanding just look at RFC_READ_TABLE FM,This will give good example
    Also Check the SM59 Transaction to create RFC Destination
    Please check with below link :
    https://www.sdn.sap.com/irj/sdn/advancedsearch?query=rfc&cat=sdn_wiki
    Thanks
    Seshu

  • Function module: why do we use FM and what is the purpose of using FM

    hi,
       Can any please explain. Why do we use FM?
                                           What is the purpose of using FM ?
                                           Where we are using FM and for what tables in R/3 ?
    I could be thankful to you if any one answer above questions.
    Arun

    Hi,
      We go for creating FM when there is a chance of using the same code in different reports in R/3.
    Suppose I have a requirement say, to display the Payer Name for every sale order.
    This is most common requirement in any project.
    You can create a FM say READ_CUSTOMER_NAME in SE37.
    Write a select statement from the table VBAP to fetch the Payer Name based on the Sales Order.
    Now you can activate the FM and it is ready to be used across all the reports in R/3.
    Need : To avoid redundant coding and to modularize the code.
    If you want to see the list of Standard FMs, got SE37 --> press F4 and you'll get all the SAP standard FMs.
    For customized FMs (User defined), type Z* or Y* and press F4.
    Hope this helps a bit !!!
    Regards,
    Balaji V

  • Function modules and rfc

    please give me the code for writing exceptions in an rfc like bapiret2 to handle all type of exceptions ehile inserting or extracting data?

    Hi,
    Refer this link.
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCFESDE2/BCFESDE2.pdf
    It explains u in detail.
    Reward if helpful.
    regards,
    Ramya

  • Problem calling function module via rfc

    Hello,
    i have imported an adaptive rfc model.
    When i use it on a view, giving the import parameters over a textview and showing the results in a table everthing works fine.
    But when i set the input-parameter programmatically with a line like this:
    wdThis
    .wdGetCompController()
    .wdGetContext()
    .currentZ_FUNCTION_MODULE()
    .setMyAttribute(parameter);
    it does not work and i do get no errors - what can it be?
    Thanks for help,
    André

    Hi Andre,
    As you told, When you passing the value from the screen it works perfectly.So, there is no problem in initializing Model.
    You have to write following code in view and context of this view should be mapped with controller.
    wdContext.currentZ_FUNCTION_MODULEElement().setMyAttribute(<value>);
    Write this statement before executing your model.
    Regards,
    Bhavik

  • RFC CALL canu00B4t execute Functions module ??

    Hello everybody,
    I have a problem with a Function module. The function module should open an link (it´s a Link of a Webdynpro Application).
    I have the following constellation.
    Bex Analyzer execute a RFC Call to open/execute the Function module. The Function module should open a URL (Webdynpro Application), but it doesn´t work.
    I don´t know why. The Connection of the RFC Call is ok. I have tested the RFC with any Object´s and it works (He "answered").
    What ist wrong in the Function Module, why can´t the FM open the URL??!
    Simple Code of Function Module
    call method cl_gui_frontend_services=>execute
    exporting
    document = 'URL'
    exceptions
    others = 1.
    Endfunction.
    A other test
    *CALL FUNCTION 'PRGN_GENER_EXECUTE_URL'
    *EXPORTING
    *NODE_DATA = 'url'.
    The VBA Code for RFC
    Sub Login()
    Dim functionCtrl As Object
    Dim sapConnection As Object
    Dim theFunc As Object
    Dim sReturn As Boolean
    Dim l_export As String
    Dim objQueryTab As Variant
    Set functionCtrl = CreateObject("SAP.Functions")
    Set sapConnection = functionCtrl.Connection
    sapConnection.Client = "100"
    sapConnection.user = "xy"
    sapConnection.Language = ".."
    sapConnection.SystemNumber = "xy"
    sapConnection.ApplicationServer = "xy"
    sapConnection.Language = "x"
    sapConnection.codepage = "xy"
    sapConnection.Destination = "xy"
    sapConnection.System = "x"
    sapConnection.SystemID = "......"
    sapConnection.Password = "xy"
    sapConnection.autologon = 1
    If sapConnection.Logon(0, True) <> True Then
    MsgBox "Keine Verbindung"
    Else
    Set theFunc = functionCtrl.Add("SS_RFC_URL_TEST")
    objQueryTab = "200"
    theFunc.Exports("I_PAR") = objQueryTab
    sReturn = theFunc.call
    If sReturn = True Then
    objQueryTab = theFunc.Imports("E_PAR")
    End If
    sapConnection.logoff
    End If
    End Sub
    >E_PAR is the Exportparameter of the Function module
    >I_PAR is the Importparameter of the Function module
    Thanks
    Edited by: Schwarzenberger Stefan on May 9, 2011 1:59 PM

    Hi, I have a similar situation.  Within VBA I am calling the RFC 'RFC_CALCULATE_TAXES_DOC'.  This RFC is used to communicate with external tax software like Taxware; it gets applicable tax rates, amounts, etc. based on tax jurisdiction code and other data.  The RFC is remote-enabled (has to be to talk to Taxware).
    This RFC requires an RFC Destination in order to work.  Within VBA, I have not been able to figure out the syntax required to enter the Destination name.  I saw Shreeram's post saying to use CALL FUNCTION 'PRGN_GENER_EXECUTE_URL' DESTINATION <RFC Destination Name>.  However, this looks like ABAP syntax and not VBA syntax.
    Does anybody know if this is possible within VBA?  Sounds like it's not but wanted to double-check.
    Thanks!!
    Kory Squire
    <<Removed email address>>
    Edited by: Matt on May 18, 2011 6:37 AM

  • Parallelization is not happening using asychnronous RFC in a function module

    A BW data source ZTEST
    has been created based on a function module ZTEST_FM to pull the
    data into BW system from R/3.
    (Have checked the parellel jobs running in SM66 transaction).
    Inside the function module, an RFC function
    module ZTEST_RFC1 has been called asynchronously to implement the parallelization
    to improve the data extraction time into BW system.
    Note: In this scenario asynchronous
    RFC is used to implement the parallel processing.
    The logic in the function module is as follows.
    Function module ZTEST_FM Logic:
    Fetch data from HRP1000 table into an internal table IT_HRP1000 for
    OTYPE = ‘TN’.
    Loop at IT_HRP1000 into work area (WA).
    Call the RFC asynchronously by passing OBJID,OTYPE and ENDDA,
    Calculate SOBID which is the required output field from the RFC
    function module.
    Populate the results into final internal table E_T_DATA.
    The output structure contains the following fields.
    OBJID
    BEGDA
    ENDDA
    SOBID
    Could you please give us some suggestions, to implement the parellel processing using asychronous RFC in this scenario.
    Would appreciate your help.

    Your RFC call looks correct. For collecting the result you will need to code the callback routine Write_E_T_data. Inside the callback you can use the statement
    RECEIVE RESULTS FROM FUNCTION ZFHLS_EX_TNM_ACADEMY_RFC1 IMPORTING <parameter list>
    to retrieve the calculated result. For the declaration of the callback routine I recommend
    FORM Write_E_T_data USING iv_name TYPE c.
    The parameter iv_name containing the name of the RFC task turned out to be mandatory in my tests.

Maybe you are looking for