project QadFinancials > class BMfgSupplier > method UpdateMfgData

Description

Controls the processing of any update logic that is required when performing a create/modfiy operation on an MFG/PRO business component.
KEEP THE ANCESTOR TAG IN THE DESCENDANTS TO AVOID SCOPING PROBLEMS ON THE RECORD-AVAILABILITY
This method is the place holder for nay update ligic and complex mapping from the financials table to MFG/PRO.


Parameters


icMfgTableNameinputcharacterName of the MFG/PRO table name that is currently being processed. This is used to determine which logic to execute within the method in the cases where one business component maps to multiple tables in MFG/PRO.
icFinancialTableNameinputcharacterName of the Financial table name that is currently being processed. This is used to determine which logic to execute within the method in the cases where one business component has multiple tables that map to MFG/PRO.
ihFinancialDataBufferinputhandle
ihMfgDataBufferinputhandle
icMfgDomaininputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program/bmfgsupplier.p)

<ANCESTOR-CODE>

assign oiReturnStatus = -98.

/* 
   We need to map the credit terms here
   This is a complex mapping the value 
   of which is a combination of the White 
   payment condition and the discount condition.
*/


/* Retrieve the language code from the business relation */
<Q-8 run BusinessRelationByIdCode (all) (Read) (NoCache)
   (input tCreditor.BusinessRelation_ID, (BusinessRelationId)
    input '':U, (BusinessRelationCode)
    output dataset tqBusinessRelationByIdCode) in BBusinessRelation >
/* Converting the white language code to it's mfgpro language code no longer needed as these codes are equal */
for first tqBusinessRelationByIdCode:
    assign tvd_mstr.vd_lang = tqBusinessRelationByIdCode.tcLngCode.
end.

/*
* mapping search name to MFG/PRO sort name, assign the sort name as the headoffice's search name
*/
<Q-12 run AddressByAddressType (all) (Read) (NoCache)
   (input tCreditor.BusinessRelation_ID, (BusinessRelationId)
    input {&ADDRESSTYPECODESYSTEM-HEADOFFICE}, (AddressTypeCode)
    output dataset tqAddressByAddressType) in BBusinessRelation >

find first tqAddressByAddressType no-error.
   
if available tqAddressByAddressType 
then do: 
      assign tvd_mstr.vd_sort = tqAddressByAddressType.tcAddressSearchName.
end.   
else do:
      assign vhFcComponent  = ?
         oiReturnStatus = -25.
      <M-13 run CreateCorruption
         (input  'tCreditor':U (icTableName), 
          input  tCreditor.CreditorCode (icKey), 
          input  trim(#T-14'A head office address has not been defined for this customer.':100(46824)t-14#) (icDescription), 
          input  ? (ilSkipMessage), 
          output viFcReturnSuper (oiReturnStatus)) in BCorrLog>
end.   


if oiReturnStatus = -98
then assign oiReturnStatus = 0.