How to develop an Remote Enabled Function Module

Hi All,
I'm totally new to ABAP. I have a requirement to create a Remote Enabled Function Module, which I can use to call from an external program like Java using JCo.
The functionality of the Remote Function is to write some data into certain fields of the tables AFPO and JEST.
Can someone please guide me, how to do the above described task. Is there any code snippets available, that would be really gr8.
Thanks & Best Regards,
Chandrasekhar.

you shuld have import parameters like this
i_aufnr tpye afpo-aufnr.
i_posnr tpye afpo-posnr.
i_matnr tpye afpo-matnr.
i_wemng tpye afpo-wemng.
i_ltrmi tpye afpo-ltrmi.
i_meins tpye afpo-meins.
i_dwerk tpye afpo-dwerk.
i_objnp tpye afpo-objnp.
i_stat type jest-stat.
in exceptions
enter_key_data.
assume all the fields are mandatory.
types: begin of t_ekpo,
      aufnr like ekpo-aufnr,
      posnr like ekpo-posnr,
      matnr like ekpo-matnr,
      wemng like ekpo-wemng,
      ltrmi like ekpo-ltrmi,
      meins like ekpo-meins,
      dwerk like ekpo-dwerk,
      objnp like ekpo-objnp, "for Status update
      end of t_ekpo.
types: begin of t_jest,
       objnr like jest-objnr,
       stat  like jest-stat,
       end of t_jest
data: x_ekpo type t_ekpo,
      x_jest type t_jest.
**need to validate before sending it to EKPO.
if not i_aufnr is initial
     and not i_posnr is initial
     and not i_objnp is initial
     and not i_stat is initial.
X_ekpo-aufnr = i_aufnr.
X_ekpo-posnr = i_posnr.
X_ekpo-matnr = i_matnr.
X_ekpo-wemng = i_wemng.
X_ekpo-ltrmi = i_ltrmi.
X_ekpo-meins = i_meins.
X_ekpo-dwerk = i_dwerk.
x_ekpo-objnp = i_objnp.
modify EKPO from X_ekpo .
if sy-subrc = 0.
commit work.
endif.
x_jest-objnr = i_objnp.
x_jest-stat = i_stat.
modify JEst from X_jest .
if sy-subrc = 0.
commit work.
endif.
else.
raise exception enter_key_data.
endif.
please let me know if you need any validation on those.
regards
vijay
Message was edited by: Vijay Babu Dudla

Similar Messages

  • How to Create a Remotely Enabled Function Module

    Hi All,
    How to Create a Remotely Enabled Function Module.
    I Want to Create a FM Using Sample Data , This for Practice
    What Fields can i give in the Import and Export Parameters.
    Please Give me one Example
    Can Any one Give me the Steps to do this.
    Regards
    Vamsi

    Hi Vamsi,
    Lets do simple example where you will first create a RFC in one server (say A) and create normal program in othere server (say B). Finally you will call the RFC in A from B.
    Do the following steps for creating RFC in server A.
    1. log on to server A
    2. go to se37
    3. Edit -> function groups-> create function group and give the function group name (say ZGRP).
    4. create a FM ( say Z_TEST_RFC) in se37 providing the function group which is created just now.
    5. go to attribute tab -> choose remote-enabled module from processing type.
    so that your FM will become RFC.
    6. provide the import parameter in import tab.
    we will provide only two import parameters.
    - parameter name : P_NUM1, typing: TYPE, associated type : I & <b>check the pass value</b> (all the parameters of RFC must pass by value).
    - parameter name : P_NUM2, typing: TYPE, associated type : I & <b>check the pass value</b>
    7. provide the export parameter in export tab.
    parameter name : P_SUM, typing: TYPE, associated type : I & <b>check the pass value</b>
    8. write the given simple code in source code tab.
    FUNCTION Z_TEST_RFC.
    P_TOT = P_NUM1 + P_NUM2.
    ENDFUNCTION.
    Do the following steps for creating ABAP program which will call the RFC in server B.
    1. se38 - > creat a program.
    2. write the given simple code.
    data tot type i.
    call function 'Z_TEST_RFC' destination '<b>XXXXXX</b>'
      exporting
        p_num1 = 10
        p_num2 = 15
      importing
        p_tot = tot.
    write tot.
    please note that <b>XXXXXX</b> is RFC connection which is avialable in <b>sm59</b> transaction in server A.
    -go to sm59 - > abap connection (list of RFC connection configurations are avialable). choose server B connection and replace it of <b>XXXXXX</b> in the code.
    finally you can execute the normal abap program that will call the RFC and display the result.
    Regards,
    Sukhee

  • Difference between BAPI and remote enabled function module

    Hi!
    what is the difference between remote enabled function module and
    BAPI.
    How do we use remote enabled function module .
    thanks
    Amit

    Please search the forum before asking basic questions.

  • How should tables be defined in remote-enabled function modules used in PI

    Hi,
    I know the outside-in development approach is best practice (although there is some conflicting viewpoints on the best approach for new developments, some favouring RFC).
    If I was to create a new remote-enabled function module in a backend system then import this into the Integration Repository what is the recommended parameter group for defining tables against the RFC?
    I've tested using import, export, changing and tables and they all work but SAP recommends not using the tables option anymore but when using import/export/changing option I receive a warning that using these parameters with deep/nested data types can lead to performance problems.
    Can someone offer any advice?
    Thanks,
    Alan

    > I've tested using import, export, changing and tables and they all work but SAP recommends not using the tables option anymore but when using import/export/changing option I receive a warning that using these parameters with deep/nested data types can lead to performance problems.
    You use import and export parameters, and avoid deep and nested structures.

  • Remote enabled function modules IN R/3

    hi,
    i posted this question before but i didnt get a convincing answer to move forward
    when data is sent to bw from r/3 there should be some remote enabled function modules which are  getting fired.
    so people told me to find fm for each data source in 'ROOSOURCE'  table.
    and to debug to get the function module IN RSA3.
    i got those function module but these r 'NORMAL FUNCTION MODULE'  but not
    'REMOTE ENABLED FUNCTION MODULES'
    IF REMOTE ENABLED FM'S ARE NOT GETTING TRIGGERED THEN HOW IS DATA GOING TO BW
    PLEASE SUGGEST ME I AM WAITING FOR LONG TIME FOR A GOOD ANSWER.

    OK,
    this is a big project.... You want to simulate a BW system.... I think don't think it is not possible but R/3 is a pair exchanging a lot of information and a lot of settings have to be done.... this seems to me very complex....
    This will depend on what kind of datasource you want to extract....
    - Master data: I would directly go the you SAP database and extract the info form the tables directly (we are actually doing that)
    - LO datasources would be a bit more complex since you'll have to initialize your datasource from a BW system.... Or figure out how this is working, meaning reverse engineering of the whole stuff! You could even think about using the exits for the business events, e.g. when an article doc is created, write the data in a flat file and/or write it directly to the DB of your DW....
    Also I would setup a BW system anyway; it is so easy then to manage all this data... You could then stick to load the data to the PSA and extract it very easily to your external DW. Even BW provide much more extraction capabilities once the data is stored there....
    They're a lot of solutions like always... the challenge is to choose the best one.
    hope this helps...
    Olivier.

  • Remote Enable Functional Module similar to F.01

    Dear All,
    I want to create a Remote Enable Functional Module similar to F.01 means input parameters (Chart of accounts,  Financial statement version, Reporting year, Reporting periods , Comparison year , Comparison periods, ALV Grid control, Profit Center.)
    And the output fields of F.01 should be in internal table or structure
    Can any give some inputs and help me in this.
    Thank you and regards,
    Tazeer.

    Hi,
    you say the u are getting output in RSA3, can i know for how many records it is taking how much time to extract?
    if you are trying to pull the data till PSA and for that itself if it is taking more time, then issue may be with the code or with ur RFC connection, if all the other data sources are working fien then there is no issue with RFC, issue may be with ur code only....
    Regards,
    Nanda.S

  • Remote-enabled function module could not be imported

    Hello all,
    I have a problem. In so called Enterprise Services Builder I want to import a remote-enabled function module. But I got the following error:
    Could someone tell me how to fix the problem? thx.
    Best regards,
    Fanglin Ye

    Hi,
    I hope I already answered.
    "You can transfer his changelist to your name for activation"
    Goto--> changelist tab --> right click on your colleague's changelist --> transfer
    then activate under your name

  • Message handling in remote enabled function module .

    Hello experts ,
    I am creating a remote enabled function module which must return a warning message based on certain condition . Inorder to meet the requirement  I have added this line in the Fm's source code :
    " Message Wxx(message class) with a ."
    But when I am trying to use it , the above given message is dispalyed as an error message . Could you please let me know where am I going wrong . TIA.
    Regards,
    Prakrita Kapoor.

    Hi Prakrita,
    Try building below code within the RFC after you have added return structure in your RFC parameters.
      IF sy-subrc NE 0.
        CLEAR message.
        message-msgty = 'E'.
        message-msgid = 'ZMI'.
        message-msgno = '001'.
        message-msgv1 =  ID.
      PERFORM return_message USING message
                                   CHANGING return.
      Endif.
      form return_message USING    VALUE(P_MESSAGE)   LIKE MESSAGE
                                   CHANGING P_RETURN  LIKE BAPIRETURN.
      CHECK NOT MESSAGE IS INITIAL.
      CALL FUNCTION 'BALW_BAPIRETURN_GET'
           EXPORTING
                TYPE       = P_MESSAGE-MSGTY
                CL         = P_MESSAGE-MSGID
                NUMBER     = P_MESSAGE-MSGNO
                PAR1       = P_MESSAGE-MSGV1
                PAR2       = P_MESSAGE-MSGV2
                PAR3       = P_MESSAGE-MSGV3
                PAR4       = P_MESSAGE-MSGV4
           IMPORTING
                BAPIRETURN = P_RETURN
           EXCEPTIONS
                OTHERS     = 1.
    endform.

  • Standard Remote-Enabled Function Module to display data.

    Good afternoon,
    Is there any Standard Remote-Enabled Function Module which can be used to display a list of material, supplier or stocks data?
    First time, I was trying to use FM link to BW Extractor as MDEX_MATERIAL_MD for Material Attributes, but these kind of FM are not Remote-Enabled and not released.
    My second solution is to find a Standard Remote-Enabled Function Module which can be used to display a list of material, supplier or stocks data, but I haven't it yet.
    May someone help me in this?
    Thanks in advance for your answers.
    Best regards,
    Paul d'ORIGNY

    Hi,
    Suppose you want to read data from the vbrk table in ECC through a function module, then you can define the function module as "remote-enabled"(attribute tab in se37-processing type). You can try the following code out:
    FUNCTION Z_EM_INVOICE.
    *""Local Interface:*
    *"  IMPORTING
    *"     VALUE(I_FKDAT) TYPE  FKDAT OPTIONAL
    *"  TABLES
    *"      E_VBRK STRUCTURE  VBRK
    *select * from vbrk into table*
    e_vbrk where fkdat = i_fkdat.
    ENDFUNCTION.
    From BI you can call the function odule as follows:Supposing that you are calling the function module in the start routine of a dso:
    data : v_dest_system TYPE char255.
    data: l_vbrk type table of vbrk.
    v_dest_system = 'DRDCLNT010'
    CALL FUNCTION 'Z_EM_INVOICE''
    destination v_dest_system
    EXPORTING
    i_fkdat = <passing variable>
    e_vbrk = l_vbrk.
    Regards,
    Anjana.

  • Remote-Enabled Function Modul G/L Accounts

    Hi!
    I am looking for remote-enabled function moduls (or BAPIs) to create and change G/L Accounts. There are two function moduls which seems perfect (GL_ACCOUNT_INSERT and GL_ACCOUNT_UPDATE) but these two are not remote-enabled.
    Does anyone know some alternatives that i missed?
    Thanks in advance,
    Frank!

    Hi.
    Look at this function module
    BAPI_ACC_GL_POSTING_POST

  • How to call a remote capable function module?

    Hi all,
    I want to call a bapi from a R/3 that is not available in the current system were i have my WebDynpro Abap application.
    So, i called the wizard "Service Call".
    In the Select Service step i have to input the destination and Function Module and
    Before i specified an RFC destination .
    The wizard cannot find the function.
    I read the Note:
    The function module must exist in the current system! The wizard does not support to call a remote capable function module that does not exist in the current system.
    The question is :
    How can i call remote capable function module?
    Thanks,
    Ari

    Hi,
    this link might help you : <a href="http://help.sap.com/saphelp_erp2005vp/helpdata/en/22/0424ba488911d189490000e829fbbd/frameset.htm">rfc in abap</a>
    grtz
    Koen

  • Remote enabled function module to copy a variant

    Hi
    Kindly let me know whether there is any remote enable function module to copy a variant  and save a  variant.
    Thanks and Regards
    neeta

    HI,
    Use the Function moduels
    <b>RS_VARIANT_CLIENTCOPY 
    RS_VARIANT_COPY   </b>    
    Regards
    Sudheer

  • Remote enabled Function module for a simple report program

    Hi Experts ,
    I have to convert a Simple list report program to a remote enabled function module, so that it can be used from the online applications.
    One option that comes to my mind is to create some import parameters for all the selection screen fields and then the result will be fetched in the export tables in function module. and call that report program using call transaction or submit program.
    I Dont know whether this is a best solution or not, can you please help me with your suggestions?
    Regards,
    Ashish Shah

    Hi,
    You can use the SUBMIT statment in the Function module , then in the report program you need to EXPORT the Result to the list then use the IMPORT option in the function moduel then pass the data to the TABLE parameters so that the data will be avilable in the table parameters
    Regards
    Sudheer

  • Error in executing remote enabled function module

    Hi All,
    I have created a remote enabled function module.
    The function module works fine without entering the RFC dest sys.
    When i enter the RFC dest sys and execute it, i get the error
    Exception                  SYSTEM_FAILURE
    Message ID               00
    Message number      341
    Message                   Runtime error CALL_FUNCTION_NOT_FOUND has occured
    The RFC connection actually works fine to connect to the system when i test it from SM59.
    But what could be the reason for the above error?
    Actual intent is that I want to execute FM created in sys1 to be executed on sys2 from sys1 itself.
    Regards,
    Rahul

    Hi,
    I guess there is no other way. For an RFC enabled function module it should exist in SYS2 .Then only you will be able to call from SYS1.
    Your RFC connection will work fine if you provide all the technical parameters correctly.A RFC function module has nothing to do with this connection
    Regards,
    Lakshman.
    Edited by: Lakshman N on May 14, 2010 11:25 AM

  • Difference between BAPI Function Module and Remote Enable Function Module

    Dear Experts,
        I want to know the main difference between BAPI Function Module and Remote Enable Function Module ?
    One main difference that I know is BAPI FM are declared in Methods of Business Object  ie BAPI are methods of BOR where as Remote Enabled FM are not. What are other differences? Is it possible to convert a Remote Enable FM to BAPI FM .
    regards
    Manish

    Hello,
    Did u create any ZBAPI?
    The Procdure for Creating the Customer BAPI is Create a Remote Enabled Function module and then goto the tcode BAPI.
    Once u go in to that just take the Project tab and enter the details.
    by this way u can create a Customer BAPI.
    With Regards,
    Sumodh.P

Maybe you are looking for