Get Invoice Number after adding the invoice

Hi,
   I am adding a service invoice to SBO using the DI api. I am able to create the Invoice successfully. Immedietly after I execute the Invoice.Add line, I would like to get the Docentry that was assigned to the invoice. What is the bst way to do this? Appreciate any help you can give me.\
See code I am using:
private void CreateSAPServiceInvoice()
               SAPbobsCOM.Documents oServiceInvoice;//ChargeBack Invoice.
               SAPbobsCOM.Documents oPaymentInvoice; //Orig: Invoice
               SAPbobsCOM.Payments_CreditCards pCC;
               oServiceInvoice = (SAPbobsCOM.Documents) frmMain.oCompany.GetBusinessObject(
                    SAPbobsCOM.BoObjectTypes.oInvoices);
               oPaymentInvoice = (SAPbobsCOM.Documents) frmMain.oCompany.GetBusinessObject(
                    SAPbobsCOM.BoObjectTypes.oInvoices);
               oServiceInvoice.DocType=SAPbobsCOM.BoDocumentTypes.dDocument_Service;
               oServiceInvoice.CardCode = pmt.CardCode;
               int x = pmt.Invoices.Count;
               //Get CC Payment Info
               pCC = pmt.CreditCards;
               for (int i=0;i<pCC.Count;i++)
                    pCC.SetCurrentLine(i);
                    this.CBAccountInfo= modcb.cbaccts.Find(pCC.CreditCard);
                    if (this.CBAccountInfo != null)
                         //Service lines
                         oServiceInvoice.Lines.ItemDescription = this.pCBAcct.AccountName;
                         oServiceInvoice.Lines.AccountCode = pCC.CreditAcct;
                         oServiceInvoice.Lines.Price = pCC.CreditSum;
                         oServiceInvoice.Lines.TaxCode="0";
                         oServiceInvoice.Lines.Add();
               //Add the invoice only if any lines have been added to the
               //Service Invoice.
               if (oServiceInvoice.Lines.Count > 0)
                    //Add the invoice
                    int j = oServiceInvoice.Add();
                    if  (j!=0)//If there is an error
                         int ix; string m;
                         frmMain.oCompany.GetLastError(out ix,out m);
                         throw new Exception(ix + ":" + m);          
                    else
                         j =oServiceInvoice.DocNum;

I think this thread might have some useful information for you.
After Save Document: How to get DocNum, LineNum

Similar Messages

  • A/P Invoice Vendor Ref Number Field updating after adding the Invoice Copy

    Hi All,
                  I am able to change the Vendor Reference number in A/P Invoice Document after adding the Document.  I want to restrict this to happen. Plzz help how to do this????
    Regards,
    Sree.

    1.The Modify Posted A/P Documents authorization refers to some fields only, e.g. the Due Date or Pay to address.
    2. Additional authorization can be defined only for full forms, not for fields.
    3. The SP Joseph suggests will refuse those modifications when the Vendor ref is empty.
    To avoid modifying the Vendor ref you can use this code:
    IF @Object_type = N'18' and @transaction_type = N'U'
    BEGIN
    declare @li int
    set @li=
    (select max(t.LogInstanc)
       from ADOC t
       where t.ObjType=18 and t.DocEntry=@list_of_cols_val_tab_del)
    IF
       (select isnull(t.NumAtCard,'')
        from ADOC t
        where t.ObjType=18 and t.DocEntry=@list_of_cols_val_tab_del
          and t.LogInstanc=@li-1)
    !=(select isnull(t.NumAtCard,'')
       from OPCH t
       where t.DocEntry=@list_of_cols_val_tab_del)
    begin
      Set @error = 10
      Set @error_message = N'Vendor refernce not modifiable !'
    end
    END
    Or if you want to allow modifying an unfilled reference, then this:
    IF @Object_type = N'18' and @transaction_type = N'U'
    BEGIN
    declare @li int
    declare @pref nvarchar(100)
    set @li=
    (select max(t.LogInstanc)
       from ADOC t
       where t.ObjType=18 and t.DocEntry=@list_of_cols_val_tab_del)
    set @pref=
    (select isnull(t.NumAtCard,'')
        from ADOC t
        where t.ObjType=18 and t.DocEntry=@list_of_cols_val_tab_del
          and t.LogInstanc=@li-1)
    If @pref !='' and @pref !=
    (select isnull(t.NumAtCard,'')
       from OPCH t
       where t.DocEntry=@list_of_cols_val_tab_del)
    begin
      Set @error = 10
      Set @error_message = N'Filled vendor refernce not modifiable !'
    end
    END

  • UDF at header level will not auto refresh before & after adding the invoice.

    Hi All,
    I have a FMS query in the UDF at AR Invoice header level. I have set the FMS query to auto refresh when tax rate field changes but the UDF doesn't auto refresh when there is a tax code in the document.
    I will need to add the invoice first then open the added invoice and press shift+F2 to get the calculated amount in the UDF to update the invoice.
    How to get the UDF to auto refresh whenever the tax code has changed? Or after the invoice has added?
    The FMS query:
    SELECT sum(T0.[TotalSumSy]) FROM INV1 T0 inner join OINV t1 on t1.docentry = t0.docentry WHERE T0.VatGroup in ('SR','DS','AJS') and t1.docentry = $[OINV.docentry]
    Thanks & BR,
    Leng

    Hi,
    I solved the problem following the steps in SAP note 633285 - Printing the total Vat amounts in each Vat group, https://websmp130.sap-ag.de/sap/support/notes/0000633285
    In order to print  in the  order  the Vat amount  in each vat group Please perform  the followed stages:
    Go to Tools (in the SBO tool bar ) and chose Manage User Field
    In Marketing Documents (Rows) add new fields according to the Num of the vat groups that you are using in Orders (e.g. A1, A2 ,A4) The type : Units and Totals  - the Structure: sum in the order each column will represent the vat amounts in the line but only for certain  Vat Group
    in order that each column will display the vat amount in the line only if it belong to certain Vat group we attach a query to each column: (e.g. we have 3 columns : A1, A2, A4) .the queries are;
    SELECT $[$38.82.NUMBER]  WHERE $[$38.18.0] = 'A1' FOR BROWSE  SELECT $[$38.82.NUMBER]  WHERE $[$38.18.0] = 'A2' FOR BROWSE SELECT $[$38.82.NUMBER]  WHERE $[$38.18.0] = 'A4' FOR BROWSE Now each column will display the vat amount only if it in the relevant vat group
    in the order document printing template you need to add those Vat column in our example we add 3  data fields : the file: Order - Rows , the Field: A1/A2/A4 - you can hide (un visible ) this columns as needed
    in the Repetitive Area Footer add a calculation field for each vat groupthe Type: Column Total , the Column: Order; A1/A2/A4 in each calculate field you will get the sum amount of the vat in the relevant Vat group. (in  addition you can add text fields with a relevant description for the calculation fields)
    Thanks & BR,
    Leng

  • How to get Spool Number after submtting the program and return

    Hi All,
    Could you please assist me on this issue. I have ABAP program which will create a spool number and this spool number is generated by submitting the same report. Now when try to retrive the spool number from sy-spono it is displaying as 000000 but it suppose to be the spool which is created during submit program. COuld you please assist me on this issue. I have added the part of code for your reference,
    DATA: l_params TYPE pri_params,
    l_valid TYPE string,
    w_spool_nr like sy-spono,
    p_m_werks like marc-werks.
    export p_werks to memory id 'P_WERKS'.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
    IMPORTING
    out_parameters = l_params
    valid = l_valid
    IF sy-subrc <> 0.
    ENDIF.
    import p_werks from memory id 'P_WERKS'.
    p_m_werks = p_werks.
    SUBMIT zmmlist01 with p_werks eq p_m_werks
    to SAP-SPOOL
    spool parameters l_params
    without spool dynpro and return.
    write: sy-SPOno.
    Thanks & Regards,
    Nagaraj Kalbavi

    Hi,
    You can use the code snippet as below :
    SELECT MAX( RQIDENT ) INTO G_SPOOL_NUM
    FROM TSP01
    WHERE RQCLIENT = SY-MANDT AND
    RQOWNER = SY-UNAME.
    Also you can use the FM RSPO_FIND_SPOOL_REQUESTS' and pass the relevant parameters to this FM. This should get you the desired results.
    Hope this would be of some help!!
    Regards,
    Lalit Kabra

  • URGENT: I can't see the Invoice commitment after creating the Invoice/PO

    Dears,
    I have created PO related project and i checked the PO commitments and it's reflected in the PSI. After that i have created invoice matched to PO it was supposed that the Commitment in the PSI changed from PO to supplier invoice but this wasn't the action, the commitment remain PO, please advice what should i do?!!!!
    Thanks in advance

    Hi,
    In your first case where the issue is there, while running PRC: Interface Supplier cost what was the value of two parameters ? Interface Supplier Invoices ? and Interface Reciept Acrruals.
    Please go through the details of parameters while doing ISC.
    PRC: Interface Supplier cost The available parameters are:
    Interface Supplier Invoices: Yes / No / Accrued Cost Only
    Interface Receipt Accruals: Yes / No
    Set A: you run that process with the following parameters' combination:
    Invoices =Yes, Receipts = No,
    The system will not interface receipt accrual transactions from PO to Projects. It will only interface the supplier
    invoice distributions at the full invoiced amount.
    Set B: you run that process with the following parameters' combination:
    Invoices = Yes, Receipts = Yes,
    The system will interface the receipt accrual transactions from PO to Projects, only if the supplier invoice full
    amount was not yet interfaced. On the other end, when looking at the supplier invoices distribution the process will
    interface the variances amounts if it finds that the receipt accrual transactions were already interfaced. Otherwise,
    the process interfaces the entire invoice distribution amount.
    Thanks

  • Account ID (HKTID) is not updating in MIRO after saving the Invoice

    Dear Gurus,
    While creating invoice in MIRO I have filled the House bank and Account ID fields in the payment tab. After saving the invoice the House bank is getting updated but  the field Account ID is emptied so this account ID is not transmitted to the accounting documents.
    Please share your ideas to get the Account ID.
    Thanks in Advance
    Krishna kumar. M

    Hi Mukthar,
    Thank you for your reply.
    Both House bank and Account ID fields are there in BSEG table and MIRO screen as well. For example I can create manual invoice in F-43 with House bank and Account ID and both are updated in BSEG table. But in MIRO I have problem that document is posting only with House Bank not the Account ID.
    In FBZP we have proper house bank configuration settings as well.
    Your input is highly appreciated.
    Thank you
    Krishna kumar.

  • After saving the invoice, excise values are disappearing in invoice

    Hi,
    While creating invoice, we have entered all the required conditions and clicked on update button to pick new conditions
    then all the invoice values are getting updated.
    when we save the invoice and open once again the excise values are disappearing.
    net value showing without duty.
    even in the printout the excise duty values are not coming.
    your inputs & suggestions will be appreciated.
    thanks
    Regards
    Suresh.

    This is due to wrong assignment of condition types.

  • My MacBook Air is not being listed under the My Products tab after adding the Apple Care Protection Plan

    I purchased my MacBook Air from US in December 2013, my company paid for it, so it got listed under their account earlier. So I asked them to remove it from there account and then I added it back to my profile in January 2014. Then it was listed under My Products tab in the My Support Profile page. Later I bought Apple Care Protection Plan for this MBA, and registered that plan with my MBA's serial number and soon after that, MBA vanished from My Products. I thought it might take some time for it to get listed back again after adding the protection plan, but it didn't appeared for quite a long time and so now I am opening this support ticket.
    Now whenever I try to add my MBA again by clicking Register New Product, I am getting "According to our records, this serial number is registered to another Apple ID. If you have more than one Apple ID, log in to My Support Profile with that Apple ID to see your other registered products. Not sure if you have another Apple ID?" How can I get my MBA back into my profile?

    AppleCare does not cover accidental damage, but try taking it to an Apple Store and see what they say!

  • UDF in documents lines that can be Change after adding the doc.

    Dear all
    How can i create a UDF in documents lines that can be change after adding the doc? He need to mark some of the lines to already audit or not audit and the date of the action.
    Kind Regards
    Margarida

    It also depends on what documents you are wanting to add these comments to. On documents such as the A/R Invoice/ Delivery, and A/P Invoice/ Goods Receipt PO you cannot change the UDFs on the line item after the document is added (regardless of whether the document is closed). Sales Orders/ Quotes and Purchase Orders line item UDFs can be changed as long as the line hasn't been closed (or partially received/delivered/invoiced).
    Hopefully that makes sense. I could give more of an explanation if I knew what documents you were wanting to add these line item comments to.

  • Getting an error while adding the user in Sharepoint foundation 2010 environment.

    Hi,
    I am having full control access to SharePoint site. Then i tried add user for that site.
    But i am getting following error while adding the user to the site.
    An unexpected error has occurred.
    Troubleshoot issues with microsoft SharePoint Foundation.
    Correlation ID:3035B777-1B7C-4463-B35E-06657B72C2E4
    Can you please help me anyone on this.
    Thanks,
    Ashok

    This could be any one of a number of things.  You need to lookup the Correlation ID in the ULS logs on the SharePoint server.  That should provide the additional information necessary to diagnose and solve the problem.  Here's a blog post
    on how to find the error.
    http://habaneroconsulting.com/Blog/Posts/Get_the_Real_SharePoint_Error_using_the_ULS_Logs.aspx#.UvEuffldWik 
    Paul Stork SharePoint Server MVP
    Principal Architect: Blue Chip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.

  • Even after adding the country code i can't seem to make any international calls.im not sure if this is relevant but apparently, the option dial assist is not to be found on my setting.pls direct me...thank you.and my phone moddle is 5s(A1457)gold

    even after adding the country code i can't seem to make any international calls.im not sure if this is relevant but apparently, the option dial assist is not to be found on my setting.pls direct me...thank you.and my phone moddle is 5s(A1457)gold  eddition.

    Hi, Thilina66.  You say you have entered the country code but still cannot make international calls.  I suppose you are adding the international access code before the country code.  This internaltional access code (011 in the US, 00 in Europe, etc.) can be substituted by adding a + sign before the country code.
    For example, to call a number in the UK from the US you have to dial:
    011 44 7540 267898
    or
    +44 7540 267898
    To call a number in the US from the UK you have to dial:
    00 1 212 456 1470
    or
    +1 212 456 1470
    Please check that the contact number in your address book is correctly written if you are dialing directly from the address book or that you enter the correct numbers in the keyboard if you are dialing from the keyboard.

  • Get plan number after calling IP01 using BDC

    Hi,
    I am using IP01 by BDC to create maintenance plan.
    Is there any mthode to get  plan number after the call instead of  reading the message table  within call statment.?
    Thanks.

    One possible way is find an implicit enhancement point and fill up the plan number to memory id and in your bdc call program import the same from memory id

  • Is there any other method so that I can contact Apple to get IMEI number ? since the phone was shyncronized several times in apple store / iCloud.

    Hello community members, my iPhone has been stolen and I tried to contact police, they are asking for IMEI number of the phone. Unfortunately I could not read the IMEI number on the box due to moisture wiped out most of the number on it. I sacanned it in and enhanced, I'm still unable to read out the number. Is there any other method so that I can contact Apple to get IMEI number ? since the phone was shyncronized several times in apple store / iCloud.

    If you backed up your iPhone in iTunes on your computer -
    Open iTunes - Edit - Preferences - Devices - See Device Backups in the Window.
    Hover mouse/curser on any backup. Read IMEI and Serial no. your of iPhone.

  • "Material  Invoice Cycle- field" in the Invoice tab of the Purchase Order?

    Hi,
    Does somebody has a clue on the field "Material  Invoice Cycle- field" in the Invoice tab of the Purchase Order?
    What are the functions, dependencies and the scenarion one can use this field.
    Regards

    Hi
    Here in Is-oil we have invoice cyles. Provisional invoice, Final invoice, interested invoice, settlement invoice etc..
    So in sales at first provisional invoice has been created than the final invoice based on the Provisional invoice.. and further invoices like  interest invoice & settlement invoice ..
    So here we are using 4 invoice cycle.. hence you have to define in the Spro-->industry solution -->oil & gas  > cross component application>maintain the invoice cycle numbers... 4
    And this data has to be used in Condition type
    Spro--> industry solution -->oil & gas  > cross component application> MM split invoice -->Enter the data in additional invoice .
    These is the function of Material invoice cycle field...
    Thanks and regards
    Raja

  • Curve 9380 gets warm/hot after configuring the email accounts

    Hello,
    I am facing this problem, need your help or the solutions.
    My Curve 9380 gets warm/hot after configuring the email accounts. It drains the battery in a hour. If I remove all the email accounts then its working normal.
    Are anyone facing such issue. Please help.
    Regards,
    Sameer

    i have not activated my email accounts even though my phone was getting the same problem that it gets warm and battery gets ruined quickly..plzz help me in that..

Maybe you are looking for

  • Message Mapping Error : "already dropped from buffer"

    Hi, today we have a new strange error in a simple message mapping File2IDoc thats results in SYSFAIL. Maybe a buffer or memory error? In short: +/ARTMAS05/IDOC/E1BPE1MARART[2]/DELN_DATE(suppressed field); root message: Index 2147483647 is already dro

  • Java thread that start executing everyday on given time

    Hello I need to write an java file using thread that can start executing everyday on given time say everyday 14:00. Can any one have any example..?

  • I lost my IPhone need your help with a question ty

    I just lost my iphone on Nov. 17th, 07 and i just wonder does iphone has Satellite positioning function, if it does can i use serial and IMEI number to find where it is or they are both not related, any suggestions will be great thank you for paying

  • HSM recommendations (from Adobe or FAXS community)?

    Never worked with an HSM before and looking for recommendations. We are looking to deploy FAXS license servers backed by networked HSM capability in multiple data centers. For performance, license servers and HSMs will be grouped within the same faci

  • What is my forms 6i version ?

    Hello, I would like to find out what is my forms 6i version on unix hp machine. What is the command ? Thanks