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

Error: When Create Receipt Entry with Multiple P/O

Status
Not open for further replies.

bnautoid

Programmer
Aug 30, 2017
4
TH
I'm try to create Receipt entry with reference P/O by .net api coding.

but there are error occurring "Incorrect procedure. Operation requires post access." when command PORCP1detail1.Update()


Then i try to test with single P/O but still error. See code as below>>>

PORCP1header.Order = 0

PORCP1header.Fields.FieldByName("RCPHSEQ").SetValue("0", False)

PORCP1header.Init()
PORCP1header.Order = 1
temp = PORCP1detail1.Exists
PORCP1detail1.RecordClear()
PORCP1detail3.RecordClear()
temp = PORCP1detail4.Exists
PORCP1detail4.RecordClear()
PORCP1detail6.Init()
PORCP1detail2.Init()

PORCP1header.Fields.FieldByName("VDCODE").SetValue(pReceiveFinal.VDCODE, True)
PORCP1header.Fields.FieldByName("PROCESSCMD").SetValue("1", False)

PORCP1header.Fields.FieldByName("PONUMBER").SetValue("PO16011079", True)

PORCP1header.Order = 0
PORCP1detail5.Fields.FieldByName("LOADPORNUM").SetValue("PO16011079", True) ' Purchase Order Number
PORCP1detail5.Fields.FieldByName("FUNCTION").SetValue("4", False)
PORCP1detail5.Process()

PORCP1header.Order = 1

PORCP1detail3.Fields.FieldByName("PROCESSCMD").SetValue("1", False)
PORCP1detail3.Process()

PORCP1detail1.Fields.FieldByName("RCPLREV").SetValue(3, False)
PORCP1detail1.Read(False)
PORCP1detail1.Fields.FieldByName("RQRECEIVED").SetValue(1, True)

PORCP1detail1.Update() //// Error this line ("Incorrect procedure. Operation requires post access.")

PORCP1detail5.Fields.FieldByName("FUNCTION").SetValue("10", True)
PORCP1detail5.Process()

PORCP1header.Insert()
PORCP1header.Init()
PORCP1header.Order = 0

Can anyone help me or give an example?

Thank you so much.
Nice.
 
Don't create a new receipt directly in PORCP1. .Browse the PO, set the qty received on each line, then .Update the PO.

Sage 300 Whisperer
 
Oh, wait, Multiple POs? I've never tried it with the API.

Sage 300 Whisperer
 
Hi Jay Converse,

What does it mean about "Don't create a new receipt directly in PORCP1"?
Because I try to Record Macro and follow coding by code generated.

Thank you so much.
 
If you've created a new receipt then reading an existing line with a positive RCPLREV value seems like it wouldn't work. New lines, before they are added to the database, typically have a negative value. You should test the return value of:
Code:
PORCP1detail1.Read(False)
with something like the following (but please don't use this actual code in production [smile] )
Code:
if PORCP1detail1.Read(False) then
    PORCP1detail1.Fields.FieldByName("RQRECEIVED").SetValue(1, True)
else
    msgbox "I did not find the line to receive"
end if
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top