DI cannot add Previous Period Sales Order

Hi all,
Currently, I had a big problem. My client is running SAP B1 2004.2B PL 50 with DI API installed. They are running a very simple customize program to add Sales Order into SAP B1. The customize program simply read a text file (Tab delimiter) and in turn create a Sales Order. It was working fine when their SAP B1 2004.2B is in Patch Level 15. However, after the upgrade to Patch Level 50, the customize program prompt error while adding Sales Order. Error Message: "Date deviates from permissible range [ORDR.DocDate]"
Anyone have any idea why this occurs? My client cannot downgrade back to lower patch as PL 50 solve the bug on Closing Production Order. Furthermore, it is a very simple coding, just that this PL 50 do not allow posting of eariler documents.
Anyone can help?
Below is the coding:
Private Sub TESTING()
    Dim vcmp As SAPbobsCOM.Company
    Set vcmp = New SAPbobsCOM.Company
    Dim err As Long
    Dim errmsg As String
    With vcmp
        .CompanyDB = "TestingDB"
        .Server = "Server"
        .DbUserName = "sa"
        .DbPassword = "sa"
        .UserName = "manager"
        .Password = "manager"
        .LicenseServer = "Server"
        err = .Connect
        If err <> 0 Then
            Call .GetLastError(err, errmsg)
            MsgBox (errmsg)
        Else
            Dim oSO As SAPbobsCOM.Documents
            Set oSO = .GetBusinessObject(oOrders)
            oSO.CardCode = "CH0002"
            oSO.DocDate = "17/10/2006"
            oSO.DocDueDate = "17/10/2006"
            oSO.DocType = dDocument_Service
            oSO.Lines.AccountCode = "_SYS00000000377"
            oSO.Lines.Price = 100
            err = oSO.Add
            If err <> 0 Then
                Call vcmp.GetLastError(err, errmsg)
                MsgBox (errmsg)
            Else
                MsgBox "Successful"
                vcmp.Disconnect
            End If
        End If
    End With
End Sub

Hi there,
Answer to your questions:
1) The period I wanted to post to is set to current/default period.
2) All the period is active and not locked.
3) The document date entered is within the period I set to current/default period. (Meaning I want to post a Sales Order in period 2006/08 and the current period had set default to 2006/08, and the document date is in 01/08/2006 (dd/mm/yyyy), but the system date now is 06/11/2006.)
Now my question is even though I did not set my posting period to the period that I want to post the Sales Order. As long as the period is active and is not locked, I should be able to use DI to post the Sales Order right? When my SAP B1 2004.2B is in PL 25, I can do it without any problem. After I upgraded to PL50 and even PL55, I cannot even post it.
Lastly, when using DI I shouldn't be bothered about setting the posting period to the correct posting period as DI do not have this function and the customize program is not run within SAP B1.
Anyone can help?

Similar Messages

  • How we add & grandtotal of sales order report in alv

    hi guru how we add & grandtotal of sales order report in alv
    regards
    subhasis

    hi subhasis,
    since u want the grand total in ALV use the following code...
    clear gs_fieldcat.
    gs_fieldcat-fieldname = field.
    gs_fieldcat-tabname = DB table
    gs_fieldcat-seltext_m = text.
    gs_fieldcat-do_sum = 'X'
    gs_fieldcat-datatype = data type (Curr or Quant)
    gs_fieldcat-ref_fieldname = reference field name
    gs_fieldcat-ref_tabname  = reference table name
    append gs_fieldcat to gt_fieldcat.
    hope this will work...
    please reward points in case usefull
    regards,
    prashant

  • Add buttons in Sales Order's Addtional Data B Tab

    Hi All,
    I want to add buttons in Sales Order's Additional Data B tab. I had try to draw a creen in painter and push a button in the screen, also assign a fcode to it.
    I had try to test the button, and I find that, it could work, but after it's action, a error msg give out and said there are no this request function.
    I think it may cause by the fcode passing between screen. However, I don't know how to fix it. Any sample coding could for me reference?
    Thanks!

    Hi,
    yes u can add the button  with Fcode on Additional data B screen.But u have write the code in the PAI of the screen,inorder to do something,for that u need to have accesskey also...i hope while adding fields to Additional data B screen u ahve used teh accessskey for adding..zfields
    Regards,
    Nagaraj

  • Add items to sales order by "Item details: configuration".

    Hi Experts.
    I need to add item to sales order but not in normal way but like this:
    1. Mark higher level item
    2. Click: Item details configuration
    3. Click: Result
    4. Click: Insert
    5. choose material.
    Do you know any FM for this?

    Hi
    If you didn't get anything then why don't you try with creating a recording in SM35 and call that recording. We did somehow similar thing. We couldn't find any function module and my ABAPER asked me to create recording in SM35 and he converted that into some BAPI or may be he called directly that recording. If you are ABAPER then try this and if you are functional like me then talk to your ABAPER.
    Thank$

  • Want to add number of sales orders in a COPA report or form

    Hi All
    I created a COPA report that has two columns: sales from sales orders & sales from billing documents. Now I want to add columns which shows number of sales orders that make up sales. Can any one explain me , how can we acheive this  With a user exit, .
    thanks in advance for looking into this

    Hi Steve,
    Walter is very right in saying so.
    In SD module itself you can get some reports like this.
    Even in COPA you will get these kind reports.  But if your company is a big company and have lots of sales orders,
    Then you will have serious problems with System performance issue. 
    When you define that sale order is a segment level character, then system will ear up the resources and take very long time in executing the reports.
    But for some reason this requirement is a must case, then it is very simple
    you define Sale order in either form or report,
    then give the variable parameters like Co.Code, Period etc. you will get all the sales orders details for the selected period
    But think about not going for it before you make up your mind
    Best Regards
    Surya

  • Error: Can't Add a New Sales Order: -10  Exchange rate not updated,

    Hi,
    I'm trying to add several Sales Orders contained in a XML document, whose root element corresponds to the Sales Person created that XML. Anyway, after I fill a Sales Order Document Object with the info in the XML and try to add it the following error appears: "Exchange rate not updated  [RDR1.U_Desc4][line: 2] , 'USD'" Which is strange because this company handles most of its transactions in MXP Currency. I will post the piece of Code that fills the object hoping it helps:
    For Each xndSalesOrder In xmlSalesOrder.Item("SalesMan").ChildNodes
                    oSalesOrder = Me.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
                    oSalesOrder.DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Items
                    With xndSalesOrder.Item("HEADER")
                        oSalesOrder.CardCode = .Item("Deudor").InnerText
                        oSalesOrder.DocDate = DateTime.Parse(.Item("FechaCont").InnerText, Nothing)
                        oSalesOrder.DocDueDate = DateTime.Parse(.Item("FechaEnt").InnerText, Nothing)
                        oSalesOrder.Comments = .Item("Observaciones").InnerText
                        oSalesOrder.DocRate = 11
                        oSalesOrder.DocCurrency = "MXP"
                        'oSalesOrder.ContactPersonCode = .Item("Contacto").InnerText
                        'User Fields
                        oSalesOrder.UserFields.Fields.Item("U_RefOV").Value = _
                            xndSalesOrder.Attributes.Item(0).InnerText
                        oSalesOrder.UserFields.Fields.Item("U_Referencia2").Value = .Item("Referencia").InnerText
                        oSalesOrder.UserFields.Fields.Item("U_FechaReferencia").Value = _
                            DateTime.Parse(.Item("FechaReferencia").InnerText, Nothing)
                    End With
                    With xndSalesOrder.Item("LINEAS")
                        For Each xndLinea In .ChildNodes
                            If intContLineas >= 1 Then                             oSalesOrder.Lines.Add()
                            End If
                            oSalesOrder.Lines.ItemCode = xndLinea.Item("Articulo").InnerText
                            oSalesOrder.Lines.Quantity = CDbl(xndLinea.Item("Cantidad").InnerText)
                            oSalesOrder.Lines.Price = CDbl(xndLinea.Item("Precio").InnerText)
                            oSalesOrder.Lines.TaxCode = xndLinea.Item("Impuesto").InnerText
                            oSalesOrder.Lines.DiscountPercent = CDbl(xndLinea.Item("DescuentoTotal").InnerText)
                            oSalesOrder.Lines.SalesPersonCode = xmlSalesOrder.Item("SalesMan").Attributes.Item(0).InnerText
                            oSalesOrder.Lines.Currency = "MXP"
                            'User Fields
                            oSalesOrder.Lines.UserFields.Fields.Item("U_Promocion").Value = _
                                xndLinea.Item("AplicaProm").InnerText 'Valores posibles: Si, No
                            oSalesOrder.Lines.UserFields.Fields.Item("U_Desc1").Value = _
                                CInt(xndLinea.Item("Descuento1").InnerText)
                            oSalesOrder.Lines.UserFields.Fields.Item("U_Desc2").Value = _
                                CInt(xndLinea.Item("Descuento2").InnerText)
                            oSalesOrder.Lines.UserFields.Fields.Item("U_Desc3").Value = _
                                CInt(xndLinea.Item("Descuento3").InnerText)
                            'If xndLinea.Item("AplicaProm").InnerText = "Si" Then
                            oSalesOrder.Lines.UserFields.Fields.Item("U_Desc4").Value = _
                                CInt(xndLinea.Item("Descuento4").InnerText) 'This is the UDF that's giving me problems!!!
                            'End If
                            intContLineas += 1
                        Next
                       If oSalesOrder.Add() <> 0 Then
                            Me.Company.GetLastError(intErrorAdd, sErrMsgAdd)
                            If (0 <> intErrorAdd) Then
                                FillLog("Sales Order Error: " & CStr(intErrorAdd) & "," & sErrMsgAdd)
                            End If
                            xmlLogSalesOrder.Item
                        End If
                    End With
                Next
    If you look at the code I've even tried the solution of hardcoding the DocRate and the Currency as seen in a similar post about the DTW.
    Sorry if code is in Spanglish, its quite late around here. I hope you can help me because it's kind of an urgent matter and I can't seem to find a solution for it.
    Other useful data: SAP BO 2005 Patch 4.
    Thanks in advance...
    Alfredo Gargari

    Hi Alfredo,
    Have you tried to add the same salesorder by hand, I think you wil first get a form with exchange rates.
    I think you should add a check to your program to check for an update currency rate (the sbobob function GetCurrencyRate does this for you).
    GetCurrencyRate MethodDescription
    Returns a Recordset object that contains the currency rate for a specified date and currency code.
    See Currency Bobs sample.
    Syntax
    Public Function GetCurrencyRate( _
       ByVal Currency As String, _
       ByVal Date As Date _
    ) As Recordset
    Parameters
    Currency
    Specifies the currency code.
    Date
    Specifies the date for the currency exchange rate.
    Return Type
    A Recordset object that contains one field named CurrencyRate that holds the rate value.
    SAP Business One returns 0 if the system cannot find the exchange rate.
    Regards,
    Ad

  • Variances for the Previous Period- Production Order Variances

    Dear All
    I am not able to settle the variances of Previous Period in Ko88. 
    The following steps I have done for the settling the variances
    1. KKS2- Production Order
    2. Ko88- Settlement of Variances
    If i settle the variances production order variances it is increase the stock and in the increase in the profit and loss account
    I need a suggestion there should not be any impact on the either in the profit and loss account and stock
    Please advise me
    Regards
    Ramesh

    Dear Vimal
    I would like to explain further more on this area.
    1. For V Material Item - When there is no stock it will be posted to Profit and Loss account
    2. For V Material Item- When there is a stock it will be posted to Balance sheet acccount- My question whether it can be posted to Profit and Loss account.  When there is a stock - What is the procedure to be followed.
    In further to that Settlement can be done only if the order is completed. settlement cannot be done if the order is not completed.
    I need to understand
    1. Whether V Material item available stock can be posted to Profit and Loss account.
    2. Whether this is based on Order completion.
    Thanks for your reply.
    Regards
    Ramesh

  • Automatically add material to sales order/delivery when a mat. is ordered

    Hi,
    When an order is created for a certain material I need another material to be added to the order automatically.
    I have tried using material determination for this but it seems that only the subitem is a deliverable item, the "material entered" cannot be picked. I am unable to use a Sales BOM because that would require the creation of a new material.
    Any advice appreciated, points will be rewarded.
    Tom

    Hi Thomas,
                    You try with Cross selling process you may get your requirement.
    1.First you do the configuration for the cross selling.Menupath for corss selling configuration is
    IMG>Sales and distribution>Basic functions>Cross selling>Define detemination for cross selling,Maintain Customer/Document procedure for cross selling and Define and assign cross selling profile.
    Here you select field Material from field catelog, you put it in the access sequence then assign the access sequence to your cross selling condition type.
    2. You maintain condition record for that cross selling type through the transaction VB41.
    Here system will give key combination with material there you enter your base material in the detailed screen you enter tail material then save the record.
    3.Now you create sales order with sales area which you maintained Cross selling profile,you enter the base material you will get tail material automatically.
    I hope it will solve you problem
    Thanks,
    Murali.

  • Standard COGS cannot be Transferred from Sales Order to Billing Document

    I did a test in current client with the following steps:
    Create Sales Order for Configurable Material -> Execute Sales Order Costing Run, marked and Saved the result via CK51 -> Create Prodcution Order for such Sales Order -> Confirm Prod Order -> Conduct GR per the Prod Order -> Conduct Goods Delivery for the Sales Order-> Create Billing.
    (There is not any costing value during the whole process)
    There are many Value Fields in the CO-PA document regarding to this billing, the value of standard COGS items(including Material Cost, Period Machine, Variable Labor etc) are also included and their value are expected to be transferred from Sales Order. However,  in my testing, those COGS value failed to be transferred to Billing document. I am not sure whether there is any config related. (KEPC hs already been done in such case). Would any expert can help on that?

    en, It is solved now. Untick "Transfer aux. CC Split" in KE40, then the value can transported to billing.
    Edited by: Ying Zhu on Nov 18, 2008 1:10 PM

  • Add fields to Sales Order Mass Change  selection screen

    Hi,
    Li & Fung customer customer needs to include following fields in the selection screen (Header Level)  and the display output in Sales Order Mass Change (/AFS/MDC).
    -     VBKD-BSTKD_E
    -     VBKD-KDGRP     
    According to the SAP documentation we have done the configuration (Add details of custom fields) and implemented the BADI u2018/AFS/MDC_SELECT_CUSTOM_FIELDSu2019 with following methods.
    -     /AFS/IF_EX_MDC_SEL_CUSTOM_FLDS~SELECT_HEADER
    -     /AFS/IF_EX_MDC_SEL_CUSTOM_FLDS~SELECT_CUSTOM_DATA
    Data selection part works perfectly, but if we do not enter any values in any custom field in  the selection screen, then the BADI is not working. The output displays the columns without any value for the custom field. However, for VBKD-KDGRP is added as a custom field in the selection, but it already exists in the output display by standard, and it does display the value.
    The system should display all custom fields values even if we did not input them as part of the selection screen
    I would like to know if we have missed something, or is it the expected behavior of this enhancement, which seems to be inconsistent. Also please advise if there are any other methods available to solve this issue.
    thanks very Much.
    Nilmini

    Hi Nilmini,
    In My case, I have added custom fields to MDC change screen by using /AFS/MDC_CHANGE_CUSTOM_FIELDS but its not appearing in Grid list display. Would like to appreciate if you can Help me to achieve this.
    Regards,
    Jelli

  • Add field to Sales Order line item

    I need to add a field to Sales Order line item, can you tell me a user exit??

    Hi,
    You can a new field in the additional data B tab of the sales order line item..
    Check the program SAPMV45A and screen number 8459
    Thanks,
    Naren

  • ADD address in sales order

    Hi Experts ,
    In sales order in partner tab address displayed for  sold to party is standard address .but 
    I want to add other then standard address of sold to party in place of standard address using function module crm_order_maintain .
    Plz guide me in this regard .

    Hi,
    First find out in which context node u want to add new field.
    for Sales_Order
    Component  BT115H_SLSO
    View            Details
    Suppose u want to add field in BTADMINH context node , then through EEWB u can add ur required field
    For EEWB , create extension--choose EEWB Bus Object Sales_Transaction and Extension Type CUSTOMER_H.
    U can change Lable from View Configuration . Choose ur view (BT115H_SLSO/Details ) > goto Configuration in change mode->choose field property and change lable.
    Regards
    Gaurav

  • Runtime error when I add materials to Sales order

    Hi All,
    The user attempted to add materials to Order 4002262638.    When adding 05302 and 05804 to the sales order, SAP
    went to the hourglass and then created the Timed out Runtime Error message.
    The Error at SAP Standard program LZVA_PRO_ALLOF01 at statement,
    When I press enter after giving materials its getting timed out due to long execution time. Looks the select query is taking lot of execution time.
    SELECT DISTINCT vbap~vbeln
             vbap~posnr
             vbap~kwmeng
        FROM vbap INNER JOIN vbak ON vbapvbeln = vbakvbeln
                  INNER JOIN vbep ON vbapvbeln = vbepvbeln
                                 AND vbapposnr = vbepposnr
        INTO TABLE lt_vbap
        WHERE vbak~kunnr  IN r_hienr  AND
              vbap~prodh  IN r_prdha  AND
              vbap~abgru  EQ space    AND
              vbep~wadat  LE gv_datbi AND
              vbep~wadat  GE gv_datab AND
              vbep~edatu  NE '00000000' AND
            vbep~bmeng GT 0 AND
              vbap~kwmeng GT 0.
    Please let me know your ideas.
    Thanks in advance,
    Rama

    Hi,
    Check if some user exits have been written in the includes attached to main porogram in sales order.
    May be the exits arent properly written or activated
    Regards,
    Dhananjay

  • Add Column in Sales Order

    Hello,
    Is it possible to add an extra column with other columns in the sales Order Form ?
    The column must be other than the existing columns in the SAP form settings.
    Rgds
    Subrata

    Hi,
    You should add it in Marketing Documents-> rows
    Regards
    Ad

  • Add mode in Sales order.

    Hi,
    When ever a Sales order is open from Sales A/R we are getting in add mode instead of find mode.
    If u like to look into last record in sales order we are getting an error "changes will cause data to be deleted"
    please provide ur suggestions.
    Vinod.

    Most likely you have a formatted search on the window that is set to refresh regulary... Thats a common problem

Maybe you are looking for