Menu

Stock Adjustments

PostTrans XML API for Sage 200 - Stock Adjustments

The XML API for Sage 200 can easily create stock transfers in Sage 200, or write off stock, etc.  An XML file is submitted to import folder, and PostTrans XML API will process it creating a Stock movement in your Sage 200 company.

After creating a Stock movement, the XML file is moved to a processed folder.   If the process fails validation, then the error/errors are appended to the top of the file, and the file is moved to a Fail folder.  A user can then easily edit the Stock Movement XML file and resubmit to PostTrans XML API for Sage 200.

Click here for an overview of the XML API for Sage 200

Example – 300 Stock Adjust.xml

<?xml version="1.0" ?>
<sage200Data>
   <settings>  <!-- Optional overide settings/mappings -->
      <companyCode>DEMO03</companyCode>
      <mappings>
         SW_ADJignoreInsufficientFreeStockException=1
         SW_ADJignoreStockLevelBelowZeroException=1
         SW_ADJcreateBinsIfNeedBe=1
      </mappings>
   </settings>
   
  <AdjHeader>     
     <!-- ===== Header ==== -->  
      <THAdjType>AO</THAdjType>   <!-- Text 2 - Type of Adjustment, basically sets the IN/OUT for TLQty -->
             <!-- Values:AI,Adjustment In ,AO,Adjustment Out,FO,FOC OUT,PI,Project Issue,GR,Goods Return OUT,WO,Write Off-->

     <THTranRef>My Test</THTranRef>   <!-- Text 20 - Transaction Reference, overides vallue set on Header -->
      <THTranRef2>My Test 2</THTranRef2>   <!-- Text 20 - Transaction Reference2, overides vallue set on Header -->
      <THTransDate>2020-02-20</THTransDate>   <!-- Date - Transaction Date, overides the date set on Header -->
     
      <!-- One or more lines   -->       
      <AdjLine>
          <!-- ===== Adjustment Lines ==== -->
          <TLStock>CA/WALL/H70/OAK</TLStock>   <!-- Text 30 - Stock Code -->
          <TLQty>2</TLQty>   <!-- Double - Quantity  -->
          
          <!-- OUT as set by 'AO' in <THAdjType> -->       
          <TLLoc>FACTORY</TLLoc>   <!-- Text 20 - Location -->
          <TLBin></TLBin>   <!-- Text 20 - Bin Location.  Set to 'Unspecified' if no value. -->
          
          <!-- IN as Contra to above, if obmitted then stock will be Written Off -->
          <TLLoc>WAREHOUSE</TLLoc>   <!-- Text 20 - Location -->
          <TLBin></TLBin>   <!-- Text 20 - Bin Location.  Set to 'Unspecified' if no value. -->          
      </AdjLine>

     </AdjHeader>
</sage200Data>

Example – 310 Stock Adjust OUT and Write Off.xml

<?xml version="1.0" ?>
<sage200Data>
     <settings>  <!-- Optional overide API settings/mappings -->
      <companyCode>DEMO03</companyCode>
      <mappings>
         SW_ADJignoreInsufficientFreeStockException=1
         SW_ADJignoreStockLevelBelowZeroException=1
         SW_ADJcreateBinsIfNeedBe=1    //Create Bins within a location if they dont exist
      </mappings>
   </settings>
   
  <AdjHeader>     
     <!-- ===== Header ==== -->
      
      <THAdjType>AO</THAdjType>   <!-- Text 2 - Type of Adjustment, basically sets the IN/OUT for TLQty -->
             <!-- Values:AI,Adjustment In ,AO,Adjustment Out,FO,FOC OUT,PI,Project Issue,GR,Goods Return OUT,WO,Write Off-->

     <THTranRef>My Test</THTranRef>   <!-- Text 20 - Transaction Reference, overides vallue set on Header -->
      <THTranRef2>My Test 2</THTranRef2>   <!-- Text 20 - Transaction Reference2, overides vallue set on Header -->
      <THTransDate>2020-02-20</THTransDate>   <!-- Date - Transaction Date, overides the date set on Header -->
     <THWoCategory>Stock Write Offs</THWoCategory>   <!-- Text 20 - Write Off Category -->
     
      <!-- One or more lines   -->          

      <AdjLine>
          <!-- ===== Adjustment Lines ==== -->
          <TLStock>IR/HINGE</TLStock>   <!-- Text 30 - Sage 200 Stock Code -->
          <TLQty>1</TLQty>   <!-- Double - Quantity  -->
          
          <!-- OUT as set by 'AO' in <THAdjType> -->       
          <TLLoc>FACTORY</TLLoc>   <!-- Text 20 - Location SHOWROOM,WAREHOUSE,FACTORY -->
          <TLBin></TLBin>   <!-- Text 20 - Bin Location.  Set to 'Unspecified' if no value. -->
          
          <!-- IN as Contra to above, if obmitted then stock will be Written Off -->
          <TLContraLoc>SHOWROOM</TLContraLoc>   <!-- Text 20 - Location -->
          <TLContraBin>23</TLContraBin>   <!-- Text 20 - Bin Location.  Set to 'Unspecified' if no value. -->          
      </AdjLine>
      <AdjLine>
          <!-- ===== Write Off Stock ==== -->
          <TLStock>IR/HINGE</TLStock>   <!-- Text 30 - Sage 200 Stock Code -->
          <TLQty>1</TLQty>   <!-- Double - Quantity  -->
          
          <!-- OUT as set by 'AO' in <THAdjType> -->       
          <TLLoc>FACTORY</TLLoc>   <!-- Text 20 - Location SHOWROOM,WAREHOUSE,FACTORY -->
          <TLBin></TLBin>   <!-- Text 20 - Bin Location.  Set to 'Unspecified' if no value. -->
      
         <!-- We have no IN location so stock is written off -->   
      </AdjLine>
     </AdjHeader>
</sage200Data>

Example – 330 Stock Adjust Goods Return OUT.xml

<?xml version="1.0" ?>
<sage200Data>
     <settings>  <!-- Optional overide settings/mappings -->
      <companyCode>DEMO03</companyCode>
      <mappings>
         SW_ADJignoreInsufficientFreeStockException=1
         SW_ADJignoreStockLevelBelowZeroException=1
         SW_ADJcreateBinsIfNeedBe=1    //Create Bins within a location if they dont exist
      </mappings>
   </settings>
   
  <AdjHeader>     
     <!-- ===== Header ==== -->
      
      <THAdjType>GR</THAdjType>   <!-- GR,Goods Return OUT -->
             <!-- Values:AI,Adjustment In ,AO,Adjustment Out,FO,FOC OUT,PI,Project Issue,GR,Goods Return OUT,WO,Write Off-->

     <THTranRef>My Test</THTranRef>   <!-- Text 20 - Transaction Reference, overides vallue set on Header -->
      <THTranRef2>My Test 2</THTranRef2>   <!-- Text 20 - Transaction Reference2, overides vallue set on Header -->
      <THTransDate>2020-02-20</THTransDate>   <!-- Date - Transaction Date, overides the date set on Header -->
     <THAccRef>ABC001</THAccRef>   <!-- Text 8 - Customer/Supplier Ref. Must be set to Customer or Supplier for Stock adjustment type FO or GR -->
     
      <AdjLine>
          <!-- ===== Adjustment Lines ==== -->
          <TLStock>IR/HINGE</TLStock>   <!-- Text 30 - Stock Code -->
          <TLQty>1</TLQty>   <!-- Double - Quantity  -->
          
          <!-- OUT as set by 'AO' in <THAdjType> -->       
          <TLLoc>FACTORY</TLLoc>   <!-- Text 20 - Location SHOWROOM,WAREHOUSE,FACTORY -->
          <TLBin></TLBin>   <!-- Text 20 - Bin Location.  Set to 'Unspecified' if no value. -->       
      </AdjLine>
      <AdjLine>
          <!-- ===== Adjustment Lines ==== -->
          <TLStock>IR/SCREW/4x20</TLStock>   <!-- Text 30 - Stock Code -->
          <TLQty>2</TLQty>   <!-- Double - Quantity  -->
          
          <!-- OUT as set by 'AO' in <THAdjType> -->       
          <TLLoc>FACTORY</TLLoc>   <!-- Text 20 - Location SHOWROOM,WAREHOUSE,FACTORY -->
          <TLBin></TLBin>   <!-- Text 20 - Bin Location.  Set to 'Unspecified' if no value. -->       
      </AdjLine>
     </AdjHeader>
</sage200Data>

XML API Tags for Sage 200 Entity 'StockAdjHeader'

Tag Name

Data Type

Description

Header Values:

THAdjType^

Text 2 Head

Type of Adjustment, basically sets the IN/OUT for TLQty
        In Cell Searching values:Stock Adjustment Type
                  AI, Adjustment In
                  AO, Adjustment Out
                  FO, FOC OUT
                  PI, Project Issue
                  GR, Goods Return OUT
                  WO, Write Off

THAccRef^

Text 8 Head

Customer/Supplier Ref. Must be set to Customer or Supplier for Stock adjustment type FO or GR
    In Cell Searching values in table THADJAccCode

THTranRef

Text 20 Head

Transaction Reference, overides vallue set on Header

THTranRef2

Text 20 Head

Transaction Reference2, overides vallue set on Header

THTransDate

Date Head

Transaction Date, overides the date set on Header

THProjectCode^

Text 30 Head

Project if Project stock issue. Can be Projectcode/Phase
    In Cell Searching values in table PROJECTADJCODE

TLPhaseFilter^

Text 30

Phase Filter. If project has duplicate Project items in different phases, this can direct to correct Phase
    Sage V21 onwards
    In Cell Searching values in table PROJECTADJPHASECODE

Adjustment Lines:

TLStock^

Text 30

Product Description. PostTrans stops importing after finding 5 consecutive blank cells.
    In Cell Searching values in table ProdADJCodeNoDesc

TLDetails

Text 60

Details

TLQty^

Double

Quantity IN/OUT
    Changes in this cell will recalc other cells. Delete ^ to disable this calculation.

Location:

TLLoc^

Text 20

Location
    In Cell Searching values in table AdjTLLoc

TLBin^

Text 20

Bin Location. Set to 'Unspecified' if no value.
    In Cell Searching values in table AdjTLBIN

TLContraLoc^

Text 20

Contra Location, Use this to move stock between locations. Set type to "1,Adjustment In" makes TLQty,TLLoc,TLBin the IN Qty/location, and thus a Ref in TLMoveLoc,TLMoveBin specify the Location and Bin to move stock from.
    In Cell Searching values in table AdjTLContraLoc

TLContraBin^

Text 20

Contrat Bin Location. Set to 'Unspecified' if column not in template.
    In Cell Searching values in table AdjTLContraBIN

TLCostPrice

Currency

Cost Price

TLStdPrice

Currency

Std Sales Price

TLSellByDate

Date

Sell lBy Date

TLUseByDate

Date

Use By Date

TLBatSerial^

Text 30

Batch Ref or for Serial then a comma seperated list or list with each on new line
    In Cell Searching values in table AdjTLBatSerial

TLBatSerRef

Text 30

Batch/Serial Ref. Searching is provided on AO when location/BIN has been entered

THWoCategory^

Text 20 Head

Write Off Category
    In Cell Searching values in table WOCategory

Analysis Codes:

TLAnal1^

Text 60

Analyisis code 1
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_01

TLAnal2^

Text 60

Analyisis code 2
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_02

TLAnal3^

Text 60

Analyisis code 3
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_03

TLAnal4^

Text 60

Analyisis code 4
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_04

TLAnal5^

Text 60

Analyisis code 5
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_05

TLAnal6^

Text 60

Analyisis code 6
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_06

TLAnal7^

Text 60

Analyisis code 7
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_07

TLAnal8^

Text 60

Analyisis code 8
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_08

TLAnal9^

Text 60

Analyisis code 9
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_09

TLAnal10^

Text 60

Analyisis code 10
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_10

TLAnal11^

Text 60

Analyisis code 11
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_11

TLAnal12^

Text 60

Analyisis code 12
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_12

TLAnal13^

Text 60

Analyisis code 13
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_13

TLAnal14^

Text 60

Analyisis code 14
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_14

TLAnal15^

Text 60

Analyisis code 15
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_15

TLAnal16^

Text 60

Analyisis code 16
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_16

TLAnal17^

Text 60

Analyisis code 17
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_17

TLAnal18^

Text 60

Analyisis code 18
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_18

TLAnal19^

Text 60

Analyisis code 19
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_19

TLAnal20^

Text 60

Analyisis code 20
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_20


Req = Field is required    EOF = End of file, Stop when no more values    

Head  A header tag can be used in header section, before row 30, of the transaction template.  Or in the rows data of data, below row 30, of the template like a traditional CSV importer.

With data type Yes/No fields, if cell starts with 'y' or 'Y' is taken as TRUE

Where ^ denotes a In Cell Code Search, delete ^ at end of tag, to turn off code search

All Text fields are trimmed (spaces before) by default. Add ' to the end of the tag name to stop this.