project QadFinancials > class BBusinessRelation > method GetContactByAddress

Description

Method to get the details of Contact


Parameters


iiAddressIDinputinteger
tApiContactinput-outputtemp-table
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BMfgAddress.ApiReplicateFromFinancialsEndUSer
method BMfgAddress.ApiReplicateFromFinancialsShipTo
method BMfgAddress.MaintainDataDebtorShipto
method BMfgAddress.MaintainDataEndUser
method BMfgEndUser.ApiReplicateFromFinancials
method BMfgEndUser.UpdateMfgData


program code (program9/bbusinessrelation.p)

/* get any contacts that have bene updated in this instance first*/
for each tContact where
         tContact.Address_ID = iiAddressID:
    create tApiContact.
    buffer-copy tContact to tApiContact.     
end.

/* If the record does not exist in the instance then check the db*/
find first  tApiContact no-error.
if not available tApiContact
then do:    
   <Q-78 run ContactByAddress (all) (Read) (NoCache)
      (input iiAddressID, (AddressId)
       output dataset tqContactByAddress) in BBusinessRelation>
       
    /* Copy the resultset into the Address Temp-table */
    /* Using the tqAddressByType temptable to populate the ad_mstr does not work */
    for each tqContactByAddress 
        where tqContactByAddress.tiaddress_id = iiAddressID :

            assign 
              vhContactHandle = dataset tqContactByAddress:get-buffer-handle(1)
              vhApiContactHandle =  temp-table  tApiContact:default-buffer-handle.
              vhApiContactHandle:buffer-create.
      <M-14 run BufferCopy
         (input  vhContactHandle (ihFrom), 
          input  vhApiContactHandle (ihTo), 
          output viFcReturnSuper (oiReturnStatus)) in BBusinessRelation>
         if viFcReturnSuper <> 0 
         then assign oiReturnStatus = viFcReturnSuper.         
                  
  
    end. /* end of for each */
end.