Adding a Statistical Journal Entry Record

The following example shows how to create a statistical journal entry record with three lines.

C#

          private void addStatisticalJournalEntry()
{

   // Create the statistical journal entry object.

   StatisticalJournalEntry newSJE = new StatisticalJournalEntry();


   // Create an external ID.

   newSJE.externalId = "101A";


   // Define the subsidiary (OneWorld accounts only).

   RecordRef mySubsidiary = new RecordRef();
   mySubsidiary.type = RecordType.subsidiary;
   mySubsidiary.internalId = "1";
   newSJE.subsidiary = mySubsidiary;


   // Declare the unit of measure type. All accounts named in the sublist
   // must be accounts that use this measure type.
                        
   RecordRef unitOfMeasureReference = new RecordRef();
   unitOfMeasureReference.type = RecordType.unitsType;
   unitOfMeasureReference.internalId = "4";
   newSJE.unitsType = unitOfMeasureReference;
        

   // Create a sublist that can have up to three lines.

   newSJE.lineList = new StatisticalJournalEntryLineList();
   newSJE.lineList.statisticalJournalEntryLine = new StatisticalJournalEntryLine[3];


   // Create RecordRefs to define the three accounts to be adjusted. These accounts
   // must all have a unit of measure that matches the one you referenced for the  
   // record via the unitsType body field.

   RecordRef firstAccount = new RecordRef();
   firstAccount.internalId = "248";

   RecordRef secondAccount = new RecordRef();
   secondAccount.internalId = "249";

   RecordRef thirdAccount = new RecordRef();
   thirdAccount.internalId = "253";


   // Define the three adjustments. The first line below reduces the balance of an  
   // account; the next two increase the balances of their accounts.

   newSJE.lineList.statisticalJournalEntryLine[0] = new StatisticalJournalEntryLine();
   newSJE.lineList.statisticalJournalEntryLine[0].account = firstAccount;
   newSJE.lineList.statisticalJournalEntryLine[0].debit = -500;
   newSJE.lineList.statisticalJournalEntryLine[0].debitSpecified = true;

   newSJE.lineList.statisticalJournalEntryLine[1] = new StatisticalJournalEntryLine();
   newSJE.lineList.statisticalJournalEntryLine[1].account = secondAccount;
   newSJE.lineList.statisticalJournalEntryLine[1].debit = 1200;
   newSJE.lineList.statisticalJournalEntryLine[1].debitSpecified = true;

   newSJE.lineList.statisticalJournalEntryLine[2] = new StatisticalJournalEntryLine();
   newSJE.lineList.statisticalJournalEntryLine[2].account = thirdAccount;
   newSJE.lineList.statisticalJournalEntryLine[2].debit = 2000;
   newSJE.lineList.statisticalJournalEntryLine[2].debitSpecified = true;
            
   _service.add(newSJE);
                       
} 

        

SOAP Request

          <soap:Body>
   <add xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
      <record xmlns:q1="urn:general_2017_1.transactions.webservices.netsuite.com" xsi:type="q1:StatisticalJournalEntry" externalId="101A">
         <q1:subsidiary internalId="1" />
         <q1:unitsType internalId="4" />
         <q1:lineList>
            <q1:statisticalJournalEntryLine>
               <q1:account internalId="248" />
               <q1:debit>-500</q1:debit>
            </q1:statisticalJournalEntryLine>
            <q1:statisticalJournalEntryLine>
               <q1:account internalId="249" />
               <q1:debit>1200</q1:debit>
            </q1:statisticalJournalEntryLine>
            <q1:statisticalJournalEntryLine>
               <q1:account internalId="253" />
               <q1:debit>2000</q1:debit>
            </q1:statisticalJournalEntryLine>
         </q1:lineList>
      </record>
   </add>
</soap:Body> 

        

SOAP Response

          <soapenv:Body>
   <addResponse xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
      <writeResponse>
         <platformCore:status isSuccess="true" xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
         <baseRef internalId="7331" externalId="101A" type="statisticalJournalEntry" xsi:type="platformCore:RecordRef" xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
      </writeResponse>
   </addResponse>
</soapenv:Body> 

        

Related Topics

General Notices