SAP beginner !! steps to create a fun module which accept int table

steps to create a fun module
1. which accept internal  table and a flag value
2. based on flag value it calls screen.
3. if flag value is ' D' it displays the internal table in Table Control in Display Mode
4. if flag value is ' E' it edits the table control also the internal table,
    it can also append a new row in table control or delete it.
5. the function module should then send the output the internal table which has changed.
plz if any one can provide solution to this do it for me
thnk u

Hi Shailesh,
    U just create 2 table control (one in Display Mode & the another in Change Mode ).While sending the Internal Table values, u send the values to the corresponding Table Control based on the Flag Value.

Similar Messages

  • I wanted to create a module pool which accepts a table n flag

    i wanted to create a module pool which accepts a table n flag.
    and based on flasg value it allows the table to get into edit or display mode.
    the table has to use table control to display for user
    and it should be able to edit the table as well as append if the flag value is edit.
    the table which has been change should be passed back.

    HI Shailesh ,
          On your screen which contains the table control , you can definately  put the flag . Now use 2 conditions , one for change n other for display mode .Initialize the value of the flag to be "X" and based on the flag valu design your table .
    lets say u have a screen 0100 ,
    at the begining put FLAG = 'X'.
    lets say , this is for your change screen  .
    then loop at the table control and allow the fields for fields input . all you should do in the PBO only .
    next in PAI , fill the table control with the changed values .
    and in PAI , in AT-user command module , code for the flag ( / push button  ) . and pass the values when the user clicks on the button .or else here you can check whether the value of the flag is  "X" ( for change mode )  or " " .
    if it  is " "   then loop at the screen and make all the fields inactive for input ( Display mode )
    Inactivation of the fields should be done in the PBO based on the conditions .
    Revert back if you need further clarification .
    This logic should  definately work .
    Reward if helpful .
    Thanks
    Ranjita

  • I need to create RFC function module which creates the IDOC

    Hi-
    Any idea how to create RFC function module which creates the outbound IDOC. If you have any sample code please forward to me.
    Thanks,
    Sony

    My Problem is
    Whenever they create Invoice using T-code's like FV65(Parked Document), automatically should create IDOC's...
    I have used message type FIDCC1 but this message type is usefull only for Posting documents.
    1. Whenever they create parked document, entries will be stored in BKPF(Parked Document-Filed-BKPF-BSTAT = 'V') and Bseg....
    2. I have to read entries from those tables and should create IDOC...
    3. I checked FM's(FI_IDOC_CREATE_FIDCC1, FI_IDOC_PREPARE) but are not useful...
    4. Now I need to write one RFC function module and that FM should create the IDOC's....
    Can anyone please help me out?
    Thanks,
    Sony

  • I'm very new tp SAP ABAP, how to create a function module..V.URGENT

    hi folks,
    I'm very new to sap abap.
    I want to create a function module.
    the following is my requirement.
    by passing(eporting parameters to funtion module from pgm point of view) a field, i want to get(importing parameters from the funtion module, from pgm point of view) some 7 fields(of various tables).
    please also tell me how can code an inner join for tables 5 tables(a,b,c,d,e). i'm joining a on b, b on c, c on d,the problem here is that i can not join d on e as there are no common fields in d and e.
    can i join e and c or b, there are no common fields even in a and e.
    please tell me the solution as soon as possible, this very important and urgent deliverable.
    thanks in advance

    Here is link for creating function modules
    <a href="http://help.sap.com/saphelp_47x200/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/frameset.htm">Creating Function Modules</a>
    Regds
    Manohar

  • Want to create a function module  which will convert smartform into PDF .

    Hi All ,
    Requirement : I want to create a function module/report  which will convert smartform into PDF .
    Thanks in advance

    Hi All ,
    zsuresh_test : for converting smartform into pdf.
    when I am excuting this report(zsuresh_test) and by passing the smartform name FOPCR_STANDARD_F1
    I am getting error :
    Incorrect parameter with CALL FUNCTION
    Can you  please help me out..
    REPORT zsuresh_test.
    Variable declarations
    DATA:
    w_form_name TYPE tdsfname VALUE 'FOPCR_STANDARD_F1',
    w_fmodule TYPE rs38l_fnam,
    w_cparam TYPE ssfctrlop,
    w_outoptions TYPE ssfcompop,
    W_bin_filesize TYPE i, " Binary File Size
    w_FILE_NAME type string,
    w_File_path type string,
    w_FULL_PATH type string.
    Internal tables declaration
    Internal table to hold the OTF data
    DATA:
    t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
    Internal table to hold OTF data recd from the SMARTFORM
    t_otf_from_fm TYPE ssfcrescl,
    Internal table to hold the data from the FM CONVERT_OTF
    T_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.
    This function module call is used to retrieve the name of the Function
    module generated when the SMARTFORM is activated
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = w_form_name
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    fm_name = w_fmodule
    EXCEPTIONS
    no_form = 1
    no_function_module = 2
    OTHERS = 3
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    Calling the SMARTFORM using the function module retrieved above
    GET_OTF parameter in the CONTROL_PARAMETERS is set to get the OTF
    format of the output
    w_cparam-no_dialog = 'X'.
    w_cparam-preview = space. " Suppressing the dialog box
    " for print preview
    w_cparam-getotf = 'X'.
    Printer name to be used is provided in the export parameter
    OUTPUT_OPTIONS
    w_outoptions-tddest = 'LP01'.
    CALL FUNCTION w_fmodule
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    control_parameters = w_cparam
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    output_options = w_outoptions
    USER_SETTINGS = 'X'
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    job_output_info = t_otf_from_fm
    JOB_OUTPUT_OPTIONS =
    EXCEPTIONS
    formatting_error = 1
    internal_error = 2
    send_error = 3
    user_canceled = 4
    OTHERS = 5
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    t_otf[] = t_otf_from_fm-otfdata[].
    Function Module CONVERT_OTF is used to convert the OTF format to PDF
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    FORMAT = 'PDF'
    MAX_LINEWIDTH = 132
    ARCHIVE_INDEX = ' '
    COPYNUMBER = 0
    ASCII_BIDI_VIS2LOG = ' '
    PDF_DELETE_OTFTAB = ' '
    IMPORTING
    BIN_FILESIZE = W_bin_filesize
    BIN_FILE =
    TABLES
    otf = T_OTF
    lines = T_pdf_tab
    EXCEPTIONS
    ERR_MAX_LINEWIDTH = 1
    ERR_FORMAT = 2
    ERR_CONV_NOT_POSSIBLE = 3
    ERR_BAD_OTF = 4
    OTHERS = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    To display File SAVE dialog window
    CALL METHOD cl_gui_frontend_services=>file_save_dialog
    EXPORTING
    WINDOW_TITLE =
    DEFAULT_EXTENSION =
    DEFAULT_FILE_NAME =
    FILE_FILTER =
    INITIAL_DIRECTORY =
    WITH_ENCODING =
    PROMPT_ON_OVERWRITE = 'X'
    CHANGING
    filename = w_FILE_NAME
    path = w_FILE_PATH
    fullpath = w_FULL_PATH
    USER_ACTION =
    FILE_ENCODING =
    EXCEPTIONS
    CNTL_ERROR = 1
    ERROR_NO_GUI = 2
    NOT_SUPPORTED_BY_GUI = 3
    others = 4
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Use the FM GUI_DOWNLOAD to download the generated PDF file onto the
    presentation server
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE = W_bin_filesize
    filename = w_FULL_PATH
    FILETYPE = 'BIN'
    APPEND = ' '
    WRITE_FIELD_SEPARATOR = ' '
    HEADER = '00'
    TRUNC_TRAILING_BLANKS = ' '
    WRITE_LF = 'X'
    COL_SELECT = ' '
    COL_SELECT_MASK = ' '
    DAT_MODE = ' '
    CONFIRM_OVERWRITE = ' '
    NO_AUTH_CHECK = ' '
    CODEPAGE = ' '
    IGNORE_CERR = ABAP_TRUE
    REPLACEMENT = '#'
    WRITE_BOM = ' '
    TRUNC_TRAILING_BLANKS_EOL = 'X'
    WK1_N_FORMAT = ' '
    WK1_N_SIZE = ' '
    WK1_T_FORMAT = ' '
    WK1_T_SIZE = ' '
    IMPORTING
    FILELENGTH =
    tables
    data_tab = T_pdf_tab
    FIELDNAMES =
    EXCEPTIONS
    FILE_WRITE_ERROR = 1
    NO_BATCH = 2
    GUI_REFUSE_FILETRANSFER = 3
    INVALID_TYPE = 4
    NO_AUTHORITY = 5
    UNKNOWN_ERROR = 6
    HEADER_NOT_ALLOWED = 7
    SEPARATOR_NOT_ALLOWED = 8
    FILESIZE_NOT_ALLOWED = 9
    HEADER_TOO_LONG = 10
    DP_ERROR_CREATE = 11
    DP_ERROR_SEND = 12
    DP_ERROR_WRITE = 13
    UNKNOWN_DP_ERROR = 14
    ACCESS_DENIED = 15
    DP_OUT_OF_MEMORY = 16
    DISK_FULL = 17
    DP_TIMEOUT = 18
    FILE_NOT_FOUND = 19
    DATAPROVIDER_EXCEPTION = 20
    CONTROL_FLUSH_ERROR = 21
    OTHERS = 22
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  • How to create RFC function module and how to call this function module

    Hi,
    i want to know step for creating RFC function module and then How to  use this function module from some other sap system.
    Thnaks,
    jigar

    Jigar,
    To implement a remote function module in ABAP, perform the following steps:
    Register the module as remotely callable in the RFC server system.
    In the function module Administration screen (transaction code SE37), set the field Can be called via REMOTE CALL. Registering a module as remote causes an RFC stub to be generated for it.
    Write the code for the function module.
    Create the destinations.....................
    Displaying, Maintaining and Testing Destinations
    To display, create or modify destinations, choose Tools ® Administration ® Administration ® Network ® RFC destinations or enter transaction code SM59.
    Remote Destinations are stored in table RFCDES. The RFCDES table describes logical destinations for remote function calls.
    It is not possible to maintain the RFCDES table directly.
    You can also access logical destinations via the Implementation Guide (IMG) by choosing Tools ® AcceleratedSAP ® Customizing ® Execute Project ® SAP Reference IMG.
    In the Implementation Guide, expand the following hierarchy structure:
    Basis
    Application Link Enabling (ALE)
    Sending and Receiving Systems
    Systems in Network
    Define Target Systems for RFC Calls
    Displaying Destinations
    The initial screen for this transaction displays a tree:
    Different connection types (i.e. partner systems or programs) are possible. For further information, see Types of Destinations.
    To display all information for a given destination, double-click it, or place the cursor on it and press F2 .
    To search for a destination, press the Find button and specify your selection. You get a list of all entries matching your selection. Place the cursor on the one you want, and press F2 or simply double-click the destination. All information for the given entry appears.
    Creating Destinations
    On the destinations overview screen (transaction code SM59), the connection types and all existing destinations are displayed in a tree structure.
    All available connection types are explained in Types of Destinations.
    To create a new RFC destination, press the Create button. A new screen is displayed with empty fields for you to fill in.
    If you want to create a new destination
    As you create a remote destination, you can specify a particular application server or a group of servers for a balanced distribution of system load.
    For details of the destination parameters, see Entering Destination Parameters.
    Changing Existing Destinations
    On the destinations overview screen (transaction code SM59), the connection types and all existing destinations are displayed in a tree structure.
    You can display all information for a given destination by double-clicking it or pressing F2 on it.
    To change an existing destination, double-click it, or place the cursor on it and press the Change button.
    For details of the destination parameters, see Entering Destination Parameters.
    Testing Destinations
    To test a destination, choose the appropriate function from the Test menu.
    Connection (also available via the Test connection pushbutton)
    Authorization (checks logon data)
    Local network (provides a list of application servers)
    You can use the CALL FUNCTION statement to call remote functions, just as you would call local function modules. However, you must include an additional DESTINATION clause to define where the function should run:
    CALL FUNCTION RemoteFunction
    DESTINATION Dest
    EXPORTING
    f1 =...
    f2 =...
    IMPORTING
    f3 =...
    TABLES
    t1 =...
    EXCEPTIONS......
    The field Dest can be either a literal or a variable: its value is a logical destination (for example, "hw1071_53") known to the local SAP System. Logical destinations are defined in the RFCDES table (or the TRFCD table in R/2 Systems) via transaction sm59 or the following menu path: Tools ® Administration, Administration ® Network ® RFC destinations. You can also access logical destinations via the Implementation Guide (IMG) by choosing Tools ® Customizing ® Enterprise IMG. In the Implementation Guide, you can then choose Cross-application components ® ALE ® Communication ® Define RFC destination.
    The remote function call concept, for example, allows you to access a function module in an R/2 System from an ABAP program in an R/3 System. If you want to read a customer record from your R/2 System’s database, create a remotely callable function module in the R/2 environment which retrieves customer records. Call this function from your R/3 System using a remote function call and listing the destination for the target R/2 System:
    Pls. reward if useful

  • How to create a login module

    Hi Everyone.
    How to create a login module which like www.sdn.sap.com
    the module is on the top left corner

    http://help.sap.com/saphelp_nwce10/helpdata/en/46/3ce9402f3f8031e10000000a1550b0/frameset.htm

  • Function Module to modify MARC table

    Hi all,
    Is There any Function Module which modifys the table MARC.
    please suggest.
    regards,
    chandra.

    Hello Reddy,
    Check this sample code:
    *& Report  ZYTEST02                                                    *
    report  zytest02                      .
    parameters:matnr like bapimathead-material,
               maktx like bapi_makt-matl_desc     default 'Mat. autm. AE',
               werks like bapi_marc-plant,
               vkorg like bapi_mvke-sales_org,
               vtweg like bapi_mvke-distr_chan.
    start-of-selection.
      perform material_create using matnr
                                    maktx
                                    werks
                                    vkorg
                                    vtweg.
    *&      Form  material_create
    *       text
    *      -->P_MATERIAL  text
    form material_create using    value(p_matnr)
                                  value(p_maktx)
                                  value(p_werks)
                                  value(p_vkorg)
                                  value(p_vtweg).
      tables: mara.
    * shift p_matnr right deleting trailing space.
    * translate p_matnr using ' 0'.
      data: headdata    like bapimathead occurs 0 with header line.
      data: clientdata  like bapi_mara.
      data: clientdatax like bapi_marax.
      data: salesdata   like bapi_mvke.
      data: salesdatax  like bapi_mvkex.
      data: plantdata   like bapi_marc.
      data: plantdatax  like bapi_marcx.
      data: return         like bapiret2.
      data: taxclassifications like bapi_mlan   occurs 0 with header line.
      data: commitmessages like bapi_matreturn2 occurs 0 with header line.
      data: returnmessages like bapiret2        occurs 0 with header line.
      data: materialdescription like bapi_makt  occurs 0 with header line.
      data: charx value 'X'.
    * Kopfdaten
      headdata-material   = p_matnr.
      headdata-matl_type  = 'FERT'.
      headdata-ind_sector = 'M'.
    * Sichten die gepflegt werden sollen
      headdata-basic_view = charx.  "Sicht auf Grunddaten
      headdata-sales_view = charx.  "Sicht auf Vertriebsdaten
    * Daten für die Sicht GRUNDDATEN 1
      materialdescription-langu = sy-langu.
      materialdescription-matl_desc = p_maktx.
      append materialdescription.
    * Mandantenspezifische Materialdaten
      clientdata-base_uom  = 'ST'.
      clientdatax-base_uom = charx.
      clientdata-trans_grp  = '0001'.
      clientdatax-trans_grp  = charx.
    * Materialdaten auf Werksebene
      plantdata-plant = p_werks.
      plantdatax-plant = p_werks.
      plantdata-loadinggrp = '0001'.
      plantdatax-loadinggrp = charx.
    * Verkaufsdaten
      salesdata-sales_org = p_vkorg.
      salesdatax-sales_org = p_vkorg.
      salesdata-distr_chan = p_vtweg.
      salesdatax-distr_chan = p_vtweg.
    * Steuerklassifikation
      taxclassifications-depcountry = 'DE'.
      taxclassifications-tax_type_1 = 'MWST'.
      taxclassifications-taxclass_1 = '1'.
      append taxclassifications.
      call function 'BAPI_MATERIAL_SAVEDATA'
        exporting
          headdata                   = headdata
          clientdata                 = clientdata
          clientdatax                = clientdatax
          plantdata                  = plantdata
          plantdatax                 = plantdatax
    *   FORECASTPARAMETERS         =
    *   FORECASTPARAMETERSX        =
    *   PLANNINGDATA               =
    *   PLANNINGDATAX              =
    *   STORAGELOCATIONDATA        =
    *   STORAGELOCATIONDATAX       =
    *   VALUATIONDATA              =
    *   VALUATIONDATAX             =
    *   WAREHOUSENUMBERDATA        =
    *   WAREHOUSENUMBERDATAX       =
           salesdata                  = salesdata
           salesdatax                 = salesdatax
    *   STORAGETYPEDATA            =
    *   STORAGETYPEDATAX           =
        importing
          return                     = return
        tables
          materialdescription        = materialdescription
    *   UNITSOFMEASURE             =
    *   UNITSOFMEASUREX            =
    *   INTERNATIONALARTNOS        =
    *   MATERIALLONGTEXT           =
          taxclassifications         = taxclassifications
          returnmessages             = returnmessages
    *   PRTDATA                    =
    *   PRTDATAX                   =
    *   EXTENSIONIN                =
    *   EXTENSIONINX               =
      call function 'BAPI_TRANSACTION_COMMIT'
           exporting
                wait   = charx
           importing
                return = commitmessages.
    *  commit work and wait.
    * Für den Fall das es notwendig wird die Exclusive Sperre wegräumen
           CALL FUNCTION 'DEQUEUE_EMMARAE'
                EXPORTING
                    matnr = p_matnr.
    * if return-type ne 'S'.
        format color col_negative.
        loop at returnmessages.
          write: / returnmessages-message.
        endloop.
    * endif.
      loop at commitmessages.
        write: / commitmessages-message.
      endloop.
    endform.                    " material_create
    If useful reward.
    Vasanth

  • Steps to create LOGICAL DATABASE in sap

    hi guys,
    i have gone through many documents about LDB. But, i didnt get the steps to create a LDB.
    plz provide me with the steps to be followed to create a LDB.
    thnx,
    shivaa.

    Hi Shiva,
    This might help you!
    Logical database structures
    There are three defining entities in an SAP logical database. You must be clear on all three in order to create and use one.
    Table structure: Your logical database includes data from specified tables in SAP. There is a hierarchy among these tables defined by their foreign keys (all known to SAP), and you are going to define a customized relationship between select tables. This structure is unique and must be defined and saved.
    Data selection: You may not want or need every item in the referenced tables that contributes to your customized database. There is a selection screen that permits you to pick and choose.
    Database access programming: Once youu2019ve defined your logical database, SAP will generate the access subroutines needed to pull the data in the way you want it pulled.
    Creating your own logical database
    ABAP/4 (Advanced Business Application Programming language, version 4) is the language created by SAP for implementation and customization of its R/3 system. ABAP/4 comes loaded with many predefined logical databases that can construct and table just about any conventional business objects you might need in any canned SAP application. However, you can also create your own logical databases to construct any custom objects you care to define, as your application requires in ABAP/4. Hereu2019s a step-by-step guide:
    1. Call up transaction SLDB (or transaction SE36). The path you want is Tools | ABAP Workbench | Development | Programming Environment | Logical Databases. This screen is called Logical Database Builder.
    2. Enter an appropriate name in the logical database name field. You have three options on this screen: Create, Display, and Change. Choose Create.
    3. Youu2019ll be prompted for a short text description of your new logical database. Enter one. Youu2019ll then be prompted to specify a development class.
    4. Now comes the fun part! You must specify a root node, or a parent table, as the basis of your logical database structure. You can now place subsequent tables under the root table as needed to assemble the data object you want. You can access this tree from this point forward, to add additional tables, by selecting that root node and following the path Edit | Node | Create. Once youu2019ve saved the structure you define in this step, the system will generate the programming necessary to access your logical database. The best part is you donu2019t have to write a single line of code.
    Watch out!
    The use of very large tables will degrade the performance of a logical database, so be aware of that trade-off. Remember that some tables in SAP are very complex, so they will be problematic in any user-defined logical database.
    Declaring a logical database
    Hereu2019s another surprising feature of logical databases: You do not assign them in your ABAP/4 Code. Instead, the system requires that you specify logical databases as attributes. So when you are creating a report, have your logical database identifier (the name you gave it) on hand when you are defining its attributes on the Program Attributes screen. The Attributes section of the screen (the lower half) will include a Logical database field, where you can declare your logical database.
    Logical databases for increasing efficiency
    Why else would you want to create a logical database? Consider that the logical databases already available to you begin with a root node and proceed downward from there. If the data object you wish to construct consists of items that are all below the root node, you can use an existing logical database program to extract the data, then trim away what you donu2019t want using SELECT statementsu2014or you can increase the speed of the logical database program considerably by redefining the logical database for your object and starting with a table down in the chain. Either way, youu2019ll eliminate a great deal of overhead.
    Reward if useful.
    Thankyou,
    Regards.

  • To get fun module for Creating prebooking

    Hi friends,
        Here is my query,
    My requirement is a person will prebook the employees for the events from portal
      & i need to provide the RFC for that.
      I got 2 fun modules for creating prebookings
    1) RH_PARTICIPATION_PREBOOK
    2) HRIQ_PARTICIPATION_PREBOOK
      but these fun modules POPS UP a window after providing the i/p's to it to select the button of prebooking.......
    But these is not possible as the SAP screen can't be popped up in portal....
      So how do i proceed with this problem??

    Hi,
    See the source code of FMs. Inside somewhre it must be calling other FM which collects actual data. Use that FM.
    Reward if useful!

  • Steps to create JCO to call R3 Function module in ISA CRM b2b webshop

    Hi experts,
    Can u help me in creating a JCo connection to R3 from CRM isa b2b webshop.
    See i am working on CRM 5.0 isa . I have a default jco connection calling to CRM.
    But i wanted an another JCO to call FM of R3.
    Can u pls give me the steps in creating this jco (XCM, Xml, changes etc )?
    Hope you have understood my question.
    Pls reply,
    thanks in advance,
    Niraja.

    Hi Niraja,
    The second option would be easy to do, as the connection is already made you can just use the connection pool.
    I feel maintaining/creating two connections would lead to performance issues.
    So its better to go with FM in CRM to FM in R/3
    If you want to go for a different connection or connection pool then follow this example
    In the world of database connectivity, creating individual connections to a database system is technically expensive and often incurs unwanted overhead in both client and server-side applications. Connection pools allow your application to check connections out from a pool and release a connection once the transaction has completed. This tip briefly explores the value and implementation of using connection pools in JCo.
    The following code presents two classes that demonstrate the use of a connection pool and its restrictions. You should be able to pull code from this example when adding pooling to your own Java/JCo application.
    The first JCo application does not use pooling:
    import com.sap.mw.jco.*;
    public class JcoTest {
    private static JCO.Client theConnection;
    private static IRepository theRepository;
    public static void main(String[] args) {
      createConnection();
      retrieveRepository();
      try {
      JCO.Function function = getFunction("RFC_READ_TABLE");
      JCO.ParameterList listParams = function.getImportParameterList();
      listParams.setValue("BSAUTHORS", "QUERY_TABLE");
      theConnection.execute(function);
      JCO.Table tableList = function.getTableParameterList().getTable("DATA");
      if (tableList.getNumRows() > 0) {
       do {
        for (JCO.FieldIterator fI = tableList.fields();
          fI.hasMoreElements();)
          JCO.Field tabField = fI.nextField();
          System.out.println(tabField.getName()
               + ":t" +
               tabField.getString());
         System.out.println("n");
       while (tableList.nextRow() == true);
      catch (Exception ex) {
       ex.printStackTrace();
    private static void createConnection() {
      try {
       theConnection = JCO.createClient("000", "DDIC", "minisap", "en", "sincgo", "00");
       theConnection.connect();
      catch (Exception ex) {
       System.out.println("Failed to connect to SAP system");
    private static void retrieveRepository() {
      try {
       theRepository = new JCO.Repository("saprep", theConnection);
      catch (Exception ex)
       System.out.println("failed to retrieve repository");
      public static JCO.Function getFunction(String name) {
        try {
             return theRepository.getFunctionTemplate(name.toUpperCase()).getFunction();
        catch (Exception ex) {
         ex.printStackTrace();
          return null;
    To add connection pooling you simply add this code to the beginning of the main method:
        if (connPool == null) {
          JCO.addClientPool(POOL_NAME,
                            5,
                            "000",
                            "bcuser",
                            "minisap",
                            "EN",
                            "sincgo",
                            "00");
    And replace the call to the createConnection() method with this:
             theConnection = JCO.getClient(POOL_NAME);
    The code should now look like this:
    import com.sap.mw.jco.*;
    public class JcoTest {
    private static JCO.Client theConnection;
    private static IRepository theRepository;
        private static final String POOL_NAME = "myPool";
    public static void main(String[] args) {
        JCO.Pool connPool = JCO.getClientPoolManager().getPool(POOL_NAME);
        if (connPool == null) {
          JCO.addClientPool(POOL_NAME,
                            5,      //number of connections in the pool
                            "client",
                            "username",
                            "paswword",
                            "EN",
                            "hostname",
                            "00");
            theConnection = JCO.getClient(POOL_NAME);
      retrieveRepository();
      try {
      JCO.Function function = getFunction("RFC_READ_TABLE");
      JCO.ParameterList listParams = function.getImportParameterList();
      listParams.setValue("BSAUTHORS", "QUERY_TABLE");
      theConnection.execute(function);
      JCO.Table tableList = function.getTableParameterList().getTable("DATA");
      if (tableList.getNumRows() > 0) {
       do {
        for (JCO.FieldIterator fI = tableList.fields();
          fI.hasMoreElements();)
          JCO.Field tabField = fI.nextField();
          System.out.println(tabField.getName()
               + ":t" +
               tabField.getString());
         System.out.println("n");
       while (tableList.nextRow() == true);
      catch (Exception ex) {
       ex.printStackTrace();
      JCO.releaseClient(theConnection);
    private static void retrieveRepository() {
      try {
       theRepository = new JCO.Repository("saprep", theConnection);
      catch (Exception ex)
       System.out.println("failed to retrieve repository");
      public static JCO.Function getFunction(String name) {
        try {
             return theRepository.getFunctionTemplate(name.toUpperCase()).getFunction();
        catch (Exception ex) {
         ex.printStackTrace();
          return null;
    Now, when this class executes, it will create a pool of 5 SAP connections. Once created, a single connection is retrieved and executed against. After the call to SAP has finished, the connections are released with:
    JCO.releaseClient(theConnection);
    You can easily integrate this code in any application that acts as a server or requires multiple users to access SAP via the Web.
    Regards,
    Sateesh Chandra

  • Steps to create a generic datasource from SAP CRM

    Dear Forum,
    Could you please provide me with the steps to create a generic datasource from SAP CRM
    Thanks for you time and efforts
    Regards,

    Hi,
    Initially create a view or identify the table to create generic extractions, remaining process is same in all data bases such as CRM........
    GENERIC EXTARCTIONS:
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/bi/generic%2bextraction
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d3219af2-0c01-0010-71ac-dbb4356cf4bf
    Generic Delta:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/84bf4d68-0601-0010-13b5-b062adbb3e33
    Assign points if these are useful.
    Rgs,
    I.R.K

  • Steps to  create a sap script

    Please  i want one sample  with  steps to  create a sap script .
    girish

    Hi Girish,
    go to se71->first u create the form.
    there from PAGES AND WINDOWS OPTION , PLACE THE CONTROL ON MAIN WINDOW->EDIT->TEXT ELMENTS.
    GOTO->CHANGE EDITOR
    THERE GIVE FOLLOWING.
    /E ELE1
    &ITAB-VBELN&
    &ITAB-ERDAT&
    &ITAB-NETWR&.
    F3->SAVE AND ACTIVATE
    AND IN THE PRINT PROGRAM
    EXECUTE THE FOLLOWING CODE
    REPORT ZUSC.
    tables:vbak.
    parametrs:ordno for vbak-vbeln.
    data:begin of itab occurs 0,
    vbeln like vbak-vbeln,
    erdat like vbak-erdat,
    netwr like vbak-netwr,
    end of itab.
    CALL FUNCTION 'OPEN_FORM'
    EXPORTING
    FORM = 'form name '
    LANGUAGE = SY-LANGU.
    select vbeln erdat netwr from vbak into table itab where vben = ordno.
    loop at itab.
    CALL FUNCTION 'START_FORM'
    EXPORTING
    FORM = ' ' "GIVE U R FORM NAME ,LANGUAGE,START PAGE
    LANGUAGE = ' '
    STARTPAGE = ' '.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
    ELEMENT = 'ele1 ' (this one u have to give in mainwindow->edit->text elements)
    FUNCTION = 'SET'
    TYPE = 'BODY'
    WINDOW = 'MAIN'.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
    ELEMENT = 'ELE1 '
    FUNCTION = 'SET'
    TYPE = 'BODY'
    WINDOW = 'MAIN'.
    CALL FUNCTION 'END_FORM'.
    ENDLOOP.
    CALL FUNCTION 'CLOSE_FORM'.
    save,activate and execute
    I think it will useful for u.
    Reward points if useful.
    Thanks,
    Usha.

  • What are the steps to create sap apo ..plz send step by steps plzzzzzzzzzzz

    what are the steps to create sap apo ..plz send step by steps plz. Iam new for these ?

    what are the steps to create sap apo ..plz send step by steps plz. Iam new for these ?

  • Steps for creating a SAP Remote cube.

    Hello Experts,
    Can you anyone list the steps for creating a SAP Remote cube please?
    Any step by step guide will be of really great help.
    Thanks in advance.
    Regards,
    Kumar.

    Creating VirtualProviders Based on Data Transfer Processes Locate the document in its SAP Library structure
    Prerequisites
    If you are using a DataSource as the source for a VirtualProvider, you have to allow direct access to this DataSource.
    Procedure:
           1.      In the Data Warehousing Workbench under Modeling, choose the InfoProvider tree.
           2.      In the context menu, choose Create VirtualProvider.
           3.      As the type, select VirtualProvider based on data transfer process for direct access.
    In terms of compatibility, a VirtualProvider that is based on a data transfer process with direct access can also be connected to an SAP source system using a 3.x InfoSource.
    The Unique Source System Assignment indicator controls whether this source system assignment needs to be unique. If the indicator is set, you can select a maximum of one source system in the assignment dialog. If the indicator is not set, you can select multiple source systems. In this case, the VirtualProvider acts like a MultiProvider.
    If the indicator is not set, characteristic 0LOGSYS is automatically added to the VirtualProvider when it is created.  In the query, this characteristic allows you to select the source system dynamically: In each navigation step, the system only requests data from the assigned source systems whose logical system name fulfills the selection condition for characteristic 0LOGSYS.
           4.      Define the VirtualProvider by transferring the required InfoObjects. Activate the VirtualProvider.
           5.      In the context menu of the VirtualProvider, select Create Transformation. Define the transformation rules and activate them.
           6.      In the context menu of the VirtualProvider, select Create Data Transfer Process. DTP for Direct Access is the default value for the DTP type. Select the source for the VirtualProvider. Activate the data transfer process. See Structure linkCreating Data Transfer Process for Direct Accesss.
           7.      Activate direct access. In the context menu of the VirtualProvider, select Activate Direct Access. In the dialog box that appears, choose one or more data transfer processes and select This graphic is explained in the accompanying text Save Assignments.
    Check this for little extra info:
    /thread/142088 [original link is broken]

Maybe you are looking for