Calling BAPI(RFC function module) in java? Part 2

Hi
Can any body tell me or give me source code for calling give BAPI...i need to give the inputs to that parameters..
data l_order_header_in    like bapisdhd1.
data t_return             like bapiret2  occurs 0 with header line.
data t_order_items_in     like bapisditm occurs 0 with header line.
data t_order_schedules_in like bapischdl occurs 0 with header line.
data t_order_partners     like bapiparnr occurs 0 with header line.
*data t_order_condition_ex like bapicond   occurs 0 with header line.
*clear   t_order_condition_ex.
*refresh t_order_condition_ex.
clear l_order_header_in.
l_order_header_in-doc_type      =  'TA'.
l_order_header_in-sales_org     =  'ZZ02'.
l_order_header_in-distr_chan    =  'Z2'.
l_order_header_in-division      =  'Z2'.
*l_order_header_in-purch_no      =  '12'.
clear   t_order_items_in.
refresh t_order_items_in.
t_order_items_in-itm_number     =  '000001'.
t_order_items_in-material       =  'HAMAM'.                 " 'LBYA1'.
t_order_items_in-target_qty     =  '0000000000001'.
t_order_items_in-comp_quant     =  '0000000000001'.
append t_order_items_in.
clear   t_order_partners.
refresh t_order_partners.
t_order_partners-partn_role     =  'AG'.
t_order_partners-partn_numb     =  '0000000006'.
append t_order_partners.
clear   t_order_schedules_in.
refresh t_order_schedules_in.
t_order_schedules_in-itm_number =  '000001'.
t_order_schedules_in-sched_line =  '0001'.
t_order_schedules_in-req_qty    =  1.
append t_order_schedules_in.
clear   t_order_partners.
t_order_partners-partn_role     =  'WE'.
t_order_partners-partn_numb     =  '0000000006'.
append t_order_partners.
break kumars.
call function 'BAPI_SALESORDER_CREATEFROMDAT2'
  exporting
  SALESDOCUMENTIN               =
    order_header_in               = l_order_header_in
  ORDER_HEADER_INX              =
  SENDER                        =
  BINARY_RELATIONSHIPTYPE       =
  INT_NUMBER_ASSIGNMENT         =
  BEHAVE_WHEN_ERROR             =
  LOGIC_SWITCH                  =
  TESTRUN                       =
  CONVERT                       = ' '
IMPORTING
  SALESDOCUMENT                 =
  tables
    return                        = t_return
    order_items_in                = t_order_items_in
  ORDER_ITEMS_INX               =
    order_partners                = t_order_partners
    order_schedules_in            = t_order_schedules_in
  ORDER_SCHEDULES_INX           =
  ORDER_CONDITIONS_IN           =
  ORDER_CONDITIONS_INX          =
  ORDER_CFGS_REF                =
  ORDER_CFGS_INST               =
  ORDER_CFGS_PART_OF            =
  ORDER_CFGS_VALUE              =
  ORDER_CFGS_BLOB               =
  ORDER_CFGS_VK                 =
  ORDER_CFGS_REFINST            =
  ORDER_CCARD                   =
  ORDER_TEXT                    =
  ORDER_KEYS                    =
  EXTENSIONIN                   =
  PARTNERADDRESSES              =
break venkat.
call function 'BAPI_TRANSACTION_COMMIT'
EXPORTING
  WAIT          =
IMPORTING
  RETURN        =
Awaiting for ur responses..
Thx
PRadeep

To call an RFC, you need to import that first. For that right click on the project into which you need to add the rfc.
Import >>import RFC modules from r/3>>Give the package name and a port name for the rfc.
set the server options as your r/3 server properties.
Then you can search the Function name >> it will be displayed in the result area>> select it and press finish.
The RFC will be imported to your project.
Then you need to create JCO for calling that rfc.
Here is a sample code which calls an RFC and setting jco..
import com.sap.mw.jco.JCO;
import com.sapportals.portal.prt.component.*;
public class rfc extends AbstractPortalComponent
     private JCO.Client jcoClient;
     Insert_pgm_PortType insFunc=new Insert_pgm_PortType();
     Zinsert_Pgm_Input ip=new Zinsert_Pgm_Input();
     Zinsert_Pgm_Output op=new Zinsert_Pgm_Output();
    public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
    this.connect();
     insFunc.messageSpecifier.setJcoClient(jcoClient);
//setting input params
     ip.setAssociate_Id1("44");
     ip.setCourse_Objt1(2);
     ip.setQlty_Content1(5);
     ip.setSeq_Content1(2);
     ip.setTraining_Id1("22");
//calling RFC
     try{
     op=insFunc.zinsert_Pgm(ip);
     }catch(Exception e){}
          response.write(op.getMessage());
          this.disconnect();
//creating JCO connection
     private void connect() {
               try {
                    jcoClient =
                         JCO.createClient("Client","userid","password","Language","servername","Systemid");
                         jcoClient.connect();
               } catch (Exception e) {
                    System.out.println("Error connecting to SAP ::" + e.getMessage());
                    e.printStackTrace();
     private void disconnect() {
               try {
                    jcoClient.disconnect();
               } catch (Exception e) {
                    System.out.println(
                         "Error dis-connecting to SAP ::" + e.getMessage());
                    e.printStackTrace();
Hope this Helps
gEorgE

Similar Messages

  • Problem while calling an RFC Function Module in Background

    Hello,
    I have created a RFC function module for reading data from an external DB system. The FM calls an external RFC program (coded in C++ using RFC SDK), which delivers the required data. This external program is maintainged as an TCP RFC Connection in SM59.
    Further I have created a report, that calls the RFC function module to get the data from the external RFC programm.
    My problem is, when I call the report in foreground, everything works OK, the RFC connection works and data can be read from the external program.
    However, when I schedule the report to run in background as a job, the report is stating in the protocoll that there was a problem calling the defined RFC connection (although the connection is working properly at that time).
    More funny is, this particular problem with running in background occurs only in the productive system, in test and development system the report works correctly also while running as a job in background.
    Can you suggest the solution to this problem? Could it be something with authorisations or server settings?
    I will be on holiday for the next 6 weeks, so take your time to answer .
    Regards,
    Dusan.
    Edited by: Julius Bussche on Jan 22, 2009 7:19 PM
    Please read the forum rules about u r g e n t ...

    This is an external RFC server program, not a remote enabled ABAP RFC function module as the others seem to be assuming, right?
    Is it possible that your DEV and QAS systems only have one application server, but the PROD has many and dedicated one(s) for processing low priority background jobs?
    It might be that the target server of your TCP connection is not this BTC instance, and your RFC server is returning the data "locally" - so, into nirvana...
    Just guessing, but might be worth checking.
    Cheers,
    Julius

  • Calling a RFC Function Module

    Hello Guys,
    I have a question regarding calling a RFC function module.
    In BW - BI 7.0 I call a RFC function module:
    (The ABAP program in BW-BI 7.0 is below)
      CALL FUNCTION ''ZTESTFUNCTIONMODULE'  " Function module in ECC
         DESTINATION 'DECCLNT110'  " ECC system
        TABLES
          it_gl_item   = it_gl
          it_errlog_gl = it_errlog_gl.
    The 'ZTESTFUNCTIONMODULE'   is RFC enabled in the ECC system.
    The purpose is we retarct the data from BW to ECC.
    When I run the function module it always asks for the user id and password.
    The SAP logon screen appears and it asks for the user id and password.
    The destination is maintained in the SM59 transaction and also the user is maintained there. I think it should login automatically into remote system and return the tables. is it correct. How to skip the logon screen.
    Do I have to pass the user id and password in the function module. I think it should take the user id from the SM59 destination. Is it correct.
    Please advise. As always thanks for your help guys.

    Hi Senthil,
    I think you answered your query in your question itself
    The user ID and password need to be maintained in RFC destination in SM59.
    Go to SM59 and then click on test connection..if it does not ask for ID and passwoed that means correct ID and password is maintained in SM59 otherwise maintain it.
    Regards,
    Atish

  • Where should i call the rfc function module? in xi or in r/3

    where should i call the rfc function module?
    for the synch scenario: file < -- >  xi <---> rfc
    i know the type of rfc is tcp/ip; but i'm not sure with the followings,
    and with some trials i can not even see any message via rwb even all the setting
    can be activated without errors.
    where should i create the rfc destination? in r/3 or xi
    where should i call the rfc via abap program? in r/3 or xi
    i guess the calling program should belong to the different server with the rfc itself....
    so confused....
    Thanks for your reply!!
    Jun

    if i create the destination in xi point to r/3, then i call the rfc use the destination in r/3 right ?
    The call doesnt use the destination in R3. XI has the RFC destination which is just used to connect to the R3 system
    but where i need to create the fm via se37? in xi or r/3 ?
    In R3
    Regards,
    Prateek

  • Migrating BAPI & RFC function modules into web services

    What is the advantage of migrating BAPI & RFC function modules into web services?

    Hi.
    That's a very good question. Why did you ask it, are you considering doing so?
    I wouldn't think there would be any performance advantages using WebServices.
    You could make your BAPI's available for other systems than Web Dynpro or SAP systems by turning them into WebServices.
    That could be an issue when you want to use different integration engines perhaps.
    A WebService might also be better for dealing with large number of requests I guess.
    When dealing with XML you can also use the advantage of XSLT for validating your data.
    The main advantages would still be the availability of your service for non-SAP systems.
    /Mikael

  • Calling RFC Function module from JAVA

    Hi All,
       We have created a RFC Function Module for Billing Plan tab in Sales order (BDC). The function Module contains BDC. When we are running the same function module in SAP it is working fine. But when the FM is called in Java , it is allowing only maximum of 5 entries , when we trying to insert at 6th position in billing plan tab, we are getting an error.
    Can any one help on this.
    Points will be rewarded for helpful answers.
    Thanks & Regards,
    Kiran I

    I think the problem is because of the number of lines displayed on the screen in the BDC session in the Billing Plan.
    You might have to add the page down logic to your BDC program.

  • Unknown error calling a RFC Function Module in BODI

    Hi all,
    I am having an issue identifying the error that my batch job in BODI is giving with regards to a RFC function module call in my query. The value returned by the standard parameter 'AL_RFC_RETCODE' are square characters (              ).
    At the completion of the job, the error message 'RFC CallReceive error <Function ZCT_INDSLS_SLS_TRN_INSERT: Invalid request.. Invalid request.>.' is being output.
    Correct me if I'm wrong but the parameter 'AL_RFC_RETCODE' should return standard values as per the techical manual provided to undertand any errors that might occur during a RFC FM call.
    Can anyone help me on this?
    Best regards,
    Andrew Wong

    Hi Senthil,
    I think you answered your query in your question itself
    The user ID and password need to be maintained in RFC destination in SM59.
    Go to SM59 and then click on test connection..if it does not ask for ID and passwoed that means correct ID and password is maintained in SM59 otherwise maintain it.
    Regards,
    Atish

  • Calling Synchronous RFC Function Module in Background

    Hi all,
    Currently we are working on some requirement where in we have to retrieve data from one system(CRM) and update the same into another system(ECC). We have developed a RFC Function in CRM system and it is being called from ECC system as in synchronous mode via a batch program.
    Now since all sychronous call to a RFC function will be dialog there is a constraint on the runtime which is being set by maximum run time for each dialog work process. So my question is there an option to call an RFC function synchronously in background (background task) so there is no runtime performance.
    The standard TRFC, QRFC calls in background runs asynchronously and so I am trying to check with the SDN world as whether has anyone tried  SRFC(Synchronous) call in background?
    Thanks in advance,
    Jagath

    So my question is there an option to call an RFC function synchronously in background (background task) so there is no runtime performance.
    One solution would be to increase the value of the "time out" parameter defined the CRM system. This i feel is not a fool-proof solution as the run-times cannot be predicted. Check this thread: Re: RFC timeout profile parameter
    For me a better solution would be to implement tRFC call instead of a synchronous call. Any reasons why you don't want to implement a tRFC ?
    BR,
    Suhas
    Edited by: Suhas Saha on Jun 26, 2010 8:52 AM

  • Regarding: calling a rfc function module for web dynpro for JAVA

    Hello all,
    I want to call an rfc enabled function module from webdynrpo application.
    *and there is one condition that function module should be called not threw bapi.*
    Thanks
    Edited by: Punit Pawar on Jul 21, 2008 10:38 AM

    Hi 
    You can call RFC(remote enabled) from R/3 through Models in Webdynpro Java.You need to have JCO destinations.You connection properties of backend System
    http://help.sap.com/saphelp_nw04s/helpdata/en/6a/11f1f29526944e8580c5e59333d96d/frameset.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/11c3b051-0401-0010-fe9a-9eabd9c216de
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b0310cf8-8cdb-2910-4a82-df1f11619f4e
    Thanks,
    Tulasi Palnati

  • API - BAPI , RFC Function module to validate user id and password

    Hi,
    Can anyone provide me with the function module to validate the username and password of the user of the back end R/3 System.
    Best Regards
    Sid

    Use function module SUSR_CHECK_LOGON_DATA. You need to provide auth_method (P for password check), userid and password.
    Be careful when you execute the function in test mode because it converts the input into upper case hence if you have lower case characters in your password it will return with invalid password. If you pass the lower case into the function in a program everything is fine.
    Regards,
    Michael

  • Problem while calling RFC function module in java

    Hi all
    com.sap.mw.jco.JCO$Exception: (102) RFC_ERROR_COMMUNICATION: Connect to SAP gateway failed
    Connect_PM  GWHOST=<system.ab.ydydy.yyyd.com>, GWSERV=sapgw00, ASHOST=<system.ab.ydydy.yyyd.com>, SYSNR=00
    LOCATION    CPIC (TCP/IP) on local host
    ERROR       hostname '<system.ab.ydydy.yyyd.com>' unknown
    TIME        Mon Jun 06 14:50:25 2005
    RELEASE     640
    COMPONENT   NI (network interface)
    VERSION     37
    RC          -2
    MODULE      ninti.c
    LINE        332
    DETAIL      NiPGetHostByName2: hostname '<system.ab.ydydy.yyyd.com>' not found
    SYSTEM CALL gethostbyname_r
    COUNTER     1
         at com.sap.mw.jco.rfc.MiddlewareRFC$Client.nativeConnect(Native Method)
         at com.sap.mw.jco.rfc.MiddlewareRFC$Client.connect(MiddlewareRFC.java:1098)
         at com.sap.mw.jco.JCO$Client.connect(JCO.java:2983)
         at MyProject.Bapi2.<init>(Bapi2.java:43)
         at MyProject.Bapi2.main(Bapi2.java:231)
    Pl help me
    pradeep

    Hi
    This is my code....
    Created on Jun 2, 2005
    To change the template for this generated file go to
    Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    package MyProject;
    @author pradeep
    To change the template for this generated type comment go to
    Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    import com.sap.mw.jco.*;
    public class Bapi2 extends Object {
       JCO.Client mConnection;
       JCO.Repository mRepository;
       public Bapi2() {
           try {
              // Change the logon information to your own system/user
              mConnection =
                JCO.createClient("122", // SAP client
                   "<pradeep>", // userid
                   "*****", // password
                   "EN", // language
                   "<abc11.aa.abc23.company.com>", // application server host name
                   "<00>");//system no
              mConnection.connect();
              mRepository = new JCO.Repository("HLL", mConnection);
          catch (Exception ex) {
            ex.printStackTrace();
            System.exit(1);
          JCO.Function function = null;
          JCO.Table codes = null;
            try {
               function = this.createFunction("BAPI_COMPANYCODE_GETLIST");
               if (function == null) {
                 System.out.println("BAPI_COMPANYCODE_GETLIST" +
                                         " not found in SAP.");
                 System.exit(1);
               mConnection.execute(function);
               JCO.Structure returnStructure =
                 function.getExportParameterList().getStructure("RETURN");
               if (! (returnStructure.getString("TYPE").equals("") ||
                        returnStructure.getString("TYPE").equals("S")) ) {
                 System.out.println(returnStructure.getString("MESSAGE"));
                 System.exit(1);
               codes =
                 function.getTableParameterList().getTable("COMPANYCODE_LIST");
               codes.setRow(2);
    codes.deleteRow();
    codes.deleteRow(5);
    codes.appendRow();
    codes.setValue("XXXX", "COMP_CODE");
    codes.setValue("Does not exist", "COMP_NAME");
    codes.appendRows(2);
    codes.setValue("YYYY", "COMP_CODE");
    codes.setValue("Does not exist either", "COMP_NAME");
    codes.nextRow();
    codes.setValue("ZZZZ", "COMP_CODE");
    codes.setValue("Nor does this", "COMP_NAME");
    for (int i = 0; i < codes.getNumRows(); i++) {
    codes.setRow(i);
                 System.out.println(codes.getString("COMP_CODE") + '\t' +
                                         codes.getString("COMP_NAME"));
            catch (Exception ex) {
               ex.printStackTrace();
               System.exit(1);
            try {
               codes.firstRow();
               for (int i = 0; i < codes.getNumRows(); i++, codes.nextRow()) {
                 function = this.createFunction("BAPI_COMPANYCODE_GETDETAIL");
                 if (function == null) {
                    System.out.println("BAPI_COMPANYCODE_GETDETAIL" +
                                            " not found in SAP.");
                    System.exit(1);
                 function.getImportParameterList().
                    setValue(codes.getString("COMP_CODE"), "COMPANYCODEID");
                 mConnection.execute(function);
                 JCO.Structure returnStructure =
                    function.getExportParameterList().getStructure("RETURN");
                 if (! (returnStructure.getString("TYPE").equals("") ||
                          returnStructure.getString("TYPE").equals("S") ||
                          returnStructure.getString("TYPE").equals("W")) ) {
                    System.out.println(returnStructure.getString("MESSAGE"));
                 JCO.Structure detail =
                    function.getExportParameterList().
                    getStructure("COMPANYCODE_DETAIL");
                 System.out.println(detail.getString("COMP_CODE") + '\t' +
                                         detail.getString("COUNTRY") + '\t' +
                                         detail.getString("CITY"));
           catch (Exception ex) {
              ex.printStackTrace();
              System.exit(1);
           mConnection.disconnect();
         public JCO.Function createFunction(String name) throws Exception {
           try {
              IFunctionTemplate ft =
                mRepository.getFunctionTemplate(name.toUpperCase());
              if (ft == null)
                return null;
              return ft.getFunction();
          catch (Exception ex) {
            throw new Exception("Problem retrieving JCO.Function object.");
       public static void main (String args[]) {
          Bapi2 app = new Bapi2();
    This is the error i'm getting...
    com.sap.mw.jco.JCO$Exception: (102) RFC_ERROR_COMMUNICATION: Connect to SAP gateway failed
    Connect_PM  GWHOST=<abc11.aa.abc23.company.com>, GWSERV=sapgw00, ASHOST=<abc11.aa.abc23.company.com>, SYSNR=00
    LOCATION    CPIC (TCP/IP) on local host
    ERROR       hostname '<abc11.aa.abc23.company.com>' unknown
    TIME        Mon Jun 06 17:15:12 2005
    RELEASE     640
    COMPONENT   NI (network interface)
    VERSION     37
    RC          -2
    MODULE      ninti.c
    LINE        332
    DETAIL      NiPGetHostByName2: hostname
                '<abc11.aa.abc23.company.com>' not
         at com.sap.mw.jco.rfc.MiddlewareRFC$Client.nativeConnect(Native Method)
         at com.sap.mw.jco.rfc.MiddlewareRFC$Client.connect(MiddlewareRFC.java:1098)
         at com.sap.mw.jco.JCO$Client.connect(JCO.java:2983)
         at MyProject.Bapi2.<init>(Bapi2.java:45)
         at MyProject.Bapi2.main(Bapi2.java:233)
    Thx
    PRadeep

  • Calling Remote enabled Function module in java using RFC Destination

    Hi
    We are on Portal 7.3 ehp1 sp9.
    Steps followed are :
    RFC Destination called “SAP_RFC” has been created as below :
    Configuration -> Destinations -> RFC Destinations
    Connection and Transport:
    Load balancing :Yes
    Provided : SystemID / MS Server / MS Server Service / Logon Group / Gateway Host / Gateway Service
    SNC : Inactive
    Logon Data:
    Authentication : Current User (Assertion Ticket)
    Language : EN
    Client : XXX
    Repository Connection:
    Destination Name : This Destination
    Specific Data:
    pooled Connection Mode : Yes
    Max : 5
    Size : 10
    Max. wait time : 10,000
    Ping Destination results : Successfully connected to System XXX as per user XXXXXXX.
    JAVA Code as Follows:
    JCoDestination destination = JCoDestinationManager.getDestination("SAP_RFC");
    //destination.ping();
    JCoRepository repository = destination.getRepository();
    JCoFunction function = repository.getFunction("FM_NAME");
    function.execute(destination);
    Lines highlighted in RED color throwing an error as below :
    {"ERROR":"Initialization of destination JCO_RFC failed: Incomplete logon data. on <SID> mshost <MS_HOST>/ com.sap.conn.jco.JCoException: (103) JCO_ERROR_LOGON_FAILURE: Incomplete logon data. on SID mshost MS_HOST"}
    And found that no COOKIE with the name “SAP_SESSIONID_<system>_<client>” was not found, I am afraid that “Assertion Ticket” was not created in above scenario.
    To confirm SSO configuration working, i have followed below steps:
    1) Created System Object pointing to R/3 and tests were successful for authentication type "SSOLOGONTICKET / ASSERTIONTICKET"
    It's J2EE application, no references or any other additional configuration been made part from above.
    Any help ?
    Thanks

    Here is log ..Assertion ticket could not be retrieved. Error was null
    Log Record Details
    Message:
    Assertion ticket could not be retrieved. Error was null
    Severity:
    Error
    Date:
    2014-04-23
    Time:
    20:28:26:056
    Category:
    /System/Security/destinations
    Location:
    com.sap.security.core.server.destinations.service.AssertionTicketRetriever
    Application:
    Thread:
    System [2]
    Data Source:
    j2ee/cluster/server0/log/system/security_00.log
    Arguments:
    Passport User Activity ID:
    3a7af5ddca8b11e384bd8adb6f484d33
    Message ID:
    Session:
    Transaction:
    User:
    Time Zone:
    +0800
    Customer Message Component:
    BC-JAS-SEC
    Runtime Component:
    tc~sec~destinations~service
    Correlation ID:
    3643650000002747
    Passport Session:
    3A7AF5DDCA8B11E384BD8ADB6F484D33
    Passport Connection:
    3a7af5ddca8b11e384bd8adb6f484d33
    Passport Connection Counter:
    0
    Log ID:
    C0000AD01D7B002200000EA5009800B2
    Host:
    host
    System:
    XXX
    Instance:
    J00
    Node:
    server0

  • CNTL_ERROR while calling a function module from Java webdynpro

    I am calling a RFC function module from javawebdynpro app
    which inturn calls a function module performing BDC on CAPP transaction. When I run this from SE37 of the same system or a different system everything works fine. But when called from Java webdynpro app, it raises a CNTL_ERROR exception and creates a short dump.
    Any help on this is highly appreciated

    Good catch, BI Learner. This was exactly it: when assigning the values from SOURCEFIELDS directly to the import/export parameters, you have to make sure that the types are EXACTLY the same, otherwise it will not work (the routine stops with an error when calling the FM, but there is no dump).
    Therefore, to solve my problem, I created the declarations precisely as expected by the FM and assigned the values to these fields:
    DATA:
          SOURCEVAL TYPE  /BIC/OIINVQTY,
          SOURCEUOM TYPE  /BIC/OIUSUOM,
          USITM TYPE  /BIC/OIUSITM,
          TARGETUOM TYPE  /BIC/OIUSUOM,
          CONVERTED_COST TYPE  /BIC/OIINVQTY.
    DATA PRODUCTION_UOM TYPE /BIC/OIUSUOM.
    " get the Production UOM
        SELECT SINGLE I~/BIC/USPRDUOM
          FROM /BIC/PUSITM AS I
          INTO PRODUCTION_UOM
          WHERE I~/BIC/USITM = SOURCE_FIELDS-/BIC/USITM AND I~OBJVERS = 'A'.
        IF ( SY-SUBRC = 4 ). " no records found
          "RAISE PARTNO_NOT_FOUND.
          RAISE EXCEPTION TYPE CX_RSROUT_SKIP_RECORD.
        ENDIF.
    " load the parameters
        SOURCEVAL = SOURCE_FIELDS-/BIC/USFRZMFC.
        SOURCEUOM = SOURCE_FIELDS-BASE_UOM.
        USITM = SOURCE_FIELDS-/BIC/USITM.
    " then you can call the FM
        CALL FUNCTION 'Z_CA_CONVERT_US_COST'
          EXPORTING
            PSOURCEVAL                = SOURCEVAL
            PSOURCEUOM                = SOURCEUOM
            PUSITM                    = USITM
            PTARGETUOM                = PRODUCTION_UOM
          IMPORTING
            PTARGETVAL                = CONVERTED_COST
          EXCEPTIONS
            CONVERSION_NOT_MAINTAINED = 1
            PARTNO_NOT_FOUND          = 2
            OTHERS                    = 3.
    " ... [do the rest]
    Thanks for your help,
    Dennis

  • RFC function module called inside an enhancment section

    Hi All,
    I am calling a RFC function module in background task as a separate unit. I am calling this FM within an enhancement section. Is it alright to use a commit work inside this RFC enabled FM even if I am calling it within an enhancemnt? Please help

    Hi,
    Yes,  you can use a commit work inside this RFC enabled FM even if I am calling it within an enhancemnt. Please refer below link regaring this. Thanking you.
    Commit within an enhancement point

  • Debuggin a Call to Remote Function Module

    Hi
    I have a scenario where i have a Remote Function Module in r3 which is being called synchronously by an external java application. The FM has a lot of input and output parameters and many tables.  The output returned by the FM is not as expected.
    Can anyone tell me how debug a Remote Function Module when a call has been made from an external application.
    I am not able to get the test data sent by the external application . So when the external application gives a call to this Remote FM and if it is possibele to debug it would be great.
    regards
    Nilesh Taunk.

    Hi Nilesh,
    1) Login to SAP with the same ID with which you will calling the RFC function module from the outside system.
    2) Goto transaction - se37/se38
    3) Goto Utilities => Settings.
    4) Select the ABAP Editor Tab.
    5) Click on the Debugging tab.
    6) Tick the Actv. button and give the user name with which you will be debugging the code. In this case the logged in user id.
    7) Press Enter.
    8) Now put an external break point inside the Function Module.
    9) Load your external application (from where you want to debug the FM) once again.
    The execution will stop in the FM.
    Hope it helps..
    Lokesh
    PS: This was a simple question, but I guess the reason no one has answered your question is due to the fact that you havent rewarded points to members helping you. Also remember to close your post once it has been answered.

Maybe you are looking for