Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create an invoice contain only miscellaneous charge

Status
Not open for further replies.

sara403

Technical User
Jun 10, 2008
58
IN
Hi,

What is Hot Fix? what is Hot fix 7049? Can i create an invoice for orders that contain only miscellaneous charge entries from the order entry screen? when i create an invoice through an VBA using this below field

CUSTOMER,SHPNAME,SHPADDR1,SHPADDR2,SHPCITY,SHPSTATE,SHPZIP,SHPCOUNTRY,BILNAME,BILADDR1,BILADDR2,BILCITY,BILSTATE,
BILZIP,BILCOUNTRY,BILPHONE,BILFAX,REFERENCE,COMMENT,
MISCCHARGE,EXTINVMISC,ITEM,QTYORDERED,QTYSHIPPED,PRIUNTPRC,
COIN


It shows an error message "method of bjects failed"
please help me.

Thanks

Saravanan
 
1. Hotfix "7049" is not listed in the Sage KB.
2. You need to single-step through your code, and check the Session.Errors object when you get the error.
 
Hi

Thanks for your valuable reply. I have an another doubt

what is KB# 7021 in Sage accpac 5.4?

Thanks

Saravanan
 
Thanks a million for this post, something in this post helped me capture the errors from Accpac, in C#. I have been struggeling to do this for quite a while now.

kind regards
V3nd3tta
 
Hi,
i am unable to create an invoice for orders that
contain only miscellaneous charge entries from
the order entry screen.i tried through macro, header information is inserted. But the line item has not been inserted and generate an internal error and operaion not allowed when the computer reach the below line "OEORD1detail1.Insert".The macro are given below
OEORD1detail1.Init

OEORD1detail1Fields("LINETYPE").Value = "2" ' Line Type
OEORD1detail1Fields("MISCCHARGE").Value = "HC" ' Miscellaneous Charges Code
OEORD1detail1Fields("EXTINVMISC").Value = "10.000" ' Extended Amount

OEORD1detail1.Insert

OEORD1detail1Fields("LINENUM").PutWithoutVerification ("-1") ' Line Number

OEORD1detail1.Read
temp = OEORD1detail1.Exists
OEORD1detail1.Init

OEORD1detail1Fields("LINETYPE").Value = "2" ' Line Type
OEORD1detail1Fields("MISCCHARGE").Value = "PACK" ' Miscellaneous Charges Code
OEORD1detail1Fields("EXTINVMISC").Value = "20.000" ' Extended Amount

OEORD1detail1.Insert


Please help me

Thanks

Saravanan.
 
Geez, here we go again.

In your code above, there are two .Insert lines. Did you get the error on the first one or the second one? If it's the second one, remove these lines:

OEORD1detail1Fields("LINENUM").PutWithoutVerification ("-1") ' Line Number

OEORD1detail1.Read
temp = OEORD1detail1.Exists
 
Hi,
Thanks for your quick reply. i got the error at the first .insert line. Here my sample code is

{ Header file information....}

OEORD1header.Insert
OEORD1header.Update
OEORD1header.Read
l_strID = OEORD1header.Fields("ORDUNIQ").Value


OEORD1detail2.Browse "", 1

OEORD1detail2Fields("PAYMENT").PutWithoutVerification ("-32767") ' Payment Number

OEORD1detail2.Browse "", -1
OEORD1detail2.Fetch
temp = OEORD1detail1.Exists
OEORD1detail1.RecordClear
temp = OEORD1detail1.Exists


OEORD1detail1.Init
OEORD1detail1.Fields("ORDUNIQ").Value = l_strID
OEORD1detail1Fields("LINETYPE").Value = "2" ' Line Type
OEORD1detail1Fields("MISCCHARGE").Value = "HC" ' Miscellaneous Charges Code
OEORD1detail1Fields("EXTINVMISC").Value = "10.000" ' Extended Amount

OEORD1detail1.Insert


OEORD1detail1Fields("LINENUM").PutWithoutVerification ("-1") ' Line Number

OEORD1detail1.Read
temp = OEORD1detail1.Exists

OEORD1detail1.Init
OEORD1detail1.Fields("ORDUNIQ").Value = l_strID
OEORD1detail1Fields("LINETYPE").Value = "2" ' Line Type
OEORD1detail1Fields("MISCCHARGE").Value = "PACK" ' Miscellaneous Charges Code
OEORD1detail1Fields("EXTINVMISC").Value = "20.000" ' Extended Amount

OEORD1detail1.Insert


When i reach the first .insert line, it will generate an error "internal error", "Order detail", operation not allowed". But the header informaion inserted and created an order entry without an line item details.The order entry details are not inserted through this process.

Please help me.

Thanks

Saravanan.





 
You must insert the detail lines before you insert the header.
 
Hi,

I tried this macro. when we run the macro while it reach the line Oheaderfields("CUSTOMER").value = "1200". it is
generating an error "view call failed". if i use oHeaderFields(word(0)).Value = str((word(1))) it is working. But when i insert the Header information it is generating an another error "Customer No 1200 Does not Exist". I have no idea on this to solve this issue.i have been fighting with this issue for the past two days. Pls help me.


Dim oSession As ACCPACXAPILib.xapiSession
Set oSession = New ACCPACXAPILib.xapiSession
On Error GoTo ACCPACErrorHandler ' Set error handler


Dim TCOMMENT As String
Dim invnum As String

invnum = ""
oSession.Open user, password, database, Date, 0 'Open a session with current date

Dim oHeader As ACCPACXAPILib.xapiView
Dim oHeaderFields As ACCPACXAPILib.xapiFields
Set oHeader = oSession.OpenView("OE0520", "OE")
Set oHeaderFields = oHeader.Fields

Dim oDetail As ACCPACXAPILib.xapiView
Dim oDetailFields As ACCPACXAPILib.xapiFields
Set oDetail = oSession.OpenView("OE0500", "OE")
Set oDetailFields = oDetail.Fields

Dim oOrderSerial As ACCPACXAPILib.xapiView
Dim oOrderSerialFields As ACCPACXAPILib.xapiFields
Set oOrderSerial = oSession.OpenView("OE0680", "OE")
Set oOrderSerialFields = oOrderSerial.Fields

Dim oOrderCom As ACCPACXAPILib.xapiView
Dim oOrderComFields As ACCPACXAPILib.xapiFields
Set oOrderCom = oSession.OpenView("OE0180", "OE")
Set oOrderComFields = oOrderCom.Fields

Dim oOrderPayment As ACCPACXAPILib.xapiView
Dim oOrderPaymentFields As ACCPACXAPILib.xapiFields
Set oOrderPayment = oSession.OpenView("OE0740", "OE")
Set oOrderPaymentFields = oOrderPayment.Fields

oHeader.Compose Array(oDetail, oOrderSerial, oOrderCom, oOrderPayment, Nothing, Nothing, Nothing, Nothing, Nothing)
oDetail.Compose Array(oHeader, Nothing)
oOrderPayment.Compose Array(oHeader, Nothing)
oOrderCom.Compose Array(oHeader, Nothing, oDetail)
oOrderSerial.Compose Array(oHeader, Nothing, oDetail)


oHeader.Cancel
temp = oHeader.Exists
oHeader.Init

'1. Customer Details Add Begin

oHeader.Fields("ORDDATE") = CDate(Date)
oHeader.Fields("ORDDATE") = CDate(Date)
oHeader.Fields("EXPDATE") = CDate(Date)
oHeader.Fields("DESC") = "Generated by cust1st"

Dim inputStr As String
Dim word As Variant
Dim ordate As Variant

MsgBox ("1")

Open App.Path & "\" & FILENAME For Input As #1

Do
Line Input #1, inputStr
If inputStr = "**" Then
Exit Do
Else
word = Split(inputStr, ":", 2, 1)
If word(0) = "ORDDATE" Then
ordate = Date + word(1)
oHeaderFields(word(0)).Value = ordate
Else
oHeaderFields(word(0)).Value = (word(1))
End If
End If
Loop

'1.End of the Coding for header information



oDetailFields("LINENUM").PutWithoutVerification ("0")
oOrderPayment.Browse "", 1
oOrderPaymentFields("PAYMENT").PutWithoutVerification ("-2")
oOrderPayment.Browse "", -1
oOrderPayment.Fetch

inputStr = ""
Do
oDetail.Read
oDetail.Init
Do
Line Input #1, inputStr
If inputStr = "**" Or inputStr = "*" Then
Exit Do
Else
word = Split(inputStr, ":", 2, 1)
If word(0) = "MISCCHARGE" Then oDetailFields("LINETYPE").PutWithoutVerification ("2")
If word(0) = "ITEM" Then oDetailFields("LINETYPE").PutWithoutVerification ("1")
If word(0) = "COIN" Then
oDetailFields("COMMINST").Value = "1"
oOrderCom.Browse "(COINTYPE=1)", -1
oOrderCom.Fetch
TCOMMENT = ""
Do
Line Input #1, inputStr
If inputStr = "END" Then Exit Do
oOrderCom.Init
oOrderComFields("COIN").Value = inputStr
oOrderCom.Insert
Loop
Else
oDetailFields(word(0)).Value = word(1)
End If
End If
Loop
If inputStr = "**" Then
oDetail.Insert
Exit Do
Else
oDetail.Insert
End If
Loop

oDetail.Update
oHeaderFields("gochkcrdt").Value = "1"
oHeader.Process
oHeader.Insert

Thanks

Saravana Bavan.T
 
You need to use a valid customer number, check that customer 1200 exists in AR.
 
1. This line is unnecessary:

temp = oHeader.Exists

2. You don't have to do

Cdate(Date)

it's already a Date.

3. These lines do nothing:

oOrderPayment.Browse "", 1
oOrderPaymentFields("PAYMENT").PutWithoutVerification ("-2")
oOrderPayment.Browse "", -1
oOrderPayment.Fetch

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top