Static checker invariant unproven on timespan field
I am attempting to implement code contracts for a class with TimeSpan properties where I want to ensure that the TimeSpan is non-negative. With the following code the static checker is giving a warning that the contract invariant is unproven (the ensures
and requires seem to be fine). A suppress message is suggested as follows:
CodeContracts: WiseTechGlobal.ROPE.Common: Method WiseTechGlobal.ROPE.Common.DepotHours(): To mask the warning at WiseTechGlobal.ROPE.Common.DepotHours.#ctor()[0x11] add
the attribute: [SuppressMessage("Microsoft.Contracts", "Invariant-16-17")]
I'd appreciate any help or guidance on how to correct this issue. I'd rather not suppress the message if there is a change I can make to correct my contract invariant test. One thing I have tried
is to initialize the backing field with the following, but this did not help.
TimeSpan earliestTimeVehiclesCanStart = new TimeSpan(0);
using System;
using System.Diagnostics.Contracts;
namespace WiseTechGlobal.ROPE.Common
// Defines the operating hours and loading/unloading times for a depot
public class DepotHours
public TimeSpan EarliestTimeVehiclesCanStart
get
Contract.Ensures(Contract.Result<TimeSpan>() >= TimeSpan.Zero);
return earliestTimeVehiclesCanStart;
set
Contract.Requires<ArgumentException>(value >= TimeSpan.Zero);
earliestTimeVehiclesCanStart = value;
TimeSpan earliestTimeVehiclesCanStart = TimeSpan.Zero;
[ContractInvariantMethod]
void ObjectInvariant()
Contract.Invariant(earliestTimeVehiclesCanStart >= TimeSpan.Zero);
The checker doesn't understand that TimeSpans work much like integers, so it has no clue that the initialization "x = TimeSpan.Zero" guarantees "x >= TimeSpan.Zero" or even that "x == TimeSpan.Zero". One workaround for this
is to simply tell the checker that this is so:
TimeSpan earliestTimeVehiclesCanStart;
DepotHours() {
earliestTimeVehiclesCanStart = TimeSpan.Zero;
Contract.Assume(earliestTimeVehiclesCanStart >= TimeSpan.Zero);
Note that it's not sufficient to tell it that "earliestTimeVehiclesCanStart == TimeSpan.Zero", because it can't prove that "==" implies ">=" for TimeStamp instances either.
Similar Messages
-
Hi,
In OVA8, I have static (adjacent field open order and open deliveries are not selected), critical field and dunning level selected.
In VKM1 status field, I can see there are Static Check, TermsOfPayment, Max dunn.
For Terms of payment and dunning, it is self explanatory that the block is due to payment term and dunning.
May I know what about Static Check? What cause the block when the status is Static Check?
Need advice.
thanksDear
Newphama Calesta ,
Please search the forum pertinent to credit management.However i try brief about this
Static check considers the net document value value of open ordersvalue of open deliveriesvalue of open billing documentsvalue of open items.
If customer credit limit has been exceeded the above mentioned criteria then a credit block will be applied either sales order ,delivery or while doing PGI.
Dynamic check has same functionality but it has an additional functionality that is credit horizon period.
Thanks&Regards
Raghu.k -
Credit management static check
Hi all,
i want to configure STATIC CHECK in my organization. My organization is operating with one sales org but many sales area. i want to configure static check to only export customers served by only one sales area xxxx/yy/zz. yy is distribution channel specially for exports & zz is specially export division with products specifically to be sold to export customers.There are almost 28 export customers. will static check be configured customer based or sales area based or sales org based.
Please guide.
regards
vikas chhabra
098714 88 718
[email protected]hi,
pl check this ;
Credit and risk management takes place in the credit control area. According to your corporate requirements, you can implement credit management that is centralized, decentralized, or somewhere in between.
An organizational unit that represents the area where customer credit is awarded and monitored. This organizational unit can either be a single or several company codes, if credit control is performed across several company codes. One credit control area contains credit control information for each customer.
For example, if your credit management is centralized, you can define one credit control area for all of your company codes.
If, on the other hand, your credit policy requires decentralized credit management, you can define credit control areas for each company code or each group of company codes.
Credit limits and credit exposure are managed at both credit control area and customer level. You set up credit control areas and other data related to credit management in Customizing for Financial Accounting. The implementation guide is under Enterprise Structure -> Definition or Assignment -> Financial Accounting and then Maintain credit control area. You assign customers to specific credit control areas and specify the appropriate credit limits in the customer master record.
Settings for determining the credit control area of a document. The settings of items 1 - 4 are taken into account according to their priority. The credit control area found is stored in field VBAK-KKBER.
1. Transaction OB38
Check which credit control area is assigned to the company code.
Company code:
Credit control area:
2. Transaction OVFL
Check which credit control area is assigned to the sales area.
Sales area:
Credit control area:
3. Transaction XD02 or VD02
Check which credit control area is assigned to the payer.
Payer:
Credit control area:
4. Transaction SE37
Is user exit EXIT_SAPV45K_001 being used?
5. Transaction OBZK
For the settings under items 2 - 4, field "All company codes" must be marked in Transaction
OB45, or the credit control area must be entered under the relevant company code in table
T001CM of the credit control areas allowed.
Company code:
Credit control areas allowed:
6. Settings for the credit checks
7. Transaction OVAK
Which settings do exist for the sales document type used?
Sales document:
Check credit:
Credit group:
8. Transaction OVAD
Which settings do exist for the delivery type used?
Delivery type:
Credit group for delivery:
Credit group for goods issue:
9. Transaction OB01
Credit management/Change risk category
Definition of the risk category for each credit control area. This risk category can be
assigned to a credit account by using Transaction FD32.
10. Transaction OVA8
Here, the individual credit checks for key fields
o credit control area
o risk category
o credit group are set. Take these key fields from the above settings and go to the detail
screen. In particular, check whether fields "Reaction" and "Status/block" are set
correctly. To carry out follow-up actions in case of a credit block, the credit check
status must be set (field "Status/block").
11. Transaction FD32
Credit master data for the payer of the relevant document.
Credit account:
Credit limit:
Risk category:
Currency:
12. Settings for updating the credit values Update of the credit values is required for the limit
check (static or dynamic credit limit check).
13. Transaction OVA7
Update of the credit value is active for the corresponding item type if the check box is marked. This field corresponds to
field "Active receivable" in Transaction VOV7.
Item type:
Active receivable:
14. Transaction V/08, Pricing
In the pricing procedure used for pricing, subtotal "A" must be entered in a line for
determining the credit value (mark the pricing procedure and doubleclick on "Control").
Usually, the net value plus taxes is used. This way the system is determined to use this
subtotal for credit pricing. The credit price is stored in field VBAP-CMPRE and used for
update and credit check.
You can find the used pricing procedure of the order under "Item -> Condition -> Analysis".
Pricing procedure:
Line with subtotal = 'A':
15. Transaction OB45
Which update group (field "Update") do you use in the relevant credit control area? The
default setting is "12". If you use another update group, check whether this is fine with
you. If you open an OSS message, please tell us the alternative update group.
Credit control area:
Update:
16. Transaction OMO1
Which kind of update did you choose for structure S066?
In any case, "Synchronous update (1)" has to be chosen as the kind of update.
All other settings will lead to errors.
Hope it helps.
Thanks
Sadhu Kishore -
Internal error at method Method 521 after CC static checker is run.
After running the static checker on my solution, does all the usual hoo hah, and then throws internal error at method Method 521 at me.
any idea what causes this? It seems intermittent at times. But occurs quite often nonetheless.
here's the output from VS2013:
CodeContracts: RenameMeOrIWillForeverHauntYourDreams.Interop.Win32: Validated: 96.1%
CodeContracts: RenameMeOrIWillForeverHauntYourDreams.Interop.Win32: Checked 1592 assertions: 1511 correct 63 unknown (19 masked)
CodeContracts: RenameMeOrIWillForeverHauntYourDreams.Interop.Win32: Contract density: 2.46
CodeContracts: RenameMeOrIWillForeverHauntYourDreams.Interop.Win32: Total methods analyzed 251
CodeContracts: RenameMeOrIWillForeverHauntYourDreams.Interop.Win32: Methods analyzed with a faster abstract domain 0
CodeContracts: RenameMeOrIWillForeverHauntYourDreams.Interop.Win32: Method analyses read from the cache 250
CodeContracts: RenameMeOrIWillForeverHauntYourDreams.Interop.Win32: Methods with 0 warnings 206
CodeContracts: RenameMeOrIWillForeverHauntYourDreams.Interop.Win32: Time spent in internal, potentially costly, operations
CodeContracts: RenameMeOrIWillForeverHauntYourDreams.Interop.Win32: Overall time spent performing action #KarrPutIntoRowEchelonForm: 00:00:00.2040141 (invoked 17139 times)
Overall time spent performing action #KarrIsBottom: 00:00:00.0670060 (invoked 11034 times)
Overall time spent performing action #ArraysAssignInParallel: 00:00:00.1240101 (invoked 22 times)
Overall time spent performing action #ArraysJoin: 00:00:00.0870076 (invoked 11 times)
Overall time spent performing action #Simplex: 00:00:00.6190450 (invoked 930 times)
Overall time spent performing action #SubPolyJoin: 00:00:00.5090412 (invoked 25 times)
Overall time spent performing action #WP: 00:00:01.2251006 (invoked 7 times)
CodeContracts: RenameMeOrIWillForeverHauntYourDreams.Interop.Win32: Total time 13.458sec. 53ms/method
CodeContracts: RenameMeOrIWillForeverHauntYourDreams.Interop.Win32: Retained 0 preconditions after filtering
CodeContracts: RenameMeOrIWillForeverHauntYourDreams.Interop.Win32: Inferred 0 object invariants
CodeContracts: RenameMeOrIWillForeverHauntYourDreams.Interop.Win32: Retained 0 object invariants after filtering
CodeContracts: RenameMeOrIWillForeverHauntYourDreams.Interop.Win32: Detected 0 code fixes
CodeContracts: RenameMeOrIWillForeverHauntYourDreams.Interop.Win32: Proof obligations with a code fix: 0
CodeContracts: RenameMeOrIWillForeverHauntYourDreamsRenameMeOrIWillForeverHauntYourDreams.Interop.Win32: Internal error at method Method 521 : System.Diagnostics.Contracts.ContractDeclarativeAssemblyAttribute.#ctor()
CodeContracts: RenameMeOrIWillForeverHauntYourDreams.Interop.Win32: Failed with uncaught exception: Input string was not in a correct format.
CodeContracts: RenameMeOrIWillForeverHauntYourDreams.Interop.Win32: Stack trace: at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args)
CodeContracts: RenameMeOrIWillForeverHauntYourDreams.Interop.Win32: \n at System.String.Format(IFormatProvider provider\, String format\, Object[] args)
CodeContracts: RenameMeOrIWillForeverHauntYourDreams.Interop.Win32: \n at Microsoft.Research.CodeAnalysis.RemoteWriterOutput`2.RemoteEmitOutcome(Boolean additional\, ProofOutcome outcome\, APC pc\, String format\, Object[] args)
CodeContracts: RenameMeOrIWillForeverHauntYourDreams.Interop.Win32: \n at Microsoft.Research.CodeAnalysis.RemoteWriterOutput`2.EmitOutcomeAndRelated(Witness witness\, String format\, Object[] args)
CodeContracts: RenameMeOrIWillForeverHauntYourDreams.Interop.Win32: \n at Microsoft.Research.CodeAnalysis.QuantitativeOutput`2.Flush()
CodeContracts: RenameMeOrIWillForeverHauntYourDreams.Interop.Win32: \n at Microsoft.Research.CodeAnalysis.QuantitativeOutput`2.Close()
CodeContracts: RenameMeOrIWillForeverHauntYourDreams.Interop.Win32: \n at Microsoft.Research.CodeAnalysis.Clousot.TypeBinder`9.InternalAnalyze()
CodeContracts: RenameMeOrIWillForeverHauntYourDreams.Interop.Win32: \n at Microsoft.Research.CodeAnalysis.Clousot.TypeBinder`9.Analyze()Further digging reveals that this has something to do with the caching of static checker results. If I do not cache or delete the cache in sql, it takes significantly longer to run (ala 20 minutes as opposed to 1), but runs as expected.
-
Hi there,
I created a datamodel and have applied a condition to it. When I execute the interface the invalid records are captured in the E$ table but all the other valid records do not appear on the target table. I couldn't able to find the reason for this. I have applied flow and static check to the condition and the same for the table column. Im not sure why the validate records are rejected.
Any help is appreciated.
CheersHI!
Let me understand, do you want the invalid records at target table?
If you use the flow control it will keep the records at E$ and WILL NOT load it.
If you use static control, it will LOAD the data and, after that, verify what are the records with problems.
Don't use both controls at same time, it doesn't make logical sense unless when needs to validate distinct constraints at each moment.
Does it help you? -
Is there a way to print the check register with the Text field
Hi,
Is there a way to print the check register with the Text field and also each item's Text field?"
When we enter a invoice we enter a generic text on the Basic Data tab then enter a "+" on each individual line item which in turns defaults to the generic text. Just wanted to know if the check register could draw in the individual line item detail where we can enter text that relates to just that line item. Sort of like the MIR7 draws in the detail for each item.
Kindly help me in full fill the above requirement.
Thanks
SunithaHi,
Can any one help me on this issue?
Thanks
Sunitha -
Checking the initiality of the fields while creating entries for a table
While creating entries using table maintenance generator(TMG) i need to check the initiality of the fields.Are there any such events?
I know i can go and change in the screen by making it mandatory or by writing a module in the PAI of the screen of table maintenance generator. Both of cases i have to change the TMG which is generated by SAP system. I want to know is there a way to achieve this with out changing the TMG possible events?hi rahul,
as far as i know, you have to do your initial valifdation in TMG and you have to change your TMG. However, if you have checked the initial flag while defining the field, you will not have initial value for that particular field.... (if the field is key field, by default it is not initial)
hope this helps....
thanks and regards,
tanmaya -
Hi experts ,
I have a requirement of having one of the table field as checkbox .when i kept it as checkbox it is not getting reflected in sm30 .i need to have a check box displayed in the field of the table in sm30 .Hey i too came across this problem and i guess changing Screen could be a troublesome task.
Other option is:
First Regenerate that particular table.
TCODE: SE14 --> Enter table name --> Click on Activate and adjust database button.
If it wont works then last option is:
Delete the Table Maintenance generator for that particular table and again create it with same details, make sure you dont change anything while recreating it (even the screen number must be same).
Open table in (Change mode) --> Utilities --> Table maintenance generator --> Delete it and again create with same parameters.
This will surely work,
<REMOVED BY MODERATOR>
Regards Pankaj.
Edited by: Alvaro Tejada Galindo on Jun 12, 2008 7:31 PM -
User exit to check the consistency of filled fields before saving
Hi,
I am looking for a User Exit which can be executed when a user click on "Save" button.
In this User Exit, I would like to implement some controls to check the consistency of filled fields.
I have an example to better understand : I work on transaction code ME11 and ME12 (create and modify Info Record). When all mandatory fields are filled, the user can save its. When the user click on "Save" button, I want that a checking (with a user exit, or anything else) verify the consistency of some fields (for example, the consistency between the Tax code of the country and the country of the supplier).
If it's not clear, I could precise...
Thanks in advance for you help...Hi,
I am looking for a User Exit which can be executed when a user click on "Save" button.
In this User Exit, I would like to implement some controls to check the consistency of filled fields.
I have an example to better understand : I work on transaction code ME11 and ME12 (create and modify Info Record). When all mandatory fields are filled, the user can save its. When the user click on "Save" button, I want that a checking (with a user exit, or anything else) verify the consistency of some fields (for example, the consistency between the Tax code of the country and the country of the supplier).
If it's not clear, I could precise...
Thanks in advance for you help... -
Authority check in infoset query for field with multiple entries
how can i perform the authority check in sq02 "at selection screen" for a multiple entry field
e.g. EKORG low 0001 - high 0005
or EKORG 0001, 0004, 0005
I already added the following statements
How the field for EKORG check must be filled
if EKORG is initial.
message 'Bitte Einkaufsorganisation wählen' TYPE 'E'.
endif.
AUTHORITY-CHECK OBJECT 'M_BEST_EKO'
ID 'ACTVT' FIELD '03'
ID 'EKORG' FIELD ?????.
IF sy-subrc = 4.
MESSAGE 'Keine Berechtigung für EKORG sy-subrc 4' TYPE 'E'.
ENDIF.hi,
which event do you use for your coding ?
it must be AT SELECTION-SCREEN
A. -
Credit static check status B in vkm3
Hello Experts,
Need your help.
I have an SO which has a credit status as Released in sales order.
When checked at VKM3, it shows Status Check B/Not Approved, Overall Status as Released and is also showing a risk cat of RK2.
Currently, the credit status of the customer has 72% credit exposure and customer has been updated with risk category 001.
From the client's automatic credit control setting, the Risk Category 001 includes Static check for open orders and deliveries, and Open items - Max open item % is 20% with 3 days open.
I would like to know,
- how is the static check in VKM3 be approved and changed it to Status A?
- As I have checked that both risk categories RK2 and 001 both have Open Items Check with Max open item 20%, then should it work if I suggest user to change the risk category into RK1 which is maintained with Max open item 75%?
Kindly help suggest solutions on how I can the static check be approved.
Thanks!
liaDear Lia,
I donot understand what your issue is. To release the order from the credit check, we will be using VKM3 transaction.
By the way, to have a clear idea on how Open item check in OVA8 works. Please find below my answer.
Customer Balance, you can check this in FD10N transaction.
You can also see the overdue open items in this transaction.
Max.open.item % will be having Maximum percentage of overdue open items/customer balance
When you activate the indicator OPEN ITEMS, and you have mentioned some XX% in the Max.open.item % and some Y days in Max.open.item %; then the system will do the following.
a.first calculate the amount of overdue open items which are due for more than Y days.
b.then divide the value obtained in step a by customer balance which you can see in FD10n transaction.
c. this will be giving some %. If this percentage is higher than the value mentioned in Max.open.item %; then the system will block the sales order for further processing.
Hope this clarifies.
Please close the thread if this answers your query. thanks
Thank you
Venkatesh SP -
Hi All,
Is there anyway to sort check boxes as per I like? I have the following static check box:
STATIC:Safari Tours/4WD;Safari 4WD,Bushwalking;Bushwalking,Camping;Camping and it is displaying check boxes like
Bushwalking
Camping Safari
Tours/4WD But I want them to be displayed as -
Safari Tours/4WD
Bushwalking
CampingThanks in advance,
Regards,
M TajuddinHi Andy,
Your suggestion worked for me. By the way what is the use of STATIC1 then? I have not tried that yet.
Thanks,
Tajuddin -
Hi All,
Can we perform static check on XML model or Excel model using any CKM ? Please help.
Thanks and regards,
SaurabhYes, you should be able to do so.
-
Hi,
If I tick static check in OVA8, may i know besides open order and open delivery which adjacent to static check, credit limit in FD33 also considered as static check?
In FD33, the credit exposure (receivable/liabilities/sales value) to determine credit limit, I would like to know if it is also considered static check if limit over.
ThanksYes. If you check Static Credit Check in OVA8, system will check the Credit Limit Defined in FD32 (displayed in FD33).
Static Check considers the Credit Exposure displayed in FD33 & the available Credit Limit.
The only thing not available in Static Check is the Horizon factor. (With Horizon in Dynamic Check, you can decide uption how many months in future you want to consider open Orders).
Hope this helps,
Thanks,
Jignesh Mehta -
Purpose of Entry/Check Table and Currency Quantity Fields...!
Hi......!,
I want to know what is the purpose of this Entry/Check Table and Currency Quantity Fields, while creating a table in DDIC .
give me a clear explanation .....!
best answers would be rewarded.
thanks
prasadHi Prasad,
All the Modules in SAP are inter related,
So their Tables also must be related and must be valid
and they are related to foreign key relation ships
and also we can provide the list of input values using search helps
to know what the search helps and check tables are assigned to the particular field they provided the tab
In the currency fields or quanitiy fields we only enter the amount but not the units,
so the units are assigned if we provide the reference field and table , and so that tab is provided to check what are reference fields and tables and also to assign new fields
hope I am clear
Reward if helpful
prasanth
Maybe you are looking for
-
Internet browsing ludicrously slow after upgrading to Mavericks
Hi All, I wonder if someone could possibly offer some suggestions please. Everything was fine and running sweetly on ML. After upgrading to Mavericks, Internet browsing has become ridiculously slow. Safari, Chrome and Firefox all exhibit the same pro
-
Connecting Macbook to AVR reciever
Im trying to connect my 2009 Macbook to my Harman Kardon AVR 1650 through an HDMI cable so I can watch video on my TV. The reciver is obviously connected to the HD TV. When I plug in the cord to HDMI 3 and select the correct input (HDMI 3), my compu
-
Acrobat v9 Pro and Standard Runtime Error!
My company recently got in the CD's from Adobe for Acrobat 9 Professional and Acrobat 9 Standard. I installed Acrobat 9 Pro on one of our systems. The system got a runtime error every time Adobe Acrobat started citing "C:\Program Files\Adobe\Acrobat
-
I can't activate my phone... Help
Whenever I click on my "iphone" in itunes it says "itunes could not connect to the itunes store. An unknown error has occured (11333). Make sure your network connection is active and try again." Can anyone tell me what is going on?
-
HT2497 I got a wireless airport from a friend. how do I conect it to my modem?
I have no papers or codes for it. how do I hook it up?