Documents Update method and datasources

Hi all,
I ve done a piece of code for updating an UDF at level line of an order when a target delivery is added. The update must be done when BeforeAction is true. This way when the user adds a new delivery, the code will update the lines of the base orders (base order of each line) and after that BO will do its updates (like closing the line if it's nedeed). For doing this i use the datasources of the form for reading the intformation, due to BeforeAction is true and the actual document is not still added. The problem is that the update method (of the order) doesn`t finish and i don`t receive any exception. Other way, if i don´t use the datasources for reading the information (if i do it using UI API), the update method works well. This is the method using DataSource:
        private void updatePiezasPtesDs(string formUid, string nombreTabla)
            Form form = kernel.Application.Forms.Item(formUid);
            try
                Matrix mtx = form.Items.Item("38").Specific as Matrix;
                DBDataSource ds = form.DataSources.DBDataSources.Item(nombreTabla);
                for (int i = 0; i < mtx.VisualRowCount; i++)
                    mtx.GetLineData(i + 1);
                    if ((ds.GetValue("BaseEntry", 0) != null) &&  //IF THIS LINE HAS BASE DOCUMENT
                        (ds.GetValue("BaseEntry", 0).Length > 0))
                        int baseEntry = int.Parse(ds.GetValue("BaseEntry", 0).ToString().Trim());                   
                        if (baseEntry > 0)
                            Documents docOrigen = kernel.getDoc(baseEntry, BoObjectTypes.oPurchaseOrders, kernel.Company); //GET THE BASE DOCUMENT OF THIS LINE
                            int baseLine = int.Parse(ds.GetValue("BaseLine", 0).ToString().Trim());
                            if (!esBaseCero(baseEntry, "POR1"))
                                baseLine--; //IF THE BASE DOCUMENT WAS DUPLICATED, THE BASE INDEX WILL BE 1 INSTEAD OF 0
                            docOrigen.Lines.SetCurrentLine(baseLine);
                            double oldValue = Convert.ToDouble(docOrigen.Lines.UserFields.Fields.Item("U_ITOP_PiezasOpenQty").Value.ToString().Trim().Replace(".", ","));
                            double recibido = Convert.ToDouble(ds.GetValue("U_ITOP_PiezasQty", 0).ToString().Trim().Replace(".", ","));
                            double newValue = oldValue - recibido;
                            docOrigen.Lines.UserFields.Fields.Item("U_ITOP_PiezasOpenQty").Value = (newValue > 0) ? newValue : 0;
                            int error = docOrigen.Update();  //THIS METHOD DOESN`T FINISH
            catch (Exception ex)
                kernel.Application.MessageBox(ex.Message, 0, "", "", "");
I tried to chek the last error after update method but the method doesn`t finish.
Other way, when i read the information by accesing directly to the cells of the matrix:
                    int baseEntry = int.Parse((mtx.Columns.Item("45").Cells.Item(i + 1).Specific as EditText).Value.Trim());                
                        double oldValue = Convert.ToDouble(docOrigen.Lines.UserFields.Fields.Ite("U_ITOP_PiezasOpenQty").Value.ToString().Trim().Replace(".", ","));
                        double recibido = Convert.ToDouble((mtx.Columns.Item("U_ITOP_PiezasQty").Cells.Item(i + 1).Specific as EditText).Value.Trim().Replace(".", ","));
                        double newValue = oldValue - recibido;
                        docOrigen.Lines.UserFields.Fields.Item("U_ITOP_PiezasOpenQty").Value = (newValue > 0) ? newValue : 0;
                        int error = docOrigen.Update();
It works well!!. I don´t know if i`m losing something but AFAIK the best way for reading the information of the actual form is using its datasources. Please if someone knows something about this it will be very helpful for me.
Thanks,
Edited by: Nauzet Diaz on Jul 29, 2008 11:46 AM
Edited by: Nauzet Diaz on Jul 29, 2008 12:32 PM

Hi all,
i'm still having problems with dbdatasources and update documents. I've written this in FormDataEvent
           //UiApp_FormDataEvent
            if ((BusinessObjectInfo.FormTypeEx.Equals(FORM_PEDIDOCOMPRAS)) &&  //PURCHASE ORDERS
                (BusinessObjectInfo.EventType.Equals(BoEventTypes.et_FORM_DATA_UPDATE)) &&
                (BusinessObjectInfo.BeforeAction))
                  procesarModificaciones(form);  //"form" ORIGINATED THE EVENT
The method procesarModificaciones(Form form) is:
       private void procesarModificaciones(Form form)
            DBDataSource ds = form.DataSources.DBDataSources.Item("OPOR");
            int docEntry = int.Parse(ds.GetValue("DocEntry", 0).Trim());
            Documents doc = kernel.Company.GetBusinessObject(BoObjectTypes.oPurchaseOrders) as Documents;
            doc.GetByKey(docEntry);
            Matrix mtx = form.Items.Item("38").Specific as Matrix;
            try
                ds = form.DataSources.DBDataSources.Item("POR1");
                for (int i = 0; i < doc.Lines.Count; i++)
                    doc.Lines.SetCurrentLine(i);
                    string itemCodeObj = doc.Lines.ItemCode;
                    int order = doc.Lines.VisualOrder + 1;
                    mtx.GetLineData(order);
                    string itemCodeForm = ds.GetValue("ITEMCODE", 0).Trim();
            catch (Exception ex)
                kernel.Application.MessageBox(ex.Message, 0, "", "", "");
I'm only exploring the business object (documents) order and the form at the same time. But this code throw this error (no sense):
"Another user-modified table budget OBGT (ODBC 2039) Message 131-283"
I've not used the table budget.
I think that the problem is related with mtx.GetLineData() because when i comment the line the error doesn't appear but, of course, the method doesn't work properly. It seems like some transaction doesn't finish and the update doesn't work due to that.
The same code using UI API instead of DbDataSources works well again:
        private void procesarModificaciones(Form form)
            DBDataSource ds = form.DataSources.DBDataSources.Item("OPOR");
            int docEntry = int.Parse(ds.GetValue("DocEntry", 0).Trim());
            Documents doc = kernel.Company.GetBusinessObject(BoObjectTypes.oPurchaseOrders) as Documents;
            doc.GetByKey(docEntry);
            Matrix mtx = form.Items.Item("38").Specific as Matrix;
            try
                ds = form.DataSources.DBDataSources.Item("POR1");
                for (int i = 0; i < doc.Lines.Count; i++)
                    doc.Lines.SetCurrentLine(i);
                    string itemCodeObj = doc.Lines.ItemCode;
                    int order = doc.Lines.VisualOrder + 1;
                    string itemCodeForm = (mtx.Columns.Item("1").Cells.Item(order).Specific as EditText).Value.Trim();
            catch (Exception ex)
                kernel.Application.MessageBox(ex.Message, 0, "", "", "");
Using UI API always for reading information from forms is not a good programming practice then help please,
Regards.

Similar Messages

  • Statistics update and docuement update

    hai,
          can any one explain the differences between statitics update and docuement update . and please explain how these updates are happen in the lo-cockpit extraction method.and wht are the differences between v1 ,v2 and v3 updates.
    thanks,
    sri

    Hi Sri!
    Look here
    /people/sap.user72/blog/2005/01/19/logistic-cockpit-delta-mechanism--episode-three-the-new-update-methods
    /people/sap.user72/blog/2005/01/19/logistic-cockpit-delta-mechanism--episode-three-the-new-update-methods
    and all my related weblogs...
    Hope it helps!
    Bye,
    Roberto
    ...please don't forget to reward the answers...it's THE way to say thanks here...

  • "Direct Delta" Update Method - Why need for Collective update

    Hi folks,
    I have been going through LO Cockpit in detail and read quite extensively about new update methods and still have one doubt.
    1)Why there is "Job control" for "Direct Delta" Update method in LO Cockpit?.
    If I understand Direct Delta correctly, Application data is directly posted to Delta Queue by SAP Update management using V1 and when the Delta request comes from BW it is read from the Delta queue. So...
    2)why bother about collective run and
    3)where exactly are we going to collect from - there is no intermediate storage like extraction Q or update tables?
    One more question. I noticed that Delta queue is a stopped qRFC. what does this mean?

    Hi Jay,
    These questions have been answered by Roberto Negro in full detail of his 3 episode Blog...
    Please read his blog.
    Click Weblogs above and search for Roberto Negro.
    --Jkyle

  • Early delta initialization and update methods

    Hi gurus
    Can we use EDI with "queued delta" as update method?
    If yes where we need to do that setting and if no then would you pl tell me which functionality we need to use in infopkg to load delta from R/3 with Queued delta as a update method?
    Pl help to understand this.
    Thanks

    In the 'update' mode in your infopackage, if you see an 'early delta init' option, you can use it for that datasource (for queued or any other delta). This is where you choose to run an 'early delta init'.

  • I have just downloaded the latest update for Pages on my iPad and now it can no longer open up documents in iCloud and then just shuts down. What The.

    i have just downloaded the latest update for Pages on my iPad and now it can no longer open up documents in iCloud and then just shuts down. What The.

    Before the reset quit Pages like this:
    Double click the Home button to show the screen with running and recently used apps. Each app icon will have a sample page above it. Flick up on the page (not the app icon) and the page will fly away and the app icon will disappear. This quits that app.

  • Just updated pages and I can't open a document in my mac

    I was working a document in pages yesterday and last night the system ask me to do an update of pages which I did. Now when I try to open the document it tells me I have to download and pay for a new pages version. Funny thing is that pages opens all of my other old files.

    Open Pages, then pull down File > Open. Navigate to the document, select it and click Open.

  • Conversion from awt to Swing, colored list widget, and awt update() method

    Now that my Interactive Color Wheel program/applet is in Swing, I guess I should continue my previous thread in here from the AWT forum ("list widget with different colors for each list item?"):
    * list widget with different colors for each list item?
    My current issue involves two canvas (well, JPanel) refresh issues likely linked to double buffering. You can see them by running the following file with "java -jar SIHwheel.jar":
    * http://r0k.us/rock/Junk/SIHwheel.jar
    [edit add]
    (Heh, I just noticed Firefox and Chrome under Windows 7 will allow you to run thie .jar directly from the link. Cool.)
    [edit]
    If you don't trust me and would rather run it as an applet, use:
    * http://r0k.us/rock/Junk/SIHwheel.html
    (For some reason the first issue doesn't manifest when running as applet.)
    1) The canvas goes "wonky-white" when the user first clicks on the wheel. What is supposed to happen is simply the user sees another dot on the wheel for his new selected color. Forcing a complete redraw via any of the GUI buttons at the bottom sets things right. The canvas behaves itself from then on, at least until minimized or resized, at which point one needs to click a GUI button again. I'll be disabling resizing, but minimizing will still be allowed.
    2) A button image, and sometimes toolTip text, from an entirely different JPanel will appear in the ULC (0,0) of my canvas.
    Upon first running the new Swing version, I had thought everything was perfect. I soon realized though that my old AWT update() method was never getting called. The desired case when the user clicks somewhere on the wheel is that a new dot appears on his selected color. This usually allows them to see what colors have been viewed before. The old paint(), and now paintComponent(), clear the canvas, erasing all the previous dots.
    I soon learned that Swing does not call update(). I had been using it to intercept refresh events where only one of the components on my canvas needing updating. Most usefully, don't redraw the wheel (and forget the dots) when you don't need to. The way I chose to handle this is to slightly modify the update() to a boolean method. I renamed it partialOnly() and call it
    at the beginning of paintComponent(). If it returns true, paintComponent() itself returns, and no clearing of the canvas occurs.
    Since I first posted about these two issues, I've kludged-in a fix to #1. (The linked .jar file does not contain this kludge, so you can see the issue.) The kludge is included in the following code snippet:
        public void paintComponent(Graphics g)
            Rectangle ulc;
         if (font == null)  defineFont(g);
         // handle partial repaints of specific items
         if (partialOnly(g))  return;
            ...  // follow with the normal, full-canvas refresh
        private boolean partialOnly(Graphics g)
         boolean     imDone = true;
         if (resized > 0)  // this "if { }" clause is my kludge
         {   // should enter on 1 or 2
             imDone = false;
             resized += 1;     // clock thru two forced-full paints
             if (resized > 2)  resized = 0;
            if (wedgeOnly)
             putDotOnWheel(g);
                paintWedge(g);
             drawSnake(g);
             drawSatSnake(g);
             updateLumaBars(g);
                wedgeOnly = false;
              else if (wheelOnly)
                wheelOnly = false;
              else
                imDone = false;  // was paint() when method was update() in the AWT version
            return(imDone);
        }Forcing two initial full paintComponent()s does whatever magic the double-buffering infrastructure needs to avoid the "wonky-white" problem. This also happens on a minimize; I've disabled resizing other than minimization. Even though it works, I consider it a kludge.
    The second issue is not solved. All I can figure is that the double buffers are shared between the two JPanels, and the artifact buttons and toolTips at (0,0) are the result. I tried simply clearing the top twenty lines of the canvas when partialOnly() returns true, but for some reason that causes other canvas artifacting further down. And that was just a second kludge anyway.
    Sorry for being so long-winded. What is the right way to avoid these problems?
    -- Rich
    Edited by: RichF on Oct 15, 2010 8:43 PM

    Darryl, I'm not doing any custom double buffering. My goal was to simply replicate the functionality of awt's update() method. And yes, I have started with the Swing tutorial. I believe it was there that I learned update() is not part of the Swing infrastructure.
    Problem 1: I don't see the effect you describe (or I just don't understand the description)Piet, were you viewing the program (via the .jar) or the applet (via the .html)? For whatever reason, problem 1 does not manifest itself as an applet, only a program. FTR I'm running JDK/JRE 1.6 under Windows 7. As a program, just click anywhere in the wheel. The whole canvas goes wonky-white, and the wheel doesn't even show. If it happens, you'll understand. ;)
    Are you aware that repaint() can have a rectangle argument? And are you aware that the Graphics object has a clip depicting the area that will be affected by painting? You might use these for your partial painting.Yes and yes. Here is an enumeration of most of the update regions:
    enum AoI    // areas of interest
        LUMA_SNAKE, GREY_SNAKE, HUEBORHOOD, BULB_LABEL, LUMA_WEDGE,
        LAST_COLOR, BRIGHTNESS_BOX, INFO_BOX, VERSION,
        COLOR_NAME, EXACT_COLOR, LUMA_BUTTON, LUMA_BARS, GUI_INTENSITY,
        QUANTIZATION_ERROR
    }That list doesn't even include the large color intensity wedge to the right, nor the color wheel itself. I have a method that will return a Rectangle for any of the AoI's. One problem is that the wheel is a circle, and a containing rectangle will overlap with some of the other AoI's. I could build an infrastructure to handle this mess one clip region at a time, but I think it would add a lot of unnecessary complexity.
    I think the bigger picture is that, though it is now updated to Swing, some of the original 1998 design decisions are no longer relevant. Back then I was running Windows 98 on a single-core processor clocked at significantly less than 1 GHz. You could actually watch the canvas update itself. The color wheel alone fills over 1000 arcs, and the color intensity wedge has over 75 update regions of its own. While kind of interesting to watch, it's not 1998 any more. My multi-core processor runs at over 2 GHz, and my graphic card is way, way beyond anything that existed last century. Full canvas updates probably take less than 0.1 sec, and that is with double-buffering!
    So, I think you're right. Let the silly paintComponent() do it's thing unhindered. If I want to track old dots on the wheel, keep an array of Points, remembering maybe the last 10. As a final step in the repainting process, decide how many of those old dots to display, and do it.
    Thanks, guys, for being a sounding board.
    Oh, I'm moving forward on implementing the color list widget. I've already added a 3rd JPanel, which is a column to the left of the main paint canvas. It will contain 3 GUI items:
    1) the color list widget itself, initially sorted by name
    2) 3 radio buttons allowing user to resort the list by name, hue, or hex
    3) a hex-entry JTextField (which is all that is there at this very moment), allowing exact color request
    The color list widget will fill most of the column from the top, followed by the radio buttons, with hex-entry at bottom.
    For weeks I had in mind that I wanted a pop-up color list widget. Then you shared your ColorList class, and it was so obvious the list should just be there all the time. :)
    -- Rich

  • How to make update method permanent once and forever?

    Hi,
    Every time I get an update to Flash and install it, at the end of the install I get the three update choices of ‘Allow Adobe to install updates (recommended)’, ‘Notify me to install updates’ and ‘Never check for updates (not recommended)’. Every time I choose the second option and every single subsequent time there is an update I have to go through the same procedure again because the first option becomes selected. I do NOT want Adobe to perform automatic updates. Is there a way to set it to notify me of updates but never bug me to change my update method? I have tried changing the setting through the Control Panel but this doesn’t make any difference either. I just want to be notified of updates but not be pestered with those same three options EVERY time.

    This answer is NOT working. The line "SilentAutoUpdateEnable=0" is already present. And it still queries for the annoying question, even when asked and answered ad nauseum.
    Adobe should in the very next update, as a minimum, make it such, that the chosen value in "Choose your update method:" remains PERMANENT and FOR EVER until the user changes it. It is WILDLY annoying to have to answer this question over and over and over and over and over and over again. Make a new value or something that will be written to the mms.cfg file, that will permanently understand this setting, I Want to update, but I want to know when and how and why, and I especially want to do it myself - Automatic updates can for novice users be nice, until it screws up the entire system - but for super user level or above it is an annoyance, that programs do not respect the answers of the user. It SHOULD ask this question ONCE, and never ever there after - unless the user changes the behaviour, in e.g. the mms.cfg file.
    I hope this is crystal clear --- it should be, and I cannot fathom that millions of other users are not annoyed by this popup box ... When i press "DONE" ... it should be EXACTLY THAT - notify me to install updates, BUT NOT to ask it every time what "update method" i want to use -- i've only told you a million times before --- just freaking get the answer and understand it.
    Annoyed regards : CyberstormXIII

  • I want all document updates and comment notifications on by default

    I got it working and sending mail to exchange.  But now I want to be able to control default notification settings.  For example:  Our company has a phone list in MS-Excel.  When it is updated I was everyone to recieve a notification that it is updated.  I don't want them to have any choice in the matter. 
    And I want all document updates and comment notifications on by default.

    Hi iTunesDJ,
    There is no way to do this. What I would do is put your Settings app on a page itself, so its out of your way. Just ignore your notifactions. I hope this helps!
    Thanks,

  • No Oracle Developer Tools and Datasources for VS2012 Update 3

    Hi all
    I am using VS2012 Update 3 and I have installed Oracle 11.2.0.3.20 32 bit successfully. Unfortunately, the tools are not showing up in the VS About Dialog, nor do I have the Oracle Datasources in VS.
    Any help appreciated.
    Juerg

    Hi Christian
    Thanks for reply. Yes I did install this exact version. The funny thing is that I can open a project in VS2012 (created in VS2010 with the 11.2.0.3 version on an other box) on my machine and the VS2012 EF designer opens correctly when double clicking on the .edmx file. The Oracle Client data providers however do not show up ( and therefore I cannot recreate the model from the database). Also the About dialog does not contain the VS Oracle tools. Build and run however works, as well deployment to an IIS/R2008 server where 11.2.0.3 is installed. 
    The ifile is a parameter in the tnsnames.ora file to reference other tnsnames.ora. That is the way we reference the company wide tnsnames.ora on a shared drive. This does not work in the 12.1 ODT version.
    http://oracleprofessional.blogspot.ch/2007/05/using-ifile-to-centralise-tnsnamesora.html
    IMHO the uninstalling of the 12.1 and reinstalling 11.2.0.3 somehow screwed up the registry or whatever. I am quite familiar with VS and also the command line switches, I did all I could (/resetsettings, etc), but nothing helped. Also a repair of VS2012 did not help. After the not working 11.2.0.3 I tried to reinstall 12.1, but with no success. I always did an uninstall and a reboot in between each installation/uninstallation.
    Another question, this installer looks a bit outdated, did Oracle ever think about using newer ways of providing such an installer ( NuGet, and/or vsix) ?
    Kind regards
    Juerg

  • Diff between statistics update and document update

    Hi Everybody,
                Can any  one explain the difference between the statistics update and document update with an example.

    Hello Raju,
    Also go through these threads
    statistical update and document update
    V1,V2,V3 updates
    Regards,
    Praveen

  • Error in creating transfer rules beween infosource and datasource in BI 7.0

    Hello Guys
    I am gettting the following error when trying to create transfer rules between infosource and datasource.
    1. Error while activating transformation
    2. Deletion of Objects with Type Transformation
    3. Preprocessing/Collecting DDIC Objects for Transfor mation 094TBEAT814OF89GQXFOFI0DX7ATMS4K
    4. Post Processing/Checking the Deletion for Transfor mation 094TBEAT814OF89GQXFOFI0DX7ATMS4K
    5. Object Transformation 094TBEAT814OF89GQXFOFI0DX7ATMS4K has been deleted
    6. Name of object of type 'TRCS' is missing
    7. Name of object of type 'TRCS' is missing
    8.Key rule 1 (target field: 0COMP_CODE): Initial update set
    9. Key rule 2 (target field: 0PLANT): Initial update set
    10. Key rule 3 (target field: 0OI_EBELN): Initial update set
    11. Key rule 4 (target field: 0AC_DOC_NO): Initial update set
    12. No rule exists
    13. Saving Objects with Type Transformation
    14. Saving Transformation 094TBEAT814OF89GQXFOFI0DX7ATMS4K
    15. Transformation 094TBEAT814OF89GQXFOFI0DX7ATMS4K saved successfully
    16. Activation of Objects with Type Transformation
    17. Saving Objects with Type Transformation
    18. Internal Activation (Transformation )
    19. Preprocessing / Creation of DDIC Objects for Trans formation 094TBEAT814OF89GQXFOFI0DX7ATMS4K
    20. Post Processing/Checking the Activation for Transf ormation 094TBEAT814OF89GQXFOFI0DX7ATMS4K
    21. Transformation 094TBEAT814OF89GQXFOFI0DX7ATMS4K was activated
    22. Syntax error in GP_ERR_RSTRAN_MASTER_TMPL, row 1,644 (-> long text)
    23. Error during generation
    24. Error when activating Transformation 094TBEAT814OF89GQXFOFI0DX7ATMS4K
    25. Resetting of Incorrect Objects Back to the Active Version (Transformation )
    26. Preprocessing / Creation of DDIC Objects for Trans formation 094TBEAT814OF89GQXFOFI0DX7ATMS4K
    27. Post Processing/Checking the Activation for Transf ormation 094TBEAT814OF89GQXFOFI0DX7ATMS4K
    28. Transformation 094TBEAT814OF89GQXFOFI0DX7ATMS4K was activated
    29. Transformation 094TBEAT814OF89GQXFOFI0DX7ATMS4K was reset to the active version
    Can anyone send me a document on how to create cubes, info and data sources,ODS's,multicubes and t/f and update rules in BI 7.0
    Thanks.

    Transformations in BI7
    http://help.sap.com/saphelp_nw04s/helpdata/en/f8/7913426e48db2ce10000000a1550b0/content.htm
    Regards,
    R.Ravi

  • In update task & Express document Update was terminated

    Hi all
    Need help!
    Requirement: When i do confirmation through CO11N i have to do GI through a BADI.
    Solution: I have written a wrapper Update module(internally has /AFS/BAPI_GOODSMVT_CREATE) with Start delayed and called that module(in update task) in the method MB_DOCUMENT_BEFORE_UPDATE of the definition MB_DOCUMENT_BADI.
    It works fine when every thing is correct, but if GI fails its still confirms the confimation and "Express document Update was terminated" pops up when i push the back button. I have written a abort statement in the update module if goods movement fails. When i check SM13 it shows the reason for erroring out. But my requirement is to stop the complete transaction if GI fails and put the error message at the bottom of screen(CO11N)
    How can i do this?
    Appreciate any suggestions.

    Hi,
    I don't think that it is possible. It's too late to call rollback. The FM in update task is called after command COMMIT WORK. Here is a quote from ABAP documentation:
    If during the update an error occurs, the update work process executes a database rollback, returns the log record with a note into table VBLOG and informs the user whose program has created the log record by SAPMail. After removing the error cause, the returned log records can be updated again.
    So you should call that module only in case that you are 100% sure that it will be processed correctly.
    Cheers

  • Express document "Updated was terminated" received from author in IW32

    Hi,
    I am creating PO in then method of IN_UPDATE or BEFORE_UPDATE of BADI  WORKORDER_UPDAT using BAPI_PO_CREATE or BAPI_PO_CREATE1, but it is not allowing commit transaction implicitly triggered by bapi so it is throwing the message Express document "Updated was terminated" received from author 'XXXX'.
    Please advice how to achieve creatING PO in the BADI.
    Regards,
    Krishna

    Hi,
    Then it would be really difficult because you will face an update termination every time incase something goes wrong in creating the PO.
    In this method even if you raise any messages it would lead to update termination.
    If you check the documentation it says that messages can be issued only in AT_SAVE method.
    Try creating your PO in this method.
    If you need the document number then what you can do is create a custom RFC FM and call it in background. In this FM call your BAPI and using the document number do the further processing.
    But if you want this document number to update something in the workorder then i feel that is not possible using this BADI.
    Regards,
    Ankur Parab

  • Updating bseg and bsis table ...

    Hello,
    I want to update bseg and bsis table. I guess i will have to use BAPI_ACC_DOCUMENT_POST.
    how do i go on using this BAPI ? any starter code snippet ...!!

    Functionality
    Using this method you can create a posing in accounting for certain business transactions.
    Possible ( Business Transactions):
    Postings that generally only affect the general ledger. (RFBU)
    Billing: For billing in Sales and Distribution, accounting is supplied with the relevant billing data. (SD00) Billing Document
    Accounting can use the data of a logistics system that result from an Invoice Receipt. (RMRP)
    Goods Movement are triggered by transactions in Sales and Distribution or by inventory postings. Within logistics, they lead to a change in the warehouse stocks of
    <DS:GLOS.Inventory Management>Inventory Management. This results in a posting in accounting. This is why accounting is supplied with the relevant data from logistics. (RMWA)
    Example
    Billing document:
    By selling goods in accordance with targets, revenue is generated. The revenue is posted in billing and forwarded
    to accounting.
    Invoice receipt:
    Raw materials are purchased in accordance with targets. The invoice receipt is posted in a logistics system. The data from the raw materials is forwarded to accounting.
    Goods Movment:
    The use of raw materials leads to a change in stock in inventory managment. The posting of raw material consumption is forwarded to accounting.
    G/L Account Posting:
    Provision posting for an expected warranty service. This can refer to acquisitions or retirements belonging to stocks that are not in subledger accounting relevant to inventory management. This is particularly the case if such materials are not displayed as vendor/customer, materials, loans etc. or cannot be displayed in this way. This can also refer to write-ups or depreciation that contain higher aggregations of values than are maintained in a corresponding subledger that is relevant to inventory management.
    The conversion of foreign currencies for receivables/payables due to large exchange rate changes that should not lead to an update of the accounts payable or accounts receivable accounting. A similar transaction can arise for the revaluation of raw materials if this revaluation takes place at a correspondingly aggreagated level.
    Reclassification of inventory of P&L statement accounts that are only used for reconcilliation purposes in the general ledger (this rearranges values for balance sheet items).
    Balance reclassifications of stocks to receivables with different return times.
    Notes
    If the parameter CurrencyAmount is filled with the currency fields, a complete document check including characteristics and value components of profitability analysis (CO-PA). Otherwise, the account assignment objects are checked.
    Messages are returned in the parameter Return. In the parameter documentation you can find the return values and their meaning.

Maybe you are looking for