Update Document problem

Hi,
I am trying to update an existing document in a container using a query, and being more specific i want to add a new node in the document. I've tried to do it using XmlModify :
try {
     XmlUpdateContext updateContext = mgr.createUpdateContext();
               // query for all the documents that we want to update
XmlResults results = mgr.query(txn, fullQuery, context, null);
XmlValue value = results.next();
while (value != null) {
     XmlDocument document = value.asDocument();
XmlModify mod = mgr.createModify();
String Violation="Violation";
XmlQueryExpression select =mgr.prepare("collection('myData.dbxml')/QoSdb/QoEViolation", context);
mod.addAppendStep(select, XmlModify.Element, "MyChild", "This is my child");
mod.execute(results, context, updateContext);
value = results.next();
          } catch (XmlException e) {
but it wasn't successful..
Any suggestions on how to do this?
I am using the latest release of Berkeley XML DB, and i am working on Fedora OS
Thanks in advance
Panayiotis

Hi,
There are at least a couple of things wrong:
1. Your select (XmlQueryExpression) needs to be a query that is relative to the context of the XmlModify.execute() call, which is a document (or whatever is returned by the "fullQuery" expression (you didn't include that). Typically, this means that the XQuery expression for the select query starts with "." or "/" and not "collection()"
2. you call mod.execute(results, ...) and not mod.execute(value, ...)
This is done after calling results.next(), which means that your context is not what I think you want it to be.
Regards,
George

Similar Messages

  • Slow respon when update Document Numbering

    Hi Expert,
    We have 7 branch and 4 different type of sales document. and we change our document numbering every month.
    We have use SAP Business One for a year. So, we have large number of document numbering.
    when we update and add new row in document numbering, we get slow respon. It can about 30 minutes every update.
    how can we make it faster?
    *we use 8.82 PL:08 version.
    Regards,
    Triadi Bagus

    Hi Triadi,
    Try to update Document Numbering when no user are logged on data or Ask your users to not to post any transaction during the period when you are updating Document Numbering.
    This problem arise because when user are punching transactions on database as Internal Document No Changes every time a transaction is punched on Database.
    This May be the reason.
    Hope this help!!
    Regards,
    Sudhir

  • Update Termiante Problem in the VF02

    Dear SAP Technical Guru's,
    I am facing Update termiante problem in the VF02 Screen .
    MESSAGE
    Update was terminated
    *System ID.... MRD
    Client....... 100
    User..... PWC
    Transaction.. VF01
    Update key... BE944DDDC5AEF1338261001635B0CD06
    Generated.... 09.07.2008, 14:25:50
    Completed.... 09.07.2008, 14:25:50
    Error Info... 00 671: ABAP/4 processor: SAPSQL_ARRAY_INSERT_DUPREC*
    Also When I scroll through the Condition records in the billing screen the conditions are disapperaing.
    I have a Userexit attached to it RV60AFZC
    Please suggest the solutions of the problem.
    regards,
    Amlan Sarkar

    I am attaching the code of the userexits:
    ***INCLUDE RV60AFZC.
    This include is reserved for user modifications                      *
    Forms for invoicing                                                  *
    The name of modification modules should begin with 'ZZ'.             *
          USEREXIT_NUMBER_RANGE_INV_DATE                                 *
          USEREXIT_FILL_VBRK_VBRP                                        *
          FORM USEREXIT_NUMBER_RANGE_INV_DATE                           *
          This userexit can be used to determine the numberranges for   *
          the internal document number. This userexit can be used when  *
          the number_ranger should impact the invoice date via table    *
          TVFKD.                                                        *
          If this userexit is active the USEREXIT_NUMBER_RANGE is not   *
          processed anymore, that means this userexit has priority.     *
          US_RANGE_INTERN - internal number range                       *
          This form is called from form LV60AU02 and LV60AU11           *
    FORM USEREXIT_NUMBER_RANGE_INV_DATE USING US_RANGE_INTERN.
    Example: Number range from TVFK like in standard
    US_RANGE_INTERN = TVFK-NUMKI.
    ENDFORM.
          FORM USEREXIT_FILL_VBRK_VBRP                                  *
          This userexit can be used to fill fields in VBRK and VBRP     *
          Be aware, that at this time the work areas KUAGV KURGV        *
          KUWEV and KUREV are not filled.                               *
          This form is called from FORM VBRK_VBRP_FUELLEN.              *
    FORM USEREXIT_FILL_VBRK_VBRP.
    Example: change Tax country
    VBRK-LANDTX = T001-LAND1.
    *{   INSERT         MRDK900206                                        1
    *if sy-tcode = 'VF01'.
    read table xkomv with key kschl = 'ZTOD'.
    if sy-subrc <> 0.
       clear xkomv.
       xkomv-kschl = 'ZTOD'.
       append xkomv.
    endif.
    *endif.
    *----Commented
    READ TABLE XKOMV WITH KEY KSCHL = 'ZTOD'.
    IF SY-SUBRC <> 0.
       CLEAR XKOMV.
       XKOMV-KSCHL = 'ZTOD'.
       APPEND XKOMV.
    ENDIF.
    *----End of comment
    *}   INSERT
    ENDFORM.
    *eject
    regards,
    Amlan Sarkar

  • Updating Document Flow

    Hi,
    I've created an inbound delivery from an outbound delivery.  Now I need to update the document flow, and I've used the code below to do so.  My problem is when viewing the document flow for the inbound delivery via VL33N - no document flow is shown.  When I view the doc flow for the outbound delivery(VL03N), the inbound delivery shows up there. 
    Why doesn't doc flow show when viewing the inbound delivery? 
    Do I need to update document flow another way?
    LOOP AT t_ib_lips INTO s_ib_lips.
          CLEAR s_ob_lips.
          READ TABLE t_ob_lips INTO s_ob_lips WITH KEY
                                                   vgbel = s_ib_lips-vgbel
                                                   vgpos = s_ib_lips-vgpos.
    * test area for document flow
          CLEAR: s_vbfa.
          s_vbfa-mandt   = s_ib_lips-mandt.
          s_vbfa-vbelv   = s_ob_lips-vbeln.        "OB delivery number
          s_vbfa-posnv   = s_ob_lips-posnr.        "OB delivery item
          s_vbfa-vbtyp_v = is_ob_likp-vbtyp.       "OB delivery type
          s_vbfa-vbeln   = s_ib_lips-vbeln.        "IB delivery number
          s_vbfa-posnn   = s_ib_lips-posnr.        "IB delivery item
          s_vbfa-vbtyp_n = s_ib_likp-vbtyp.        "IB delivery type
          s_vbfa-rfmng   = s_ob_lips-lgmng.        "Referenced quantity
          s_vbfa-meins   = s_ob_lips-meins.        "uom
          s_vbfa-VRKME   = s_ob_lips-vrkme.
          s_vbfa-matnr   = '                 X'.
    *      s_vbfa-stufe   = '00'.
          CALL FUNCTION 'RV_XVBFA_MAINTAIN'
               EXPORTING
                    f_vorgang = 'H'
                    fvbfa     = s_vbfa
                    fvbfad    = s_vbfad
               TABLES
                    fxvbfa    = t_xvbfa
                    fyvbfa    = t_yvbfa
                    fxvbapf   = t_xvbapf.
        ENDLOOP.
    CALL FUNCTION 'RV_DOCUMENT_FLOW_UPDATE_U'
             EXPORTING
                  f_vbeln  = is_ob_likp-vbeln
                  i_status = 'H'
             TABLES
                  fxvbfa   = t_xvbfa
                  fyvbfa   = t_yvbfa.
    Below is some of the data from the entry of VBFA that is created
    VBELV         POSNV    VBELN     POSNN  VBTYP_N  VBTYP_V     STUFE
    100005128     1      180006319   1     7       J     00

    Is there a BAPI you can use instead? Neither of these FMs are released or documented. It's quite a task trying to figure out how SAP uses these FMs to update.
    Rob

  • Fail Updating Document Using DI API in Form_Data_Update_Event

    Hi,
    B1 2007B PL14
    I have problem updating document using DI API in Form_data_Update_Event.
    I have made sure that beforeaction=false and actionsuccess=true (to me, this means that B1 has completed the update process), then my codes will be executed to update the same document using DI.
    However, I notice that when my codes is executed, the document form is still in "Update" mode, that this results in the system returning error message "another user-modified table (odbc-2039)
    Any suggestions?

    Hi Shahid,
    I am not sure what your question is. The code you pasted looks like the MatrixAndDataSources example that comes with the SDK. What are you trying to do?
    Thanks,
    Adele

  • Approval Process to Apply to Updated Documents

    Hi,
    My customer has a problem with certain Sales Orders not going through the Approval Process.  Users are circumnavigating the Approval Process in a sneaky way. 
    Let us say that we have a Sales Order with a value of £1000.  On hitting Add, SAP asks the user to submit the Sales Order for approval.
    If the user then clicks Cancel they return to the Sales Order entry form.  If he then changes the Order value to a figure which does not fire the Approval Process (for example £0) the system allows the Order to be Added.
    If the user then amends the Order back to the original £1000, he can Update the Order without firing the Approval Process.  I found out how this was happening by looking at the History of a Sales Order and have recreated the issue locally.
    I have found SAP Note Number 904373 - Approval Procedure not working on marketing documents.  This note states that the above scenario is system behaviour.
    Can this be changed so Updated documents will fire the approval process?
    Thanks
    Greig

    Hi All,
    Can we use the Request API to create the request (and then Approval) for other than ADD (object type like Disable, Enable etc) of a user like below
    long lRequestKey;
    long UserKey=1;
    long ObjectKey=201; //testro1
    HashMap reqMap = new HashMap();
    reqMap.put("Requests.Target Type", "U");
    reqMap.put("Requests.Object Request Type", "Disable");
    reqMap.put("Requests.Type", "U");
    lRequestKey = reqObj.createRequest(reqMap);
    System.out.println("Created request and got key :" + lRequestKey);
    reqObj.addRequestUser(lRequestKey, UserKey);
    System.out.println("Added the request user");
    reqObj.addRequestObject(lRequestKey, ObjectKey); // I am not sure if this part is right but without this it is giving me the error.
    System.out.println("Added the request object");
    reqObj.completeRequestCreation(lRequestKey);
    System.out.println(Completed and submitted the request");
    I gave it a try but the Resource detail is not getting populated in the request due to which request hang up in "Request Initialized" state. I tried by passing the Process Instance Key also but no luck.
    Any chance if anyone crack it before. Please tell me. Thanks

  • Tabs only open in a new window. Ctl T opens a new window NOT a new tab help-last update this problem started. How do I set FF back to open tabs in 1 window

    Tabs only open in a new window. Ctl T opens a new window NOT a new tab help-last update this problem started 2 days ago. How do I set FF back to open tabs in 1 window?
    There is no plus sign and going into optins and changing settings has not worked. I have uninstall FF and reinstall-keeping my personalization-and that was no help.
    Right clicking on FF Icon to open a new tab, or going up to FF drop down tab and clicking on new tab both do not work.
    Help everything opens a new window not a new tab. there seems to be no way to reset this or to chose a different optin. I just downloaded new tabs at end addon and it didn't do a thing.

    as a first troubleshooting step - does it work like normally when you open & run firefox in [[Safe Mode|safemode]] by pressing the shift key while you open firefox (all other instances have to be closed before)...

  • 10.4.11 combo update install problem

    Has anyone else had trouble installing the combo update from 10.4 to 10.4.11?? Mine almost finishes and says it encounters an unknown error and cannot finish the install. Says it moves the update to trash and says try again from the finder...
    HELP!!

    Updating
    Certain steps appear to minimize the risk of an update producing problems.
    Number one is to make sure you have a bootable clone backup of your computer in case you do need to back out of it again. This is the only guaranteed way of not having to worry about the results of an update.
    Some like to boot from their installer discs or an external backup and verify (and if necessary repair) their internal drives as well as drive permissions. This is done with Disk Utility. You can verify a drive while booted from the same drive but sometimes this produces spurious errors. Repairing a drive (if necessary) has to be done while booted from another disk.
    [Resolve startup issues and perform disk maintenance with Disk Utility and fsck|http://docs.info.apple.com/article.html?artnum=106214]
    [Using Disk Utility in Mac OS X 10.4.3 or later|http://docs.info.apple.com/article.html?artnum=302672]
    [Disk Utility's Repair Disk Permissions|http://docs.info.apple.com/article.html?artnum=25751]
    You can also go to the step of booting into safe mode to do the install.
    [Mac OS X: Starting up in Safe Mode|http://docs.info.apple.com/article.html?artnum=107393]
    [What is Safe Boot, Safe Mode? (Mac OS X)|http://docs.info.apple.com/article.html?artnum=107392]
    [Safe Boot takes longer than normal startup|http://docs.info.apple.com/article.html?artnum=107394]
    I like to download the update onto my computer and install it from there rather than let Software Update do it. I know a few people who had problems with doing the update via software updater found a manual install to work.
    Repair permissions again afterward.
    It helps to only install one update at a time and to run the computer for a while to make sure it is behaving well.
    The more cautious even like to unplug third party peripherals (see [comment by BDaqua|http://discussions.apple.com/message.jspa?messageID=9040746#9040746]).
    Almost all of the above steps (except backup) have been questioned (e.g., [Permissons repair|http://www.macworld.com/article/52220-3/2006/08/repairpermissions.html] as to necessity. Probably many people have done successful updates without doing them. I say they can't hurt, they can very likely do good (especially if your computer isn't regularly maintained), so why not do them to be safe?
    [BDaqua's comments on updating problems|http://discussions.apple.com/message.jspa?messageID=8948595#8948595]
    [Baby Boomer's comments on updating problems|http://discussions.apple.com/message.jspa?messageID=9025760#9025760]
    [Klaus1's post on updating and removing updates|http://discussions.apple.com/message.jspa?messageID=10257902] and [another one|http://discussions.apple.com/message.jspa?messageID=10402175]

  • S_ALR_80712357 'update document,update run'

    Dear friends,
    We are testing the report S_ALR_87012357, Advanced VAT return report. Accidentally we realized if we select the option 'update document, update run' but forgot to select 'batchinput session required', the report will marke the tax items and save them in table BSET, but no posting will be generated. I understand this is a mistake of user, however, I will be interested to know if SAP provides any program which can fix these incorrectly processed items, e.g. post the taxes to the vat payable account by using a special program. Or, is this a system limitation, say, user will have to run the program correctly with the respective options selected. I can not access OSS, so I am not sure if there's any OSS related to this.
    Is there anyone who can help?
    Thanks.

    Hello,
    After some tests I found the fields I was looking for,
    So once document updated , the VAT line item in BSET Table is updated via 2 Fields :
    STMDT : TAX return on
    STMTI : TAX return on
    Thank you all for your time
    Tamim

  • Update Document Flow - delivery -- bill

    Hi Experts,
    I want to "deactivate" update document flow between delivery and bill for an item category (say e.g. ZTAN). Where can I do that?
    In other words in table VBFA when I put "Follow on" document as my invoice #, I do not want to see my delivery # as preceeding document.
    I have checked VTFL, at item category level, there is NO field as "Update document flow"
    also I have checked VTFA, at item category level, there is NO field as "Update document flow"
    (in VTAA and VTLA, at item category level, there is field as "Update document flow" - but this is not my query)
    Please help
    Typewriter

    Hi,
    I donot understand your post. What shall I accomplish with your suggestion? For my better understanding, please elaborate.
    In VTFL, at item category level, Copy requirement is to check if all the criteria are met, if yes, then copying information is done from Delivery to Invoice. I think, this has nothing to do with populating information in document flow.
    Could you please advice, where exactly is the configuration for "Update doc flow" in VTFL and VTFA?

  • SQL Server 2005 Update mechanism problem

    Hi Gurus,
          We're faced with one SQL Server 2005 update mechanism problem. Here is my problem:
          According to our requirement, an add_on interface program is designed to execute creation of production order by calling Bapi.
          There are 3 steps in this add_on program:
          Step 1: Create production order
          Step 2: Change the information of production.
          Step 3: Some other
          After the step 1 has finished immediately step 2 is called, Howerver the information which should have inserted into database table couldn't be found from database. (Maybe because the time between two steps is too short to finish inserting)
          In order to ensure the complete of the transaction, before the step 2 executed, the information in step 1 should have inserted into database.
           Is there any solution to solve this problem?
           I guess whether there is any parameter which control the time of writing buffer into database...
    Any advice is appreciated.
    Thanks & Best Regards,
    Derek Yang

    Hi
    I have the same problem, but that post didnt help me
    This is the error I have:
    My snapshot agent hangs.. waiting for a response from the server.. and timeouts.
    This only hapens for a publication that has a filter based on HOSTNAME()
    The other publications work fine
    Error messages:
    Message: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
    Command Text: sp_MSsetup_partition_groups
    Parameters: @publication = XXXXXXX
    Stack: at Microsoft.SqlServer.Replication.AgentCore.ReMapSqlException(SqlException e, SqlCommand command)
    at Microsoft.SqlServer.Replication.AgentCore.AgentExecuteNonQuery(SqlCommand command, Int32 queryTimeout)
    at Microsoft.SqlServer.Replication.AgentCore.ExecuteDiscardResults(CommandSetupDelegate commandSetupDelegate, Int32 queryTimeout)
    at Microsoft.SqlServer.Replication.Snapshot.MergeSnapshotProvider.SetupPartitionGroups()
    at Microsoft.SqlServer.Replication.Snapshot.MergeSnapshotProvider.DoRegularMergeSnapshotPreparations()
    at Microsoft.SqlServer.Replication.Snapshot.MergeSnapshotProvider.DoPreArticleFilesGenerationProcessing()
    at Microsoft.SqlServer.Replication.Snapshot.SqlServerSnapshotProvider.GenerateSnapshot()
    at Microsoft.SqlServer.Replication.SnapshotGenerationAgent.InternalRun()
    at Microsoft.SqlServer.Replication.AgentCore.Run() (Source: MSSQLServer, Error number: -2)
    Get help: http://help/-2
    Server XXXXXXXXX, Level 11, State 0, Procedure , Line 0
    Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. (Source: MSSQLServer, Error number: -2)
    Get help: http://help/-2

  • Force "Update document rows according to neu BP'sData"

    How can I run the command "Update document rows according to neu BP'sData" over my AddOn.
    This command start automatically when GPCode change in the sales document for example.
    thanks,
    Marcelo

    Hi,
    There is no function that you can force the updating of the rows in your addon.
    what you can do is to simulate how SAP B1 do the updating of the row.
    You can Pop a messagebox to ask if they want to update the rows if they change the business partners.
    If they select Yes then
    Get the PriceList that the Business Partner is using then Parse the Rows And find the Price for that item in the Price List and update the Price Column.
    else
    Do nothing..
    Thanks and regards,
    Wilson

  • FORCE TO "Update document rows to new BP's data"

    How do I force to respond YES in the dialog box "Update document rows to new BP's data?" shows, when I DUPLICATE a marketing document?
    Edited by: Gabriel Marroquin on Sep 25, 2008 6:46 PM

    I want that the user dosen´t have the option to answer NO, that´s I need that the answer always be YES. (If a sales user DUPLICATE an old quotation, wich has a lower price than the actual price of an article, and he answer NO, the actual price of the article doesn´t refresh and the company loose money.)

  • S_ALR_87012357 update document, what filed ?

       Hello All ,
    When we run the VAT reprot S_ALR_87012357 with Update document selected, what is the filed / table that are impacted with this option ?
    Is there a way to see all documents 'updated' by the VAT report and  where is this flag ?
    Thank you all

    Hello,
    After some tests I found the fields I was looking for,
    So once document updated , the VAT line item in BSET Table is updated via 2 Fields :
    STMDT : TAX return on
    STMTI : TAX return on
    Thank you all for your time
    Tamim

  • Update/Insert Problem with Oracle Warehouse Builder

    Hello,
    i have update/insert problem with owb.
    Situation: I have a source-table called s_account and a target table called w_account_d. In the target table are already data which was filled trough the source table inserts. Now anyone make changes on data on the target table. This changes should now give further on the source table with an update operation. But exactly here is the problem i can´t map back the data to source because that will create a loop.
    My idea was to set a trigger but i can´t find this component in owb or is anywhere hidden?
    Also i have already seen properties as CDC or conditonal loading in the property inspector of the table, but i have no idea how it works.
    Give it other possibilities to modeling this case? or can anyone me explain how i can implement this eventually with CDC?
    I look forward for your replies :)

    Hi
    thanks for your answer. I follow your suggestion and have set the constraints of both tables into the database directly.Nevertheless it doesn´t work to begin. In the next step i found by right click on a table the listpoint "configure" - I goes to "unique key" --> creation method and set here follow options: Constraint State = ENABLE, Constraint Validation = Validate. That error message that appears before by the deployment disappears yet. Now i start the job to test if the insert/update process works right. Finally it seems to work - but not really.
    My Testscenario
    1. Load the data from source table about the staging area to data warehouse table: Check - it works!
    2. Change one data record in source table
    3. Load the source table with changed data record once again to staging area: Check - it works!
    4. Load new staging area table with the changed data record to data warehouse table: Check it works! BUT, BUT i can not recognize if it is insert or update operation, then under the design window by jobs execution windows is reported "rows selected 98", Rows inserted" is empty and "rows updated" is empty. So i think works not correct, then my opinion if it works correct it should show be "rows updated" 1.
    What can yet now still be wrong or forgotten? Any ideas?
    *By the way think not 98 rows there is not important if you make an update or insert which performance. It is an example table the right tables have million of records.*
    I look forward for your answers :)

Maybe you are looking for