Skip to Content

(Help Required) Insert / Update Primary Form Item in (Journal Voucher or Journal Entry) using DiApi

Hello Everyone,

While adding / Updating JournalVoucher using SAPDIAPI, application is getting crashed !!! Please look into this issue & suggestion me some solution :-

The below line crashes while adding Journal Voucher ==> Property ==> "Primary Form Item"

objSDocuments.JournalEntries.Lines.PrimaryFormItems.CashFlowLineItemID = objHeader.PrimaryFormItemId; (Primary form Item)

SAP BUSINESS ONE 9.2 PL 08

SAPbobsCOM.JournalVouchers objSDocuments= (SAPbobsCOM.JournalVouchers)oCmpy.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oJournalVouchers);

objSDocuments.JournalEntries.Series = Convert.ToInt32(objGeneralLedgerManager.GetSeries());
objSDocuments.JournalEntries.DueDate = dtPostingDate;
objSDocuments.JournalEntries.ReferenceDate = dtPostingDate;
objSDocuments.JournalEntries.TaxDate = dtPostingDate;
objSDocuments.JournalEntries.UseAutoStorno = BoYesNoEnum.tYES;
objSDocuments.JournalEntries.StornoDate = dtPostingDate.AddDays(1);
foreach (JHeaderLines objHeader in lstHeaderLines)
{
objSDocuments.JournalEntries.Lines.AccountCode = objHeader.AccountCode;
objSDocuments.JournalEntries.Lines.Debit = (Double)objHeader.Debit;
objSDocuments.JournalEntries.Lines.Credit = (Double)objHeader.Credit;
if (objHeader.PrimaryFormItemId > 0)
{
try
{
objSDocuments.JournalEntries.Lines.PrimaryFormItems.CashFlowLineItemID = objHeader.PrimaryFormItemId;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}

objSDocuments.JournalEntries.Lines.Add();
}


string iDraftOrder = "";
int iError = objSDocuments.Add();

Some more details about the error : Please find the application / windows logs -

untitled-1.jpg (91.6 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Aug 11, 2017 at 11:10 AM

    Hi Rahul,

    One important thing, is it getting crashed every time or randomly it is crashing? Also is it specific to one particular environment or it is crashing everywhere.

    There can be the issues while there is DI API version mismatch on client machines. For this, you can refer to SAP Note 861599.

    Kind regards,

    ANKIT CHAUHAN

    SAP SME Support

    Add comment
    10|10000 characters needed characters exceeded

    • Thanks Ankit for your reply.

      We have installed on SAP Hana on the server & I am doing the development on it during the debugging or execution of the app I am stumbling upon this error. One more thing when I set the value to primary form item @ that time, the error pops out.

      1. Crashed Everytime : Yes
      2. No Version Mis-Match : Cause I am doing the development on the server only so no issue related to this.
      3. DI API version mismatch on client machines : No, We have installed SAP Hana on Fresh Server so no issue related to version mismatch