Execute one thread in background mode.

hello ,
I have an application where the user can shows dialogs to displays, adds, modify and delete rows of one tale inside some JTextFields.
I have a problem to use this application, when one same dialog is showed more then one time....
Exactly: not problems come the first time the dialog is showed, but the second time, the time to wait because the performance is executed is very long..., and further, ....when the dialog at last was is shoved, no data of the table are in the JTextFields.
I get errors too when at last the dialog was shoved, and the errors not aways said the same reason..., but all the errors are referred to the impossibility (in the performances that followed the first) to have a suitable resultset containing the data.
Some error are "null pointer exception" to read the resultSet, other error is "Impossibils get a block in the required time" ...
I read documentation and I understand that the fault, probably, could came from the Event Dispach Thread that had the task to manage the creation of the ResultSet.
Now I am trying to solve (at this moment without success) the problem in this direction, ...as well I have not experience about to manage the use of SwingWorker class.
I should like hear what it is wrong in that I am doing...
Initially my code was this
     * Create a resultSet, for the current table       
    private void createResultSet() {
            statement = dbconn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
            currentResultSet = statement.executeQuery("Select * from " + tableName);
            boolean validateState = currentResultSet.last();
            regsNmbrOnTheTable = currentResultSet.getRow();
            System.out.println("Numero attuale di records = " + regsNmbrOnTheTable);
            // here come the exception:
            // Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        } catch (SQLException ex) {
            reportErrors.checkingSyntaxInInputTags("metodo createResultSet(): Errore nel creare il resultSet");
//            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    } // createResultSetrecently I modified it in order to put the creation of the ResultSet in background....
     * Create a resultSet, for the current table
    private void createResultSet() {
        (acquiresResultSetInBackground = new AcquiresResultSetInBackground()).execute();
        currentResultSet = acquiresResultSetInBackground.doInBackground();
    } // createResultSet
  // inner class to manage the performance in background mode.
  class AcquiresResultSetInBackground extends SwingWorker <ResultSet, Void> {
        ResultSet resultSet;
        @Override
        protected ResultSet doInBackground()  {
        try {
            statement = dbconn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
              resultSet = statement.executeQuery("Select * from " + tableName);
        } catch (SQLException ex) {
            reportErrors.checkingSyntaxInInputTags("metodo createResultSet(): Errore nel creare il resultSet");
        return resultSet;
}How I said I get again the same behavior that was before......
thank you
Regards
tonyMrsangelo

For custom transactions you shouldn't have a problem - unless you're trying to do something that needs dialog with the presentation server.
Set an infinite loop in the custom transaction, launch your program in backround, then from Sm50, go to debug and find out what's going on.
DATA: debug.
WHILE debug IS INITIAL. " Debug from SM50 will get you here, change field DEBUG in the
ENDWHILE.               " debugger to contain 'X', and the loop will end.
Also, if your custom tx calls any standard SAP programs/FM, there is a chance that those programs work differently in background than foreground.

Similar Messages

  • Not able to execute custom transaction in Background mode

    Dear All,
    There is a custom modele pool program to update the data in info type 9003. We have written a Z program in that we are calling this custom modele pool through CALL TRANSACTION with mode 'N' and update 'S'.
    Z Program is running successfully and updating data in 9003 info type when we run in foreground mode.
    But it is not updating when runs in Background mode.
    Am I need to take any other precautions when run in background mode for custom transaction?
    We are using 4.6C version.
    Thanks in advance.
    Regards,
    Abaper

    For custom transactions you shouldn't have a problem - unless you're trying to do something that needs dialog with the presentation server.
    Set an infinite loop in the custom transaction, launch your program in backround, then from Sm50, go to debug and find out what's going on.
    DATA: debug.
    WHILE debug IS INITIAL. " Debug from SM50 will get you here, change field DEBUG in the
    ENDWHILE.               " debugger to contain 'X', and the loop will end.
    Also, if your custom tx calls any standard SAP programs/FM, there is a chance that those programs work differently in background than foreground.

  • Executing Proxy in Background Mode

    Hi All
    Is it possible to execute the proxy in background mode ??
    This is for a File->XI->ABAP Proxy interface..the message size is more than 30MB and is getting timed out in the inbound queue of the receiver (abap prxy)after 10mins.
    This is bcoz the max runtime for the dialog work process is set to 600secs and we are unable to increase it further.
    can anyone help.
    Thx in advance
    chemmanz

    Hi Chemmanz,
    You can increase the capacity of processing the message in Admin options.
    Go to SXMB_ADM, run Integration Engine Configuration
    Change specific configuration and then set the size of the message to be processed against the parameter
    MAX_MESSAGE_TRANSFER_SIZE.
    Hope this should solve your problem.
    Regards,
    Suraj Kumar.

  • Execution of Report with Tabstrips in Background Mode

    Hi everyone,
                  I have used 2 tabstrips in my report. When I choose the second tabstrip, give the related I/P's and then execute in Background mode. The O/P generated is coming for the 1st tabstrip instead of what I'd selected.
    How could I execute the report in Background Mode for my Second Tabstrip? Any changes to be done in my Coding?
    Please throw some light into this !!!!
    Regards,
    Ramakrishnan.G

    Hi
    You may have attached user command to your tabs in definition -
    <b>DATA : TAB1, TAB2.
    SELECTION-SCREEN BEGIN OF TABBED BLOCK TB FOR 2 LINES.
    SELECTION-SCREEN TAB (15) TABNAME1 USER-COMMAND TAB1 DEFAULT SCREEN 101.
    SELECTION-SCREEN TAB (15) TABNAME2 USER-COMMAND TAB3 DEFAULT SCREEN
    102.
    ...</b>
    Now in
    <b>
    INITIALIZATION.
      TABNAME1 = 'TAB1'.
      TABNAME2 = 'TAB2'.
    AT SLECTION-SCREEN.
    IF TB-ACTIVETAB = 'TAB1'.
        TAB1 = 'X'.
        TAB2 = ' '.
      ELSE.
        TAB1 = ' '.
        TAB2 = 'X'.
      ENDIF.
    START-OF-SELECTION.
    IF TAB1 = 'X'.
      PERFORM ROUTINE_FOR_TAB1.
    ELSE.
       PERFORM ROUTINE_FOR_TAB2.
    ENDIF.</b>
    Cheers.
    ( Dont forget to reward if answers helped )

  • Transaction in background mode

    Hi experts,
    is it possible to execute transaction VT01N in background mode ?
    This doesn't seem to work with ERP2005 ...
    CALL TRANSACTION 'VT01N' USING bdcdata MODE 'N' UPDATE 'S'
    Thanks for support.
    David.

    HI,
    yes it is possible.
    for more information please check out the link below it will help you
    http://www.s001.org/ABAP-Hlp/abapcall_transaction.htm
    ***********please reward points if the information is helpful to you************

  • FM not executing in background mode sometimes

    Hi,
    I'm using one Z function module for Production order confirmations which inturn calls 'BAPI_PRODORD_COMPLETE_TECH'.
    There is 'BAPI_TRANSACTION_COMMIT' and 'BAPI_TRANSACTION_ROLLBACK' also present.
    My issue is, this functionality works perfectly fine when I execute the program in foreground mode, but does not go through sometimes when I schedule it in background.
    Note : Its not completely skiping the entries in background mode. It works sometimes and sometimes doesn't.
    Can anyone comment if they have faced similar issues ?
    Regards,
    Shiva

    Hi !
    In my opinion it fails, when there is a popup coming from the BAPI.
    We have the issue that when we process in background the orders where a popup should be shown (e.g. the popup asking if setting TECO is OK although reprocessing records exist).
    When we reprocess our IDOC (which are calling that BAPI) in BD87, the popup is even shown in BD87 !
    Any idea how to tell the BAPI to ignore such messages and still set the TECO ?
    Any other way to set the TECO ?
    thx a lot !

  • How to restrict user at selection screen while executing in background mode

    hi all,
    how to restrict user at selection screen while executing in background mode
    Regards
    Deepak

    Hi,
    We can get the Program whether this is running in background or not then we need to use SY-BATCH, if the SY-BATCH is set to X then the program is running in Background,
    so in the INITIALIZATION event, you can use this SY-BATCH and check the User names, and give the error messsage which you want to restrict
    Regards
    Sudheer

  • Suppressed some coloum while executing in Background mode

    Hi All
    As I am trying to execute report in foreground mode I am getting ALV output properly with all coloum while I am executing the same report in background mode I am getting same output with some of the coloum is not coming properly.
    Please guide me to resolve the above issue.
    Thanks
    KRISH

    Hi All
    I am executing the custom report in foreground mode ALV output showing all columns for that same report I am executing in background mode some of the ALV output columns are missed out
    For example:
    Standard report output showing 10 columns, but I am executing the same report in background some of the columns are suppressed only I am able to view 5 columns remaining I am not able to view.
    Please help me to resolve the above issue.
    Thanks
    KRISH

  • BDC Program is not working in background mode

    Hi All,
             I hv one bdc program for tcode fb02 which is working fine in foreground mode and data is updated to each screen properly. While running the same program in Background mode data is not updated. Can u seggust the solution.
    Regards,
    Rahul S

    Hi ,
    Remove the break point in the BDC performs.
    put the break point once u complete the BDC.... otherwise execute the BDC in MODE 'E'.. error mode.
    regards,
    Rama Reddy
    Edited by: ram reddy on Nov 16, 2009 5:37 AM

  • BDC is not working in background mode and working fine in Foreground mode

    Hi Experts,
    I have created a BDC in SHDB for the transaction code:CWBQM for creating and deleting the record and converted the BDC recording into the program using call transaction. It is working fine in both foreground and background. When I given the same program for users testing one for the user was able to delete the records but Creation is not working in the same BDC. He is able to create the same records in another PC and the problem is only in that PC and only during the creation of the record. When I change the mode to 'A' mode for testing and request the user to execute and it is working fine the records created successfully. What could be the issue ?
    Thanks,
    Hema

    Hello,
    While recording BDC in SHDB try setting "Simulate background mode" flag and give a try.
    Cheers,
    Nag

  • Can we schedule BDC in Background Mode - SM37

    Hi Guru,
    Can we schedule our BDC in background - SM37 . Upload file will be on Local Sustem - C drive.
    Regards
    Durgesh
    Moderator message: background/GUI problems = FAQ, please search before posting.
    locked by: Thomas Zloch on Oct 6, 2010 2:14 PM

    GUI functions (like GUI_UPLOAD) will not work in background, they need an actual Gui active.
    There are plenty of threads on  this subject, search also in the wiki for threads/guide like [Working with files |http://wiki.sdn.sap.com/wiki/display/ABAP/Workingwithfiles] or [Communication to Presentation Server in Background Mode|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/9831750a-0801-0010-1d9e-f8c64efb2bd2&overridelayout=true] or [Working with FTP Server |http://wiki.sdn.sap.com/wiki/display/ABAP/WorkingwithFTP+Server]
    (To execute a BDC in background use report RSBDCSUB.)
    Regards,
    Raymond

  • Export in background mode

    Does anyone know how to run an export in background mode for windows ?
    Normally in unix I would simply nohup the expdp command.
    Also what is the purpose of being able to reattach to a job in Data Pump - that in itself would suggest the export is already running as a background process - so what does this mean for the command prompt window where you launch expdp from ? Can you break out of this command prompt and the export will continue in the background ?
    Also is there anyway to monitor how far your export has gone ? At the moment all I am looking at is the contents of dba_datapump_jobs which simply tells me if the job is still executing or not
    thanks,
    Jim

    Jim,
    Export does run in a background process. There are actually at least 3 processes running.
    1. You have the client, which is where you run your expdp/impdp command.
    2. You have the MCP processes which is a Data Pump process
    3. You have a WORKER processes (or more if you use parallel) that are Data Pump processes.
    I always use LINUX, but I think it works the same for Windows. Once you have the job running, you can type a CTL-C and you will get to an IMPDP> or EXPDP> prompt. This allows you to do other commands. One is to exit the client process. You can also stop the job or kill the job. Try it and type HELP at one of those prompts.
    At this same prompt, you can type STATUS will will give you some idea on what is being worked on.
    Some of the reasons you would want to attach to a job is
    1. You previously exited and want to reattach to change something.
    2. You left it running while you were in the office and now you are home and want to see the status. (you can have multiple clients attached to the same data pump job.
    3. Your job stopped for some reason (power outage, failure, etc.) and you want to restart it.
    Hope this helps.
    Dean

  • Synchronization of FM in background mode

    Hi all!
    I need to implement a function module in background mode that contains a call transaction.
    The problem is that i need a synchronization between consecutive calls, so i have to insure that one FM is processsed completely to start the next one. I tried with qrfc's but that solution only insures the order of the functions. Any suggestions?
    I appreciate if anyone can check this statement once.
    Thanks!

    Ok, peluka. I'm going to try this way but, what happens when another process wants to execute a FM that is locked? Is this process waiting until unlock? This is what i need.
    Thanks!

  • The Coded Ui Test Method is runnung in Single Thread Apartment(STA) Mode of COM

    Hi,
    when running tests with CUIT,and after a timeout in the previous tests we noticed the following error:
    lass Initialization method TestSuite2.MyClassInitialize threw exception. Microsoft.VisualStudio.TestTools.UITest.Extension.UITestException: Microsoft.VisualStudio.TestTools.UITest.Extension.UITestException: The Coded UI Test is running in Single Thread Apartment (STA) mode of COM. In this mode, all the playback calls should happen from the TestMethod thread only and UITestControl should not be shared across TestMethods..
    Stack Trace:
    at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.ThrowExceptionIfCrossThreadAccess(IScreenElement uiElement)
    at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.InitPlayback()
    at Microsoft.VisualStudio.TestTools.UITesting.Playback.Initialize()
    at RapArtTest.Tests.Generic.GenericTestsTemplate.ClassInit(TestContext context)
    at TestSuite2.MyClassInitialize(TestContext context)Please note that we get this error if we have 10 tests failing with a timeout issue previously, after that all our tests suite fail with the same STA error.is there a way to workaround this ?

    Hi kaki2000,
    >>Please note that we get this error if we have 10 tests failing with a timeout issue previously.
    Which VS IDE did you use, VS2010 or high version?
    Do you run your coded UI tests in VS IDE or you add them to a load test? If you run your coded UI tests one by one in VS IDE, how about the result?
    >>The Coded UI Test is running in Single Thread Apartment (STA) mode of COM.  In this mode, all the playback calls should happen from the TestMethod thread only and UITestControl should not be shared across TestMethods..
    After a test method is finished, please call the clean playback. Then the later test method can reload UIMap and find exactly one on testing.
    Reference:
    http://blog.csdn.net/marryshi/article/details/8815025
    https://social.msdn.microsoft.com/Forums/en-US/ea5a2bd0-dbae-4256-b8c3-25d6eb45257a/codedui-single-thread-apartment-sta-mode-of-com-issue?forum=vsautotest
    In addition, do not call UI actions from the ClassCleanup method.
    Reference:
    http://stackoverflow.com/questions/16667350/coded-ui-test-single-thread-apartment-sta-error-occurred-while-executing-clas
    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you.
    Microsoft does not control these sites and has not tested any software or information found on these sites;
    Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.
    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.
    Best Regards,
    Jack
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Oops ALV in background mode

    Hi Experts,
    I know this topic is discussed several times but I still have a confusion.
    I have created one ALV report using custom container like the usual way. As per my understanding this report shouldn't execute in background
    but when I execute the report in background in development system, it's not throwing any error and I am able to get the spool.
    Why is this happening? Is there a possibility that if I transport the object to other system I may get error?
    Please share your thoughts.
    Thanks,
    Tiki

    This is my "common code" i use to manage CL_GUI_GRID in background without touching the output screen to define a container
    CLASS lcl_event_handler DEFINITION DEFERRED.
    DATA: gr_event_handler      TYPE REF TO lcl_event_handler.
    *---- ALV Grid instance reference
    DATA: gr_alvgrid            TYPE REF TO cl_gui_alv_grid.
    *---- Custom container instance reference
    DATA: gr_splitter_container TYPE REF TO cl_gui_splitter_container,
           gr_container          TYPE REF TO cl_gui_container.
    *---- Header container
    DATA: gr_docking_container  TYPE REF TO cl_gui_docking_container,
           gr_document           TYPE REF TO cl_dd_document.
    IN PBO
    IF sy-batch = 'X'.
    *---- Creating ALV grid within a docking container
           CREATE OBJECT gr_alvgrid
             EXPORTING
               i_parent = gr_docking_container.
         ELSE.
    *---- Creating Splitted Containers
           CREATE OBJECT gr_splitter_container
             EXPORTING
               parent  = cl_gui_container=>screen0
               rows    = 1
               columns = 1.
           CALL METHOD gr_splitter_container->set_border
             EXPORTING
               border = cl_gui_cfw=>false.
           CALL METHOD gr_splitter_container->set_row_mode
             EXPORTING
               mode = gr_splitter_container->mode_relative.
           gr_container =
             gr_splitter_container->get_container( row = 1 column = 1 ).
    *---- Creating ALV Grid instance
           CREATE OBJECT gr_alvgrid
             EXPORTING
               i_parent = gr_container.
    *---- Preparing document header
           PERFORM prepare_header.
         ENDIF.
    *-- Creating an instance for the event handler
         CREATE OBJECT gr_event_handler.
    *-- Registering handler methods to handle ALV Grid events
    *   NOTA: Qua vanno registrati eventuali metodi aggiunti per gestire
    *   altri eventi della classe CL_GUI_ALV_GRID.
         SET HANDLER gr_event_handler->handle_double_click  FOR gr_alvgrid.
         SET HANDLER gr_event_handler->handle_hotspot_click FOR gr_alvgrid.
         SET HANDLER gr_event_handler->handle_data_changed  FOR gr_alvgrid.
         SET HANDLER gr_event_handler->handle_data_changed_finished
                                                            FOR gr_alvgrid.
         SET HANDLER gr_event_handler->handle_toolbar       FOR gr_alvgrid.
         SET HANDLER gr_event_handler->handle_user_command  FOR gr_alvgrid.
    *-- Preparing layout structure
         PERFORM prepare_layout.
    *-- Preparing print structure
         PERFORM prepare_print.
    *-- Preparing field catalog
         PERFORM prepare_field_catalog.
    *-- Preparing sort criteria table
         PERFORM prepare_sort_criteria.
    *-- Prepating filter criteria table
         PERFORM prepare_filter_criteria.
    *-- Preparing function codes to exclude from the toolbar
         PERFORM prepare_toolbar_exclude.
    *-- Preparing the output for the ALV grid list
    *-- NOTE: set I_BUFFER_ACTIVE = 'X' to speed to the list display
    *-- if the ALV grid uses statically always the same field catalog
         CALL METHOD gr_alvgrid->set_table_for_first_display
           EXPORTING
    *       i_buffer_active               = 'X'
    *       i_structure_name              = 'GS_OUTTAB'
             is_variant                    = gs_variant
             i_save                        = 'A'
             i_default                     = 'X'
             is_layout                     = gs_layout
             is_print                      = gs_print
    *       IT_SPECIAL_GROUPS             =
             it_toolbar_excluding          = gt_exclude[]
    *       IT_HYPERLINK                  =
    *       IT_ALV_GRAPHICS               =
           CHANGING
             it_outtab                     = gt_outtab[]
             it_fieldcatalog               = gt_fieldcat[]
             it_sort                       = gt_sort[]
             it_filter                     = gt_filter[]
           EXCEPTIONS
             invalid_parameter_combination = 1
             program_error                 = 2
             too_many_lines                = 3
             OTHERS                        = 4.
    *-- Allows to edit the toolbar
         CALL METHOD gr_alvgrid->set_toolbar_interactive.

Maybe you are looking for

  • Import from reader question

    I import from my card reader directly to a folder on my hard drive and into LR as DNG files.  The next time I try to import, some of the files I previously imported are still checked as well as the new ones on the card.  If I try to import the ones I

  • I lost my CD - where can I get audioHQ and creative recorde

    I have installed the drivers for my card, but when I try to install audioHQ or creative recorder it tells me I do not have a previous version installed. I have scoured the site and am unable to find what I need I have installed: AUD_EAX4DRV_0303.exe

  • Sql loader function attachment....

    Hello all, I have a doubt on sql loader.... Now i'm having like below tables.. TableA empno|ename 1|A 2|B 3|C Table B salary|empno 10|1 12|2 14|3 My requirement is, in my data file instead of empno i'm having ename. Now, I need to right a function wh

  • How to provide f4 help

    Hi guys,   here i amproviding some sample code. requirement is uploading data from xl to internal table. problem is how to provide f4 help for file name. using cl_gui_frontend_services. type mismatching is occuring. DATA:  wa_filename1 TYPE file_tabl

  • AD-HOC Documentation

    Hi,      I need some documentation material which provides to work on Ad-Hoc Queries in WAD. I am very new to BW as well I have little bit idea about WAD.      Please email to [email protected] Regds Sam