Problema in Add Distribution Rule

Hi!
i have a function like tihs:
Public Function AddDistributionRule(ByVal ProfitCenters(,) As String) As String
        Dim _return As String = "1"
        Dim oCmpSrv As SAPbobsCOM.CompanyService = oCompany.GetCompanyService()
        Dim oDLservice As SAPbobsCOM.DistributionRulesService = oCmpSrv.GetBusinessService(SAPbobsCOM.ServiceTypes.DistributionRulesService)
        Dim oDL As SAPbobsCOM.DistributionRule
        ' Add distribution rule
        oDL = oDLservice.GetDataInterface(SAPbobsCOM.DistributionRulesServiceDataInterfaces.drsDistributionRule)
        oDL.FactorCode = "prova1"
        oDL.FactorDescription = "Desc 1"
        oDL.InWhichDimension = 1
        oDL.TotalFactor = ProfitCenters(0, 1)
        oDL.DistributionRuleLines.Add()
        oDL.DistributionRuleLines.Item(0).CenterCode = ProfitCenters(0, 0)
        oDL.DistributionRuleLines.Item(0).TotalInCenter = ProfitCenters(0, 1)
        Try
            oDLservice.AddDistributionRule(oDL)
        Catch ex As Exception
            oLog.Errore(ex.Message, ex)
            _return = ""
        End Try
        Return _return
    End Function
The AddDistributionRule method gets the following error: Invalid date input
I can not understand the cause of this error ... can you help?
Thanks!

Hello
You has to define the Effective date from at lines
DL.DistributionRuleLines.Item(0). Effectivefrom = 'ENTER DATE HERE
If you do not know the date, you can enter as early as you can (first date of first period - you can select from OFPR table)
Regards
János

Similar Messages

  • Problem when update distribution rules by "UpdateDistributionRule" method

    Dear,
    I want to use the "UpdateDistributionRule" method for updating (add new line) the existing distribution rules. I have tried the code from SDK help, but it does not work.
    Here is the code from SDK help as below:
    oCmpSrv = oCompany.GetCompanyService()
    Dim oDLservice As SAPbobsCOM.DistributionRulesService = oCmpSrv.GetBusinessService(SAPbobsCOM.ServiceTypes.DistributionRulesService)
    Dim oDL As SAPbobsCOM.DistributionRule
    Dim oDLParams As SAPbobsCOM.IDistributionRuleParams
    ' Get distribution rule
    oDLParams = oDLservice.GetDataInterface(SAPbobsCOM.DistributionRulesServiceDataInterfaces.drsDistributionRuleParams)
    oDLParams.FactorCode = "1"
    Try
        oDL = oDLservice.GetDistributionRule(oDLParams)
    Catch ex As Exception
        MsgBox(ex.Message)
    End Try
    ' Update distribution rule
    oDL = oDLservice.GetDataInterface(SAPbobsCOM.DistributionRulesServiceDataInterfaces.drsDistributionRule)
    oDL.FactorCode = "1"
    oDL.FactorDescription = "Desc 1"
    oDL.InWhichDimension = 1
    oDL.TotalFactor = 40
    oDL.DistributionRuleLines.Add()
    oDL.DistributionRuleLines.Item(0).CenterCode = "1"
    oDL.DistributionRuleLines.Item(0).TotalInCenter = "10"
    oDL.DistributionRuleLines.Add()
    oDL.DistributionRuleLines.Item(1).CenterCode = "2"
    oDL.DistributionRuleLines.Item(1).TotalInCenter = "30"
    Try
        oDLservice.UpdateDistributionRule(oDL)
    Catch ex As Exception
        MsgBox(ex.Message)
    End Try
    Regards,
    On

    HI,
    Tried, but not work.
    It shows - Invalid row number
    Also, I try another like the following, but not work.
    It shows - Enter valid amount in "Total"
    Dim oCmpSrv As SAPbobsCOM.CompanyService
            oCmpSrv = oCompany.GetCompanyService()
            Dim oDLservice As SAPbobsCOM.DistributionRulesService = oCmpSrv.GetBusinessService(SAPbobsCOM.ServiceTypes.DistributionRulesService)
            Dim oDL As SAPbobsCOM.DistributionRule
            Dim oDLParams As SAPbobsCOM.IDistributionRuleParams
            ' Get distribution rule
            oDLParams = oDLservice.GetDataInterface(SAPbobsCOM.DistributionRulesServiceDataInterfaces.drsDistributionRuleParams)
            oDLParams.FactorCode = "DR001"
            Try
                oDL = oDLservice.GetDistributionRule(oDLParams)
                ' Update distribution rule
                oDL.FactorCode = "DR001"
                oDL.FactorDescription = "Desc 1"
                oDL.InWhichDimension = 1
                oDL.TotalFactor = 60
                oDL.DistributionRuleLines.Item(0).CenterCode = "036" -> exist line
                oDL.DistributionRuleLines.Item(0).TotalInCenter = "20"
                oDL.DistributionRuleLines.Item(1).CenterCode = "049" -> exist line
                oDL.DistributionRuleLines.Item(1).TotalInCenter = "30"
                oDL.DistributionRuleLines.Add()
                oDL.DistributionRuleLines.Item(2).CenterCode = "090" -> new line
                oDL.DistributionRuleLines.Item(2).TotalInCenter = "10"
                Try
                    oDLservice.UpdateDistributionRule(oDL)
                Catch ex As Exception
                    MsgBox(ex.Message)
                End Try
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
    Regards,
    On

  • How to add the distribution rule at AR Invoice in SAP 2007B PL10

    Hi All,
           I want to add the default distribution rules of each item at marketing documents via DI API when item's warehouse changed? Now, I'm using the SAP 2007B PL 10.
           Any ideas?
    Thanks and regards,
    Lei

    Hi,
                 When add the Itemcode, default warehouse and costing codes (Profit Center) are automatically asign by SAP.
    When change the warehouse for this Itemcode, the costing codes(Profit Center) are disappear. I don't want to disappear the costing codes, that's why I try to resign the default costing codes when the warehouse change.
                At SAP 2005, easily  access the screen matrix in the marketing document and add the required values in each costing codes columns. But SAP 2007, all costing codes are combined in 1 col and those have the other screen.
              Do you have any idea to control the costing codes?
    Thanks and regards,
    Lei Nandar Myint

  • AIAB Distribution Rule for Settlement Error, "Asset cannot settle to itself"

    Hello Everyone,
    I have a customer who is getting the "asset cannot settle to itself" error when trying to set up a distribution rule to settle the remaining items of a Line Item Managed AUC to multiple Assets.  The Asset numbers and AUC number do NOT match.  Here are the steps that have been followed.
    Created an Internal Order, #2000####. (1998)
    Created the AuC asset. #600####(2011)
    Created Settlement Rule (Sender – Internal Order, Receiver - AUC) (2011
    Settle Internal Order to AUC.
    Create Assets. (2014). #900###1 - #900##99 etc.
    Create Settlement Rule (Sender – AUC, Receiver – Multiple Assets)  This is where my customer gets the error. 
    They were able to settle other items from this AuC to Assets last October.  It seems very strange to me that the Internal Order was created in 1998 and the AUC was created in 2011 but as I said, this was working at least last October and possibly in March of this year. 
    Thanks for you help.
    Rick 

    Hello Stacy, 
     Sorry I didn't get back to you sooner but I just had a major implementation go live on the 2nd so I've been rather busy.  I opened a ticket with SAP on this and this is what was found.   
    Joachim from SAP Support explained that the AUC had been settled to itself last year, that is the posting the program was throwing the error on.  My assumption is that we were able to settle AUC's to themselves prior to our March upgrade.  This explains the problem and we have a resolution.  We are transferring AUCs that this has happened with to a new AUC and then settling the new AUC as usual.  
    I believe SAP fixed a bug that had previously allowed AUC's to settle to themselves in one of the updates but because this AUC had a record from the past where it settled to itself the program was validating old line items and that is why it throws the error.   
    Ramnik's suggestion was another option but we didn't want to change the message to a warning because we didn't want anyone to settle an asset to itself.
    Hope this helps.
    Thanks,
    Rick

  • Distribution Rule in Incoming Payment of Invoice

    Hello Experts,
    I'm running SAP B1 8.81 PL05 and I have the following problem.
    I issue an A/R Invoice + Payment  and I have in the "Payment Means" a discount. The final result is an issue of two different journal entries - one for the invoice and another for the payment discount.
    The problem is that I want to have a Distribution Rule associated with the Incoming Payment discount and I can't find a way to associate it - the solution of associating a distribution rule to the account is not possible because the Distribution Rule changes according to the sales employee.
    Help would be very appreciated.

    Hi Thomas,
    From the SAP help, you can know what is the use of this rule.
    Defining Distribution Rules
    Use
    For cost accounting, this setting is mandatory.
    Use this procedure to define distribution rules to distribute amounts between different profit centers.
    Prerequisites
    You have defined profit centers.
    Note: If you delete a distribution rule for one profit center (100%) this does not automatically delete the profit center.
    You can also look up this key word to find more info. For examle, you can find SAP note 1236348 to see if it fits you.
    Thanks,
    Gordon

  • Different Distribution Rule on Outgoing Payment cannot be split on Journal

    Hi All,
    I created an Outgoing Payment for Vendor for several invoices. Each invoice was assigned to different Distribution Rule. But the journal created summarized all the invoices (only one row for debit AP), and no distribution rule was assigned. Is this a bug? Anybody ever experienced the same problem?
    Thanks in advance for your help.
    Regards,
    Marini

    Hi Gordon,
    I am working with version 2007 A PL 42.
    I found that Distribution Rule on Outgoing Payment is for Discount purpose. When we fill Discount then it will be posted to Discount Account with Distribution Rule defined.
    Thanks,
    Marini

  • Cost Centers and distribution rules

    I need to allocate costs to profit centers and would like to have the costs be allocated first to the department cost center then distributed to product profit center by %.
    Example:  An invoice is first allocated to the sales department, then the distribution rule will allocate the cost between 4 product lines (33 % chemical A, 33 % chemical b, 17 % chemical c and 17 % chemical d).
    How would I setup the profit centers, cost centers and distribution rule to accomplish the above task.
    Thank you,
    Wayne

    Hi Fred,
    I assume you using 8.81?
    1. Administration - General Settings - Cost Accounting : Tick "Use Multidimensions" option
    2. Financial - Cost Accounting - Dimensions : Tick "Dimension 1" and "Dimension 2".
    Give proper description to each dimension, in your case maybe "Department" to Dimension 1 and "Product" to Dimension 2
    3. Financial - Cost Accounting - Cost Centers : Create your intended cost centre, "Sales" cost centre with dimension "Department", "Chemical A" to "Chemical D" with dimension "Product"
    4. Financial - Cost Accounting - Distribution Rules :
    As for your intention to allocate the invoice to Sales Department, since you want to allocate it 100% to Sales Department, you don't need to create a distribution rules, since B1 will automatically create a distribution rule with 100% allocation for each cost centre you created.
    As for your production cost allocation, create a distribution rule with your code "DR-P01" as an example, choose dimension "Product", set the Total with "100". In the detail section, choose each cost centre (Chemical A to D), enter respective value and click "Add" button.

  • Selection of Distribution Rule in Incoming and Outgoing Payment

    There is an option of selecting the distribution rule in Incoming and Outgoing Payment having transaction of Account type but the requirement is of having the selection of distribution rule having transaction of Customer and Vendor (Invoice wise and Payment on Account)

    What is the purpose for distribution rules in Outstanding invoice list in incoming payment? I try to attach the analysis there and post incoming payment but it will not appear in Journal entries which defeat the main purpose.
    The problem face by customer is that they had many outlets and finance department in HQ needs to monitor daily collection from each outlets.
    The desired outcome by customer is:
    Dr Bank  [profit center=Outlet A]   XXX
    Cr     Customer                                   XXX
    Eventually print out reports in XLR as
                                     Outlet A     Outlet B    Outlet C
    Bank                          XXX            XXX          XXX
    Regards
    Thomas
    Edited by: Rui Pereira on Dec 4, 2008 2:15 PM

  • HOW TO ADD BUSINESS RULES

    HI EVERY ONE,
      I HAVE A REQUIREMENT WORKING ON MM , I HAVE SOME BUSINESS RULES IN FUNCTIONAL DESIGN DOCUMENT AND I NEED TO WRITE THE TECH DESIGN . MY QUESTION IS HOW TO ADD BUSINESS RULES IN TECH SPEC. EXAMPLE I HAVE FINAL DUE DATE AS BUSINESS RULE i.e,
    Final Due Date = Baseline Date + Maximum Day Term
    If Clearing Date is = Final Due Date = Invoice is Paid-On Time
    If Clearing Date is < Final Due Date = Invoice is Paid Early.
    If Clearing Date is > Final Due Date = Invoice is Paid Late
       I have the data available for Final Due date from R3 .
    So after creating the Info Object( characteristic), where can I add this formula for that Z INFO OBJECT ?  I have total of 5 business rules like this in my funtional doc
    Help will be appreciated . Points will be assigned if my problem solved...
    thanks

    Hi Harish,
    With the assumptions:
    1. You are using a BI 2004s system
    2. The fields Baseline Date, Clearing Date & Maximum Day Term are being sourced from R/3
    The rules can be coded into the End Routine in the Transformation.
    If you are using a BW 3.x system, this logic can be coded in the Start Routine at the Transfer Rules or the Start Routine at the Update Rules.
    Hope this helps.
    Regards,
    Shrikant

  • Profit Centres and Distribution Rules

    Hi, Is there someone who can help me about a problem with cost accounting?
    I've set profit centres, distribution rules (created and linked to profit centres), I've linked accounts to distribution rules so the "profit centre report" shows all the expenses related to each PC/DR. I also can see the table with all the parameters I set. My question is: how can I check (or is it possible to check) if a specific cost (account) is more than the limit I set in the distribution rules? In other terms: If I set 10.000 EUR on DR called "training expenses" with account linked "040001" and then I charge this account with 20.000 EUR; is it possible to have a notification or something in the "profit centre report" or in the "table of PC and DR" who tells: "ehy man, you spent too much!!!" (or at least the possibility to have DR values in the PC report?).
    Thanks a lot in advance and sorry about the length of my post.

    No but you can use the Budget features of B1 to do something similar. If you turn on Budgeting from the System Initialization>General Settings>Budget   You can warn on devations from Budget or block devations from budget, on PO, GRPO and JEs
    dan

  • Add Routing Rule

    how to create new routing table?
    how to add routing rule to route table?

    Hi!
    I supose your network configuration is OK.
    I have some problems in order to configure mine under Solaris 10. But trying to change this, I found something that can help you.
    In a terminal window, type "man route". I could add a new one, but, because I am not able to find how to change the IP gateway, it returns me an error.
    I hope this can help you
    Zenaida

  • Distribution Rules in Journal Entries

    Currently, cost centres and distributions rules only apply to sales and expenditure type GL accounts.  Our client would like this to be extended to all types of GL accounts so as to include balance sheet accounts. 
    The reason for this is the client uses a job costing add on with SAP Business One.  The job costing module works with cost centres which translate into cost centres distribution rules in SAP.  The client wants to track these cost centres throughout the entire system, and especially the work in progress account which is a balance sheet account.
    Is there any plans for extending the cost centre distribution rules functionality to include balance sheet postings as well as profit and loss postings to allow for full reporting?
    Thanks,

    Hi,
    You may check and post it here: https://cw.sdn.sap.com/cw/community/ideas/sme/b1
    Thanks,
    Gordon

  • Distribution rules for Settlement Profile

    Hi
    I have setup a PM Orders which collect all the maintenance and running cost of vehicles (equipments).  I have assigned settlement Profile "Internal Order" with settlement rule "Mandatory for release".
    Now when I click settlement rule button in work order, there are two distribution rules PER and FUL both 100% and to same cost centre (which belongs to equipment).
    Is this normal to have two distribution rules? will it cause any issues? where can I go to setup distribution rule to just one e.g FUL 100 (just one line), if I have to.
    Thanks in Advance.

    hi..
    1. This is SAto creat two dis rule by default.
    2. This will not creat any problem in settlement.
    Basic concept is :
         A)  Maintenance Order settlement rule having 2 lines that is Per & Ful. Peroidic Settlement- in this settlement rule system settle whatever cost occurs upto today & suppose in future if you want to charge some more cost on the same Maint. Order then system will accept it. And when ful or Final settlement runs the rest of the cost will settle to the cost receiver.
         B) You need not to delete any line whether this is PER or FUL.Its depends upon the settlement job which is done manually or schedule batch job. Suppose you has created schedule batch job for PER and FUL both. And the schedule frequency of PER is weekly and schedule frequency of FUL is monthly.
    I think this will give you some light on this issue.
    kkumar

  • Creation of Distribution rule(Settlement rule) in production order

    Hello SAP GURUS,
        I have one good query for you guys.When we create production order,by default it takes settlement rule (settle the cost of production order to material even that 100% settlement),and its because we have given the distribution rule (Default rule) in Order type dependent parameters.But in one of my friend system when i was creating production order manually it was not taking settlement rule by default and when i was going to save the order it was saying that settlement rule is not defined.I checked in order type that settlement profile was defined their.Even i checked in order type dependent parameter, distribution rule(default rule)  was their as material 100% settlement,defined over their.
      could you guys help in understanding this problem that where we have to define that system should create settlement rule by default(Settlement to material and even that 100% settlement).

    Hi..
    please try this....Goto KSR2_VBP.
    THere are two strategies.. 01 and 02.
    01 for manual creation of settlement rules
    02 for auto creation..
    first check whether 01 and 02 are in your plant.
    Sales and distrib....basic functions......auto gen. of settlement rules.......
    here you ll find two activities.
    (1)maintaining the settlement strategies and
    (2)activating one among them.
    If you activate 02, your problem will be solved..
    Also check this..
    http://help.sap.com/erp2005_ehp_03/helpdata/EN/a9/ab777d414111d182b10000e829fbfe/frameset.htm
    The settlement profile is to be defined for thee particular Order Type to generate automatically.
    Define Production Order Type in OPJH
    Under Cost controlling check the settlement profile .
    If not create the same in OPJH.
    Settlement Profile: Create settlement profile - SPRO > Controlling > Product Cost Controlling > Product cost by Order > Period End Closing > Settlement > Create Settlement Profile
    Enter Settlement profile from OPJH or Choose one for production order
    and configure Settlement profile. Indicators
    with wishes
    karthick.

  • Delete Distribution Rules For AUC

    Hi,
    I am wroking on one problem address to me. User haas created 999 distribution rule group for AUC settlement...and getting error message KD803.... Maximum distribution rule group reached.(T code AIAB).. we have implemented note 720619 and 483600 to delete unused distribution rule group.... but I am still not able to delete the same....as I found in programme (Z_SAP_SRULE_DEl_DISTR_GROUPS) it is not supporting assets rule group....
    can you please suggest some other way how to delete Dist. rule group.....
    Regards,

    Hello
    If any un used rules are there then only the said programme deleted the rule, if 999 rules are used then it is better to look for other options   like transfer the values to another Internal order
    Thanks
    Kameshwar Rao

Maybe you are looking for

  • Lines not appearing in SVG Line Graph

    Hi , I have created a chart region which is of tyoe SVG ( Line) . My issue is that for some cases I can only see the Marker Style at the correct position but I cannot see a line joining the dots. What could I be doign wrong here ? Appreciate any resp

  • Configuring one LDAP domain with two OU (one RO, another RW)

    Hi Team, My client is implementing NW 7.0 Enterprise Portal on SP14, AIX 5.3 & Oracle 10.2.0.4. We're using MS-ADS LDAP as an UME data source. The client wishes to configure UME for one single ADS LDAP (domain) with two OU (NOT domains) such that:   

  • CPU 100% alert from Norton Internet Security

    All I was doing was synching the iPod. Is this just some random Norton stupidness?

  • W510 Mulitple BSOD's Almost daily

    I've had my w510 since May. And it's BSOD'd on me just about daily and usually more than once a day. Take a look at the picture of my system crash history from lenovo tools support history: What am i supposed to do with this information?  I run vanil

  • Names and codes for enterprise structure

    HI all, I would like to know the right procedure for giving the naming conventions for the enterprise structure. whether should crete with  alpha numeric or numeric or only alphabets are also accepted. Let point of time if we go for upgrades,  will t