on 05-16-2016 10:48 AM
Hi Experts,
How can I detect the error per line item in DI API. Can u provide me a sample code thanks
Regards,
Phoenix Langaman
Hi Phoenix,
What kind of error are you hoping to see ?
If you are looking for Data Validation error it is not possible.
The validation is only triggered when the Add/Update/Cancel method is called.
The best way for this is only by exporting the document to xml and examine it.
Regards
Edy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
And also, what are the qualification of per item to meet the error(s)?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sir,
I need to determine all the error per line item in order for me to easily correct it before posting. But the problem is that the error on SAP triggers when .Add method is called and the error return only 1 line item per call but in reality the error contains 3 line item so as of now the problem is that the you need to call add method 3x in order to correct all the error before posting..
Before you post, you just add a validation. You will have 2 loops. 1 loop for the validation and 1 loop for add the line.
In the first loop. Put some query base on your requirements. For example:
Dim oQry as String
For i as integer = 0 to rowcount - 1
oQry = "SELECT ItemCode FROM OITM WHERE ItemCode = '"& yourItem &"' "
oRec.DoQuery(oQry)
If oRec.RecordCount = 0 Then
'Return Error
End If
Next
In this example, I want to validate if my item is existing in my OITM table.
Regards,
Hi Phoenix,
There is no way you can validate the whole lines at the point Add().
What you can do to achieve this is to validate your self all the lines like Bryan showed you.
But this will be very tedious job, since you need to validate a lot of things.
a few things :
1. Item Code exists?, is it active?
2. WhsCode exists? Is the item maintained in this WhsCode? WhsCode Active ?
3. AccountCode bound to this item Active ?
4. CostCentres valid and active ?
5. Unit Price must be Positive
6. etc
Regards
Edy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Phoenix,
I am not sure if this applies to your case but If you want to see whether a line is going to throw an error when you Add/Update it you can use Transaction method. This way you will see the validation error as mentioned. And you will also be able to rollback the transaction if operation succeeds.
You can check StartTransaction Method in the SDK Help file for more information.
Kind Regards,
Atilla
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
100 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.