COMMIT Performance and LUW concept in Function Calls

Hi,
I have a FM used in Web-Service comprising of around 8700 lines of code. It has, at several times, called different function modules.
My Concern:
At one point, a function module is used which creates an IBASE, which is further processed in the FM by updating its products. Earlier, BAPI_TRANSACTION_COMMIT was tried with WAIT= 'X' but the creation was not synchronous. Thus, code would not go further, as condition for ibase created failed. It means that "commit work and wait" inside the BAPI_TRANSACTION_COMMIT does not make the DB updation synchronous. Thus, a wait of 10 Seconds was put which seems to be working fine for last 6 months.
1. What did not work with BAPI_TRANSACTION_COMMIT ?
2. Does writing "commit work and wait" outside the FM BAPI_TRANSACTION_COMMIT different from writing it inside ?
3. When we move to FM call in a program, we enter a new context. Does a new dialog step is created ?? If I fire a commit work in the called FM, will it also commit the DB changes in the calling program ?
4. how much impact COMMIT WORK statement put on performance, especially when it is too frequently used, and when the data changed above is not accessed by the further code ?
5. In what condition commit work/wait upto n seconds combination becomes necessary
Regards,
Chitwanjit Singh

sometimes a perforance hit it worth the maintability factor.I disagree, strongly. The developer's Prime Directive is to make the user's experience a good one. Inflicting poorly performing code on the user in the name of maintinability is not on.
Q: Why does the code have to be maintained so much?
A: Because the users' keep complaining about how slow it runs....
[SOAPBOX]
Of course in the real world things get confused and it can be quite difficult to distinguish programmers' issues - encapsulation, flexibility, maintainability - from users' issues - correctness, completeness, performance.
But the relative worth of these things is easy to assess. A highly-modular parameter driven architecture that delivers the wrong answer and takes an age to do it ain't worth jack. Even if it is so maintainable that it's easy to fix every bug in it.
[SOAPBOX]
"Whatever waits for us behind those doors, we have a better chance of survival if we stick together." Gladiator
Cheers, APC

Similar Messages

  • Performance of mapping containing a function call

    Hi,
    I have:
    SOURCE TABLE ------------------------------------------------- JOIN --------------- TARGET TABLE
    CONSTANT ----------------------- FUNCTION --------------------^
    The source table has an ID column and the function returns a P_ID which is selected from a control table. The join includes the clause; WHERE ID > P_ID - this restricts rows to later than a point in time and the P_ID is constant during the mapping's run.
    When I deploy this, it performs badly and, on examination, it appears that the function is being called for each row in the source table.
    Is it possible to set up the mapping so that P_ID is fetched once when the mapping starts and the value is re-used for the rest of the run? Would making the function deterministic help in this case?
    Regards
    Steve

    OK, thanks for all your help, guys.
    There seems to be two solutions depending on the contents of the function:
    1. When the function contains complex processing - Modify the premapping to return the single value. In my case, the current premapping stage maps to a generic premapping function so I will need to wrap it in a dedicated function that calls the generic function, then calls the function that returns the single value I want.
    2. If the functionality of the function is simple enough - in some of my cases it consists only of a select statement - bin the function in favour of the select itself and combine that into the mapping. The optimiser will then just drag the value I want in.
    Thanks for the input.
    Steve

  • Java.util.regex and replacing patterns with function calls

    Hi everyone,
    I'm in terrible need for help.
    Any advice is much appreciated.
    I have the following sentence in a file. The sequence of numbers is actually a
    date in seconds since 1970. I need to identify the 9 or 10 sequence of numbers
    send that to a method that will transate the numbers into a date in a string format.
    Then replace it in the file.
    Here is an example:
    "My name is Peter. Please 1020421277 help me figure this out 108062327. "
    using the following block I can convert it to this
    "My name is Peter. Please | help me figure this out |. "
    [block]
    Pattern p = Pattern.compile("[0-9]{9,10}+");
    Matcher m = p.matcher("");
    String aLine = null;
    while((aLine = in.readLine()) != null) {
    m.reset(aLine);
    String result = m.replaceAll("|");
    out.write(result);
    out.newLine();
    [end block]
    So I need to change the above block so that my sentence looks like this.
    "My name is Peter. Please 05/03/2002 10:21:17 help me figure this out 06/04/1973 17:18:47. "
    The method that converts the numbers into a date is not of a concern because I already have
    the code to do that.
    If anyone has suggestion, please let me know.
    Thanks in advance.
    Peter
    [email protected]

    Never mind, I was able to figure it out....
    Common2 cm = new Common2();
    Pattern p = Pattern.compile("[0-9]{9,10}+");
    Matcher m = p.matcher("");
    m = p.matcher(s1);
    while ((found = m.find())) {
    String replaceStr = m.group();
    System.out.print("\tReplaceString is: " + replaceStr);
    replaceStr = cm.get_date(replaceStr);
    System.out.println("\t\tConverted to: " + replaceStr);
    m.appendReplacement(buf,replaceStr);
    m.appendTail(buf);
    ----------------- The get_date method in Common2 looked like this ------------------------------
    public String get_date(String myString)
    String s;
    long lsecs = Long.parseLong(myString);
    lsecs = lsecs * 1000; // its now milliseconds.
    // Determine default calendar and then the offset to GMT.
    Calendar localCalendar = Calendar.getInstance();
    int offset = localCalendar.get(Calendar.DST_OFFSET) + localCalendar.get
    (Calendar.ZONE_OFFSET);
    // Take the number of milliseconds subtract the gmtoffset
    Date GMTdate = new Date(lsecs - offset);
    // Format date
    Format myformat;
    myformat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss a z ");
    s = myformat.format(GMTdate);
    return s;
    Peter

  • Debug-mode and function calls

    Hi there,
    I'm coding a program in SE38 in a BW environment and there is a function call made (RSDRI_INFOPROV_READ). It seems that the table returned by this function won't accept double entries (which should be the case for standard tables), however, when I execute my program in debug mode, it does everything like it should. Anyone knows why it doesn't work when i choose execute as background job? It's hard to find what's wrong since in debug all goes well...
    thank you,
    Tom

    Why not debug the program in background running?You can add a endless loop before the code you are interested in, and then enter debug mode to jump to the focus code at background job console.

  • Preloading and initialization of function calls brings response to a halt

    I am creating a form with many CFC calls to the server.
    However, on initial load, I am calling all these functions so that
    my detailregion which relies on the result set from these
    function calls would not error out. These initial functions do not
    return any results - there exist to satify the regiondetail
    bindings.
    Eg. my initialization calls
    var getEmployees = new Spry.Data.XMLDataSet(someCFCFile,
    "employees/employee_id", { useCache: false });
    var getDocs = new Spry.Data.XMLDataSet(someCFCFile,
    "employees/employee_id", { useCache: false });
    My issue is that the number of calls I am making are causing
    the page to take 15+ seconds to load. I can't do without them
    because my regiondetail rely on them initially. And also, later on,
    my code uses these variables to make other calls Eg.
    getEmployees .setURL(someCFCFile);
    I have tried to perform these initial call with a null value,
    but IE is still taking just as long to process these calls.
    Eg.
    var getEmployees = new Spry.Data.XMLDataSet(NULL,
    "employees/employee_id", { useCache: false });
    Please help. Thanks.

    Either Restrict Access or a Send Email Instance. Once I have tried to add either one of these to a page or successfully added, then I can't use ADDT at all.
    For instance I click on any of the Wizards to run them, I get a ADDT window with the word loading across it. It sits and spins.
    I have spent all afternoon trying to just get back to where I can work with ADDT again normally. The only way I have found that ADDT will work again after trying to utilize the email function or the Login function is to delete all of the ADDT include files and re-install.
    Not very time affective.

  • [svn] 3045: Fix FB-13900: Expression Evaluator: 'is' and 'as' expressions return 'Target player does not support function calls'

    Revision: 3045
    Author: [email protected]
    Date: 2008-08-29 10:59:25 -0700 (Fri, 29 Aug 2008)
    Log Message:
    Fix FB-13900: Expression Evaluator: 'is' and 'as' expressions return 'Target player does not support function calls'
    Ticket Links:
    http://bugs.adobe.com/jira/browse/FB-13900
    Modified Paths:
    flex/sdk/trunk/modules/debugger/src/java/flash/tools/debugger/concrete/BinaryOp.java
    flex/sdk/trunk/modules/debugger/src/java/flash/tools/debugger/concrete/PlayerSession.java

    Revision: 3045
    Author: [email protected]
    Date: 2008-08-29 10:59:25 -0700 (Fri, 29 Aug 2008)
    Log Message:
    Fix FB-13900: Expression Evaluator: 'is' and 'as' expressions return 'Target player does not support function calls'
    Ticket Links:
    http://bugs.adobe.com/jira/browse/FB-13900
    Modified Paths:
    flex/sdk/trunk/modules/debugger/src/java/flash/tools/debugger/concrete/BinaryOp.java
    flex/sdk/trunk/modules/debugger/src/java/flash/tools/debugger/concrete/PlayerSession.java

  • HT203175 I have no problem signing on to iTunes my issue is once on the site I can not use the "search". It says there is a runtime error R6025 pure virtual function call. Has anyone had this problem and how do I fix it. Thanks

    I do not have a problem getting in the iTunes stores. My issue is once on the site I can not use the "search". It says there is a pure virtual function call R6025. How can I solve this problem? Do I have to create a new account? Do I have to uninstall and re-install? Thanks

    Thanks so much for your feedback. I really appreciate any input here.
    If someone from Adobe could GUARANTEE that this problem would go away if I
    purchased CS4, I would pony up the cash and do it. However, I'm skeptical
    about that because I just saw someone else post a message on the forum today
    who is running CS4 and getting the exact same runtime error as me.
    I'll try un-installing and re-installing as Admin, and if that doesn't work,
    maybe I can find a used copy of CS3.
    In the meantime, I'm also wondering if a Photoshop file can carry any sort
    of corrupt metadata inside it once it has errored out? Reason I ask is, I
    had to port all of my old PSD files to the new computer, and I only seem to
    be getting this error when I attempt to work on one of the files that
    previously got the runtime error when they were sitting on my XP machine.
    When I create new files from scratch on this new computer, they seem to be
    working just fine (at least, for now).
    If so, I would probably be smart to never open those troublesome
    "errored-out" files again.

  • Bad performance due to the use of AGO and TO_DATE time series functions

    Hi all,
    I'm building an OBI EE Project on top of a 1TB DW, and i'm facing major performance problems due to the use of the AGO and TO_DATE time series functions in some of the Metrics included on the reports. I discovered that when a report with one of those metrics is submited to the DB, the resulting query/explain plan is just awful!... Apparently OBI EE is asking the DB to send everything it needs to do the calculations itself. The CPU cost goes to the roof!
    I've tried new indexes, updated statistics, MV's, but the result remains the same, i.e., if you happen to use AGO or TO_DATE in the report you'll get lousy query time...
    Please advise, if you have come across the same problem.
    Thanks in advance.

    Nico,
    Combining the solution to view the data in dense form (http://gerardnico.com/wiki/dat/obiee/bi_server/design/obiee_densification_design_preservation_dimension), and the use of the lag function (http://gerardnico.com/wiki/dat/obiee/presentation_service/obiee_period_to_period_lag_lead_function) appears to be the best solution for us.
    Thanks very much.

  • Call the database table on commit operation and fetch the rows

    Hi
    I am new to Bpel. I have a task to call the database table on commit operation and fetch the rows and call a webservice iteratively for fetching the data into a file?
    Can anybody help me on this
    Thanks and regards
    Richa

    HI,
    update ZYBKP set MATNR = <b>zcore_2-ZDUMMY</b> where matnr = <b>zcore_2-ZDUMMY</b>.
    update ZY310 set MATNR = zcore_2-ZDUMMY where matnr = zcore_2-ZDUMMY.
    update ZYBCS_LOT set MATNR = zcore_2-ZDUMMY where matnr = zcore_2-ZDUMMY.
    <b>YOU ARE COMPARING SAME MATERIAL AND UPDATING WITH THE SAME..</b> AND ALSO ZCORE_2 IS A DATABASE TABLE AND MAY NOT CONTAIN ANY VALUE AT THAT POINT...
    in these statments you say that
    update table set matnr = 'MATNR' WHERE MATNR = 'MATNR'.
    EVEN THOUGH THIS STATMENT IS EXECUTED THERE WILL NOT BE ANY CHANGE IN THE TABLE...
    Thanks,
    Mahesh

  • Avoid procedure or function calls between a SQL operation and an implicit cursor test

    when i analyse this code with code expert

    atpidgeon wrote:
    when i analyse this code with code expert
                            UPDATE P_PM_CONTROL_COUNT
                            SET AVAIL_SEG = AVAIL_SEG -1,
                                ALLOCATION = ALLOCATION -1
                            WHERE PM_UNIT_TYPE_ID = vrectab(1)
                            AND USAGE_DATE = vrectab(2)
                            AND SEGMENT_CODE = vrectab(5)
                            AND ALLOCATION - UNITS_RESERVED > 0;
                            IF sql%rowcount = 0 then --Added block and exception to prevent invetory going negative when placing multi units in same unit type out of service.
                                vErrMsg := 'Could not process your out of service request because your selection for unit '|| vrectab(3) || ' at ' || pvPropertyId || ' for ' || vrectab(2) || ' would cause segment ' || vrectab(5) || ' to be over allocated.';
                                RAISE SegOverAllocated;
                            END IF;
    i get "Avoid procedure or function calls between a SQL operation and an implicit cursor test.",as far has i know
    iff you're doing a sql%rowcount    after an update.. trying to see how many rows were updated...  you dont want procedure or function calls between the update and the sql% line
    correct me if im wrong and how would i fix it?or maybe i shouldnt
    You correct it by NOT executing function calls as part of the UPDATE statement.
    1. Issue the function calls BEFORE the update statement
    2. save the function results into variables
    3. use those variables in the UPDATE statement.
    v_rectab1 := vrectab(1);
    v_rectab2 := vrectab(21);
    v_rectab5 := vrectab(5);
    UPDATE P_PM_CONTROL_COUNT 
                            SET AVAIL_SEG = AVAIL_SEG -1,
                                ALLOCATION = ALLOCATION -1
                            WHERE PM_UNIT_TYPE_ID = v_rectab1
                            AND USAGE_DATE = v_rectab2
                            AND SEGMENT_CODE = v_rectab5
                            AND ALLOCATION - UNITS_RESERVED > 0;

  • SOAP function call and expired passwords

    Hi,
    in the RFC SDK, there is a useful function called RfcRegisterPasswordChanger. With that, it is possible to get notified when the user's password is expired (e.g. when the user first logs on after resetting the pw via SU01). The important thing about this is that it allows the client application to change the password without bringing up the GUI.
    Is there a similar functionality when SOAP is used instead of RFC (through /sap/bc/soap/rfc), e.g. some method to find out whether a password is expired and provide a new one?
    thanks,
    chris

    What version of SAAJ are you using? The methods you cite were added in 1.2 so if you're using an earlier version that would explain the errors.

  • I downloaded latest update of iTunes (windows 7, 64bit) and have now the problem runtime error R6025 pure virtual function call (Microsoft Visual C   runtime library) - Who would have a solution to that problem? Thanks *********

    I downloaded latest update of iTunes (windows 7, 64bit) and have now the problem runtime error R6025 pure virtual function call (Microsoft Visual C   runtime library) - Who would have a solution to that problem?
    Thanks from Switzerland
    <Edited by Host>

    For general advice see Troubleshooting issues with iTunes for Windows updates.
    The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it, which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down page in case one of them applies.
    Your library should be unaffected by these steps but there is backup and recovery advice elsewhere in the user tip.
    (I've asked the hosts to remove your email address)
    tt2

  • SSDT vs 2013 and Clr function, call a Clr method name dynamically using SQLCMD variables

    Hello,
    My question is this, hopefully this makes sense:
    How could I got about doing this, inside a SQL function, I would like to re-name the Clr method call based on a SQLCMD variable? 
    I have a Clr project to encrypt/decrypt data, there are different method names depending on the deployment types.
    For the definition of a function called dbo.EncryptThis, I would like to use a SQLCMD variable to change the name depending on SQLCMD variables. This works fine in SQL Server Mgmt studio, but VS 2013 fails to recognize the SQLCMD variable and the build fails
    with: "Error
    1
    SQL71521: A method with a matching signature was not found in the loaded assembly.".
    THis code works fine in SQL Server Mgmt Studio, but fails to build in the SSDT project.
    In the SSDT project I have the SQLCMD variable defined and think I have SQLCMD mode enabled, by doing this:
    Right click file > Execution Settings > SQLCMD mode
    CREATE FUNCTION [dbo].[EncryptData]
    (@str NVARCHAR (MAX))
    RETURNS NVARCHAR (MAX)
    AS
    EXTERNAL NAME [CryptoClrAssembly].[LibName].[EncryptData$(MethodName)]
    Is this even possible in SSDT? or would I have to do this in a post-deploy script?

    Hi Kevin,
    Thanks for the info.
    Bummer, so the only other solution I have is to create a post-deploy script to change the function based on a SQLCMD variable or other logic?
    What would be really cool, would be if during the build process the SQLCMD variables would get replaced with the default value to the SQLCMD variable, thus would allow to build the project. Also, during deployment, if someone entered an incorrect method
    from the assembly it would just fail.

  • COMMIT WORK AND WAIT USE

    Hi Friends,
    what is mean by COMMIT WORK AND WAIT.
    when we use ths syntax...??
    situation pls.
    regards,
    venu.

    Hi,
    To apply the changes made to the runtime objects of persistent classes to the actual persistent objects in the database, execute the COMMIT WORK statement. (Alternatively, use COMMIT WORK AND WAIT or SET UPDATE TASK LOCAL). Unless you are executing an object-oriented transaction from within the Transaction Service, you must include the COMMIT WORK statement explicitly in the program. Otherwise, it is encapsulated in the Transaction Service. (If you explicitly include the COMMIT WORK statement as described here, the t op-level transaction runs in compatibility mode).
    The function of the COMMIT WORK statement is extended when you use it in conjunction with Object Services. Before COMMIT WORK closes the SAP LUW and triggers an update, it calls internal methods of the Persistence Service. These methods bundle the changes made to managed objects of the Persistence Service and pass them to a special update function module using CALL FUNCTION ... IN UPDATE TASK. Thus the Persistence Service works with traditional update methods. The update module is usually registered after any update modules that have already been registered. The update is then triggered and the update task executes the update module in the order in which they were registered.
    After the system executes the COMMIT WORK statement, it sets the attributes of each persistent object in the ABAP program to initial. (That is, it calls the IF_OS_STATE~INVALIDATE method).
    Local Update
    If you want to change managed objects directly, rather than using the update module, you must change the update mode of the implicitly used Transaction Service. That is, the following statements must be executed before the COMMIT WORK statement:
    DATA TM type ref to IF_OS_TRANSACTION_MANAGER.
    DATA T type ref to IF_OS_TRANSACTION.
      TM = CL_OS_SYSTEM=>GET_TRANSACTION_MANAGER( ).
    T = TM->GET_CURRENT_TRANSACTION( ).
    T->SET_MODE_UPDATE( OSCON_DMODE_DIRECT ).
    COMMIT WORK.
    To ensure database consistency, the local update is activated internally using SET UPDATE TASK LOCAL. In such cases, the system raises an exception if there are already update modules registered in the update task. You can only register additional classical update modules after setting the mode. They will then also be updated locally.
    COMMIT
    Basic form
    COMMIT WORK.
    Addition
    ... AND WAIT
    Effect
    Executes a database commit and thus closes a logical processing unit or Logical Unit of Work ( LUW ) (see also Transaction processing ). This means that
    all database changes are made irrevocable and cannot be reversed with ROLLBACK WORK and
    all database locks are released.
    COMMIT WORK also
    calls the subroutines specified by PERFORM ... ON COMMIT ,
    executes asynchronously any update requests (see CALL FUNCTION ... IN UPDATE TASK ) specified in these subroutines or started just before,
    processes the function modules specified in CALL FUNCTION ... IN BACKGROUND TASK ,
    cancels all existing locks (see SAP locking concept ) if no update requests exist,
    closes all open database cursors (see OPEN CURSOR ) and
    resets the time slice counter to 0.
    COMMIT WORK belongs to the Open SQL command set.
    Return code value
    The SY-SUBRC is set to 0.
    Notes
    All subroutines called with PERFORM ... ON COMMIT are processed in the LUW concluded by the COMMIT WORK command. All V1 update requests specified in CALL FUNCTION ... IN UPDATE TASK are also executed in one LUW . When all V1 update requests have been successfully concluded, the V2 update requests ("update with start delayed") are processed, each in one LUW . Parallel to this, the function modules specified in CALL FUNCTION ... IN BACKGROUND TASK are each executed in one LUW per destination.
    COMMIT WORK commands processed within CALL DIALOG processing
    - execute a database commit (see above),
    - close all open database cursors,
    - reset the time slice counter and
    - call the function modules specified by CALL FUNCTION IN
    BACKGROUND TASK in the CALL DIALOG processing.
    However, subroutines and function modules called with PERFORM ... ON COMMIT or CALL FUNCTION ... IN UPDATE TASK in the CALL DIALOG processing are not executed in the calling transaction until a COMMIT WORK occurs.
    Since COMMIT WORK closes all open database cursors, any attempt to continue a SELECT loop after a COMMIT WORK results in a runtime error. For the same reason, a FETCH after a COMMIT WORK on the now closed cursors also produces a runtime error. You must therefore ensure that any open cursors are no longer used after the COMMIT WORK .
    With batch input and CALL TRANSACTION ... USING , COMMIT WORK successfully concludes the processing.
    Addition
    ... AND WAIT
    Effect
    The addition ... AND WAIT makes the program wait until the type V1 updates have been completed.
    The return code value is set as follows:
    SY-SUBRC = 0 The update was successfully performed.
    SY-SUBRC <> 0 The update could not be successfully performed.
    Note
    Runtime errors
    COMMIT_IN_PERFORM_ON_COMMIT : COMMIT WORK is not allowed in a FORM callled with PERFORM ... ON COMMIT .
    COMMIT_IN_POSTING : COMMIT WORK is not allowed in the update task.
    if its useful reward points

  • Commit work and roll back with simple language and simple example

    hi guru
    commit work and roll back with simple language and simple example

    Hi,
    The statement COMMIT WORK completes the current SAP LUW and opens a new one, storing all change requests for the current SAP LUW in the process. In this case, COMMIT WORK performs the following actions:
    It executes all subroutines registered using PERFORM ON COMMIT.
    The sequence is based on the order of registration or according to the priority specified using the LEVEL addition. Execution of the following statements is not permitted in a subroutine of this type:
    PERFORM ... ON COMMIT|ROLLBACK
    COMMIT WORK
    ROLLBACK WORK
    The statement CALL FUNCTION ... IN UPDATE TASK can be executed.
    ROLL BACK:
    The statement ROLLBACK WORK closes the current SAP-LUW and opens a new one. In doing so, all change requests of the current SAP-LUW are canceled. To do this, ROLLBACK WORK carries out the following actions:
    1) Executes all subprograms registered with PERFORM ON ROLLBACK.
    2) Deletes all subprograms registered with PERFORM ON COMMIT.
    3) Raises an internal exception in the Object Services that makes sure that the attributes of persistent objects are initialised.
    4) Deletes all update function modules registered with CALL FUNCTION ...IN UPDATE TASK from the VBLOG database table and deletes all transactional remote Function Calls registered with CALL FUNCTION ... IN BACKGROUND TASK from database tables ARFCSSTATE and ARFCSDATA.
    5) Removal of all SAP locks set in the current program in which the formal parameter _SCOPE of the lock function module was set to the value 2.
    6) Triggers a database rollback, which also ends the current database-LUW.

Maybe you are looking for