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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sage 300 ERP order entry customization not creating new ship-to

Status
Not open for further replies.

sarojaramkumar

Technical User
Nov 15, 2015
32
IN
Dear all,
I am doing a Sage 300 ERP OE Order Entry customization...
As per the requirement, I have to completely hide the tabs. I did. Now i want to create Customer Ship-To address on the fly. I have attached a macro for creating Customer Ship-To. It works in my laptop.

But the same source/same ocx is not creating Ship-To in customer's server..
Any help Please............


here below is the coding i used
------------------------------------------------
Dim temp As Boolean
Dim ARCUSTSHIP1header As AccpacCOMAPI.AccpacView
Dim ARCUSTSHIP1headerFields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0023", ARCUSTSHIP1header
Set ARCUSTSHIP1headerFields = ARCUSTSHIP1header.Fields

Dim ARCUSTSHIP1detail As AccpacCOMAPI.AccpacView
Dim ARCUSTSHIP1detailFields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0412", ARCUSTSHIP1detail
Set ARCUSTSHIP1detailFields = ARCUSTSHIP1detail.Fields

ARCUSTSHIP1header.Compose Array(ARCUSTSHIP1detail)

ARCUSTSHIP1detail.Compose Array(ARCUSTSHIP1header)



ARCUSTSHIP1headerFields("IDCUST").Value = afeOEORDHcustomer.Value ' Customer Number

ARCUSTSHIP1header.Browse "(IDCUST = " & afeOEORDHcustomer.Value & ")", 1
temp = ARCUSTSHIP1header.Exists
ARCUSTSHIP1header.Init

ARCUSTSHIP1headerFields("IDCUST").PutWithoutVerification (afeOEORDHcustomer.Value) ' Customer Number
ARCUSTSHIP1headerFields("IDCUSTSHPT").PutWithoutVerification ("") ' Ship-To Location

ARCUSTSHIP1headerFields("IDCUSTSHPT").Value = cboShiptoCode.Text ' Ship-To Location

temp = ARCUSTSHIP1header.Exists

ARCUSTSHIP1headerFields("PROCESSCMD").PutWithoutVerification ("0") ' Process Command Code

ARCUSTSHIP1header.Process
ARCUSTSHIP1detailFields("OPTFIELD").PutWithoutVerification ("DROPSHIP") ' Optional Field
ARCUSTSHIP1detail.Read

ARCUSTSHIP1detailFields("VALIFBOOL").Value = ChkDropShp.Value ' Yes/No Value

temp = ARCUSTSHIP1detail.Exists
ARCUSTSHIP1detail.Update

ARCUSTSHIP1detailFields("OPTFIELD").PutWithoutVerification ("DROPSHIP") ' Optional Field

ARCUSTSHIP1detail.Read
ARCUSTSHIP1headerFields("NAMELOCN").PutWithoutVerification (cboShiptoCode.Text) ' Description

ARCUSTSHIP1headerFields("TEXTSTRE1").PutWithoutVerification (txtSTAddress1.Text) ' Address Line 1
ARCUSTSHIP1headerFields("TEXTSTRE2").PutWithoutVerification (txtSTAddress2.Text) ' Address Line 2
ARCUSTSHIP1headerFields("TEXTSTRE3").PutWithoutVerification (txtSTAddress3.Text) ' Address Line 3
ARCUSTSHIP1headerFields("TEXTSTRE4").PutWithoutVerification (txtSTAddress4.Text) ' Address Line 4
ARCUSTSHIP1headerFields("NAMECITY").PutWithoutVerification (txtSTCity.Text) ' City
ARCUSTSHIP1headerFields("CODESTTE").PutWithoutVerification (txtSTSTATE.Text) ' State/Prov.
ARCUSTSHIP1headerFields("CODEPSTL").PutWithoutVerification (txtSTZIP.Text) ' Zip/Postal Code
ARCUSTSHIP1headerFields("CODECTRY").PutWithoutVerification (txtSTCountry.Text) ' Country
'ARCUSTSHIP1headerFields("NAMECTAC").PutWithoutVerification ("CONTACT") ' Contact Name
'ARCUSTSHIP1headerFields("EMAIL").PutWithoutVerification ("EMAIL") ' E-mail

ARCUSTSHIP1header.Insert

Dim ARCUSTSHIP57header As AccpacCOMAPI.AccpacView
Dim ARCUSTSHIP57headerFields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0023", ARCUSTSHIP57header
Set ARCUSTSHIP57headerFields = ARCUSTSHIP57header.Fields

Dim ARCUSTSHIP57detail As AccpacCOMAPI.AccpacView
Dim ARCUSTSHIP57detailFields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0412", ARCUSTSHIP57detail
Set ARCUSTSHIP57detailFields = ARCUSTSHIP57detail.Fields

ARCUSTSHIP57header.Compose Array(ARCUSTSHIP57detail)

ARCUSTSHIP57detail.Compose Array(ARCUSTSHIP57header)


ARCUSTSHIP57header.Init

ARCUSTSHIP57headerFields("IDCUST").Value = afeOEORDHcustomer.Value ' Customer Number

ARCUSTSHIP57header.Browse "((IDCUST=" & afeOEORDHcustomer.Value & "))", 1

Exit Sub

ACCPACErrorHandler:
Dim lCount As Long
Dim lIndex As Long

If Errors Is Nothing Then
MsgBox Err.Description
Else
lCount = Errors.Count

If lCount = 0 Then
MsgBox Err.Description
Else
For lIndex = 0 To lCount - 1
MsgBox Errors.Item(lIndex)
Next
Errors.Clear
End If
Resume Next

End If

------------------------------------------------
Thanks
saroram
 
Your macro contains a large amount of extra code. Clean it up otherwise we won't be interesting in looking at the code. Also, use the

Code:
Code button on the editor so that 
You code will be formatted
and easier to read.
 
Thanks to all.

This issue is resolved.

Explanation:
I have created a separate private function for create-shipto and called this function into the eReason = ADDNEW.
It didn't worked.

I copied the same code INSIDE THE eReason= ADDNEW. (instead of calling as a function)

It started Working.


Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top