Insert and modify in a Job Journal

martamarta Member Posts: 24
edited 2007-04-04 in Navision e-Commerce
Hello,

Somebody tried to insert lines in a Job Journal and works ?

I make a web part request template (header + line).
Table 210 line
Table 327 Header

In the codeunit 6823 I try to do something like the process to insert a sales line.
When I try to insert in sharepoint the error is: (Navision error (10500): The Sección diario proyecto does not exist. Identification fields and values: Journal Template Name='PROY',Name='' )

Is that method to insert Job Journal correct, any other idea to do this ? I have another problem similar like this in the code unit 6825 when I try to modify lines.

My code is:


InsertJobJournalLine(VAR XMLDocInHead : Automation "'Microsoft XML, v3.0'.DOMDocument";GUID : Text[50];VAR LineRecordRef : RecordRef)

// The folowing Fields need to be configured for the Head Data of inbound XML
// Field No. Field Name
// 1 Journal Template Name
// 73 Journal Batch Line

LineRecordRef.OPEN(DATABASE::"Job Journal Line",FALSE);

// Init the Record
LineRecordRef.INIT;

// Set the Primarykey Fields

LineFieldRef := LineRecordRef.FIELD(JobJournalLine.FIELDNO("Journal Template Name"));
EPSupportFunctions.ModifylFieldRefOnInsert(DATABASE::"Job Journal Line",JobJournalLine.FIELDNO("Journal Template Name"),
EPDecodeXML.GetValueByFieldIDFromHeadData(XMLDocInHead,JobJournalLine.FIELDNO("Journal Template Name")),
LineFieldRef);
JournalTemplateName := LineFieldRef.VALUE;
EPSupportFunctions.CreateTempHeadFilterTable(JobJournalLine.FIELDNO("Journal Template Name"),
JournalTemplateName,GUID);


LineFieldRef := LineRecordRef.FIELD(JobJournalLine.FIELDNO("Journal Batch Name"));
EPSupportFunctions.ModifylFieldRefOnInsert(DATABASE::"Job Journal Line",JobJournalLine.FIELDNO("Journal Batch Name"),
EPDecodeXML.GetValueByFieldIDFromHeadData(XMLDocInHead,JobJournalLine.FIELDNO("Journal Batch Name")),
LineFieldRef);
JournalBatchName := LineFieldRef.VALUE;


EPSupportFunctions.CreateTempHeadFilterTable(JobJournalLine.FIELDNO("Journal Batch Name"),
JournalBatchName,GUID);

// Get Line Number
LineRecordRef2.OPEN(DATABASE::"Job Journal Line",FALSE);
LineRecordRef2Filter := STRSUBSTNO('WHERE(1=CONST(%1),73=CONST(%2))',JournalTemplateName,JournalBatchName);

LineRecordRef2.SETVIEW(LineRecordRef2Filter);
IF LineRecordRef2.FIND('+') THEN BEGIN
LineFieldRef2 := LineRecordRef2.FIELD(JobJournalLine.FIELDNO("Line No."));
NextLineNo := LineFieldRef2.VALUE;
NextLineNo := NextLineNo + 10000;
END ELSE BEGIN
NextLineNo := 10000;
END;
LineRecordRef2.CLOSE;

LineFieldRef := LineRecordRef.FIELD(JobJournalLine.FIELDNO("Line No."));
LineFieldRef.VALUE(NextLineNo);

LineRecordRef.INSERT(TRUE);

// Insert Head Key fields for Answer
EPSupportFunctions.CreateTempHeadFilterKeys(JobJournalLine.FIELDNO("Journal Template Name"),GUID);
EPSupportFunctions.CreateTempHeadFilterKeys(JobJournalLine.FIELDNO("Journal Batch Name"),GUID);


Thanks!

Comments

  • PeterTomPeterTom Member Posts: 14
    i have the excaxt samme problem did you find a solution ?

    regards

    Peter
Sign In or Register to comment.