Page 2 of 2

Re: Create PO via dll

PostPosted: Fri Aug 25, 2017 1:27 pm
by Riyaz
Thanks for your help Scott

Re: Create PO via dll

PostPosted: Wed Aug 30, 2017 1:44 pm
by Riyaz
Hi Scott

Still having some problems, seem to run again but still wont create any PO under JIWA, can you pls let me know the full script for creating PO in V6, how to add inventory items etc, would really appreciate that. Am using the below at the moment which executes fine

With PurchaseOrder
.Database = JiwaDatabase
.JLib = JiwaLib
.SystemProfile = JiwaSysProfile

If .NewOrder(strDebtorID, JiwaPurchaseOrder.eumJiwaPurchseSupplierType.eumCreditor) = False Then
Throw New Exception(.ErrorMessage)
End If

.Reference = "1003670"
.CreditorID = strDebtorID
.AddNonInventoryItem("81643-001", newKey)

'End With


If .SaveOrder() Then
Throw New Exception(.ErrorModule)
End If

End With

Re: Create PO via dll

PostPosted: Fri Sep 01, 2017 11:00 am
by Riyaz
Hi Scott

Would you have anything for me on this pls?

Re: Create PO via dll

PostPosted: Mon Sep 11, 2017 12:02 pm
by Riyaz
Hello

Can anyone pls reply to this thread?

Re: Create PO via dll

PostPosted: Mon Sep 11, 2017 8:15 pm
by Mike.Sheen
Hi Riyaz,

This code looks wrong.

Code: Select all
If .SaveOrder() Then
   Throw New Exception(.ErrorModule)
End If


You only want to throw the exception if .SaveOrder() does NOT return true. So change it to:

Code: Select all
If Not .SaveOrder() Then
   Throw New Exception(.ErrorModule)
End If


And you'll probably want to throw with the .ErrorMessage property not the .ErrorModule property in order for the caller to properly display/react to the reason for any failure.

Mike

Re: Create PO via dll

PostPosted: Tue Sep 12, 2017 4:19 pm
by Riyaz
Hi Mike

Thanks for that, I'll give it a shot, can you pls also let me on how to add inventory items etc to the PO

Re: Create PO via dll

PostPosted: Tue Sep 12, 2017 4:30 pm
by Scott.Pearce
Code: Select all
Dim newKey As String
Dim inventoryID as String = "00000000040000000002" 'Part no. 8100044

If .AddInventoryItem(inventoryID, newKey) = 0 Then
    Throw New Exception(.ErrorModule)

Re: Create PO via dll

PostPosted: Tue Sep 26, 2017 4:55 pm
by Riyaz
Hi Mike / Scott

Can you pls help me with this as I feel like am shooting in the dark with nothing to refer to. All I'm trying to do is to create a PO using the Jiwa 6 dll and I dont have class references, method references, etc, would really appreciate your help with a full example on creating a PO with dll.

Am using the code below, and I keep getting errors like this "Object variable or With block variable not set" , I think that means I havent assigned all required parameters, I would love to, but I dont know which all I need to assign. Below is my code again. I have try catch, the exceptions I get are pretty generic like the one above.

With PurchaseOrder
.Database = JiwaDatabase
.JLib = JiwaLib
.SystemProfile = JiwaSysProfile

.Reference = "1003670"
.CreditorID = strDebtorID

'1B2E5B064C5248909F34 is the ID for part no 81643-001

If .AddInventoryItem("1B2E5B064C5248909F34", newKey) = JiwaPurchaseOrder.enumJiwaPurchaseOrderReturnCodes.e_PurchaseOrderReturnCodeFailure Then
Throw New Exception(.ErrorMessage)
End If

If .NewOrder(strDebtorID, JiwaPurchaseOrder.eumJiwaPurchseSupplierType.eumCreditor) = False Then
Throw New Exception(.ErrorMessage)
End If

If Not .SaveOrder() Then
Throw New Exception(.ErrorMessage)
End If

End With

Re: Create PO via dll

PostPosted: Mon Oct 02, 2017 2:10 pm
by Riyaz
Hi Mike / Scott

Appreciate that you're busy, Anything on this pls as am progressing at all?