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!

Xapi Receipt Entry

Status
Not open for further replies.

molku

Programmer
May 17, 2006
7
US
I am trying to receive a PO through the xapi.
The reciept does get created, but none of the detail lines are there.
My code is Delphi, and we have wrappers to encapsulate views so some of this may look strange:
Code:
         m_rcptHeaderView := m_Session.OpenView('PO0700', 'PO');
         m_rcptHeader := Trcptheader.Create(m_rcptHeaderView);

         m_rcptDetailView := m_Session.OpenView('PO0710', 'PO');
         m_rcptDetail := Trcptdetail.Create(m_rcptDetailView);

         RcptCmntView := m_Session.OpenView('PO0695', 'PO');
         RcptVndView := m_Session.OpenView('PO0718', 'PO');
         AddCostView := m_Session.OpenView('PO0714', 'PO');
         RcptFuncView := m_Session.OpenView('PO0699', 'PO');
         RcptPoView := m_Session.OpenView('PO0705', 'PO');
         RcptOptFldView := m_Session.OpenView('PO0703', 'PO');
         RcptCostDistrView := m_Session.OpenView('PO0696', 'PO');
         RcptDtlOptFlds := m_Session.OpenView('PO0717', 'PO');
         RcptVndOptFldView := m_Session.OpenView('PO0721', 'PO');
         RcptAddCostOptFld := m_Session.OpenView('PO0719', 'PO');

         SetLength(ViewArray, 8);
         ViewArray[0] := RcptCmntView;
         ViewArray[1] := m_rcptDetailView;
         ViewArray[2] := RcptVndView;
         ViewArray[3] := AddCostView;
         ViewArray[4] := RcptFuncView;
         ViewArray[5] := RcptPoView;
         ViewArray[6] := RcptOptFldView;
         ViewArray[7] := RcptCostDistrView;
         m_rcptHeaderView.Compose(ViewArray);

         SetLength(ViewArray, 6);
         ViewArray[0] := m_rcptHeaderView;
         ViewArray[1] := RcptCmntView;
         ViewArray[2] := RcptFuncView;
         ViewArray[3] := nil;
         ViewArray[4] := nil;
         ViewArray[5] := RcptDtlOptFlds;
         m_rcptDetailView.Compose(ViewArray);

         SetLength(ViewArray, 2);
         ViewArray[0] := m_rcptHeaderView;
         ViewArray[1] := m_rcptDetailView;
         RcptCmntView.Compose(viewArray);

         SetLength(ViewArray, 4);
         ViewArray[0] := m_rcptHeaderView;
         ViewArray[1] := AddCostView;
         ViewArray[2] := RcptFuncView;
         ViewArray[3] := RcptVndOptFldView;
         RcptVndView.Compose(ViewArray);

         SetLength(ViewArray, 7);
         ViewArray[0] := RcptVndView;
         ViewArray[1] := RcptFuncView;
         ViewArray[2] := m_rcptHeaderView;
         ViewArray[3] := nil;
         ViewArray[4] := nil;
         ViewArray[3] := RcptAddCostOptFld;
         ViewArray[4] := RcptCostDistrView;
         AddCostView.Compose(ViewArray);

         SetLength(ViewArray, 7);
         ViewArray[0] := m_rcptHeaderView;
         ViewArray[1] := RcptCmntView;
         ViewArray[2] := m_rcptDetailView;
         ViewArray[3] := AddCostView;
         ViewArray[4] := RcptVndView;
         ViewArray[5] := RcptPoView;
         ViewArray[6] := RcptCostDistrView;
         RcptFuncView.Compose(ViewArray);


         SetLength(ViewArray, 2);
         ViewArray[0] := m_rcptHeaderView;
         ViewArray[1] := RcptFuncView;
         RcptPoView.Compose(ViewArray);

         RcptOptFldView.Compose(m_rcptHeaderView);

         SetLength(ViewArray, 5);
         ViewArray[0] := AddCostView;
         ViewArray[1] := RcptVndView;
         ViewArray[2] := m_rcptHeaderView;
         ViewArray[3] := RcptFuncView;
         ViewArray[4] := nil;
         RcptCostDistrView.Compose(ViewArray);

         RcptDtlOptFlds.Compose(m_rcptDetailView);

         RcptVndOptFldView.Compose(RcptVndView);

         RcptAddCostOptFld.Compose(AddCostView);

   m_rcptHeaderView.Order := 1;
   m_rcptHeaderView.Order := 0;
   m_rcptHeaderView.Fields.Field[0].PutWithoutVerification('0');
   m_rcptHeaderView.Init;
   m_rcptHeaderView.Order := 1;
   m_rcptDetailView.RecordClear;
   RcptVndView.RecordClear;
   AddCostView.RecordClear;
   RcptPoView.Init;
   RcptCmntView.Init;
   m_rcptHeaderView.Fields.Field[22].Value := PoRcvrNbr;
   m_rcptHeaderView.Fields.Field[25].Value := VNDREC;
   m_rcptHeaderView.Fields.Field[229].PutWithoutVerification('1');
   m_rcptHeaderView.Process;
   m_rcptHeaderView.Fields.Field[41].Value := PoRcvrNbr;
   m_rcptHeaderView.Order := 0;

   RcptFuncView.Fields.Field[2].Value := PoRcvrNbr;
   RcptFuncView.Fields.Field[5].PutWithoutVerification('4');
   RcptFuncView.Process;
   m_rcptHeaderView.Order := 1;
   RcptVndView.Fields.Field[175].PutWithoutVerification('1');
   RcptVndView.Process;
   tmpStr := RcptVndView.Fields.Field[0].Value;
   RcptVndView.Browse('(RCPHSEQ = "' + tmpStr + '")', 1);
   RcptVndView.RecordClear;
   RcptFuncView.Fields.Field[5].PutWithoutVerification('10');
   RcptFuncView.Process;
   m_rcptHeaderView.Insert;


   RcptFuncView.Fields.Field[0].PutWithoutVerification(tmpStr);
   RcptFuncView.Fields.Field[5].PutWithoutVerification('2');
   RcptFuncView.Process;

   m_rcptHeaderView.Init;
   m_rcptHeaderView.Order := 0;
   m_rcptHeaderView.Fields.Field[0].PutWithoutVerification('0');
   m_rcptHeaderView.Init;
   m_rcptHeaderView.Order := 1;
   m_rcptDetailView.RecordClear;
   RcptVndView.RecordClear;
   AddCostView.RecordClear;
   RcptPoView.Init;
   RcptCmntView.Init;
 
Thanks Jay. When I recorded a macro, it did not capture inserting the detail lines. It just did it, and left them not complete. I thought there was some magic involved with the ...view.fields.field["FUNCTION"] = 4 going on in the dll. When I marked each PO line as complete, the macro logged the insertions and I could see what to do.

Bob Crowley
Programmer
Systems Engineering
 
Hi Bob,

Did you manually create your wrappers or did you let Delphi create the wrapper and then modify it?

Regards,

Django
(Delphi) Programmer and Accpac consultant
 
I'm not sure how we got the type libray for the xapi, but the wrappers I'm talking about were written by us. We create a wrapper for each view that we use, with the fields we need and getters and setters for each.
Basically so we can do : MyHeaderView.VendorId := '70111';
Instead of: MyHeaderView.Fields.Field[4].Value := '70111';
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top