Jco Call a Function Module in BackGround

Hello All.
Some one can send me a simple exemplo how to call a ABAP Function Module in BackGround.
Can i set this in Java side?
..or only set the BackGround Work Process in SAP side?
In my java application call the Abap Function Module like this:
client.execute(function);
How to set parameters to execute the function in BackGround.
My rpoblem is when the return the data to java side ...occurs the error TIME_OUT in Dialog WorkProcess.
I need to call in background to better performance and to prevent the TIME_OUT.
Best regards.
Taylor.

Hi.
I don’t know how to do, but, you can do a previous RFC, this new RFC execute the original function in background mode. I did something like that:
- JAVA: client.execute("RFC_FUNCTION", input, output);
- SAP: RFC_FUNCTION:
CALL FUNCTION func IN BACKGROUND TASK
                     [DESTINATION dest]
                     parameter_list
                     [AS SEPARATE UNIT].
or
CALL FUNCTION update_function IN UPDATE TASK
                             [EXPORTING p1 = a1 p2 = a2 ...]
                             [TABLES t1 = itab1 t2 = itab2 ...].
I hope that help you

Similar Messages

  • Difference between calling a function module in background task and update

    Hi experts,
    Can someone explain me the basic difference between calling a FM in  background and update tasks?
    Also what is the advantage of using backgroud RFCs over the above 2.
    Thanks in advance,
    reddy

    This is essentially a difference of synchronization with the main program calling this FM.
    For Update task, we specify explicitely that we want to update some rows in a database table. But Update task is essentially for waiting that all tasks to do before are done and updating database at the end. The main point is that MF called in Update task wait for a COMMIT WORK to be executed.
    On the other hand FM in background task are executed immediatly and are not specific to updating database table : it can be a function that would return some values or something else like that.
    If you want to see more about difference between background jobs / update jobs, you can also have a look at transaction SM51. Here you will see all the servers composing your SAP instance and what kind of task they can execute :
    - background jobs corresponds to BATCH
    - update tasks corresponds to UPDATE
    Those 2 kinds of tasks stands not necessarily on the same server...
    Best regards,
    Samuel

  • Debugging the Functional Module in Background.

    I am calling a Custom Functional module in Background mode using the syntax CALL FUNCTION ZFM in background task.
    Can anyone tell how to debug the code using this..
    Thanks ,
    Yatish

    Hello Yatish
    You could try to use the following trick:
    (1) Put an endless loop into the coding of your function module where you want to start debugging, e.g.
      DATA:
        lx_exit_loop(1)     TYPE c.
      lx_exit_loop = ' '.
      DO.
        IF ( lx_exit_loop = 'X' ).
          EXIT.
        ENDIF.
      ENDDO.
    (2) Call your function module in background task
    (3) Call transaction <b>SM50</b> and search for the background process.
    (3) Choose from menu <i>Program/Mode -> Program -> Debugging</i>
    Now you the debugger should bring you right to your endless loop. Set lx_loop_exit = 'X' in the debugger and continue (F5 or F6).
    Regards
      Uwe

  • Program making a RFC call to Function Module not working in background

    Hi All,
    I have an ABAP Program which is used to do a reconciliation check between the R/3 and BI system for Invoice Data. Please find below the details of the program flow:
    1.     Program counts the number of records in the DSO table and aggregates the Net_Value based on the date range (passed as parameters)
    2.     Program calls a Function Module (RFC Call) which counts the number of records in the R/3 table and aggregates the Net_Value for the same date range
    3.     Function Module Passes back the count values and aggregated Net_Value to the program
    4.     Program compares the count and aggregated Net_Value from EDWH and MSP systems and sends an email mentioning whether the counts match or not
    However we are facing an issue.
    Whenever, we execute the program in dialog mode, it works fine and fetches results within 5-6 minutes. However if we schedule the program to run in background (parameters through a variant), it gives no results even after running for over 3-4 hours. We tried figuring it out yesterday but could not come to any conclusion. Since there is a RFC call being to the function module, we were wondering if we need to specify some other parameter as well.
    Thanks & Regards
    Dharmendra

    RFC Call is a procedure for executing remote enables function modules. It is done via the 'Remote Enabled' radio button on the function module's attribute screen.

  • What is the use of CALL FUNCTION MODULE - AT BACKGROUND TASK?

    Hi experts,
    I found Call functional module in background task will make the FM run at the next commit work as some people said. So I have some questions:
    1 if we use COMMIT WORK commend, the pending FM will be called? If there are several FMs called at background task, what is the sequence of them? How many conditions will trigger the running of these FMs?
    2 Where can I find the log of this pending FMs? In SAP library, it says there are 2 tables. But I checked these tables and can only find the FM name and user of it. And I can not understand content of these tables. It seems one is for the main information of FM, and the other is for the data of the FM, maybe the parameters.
    3 If I call a FM in this way, Can I canncel it before the next commit work in some way?
    Finally, thanks for reading and help.

    HI,
    When the COMMIT WORK statement is executed, the function modules registered for the current SAP-LUW are started in the order in which they were registered. ROLLBACK WORK deletes all previous registrations for the current SAP-LUW.
    If the specified destination is not available when COMMIT WORK is executed, an executable program called RSARFCSE is started in background processing. By default, this tries to start the function modules registered for a SAP-LUW in their destination every 15 minutes and up to 30 times. These parameters can be changed in the transaction SM59. If the destination does not become available within the defined time, it is recorded in the database table ARFCSDATA as the entry "CPICERR". The entry in the database table ARFCSSTATE is deleted after a standard period of eight days

  • Running Function Module in Background with Update Task is not working

    Hello Friends,
    I have a "Z" Report Program where I am running this Report in Background using JOB_OPEN, JOB_SUBMIT, JOB_CLOSE. I am calling this in BADI.
    In this Report I am calling another Function Module PRICES_POST which is a standard Function Module and in this FM there is another FM 'CKML_UPDATE_MATERIAL_PRICE IN UPDATE TASK'. Now when I am running the BADI these values are not being updated.
    Friends I would like to know whether can we run Function Modules which are  included with UPDATE TASK as Background Job program?
    Kindly help me in providing your valuable suggestions in proceeding further.
    Thanks and Regards
    Pradeep Goli

    Usually the sequence of CALLs in your report should look like
      CALL FUNCTION 'CM_F_INITIALIZE'
        EXPORTING
          msg_on_screen = c_x.
      CALL FUNCTION 'CKMS_BUFFER_REFRESH_COMPLETE'.
      CALL FUNCTION 'PRICES_CHANGE'
        EXPORTING
          actual_bdatj = f_matpr-pp-bdatj
          actual_poper = f_matpr-pp-poper
          bukrs        = p_bukrs
          budat        = p_date
          xblnr        = p_xblnr
        TABLES
          t_matpr      = t_matpr.
      READ TABLE t_matpr WITH KEY pp-xerror = ' '
                                TRANSPORTING NO FIELDS.
      IF sy-subrc <> 0.
        MESSAGE i046(ckprch).
      ELSE.
        CALL FUNCTION 'PRICES_POST'
          EXPORTING
            i_bktxt    = p_bktxt
            bukrs      = p_bukrs
            lis_update = 'X'
          TABLES
            t_matpr    = t_matpr.
      ENDIF.
      COMMIT WORK.
    If you forget the COMMIT-WORK each and every FM called in UPDATE TASK will not be triggered.
    Regards,
    Raymond

  • System failure, during call of function module RSWR_RFC_SERVICE_TEST

    Hi Team,
         I am working with BW and Portal Integration, with the Netweaver
    2004s SP 11 version. I have a issue when i run the RSPOR_SETUP program
    to test the configuration.
    The error is on status 5 and 12, i get the following error:
    System failure, during call of function module RSWR_RFC_SERVICE_TEST,
    and when i enter at the dev_jrfc.trc log file, i have the following
    error:
    Exception thrown [Tue Jul 10 16:12:16,687]:Exception thrown by
    application running in JCo Server
    java.lang.RuntimeException: call FM RSWR_RFC_SERVICE_TEST to ProgId
    smxpedvc_PORTAL_EPD on host smxpedvc.grupoempresarialangeles.com.mx
    with SSO not authorized: No login module succeeded.
            at
    com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest
    (RFCDefaultRequestHandler.java:79)
            at com.sap.engine.services.rfcengine.RFCJCOServer.handleRequest
    (RFCJCOServer.java:156)
            at com.sap.mw.jco.JCO$Server.dispatchRequest(JCO.java:7785)
            at com.sap.mw.jco.MiddlewareJRfc$Server.dispatchRequest
    (MiddlewareJRfc.java:2405)
            at com.sap.mw.jco.MiddlewareJRfc$Server.listen
    (MiddlewareJRfc.java:1728)
            at com.sap.mw.jco.JCO$Server.listen(JCO.java:8145)
            at com.sap.mw.jco.JCO$Server.work(JCO.java:8265)
            at com.sap.mw.jco.JCO$Server.loop(JCO.java:8212)
            at com.sap.mw.jco.JCO$Server.run(JCO.java:8128)
            at com.sap.engine.core.thread.impl3.ActionObject.run
    (ActionObject.java:37)
            at java.security.AccessController.doPrivileged(Native Method)
            at com.sap.engine.core.thread.impl3.SingleThread.execute
    (SingleThread.java:100)
            at com.sap.engine.core.thread.impl3.SingleThread.run
    (SingleThread.java:170)
    Could you help me to solve this issue.
    Thanks so much.

    Have you checked the user that is used to connect from J2EE back to ABAP?
    I had a similar problem, went into the Visual Administrator and found the incorrect password (or possibly outdated password) was being used to communicate back to ABAP, and updating that sorted out my problem.
    Hope this helps.
    Cheers,
    Andrew

  • System failure during call of function module RSWR_RFC_SERVICE_TEST in BW

    Hello All,
                I am doing configuration with BW and EP portal when we run the program (RSPOR_SETUP) in step - 12 Maintain User Assignment in Portal = (System failure during call of function module RSWR_RFC_SERVICE_TEST) giving this error SSO is working fine.
    RFC connection is working fine with BW and portal
    When i execute the FM - RSWR_RFC_SERVICE_TEST it is giving error (SYSTEM_FAILURE) and in Portal side log file it is giving below error.
    dev_jrfc.trc
    Exception thrown [Fri Sep 05 15:14:57,928]:Exception thrown by application running in JCo Server
    java.lang.RuntimeException: Bean RSWR_RFC_SERVICE_TEST not found on host (Hostname), ProgId=EPP_PORTAL_SID: Object not found in lookup of RSWR_RFC_SERVICE_TEST.
            at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:138)
            at com.sap.engine.services.rfcengine.RFCJCOServer$J2EEApplicationRunnable.run(RFCJCOServer.java:269)
            at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
            at java.security.AccessController.doPrivileged(Native Method)
            at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)
            at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)
    Please help me find the solution.
    Thanks
    Gurpal

    Hi Gurpal,
    Please go through the below SAP notes
    878455
    - Information broadcasting: No portal user exists
    814083
    - Inf. broadcasting: Changed RFC settings as of NW 04 SP11
    1135947 - Bean not found
    Hope this solves your problem.
    Regards,
    Prithviraj.

  • How to run ABAP Function Module in Background Wchich Takes Long Time to Run

    How to run ABAP Function Module in Background FOR LONG TIME
    I am not that experienced with ABAP. I am on SAP BI 7.0. I WANT TO RUN A FUNCTION MODULE
    RSDRT_INFOCUBE_DATA_COPY.
    I used SE37 and then executed the module, I supplied  the parameters on the form which opped-up and then  program started running. . Program was however interrupted after 10 minutes by ABAP. How can I run  it in background without interruption?
    THANKS A LOT.

    Hi,
    You can call this FM in a program and run that program in background.
    Regards,
    Raju

  • Function module in background task

    Hi,
    I have a user-exit, that must modify a value. But this value  have a lock entry (it's my own transaction that set this lock-entry). So I would like to call a function in background task to modify the value when the lock entry disapear.
    But ...
    I don't see anything append in the SM50.
    If I call the function not in background, I could debug the function.
    When I set background debugging nothing append.
    I have set the RFC option in the function module.
    CALL FUNCTION 'ZCALL_MB26_CONFIRMATION_OT'
      IN BACKGROUND TASK AS SEPARATE UNIT DESTINATION 'NONE'
    Rgd
    Frédéric

    Hello Fred,
    This is a sample code to wait for unlock (but if a user is in modification it can be endless).
      data : w_garg like  seqg3-garg.
      data : t_enq like seqg3 occurs 0.
      concatenate sy-mandt tplnr into w_garg.
      do.
        refresh t_enq.
        call function 'ENQUEUE_READ'
         exporting
           gclient                     = sy-mandt
           gname                       = 'IFLOT'
           garg                        = w_garg
      GUNAME                      = SY-UNAME
      LOCAL                       = ' '
    IMPORTING
      NUMBER                      =
      SUBRC                       =
          tables
            enq                         = t_enq
    EXCEPTIONS
      COMMUNICATION_FAILURE       = 1
      SYSTEM_FAILURE              = 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.
        if t_enq[] is initial.
          exit.
        endif.
      enddo.
    David

  • How to run ABAP Function Module in Background FOR LONG TIME?

    I am not that experienced with ABAP. I am on SAP BI 7.0. I WANT TO RUN A FUNCTION MODULE
    RSDRT_INFOCUBE_DATA_COPY.
    I used SE37 and then executed the module, I supplied  the parameters on the form which opped-up and then  program started running. . Program was however interrupted after 10 minutes by ABAP. How can I run  it in background without interruption?
    THANKS A LOT.

    Change parameter rdisp/max_wprun_time.
    Default value for this is 600 seconds (10minutes).Change it to a time which you think you need for copying infocube data.
    May be 5 hours.
    PS:You can not run Function Module in background directly,but you can create a Z* program and call that FM from within that program and then run the program in background.
    Hope this answers your query. Best of Luck!
    Thanks and Regards
    Anindya
    Edited by: Anindya Bose on Jun 30, 2009 1:24 PM

  • 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

  • Can we call a function module in ADHOC query

    Hi
    Can we call a function module in ADHOC query if yes how.
    Also we ned to know how to call a function module in SAP query.
    An early responce is appreciated.
    Thanks and best regards
    Rajeev

    Okay as far as I understand your aim is:
    To fill a field in the output list with a value that is based on the current line information and calculated by a function module
    So go to SQ02 and create an additional field in the InfoSet.
    You can refer in the coding to the technical names you can see in the left tree window like P0000-PERNR.
    More information is avaiable in the Help part look for additional field in SQ02.
    Regards,
    Michael

  • Upload data from excel with vba by calling a function module

    Hello all,
    i have a problem with the function module "ALSM_EXCEL_TO_INTERNAL_TABLE". I will call this function module with vba to load data from excel to sap with a Buttonclick. I have copied this function module and set it remotable. But i can´t call it from excel.
    Can you give me some tips how can i
    upload data from excel with vba by click a button.
    The problem seems the function: call method cl_gui_frontend_services=>clipboard_import in the function module, because when i comment this function call the vba-call is true but no results. 
    How can I call the function module correct with vba?
    Thanks a lot for your tips!!!!
    Chris
    Message was edited by:
            Christoph Kirschner

    HI
    Uploading data directly from Excel file format
    * Upload data direct from excel.xls file to SAP
    REPORT ZEXCELUPLOAD.
    PARAMETERS: filename LIKE rlgrap-filename MEMORY ID M01,
                begcol TYPE i DEFAULT 1 NO-DISPLAY,
                begrow TYPE i DEFAULT 1 NO-DISPLAY,
                endcol TYPE i DEFAULT 100 NO-DISPLAY,
                endrow TYPE i DEFAULT 32000 NO-DISPLAY.
    * Tick don't append header
    PARAMETERS: kzheader AS CHECKBOX.
    DATA: BEGIN OF intern OCCURS 0.
            INCLUDE STRUCTURE  alsmex_tabline.
    DATA: END OF intern.
    DATA: BEGIN OF intern1 OCCURS 0.
            INCLUDE STRUCTURE  alsmex_tabline.
    DATA: END OF intern1.
    DATA: BEGIN OF t_col OCCURS 0,
           col LIKE alsmex_tabline-col,
           size TYPE i.
    DATA: END OF t_col.
    DATA: zwlen TYPE i,
          zwlines TYPE i.
    DATA: BEGIN OF fieldnames OCCURS 3,
            title(60),
            table(6),
            field(10),
            kz(1),
          END OF fieldnames.
    * No of columns
    DATA: BEGIN OF data_tab OCCURS 0,
           value_0001(50),
           value_0002(50),
           value_0003(50),
           value_0004(50),
           value_0005(50),
           value_0006(50),
           value_0007(50),
           value_0008(50),
           value_0009(50),
           value_0010(50),
           value_0011(50),
           value_0012(50),
           value_0013(50),
           value_0014(50),
           value_0015(50),
           value_0016(50),
           value_0017(50),
           value_0018(50),
           value_0019(50),
           value_0020(50),
           value_0021(50),
           value_0022(50),
           value_0023(50),
           value_0024(50),
           value_0025(50),
           value_0026(50),
           value_0027(50),
           value_0028(50),
           value_0029(50),
           value_0030(50),
           value_0031(50),
           value_0032(50),
           value_0033(50),
           value_0034(50),
           value_0035(50),
           value_0036(50),
           value_0037(50),
           value_0038(50),
           value_0039(50),
           value_0040(50),
           value_0041(50),
           value_0042(50),
           value_0043(50),
           value_0044(50),
           value_0045(50),
           value_0046(50),
           value_0047(50),
           value_0048(50),
           value_0049(50),
           value_0050(50),
           value_0051(50),
           value_0052(50),
           value_0053(50),
           value_0054(50),
           value_0055(50),
           value_0056(50),
           value_0057(50),
           value_0058(50),
           value_0059(50),
           value_0060(50),
           value_0061(50),
           value_0062(50),
           value_0063(50),
           value_0064(50),
           value_0065(50),
           value_0066(50),
           value_0067(50),
           value_0068(50),
           value_0069(50),
           value_0070(50),
           value_0071(50),
           value_0072(50),
           value_0073(50),
           value_0074(50),
           value_0075(50),
           value_0076(50),
           value_0077(50),
           value_0078(50),
           value_0079(50),
           value_0080(50),
           value_0081(50),
           value_0082(50),
           value_0083(50),
           value_0084(50),
           value_0085(50),
           value_0086(50),
           value_0087(50),
           value_0088(50),
           value_0089(50),
           value_0090(50),
           value_0091(50),
           value_0092(50),
           value_0093(50),
           value_0094(50),
           value_0095(50),
           value_0096(50),
           value_0097(50),
           value_0098(50),
           value_0099(50),
           value_0100(50).
    DATA: END OF data_tab.
    DATA: tind(4) TYPE n.
    DATA: zwfeld(19).
    FIELD-SYMBOLS: <fs1>.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
           EXPORTING
                mask      = '*.xls'
                static    = 'X'
           CHANGING
                file_name = filename.
    START-OF-SELECTION.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           EXPORTING
                filename                = filename
                i_begin_col             = begcol
                i_begin_row             = begrow
                i_end_col               = endcol
                i_end_row               = endrow
           TABLES
                intern                  = intern
           EXCEPTIONS
                inconsistent_parameters = 1
                upload_ole              = 2
                OTHERS                  = 3.
      IF sy-subrc <> 0.
        WRITE:/ 'Upload Error ', SY-SUBRC.
      ENDIF.
    END-OF-SELECTION.
      LOOP AT intern.
        intern1 = intern.
        CLEAR intern1-row.
        APPEND intern1.
      ENDLOOP.
      SORT intern1 BY col.
      LOOP AT intern1.
        AT NEW col.
          t_col-col = intern1-col.
          APPEND t_col.
        ENDAT.
        zwlen = strlen( intern1-value ).
        READ TABLE t_col WITH KEY col = intern1-col.
        IF sy-subrc EQ 0.
          IF zwlen > t_col-size.
            t_col-size = zwlen.
    *                          Internal Table, Current Row Index
            MODIFY t_col INDEX sy-tabix.
          ENDIF.
        ENDIF.
      ENDLOOP.
      DESCRIBE TABLE t_col LINES zwlines.
      SORT intern BY row col.
      IF kzheader = 'X'.
        LOOP AT intern.
          fieldnames-title = intern-value.
          APPEND fieldnames.
          AT END OF row.
            EXIT.
          ENDAT.
        ENDLOOP.
      ELSE.
        DO zwlines TIMES.
          WRITE sy-index TO fieldnames-title.
          APPEND fieldnames.
        ENDDO.
      ENDIF.
      SORT intern BY row col.
      LOOP AT intern.
        IF kzheader = 'X'
        AND intern-row = 1.
          CONTINUE.
        ENDIF.
        tind = intern-col.
        CONCATENATE 'DATA_TAB-VALUE_' tind INTO zwfeld.
        ASSIGN (zwfeld) TO <fs1>.
        <fs1> = intern-value.
        AT END OF row.
          APPEND data_tab.
          CLEAR data_tab.
        ENDAT.
      ENDLOOP.
      CALL FUNCTION 'DISPLAY_BASIC_LIST'
           EXPORTING
                file_name     = filename
           TABLES
                data_tab      = data_tab
                fieldname_tab = fieldnames.
    *-- End of Program
    <b>Excel Upload Alternative - KCD_EXCEL_OLE_TO_INT_CONVERT</b>
    *Title : Excel Uploading
    TYPES:   BEGIN OF t_datatab,
             col1(25)  TYPE c,
             col2(30)  TYPE c,
             col3(30)  TYPE c,
             col4(30)  TYPE c,
             col5(30)  TYPE c,
             col6(30)  TYPE c,
             col7(30) TYPE c,
             col8(30)  TYPE c,
             col9(30)  TYPE c,
             col10(30)  TYPE c,
             col11(30)    TYPE c,
           END OF t_datatab.
    DATA: it_datatab TYPE STANDARD TABLE OF t_datatab INITIAL SIZE 0,
          wa_datatab TYPE t_datatab.
    Data : p_table type t_datatab occurs 0 with header line.
    DATA : gd_scol   TYPE i VALUE '1',
           gd_srow   TYPE i VALUE '1',
           gd_ecol   TYPE i VALUE '256',
           gd_erow   TYPE i VALUE '65536'.
    DATA: it_tab TYPE filetable,
          gd_subrc TYPE i.
    field-symbols : <fs>.
    *Selection screen definition
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS:  p_file LIKE rlgrap-filename
                   DEFAULT 'c:test.xls' OBLIGATORY.   " File Name
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      REFRESH: it_tab.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title     = 'Select File'
          default_filename = '*.xls'
          multiselection   = ' '
        CHANGING
          file_table       = it_tab
          rc               = gd_subrc.
      LOOP AT it_tab INTO p_file.
    *    so_fpath-sign = 'I'.
    *    so_fpath-option = 'EQ'.
    *    append so_fpath.
      ENDLOOP.
    START-OF-SELECTION.
      PERFORM upload_excel_file TABLES   it_datatab
                                 USING   p_file
                                         gd_scol
                                         gd_srow
                                         gd_ecol
                                         gd_erow.
    * END-OF-SELECTION.
    END-OF-SELECTION.
      LOOP AT it_datatab INTO wa_datatab.
        WRITE:/ wa_datatab-col1,
                wa_datatab-col2,
                wa_datatab-col3,
                wa_datatab-col4,
                wa_datatab-col5,
                wa_datatab-col6,
                wa_datatab-col7,
                wa_datatab-col8,
                wa_datatab-col9,
                wa_datatab-col10,
                wa_datatab-col11.
      ENDLOOP.
    *&      Form  UPLOAD_EXCEL_FILE
    *       upload excel spreadsheet into internal table
    *      -->P_TABLE    Table to return excel data into
    *      -->P_FILE     file name and path
    *      -->P_SCOL     start column
    *      -->P_SROW     start row
    *      -->P_ECOL     end column
    *      -->P_EROW     end row
    FORM upload_excel_file TABLES   p_table
                           USING    p_file
                                    p_scol
                                    p_srow
                                    p_ecol
                                    p_erow.
      DATA : lt_intern TYPE  kcde_cells OCCURS 0 WITH HEADER LINE.
    * Has the following format:
    *             Row number   | Colum Number   |   Value
    *      i.e.     1                 1             Name1
    *               2                 1             Joe
      DATA : ld_index TYPE i.
    * Note: Alternative function module - 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
        EXPORTING
          filename                = p_file
          i_begin_col             = p_scol
          i_begin_row             = p_srow
          i_end_col               = p_ecol
          i_end_row               = p_erow
        TABLES
          intern                  = LT_INTERN
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
      IF sy-subrc <> 0.
        FORMAT COLOR COL_BACKGROUND INTENSIFIED.
        WRITE:/ 'Error Uploading file'.
        EXIT.
      ENDIF.
      IF lt_intern[] IS INITIAL.
        FORMAT COLOR COL_BACKGROUND INTENSIFIED.
        WRITE:/ 'No Data Uploaded'.
        EXIT.
      ELSE.
        SORT lt_intern BY row col.
        LOOP AT lt_intern.
         MOVE lt_intern-col TO ld_index.
         assign component ld_index of structure
         p_table to <fs>.
    move : lt_intern-value to <fs>.
    *     MOVE lt_intern-value TO p_table.
          AT END OF row.
            APPEND p_table.
            CLEAR p_table.
          ENDAT.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    "UPLOAD_EXCEL_FILE
    Regards
    Pavan

  • How to call a function module from the Web Template?

    Hi all,
    how can I call a function module from a BI 7.x web template and then show the result of the FM on the web template?
    Many thanks for your hints.
    Regards, Nils

    Hi!
    I am too working on a similar issue.
    Probably this helps:
    Re: Calling a function module from a Web Template
    Regards,
    Sri

Maybe you are looking for