Employee Portal - Insertion & Modification Error

Hi Experts,

I have configured the Employee Portal, done full setup for Header + Line forms.

I have written the Code in Codeunits for Inserting and Modifying the Records. Insertion & Modification of Header is working fine. But i am getting the error while doing the same in Lines.

Here is my code for Line Insertion :
// The following Fields need to be configured for the Head Data of inbound XML
// Field No. Field Name
// 15 Requisition No.
// 1 Line

LineRecordRef.OPEN(DATABASE::“Indent Line”,FALSE);

// Init the Record
LineRecordRef.INIT;

// Set the Primarykey Fields
LineFieldRef := LineRecordRef.FIELD(IndLine.FIELDNO(IndLine.“Requisition No.”));
EPSupportFunctions.ModifylFieldRefOnInsert(DATABASE::“Indent Line”,IndLine.FIELDNO(IndLine.“Requisition No.”),
EPDecodeXML.GetValueByFieldIDFromHeadData(XMLDocInHead,IndLine.FIELDNO(IndLine.“Requisition No.”)),LineFieldRef);
DocumentNo := LineFieldRef.VALUE;
EPSupportFunctions.CreateTempHeadFilterTable(IndLine.FIELDNO(IndLine.“Requisition No.”),DocumentNo,GUID);

// Get Line Number
LineRecordRef2.OPEN(DATABASE::“Indent Line”,FALSE);
LineRecordRef2Filter := STRSUBSTNO(‘WHERE(15=CONST(%1))’,DocumentNo);

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

LineFieldRef := LineRecordRef.FIELD(IndLine.FIELDNO(IndLine.Line));
LineFieldRef.VALUE(NextLineNo);

LineRecordRef.INSERT(TRUE);

// Insert Head Key fields for Answer
EPSupportFunctions.CreateTempHeadFilterKeys(IndLine.FIELDNO(IndLine.“Requisition No.”),GUID);

Error : Navision error (10500): You cannot enter ‘ERROR))’ in Integer.

Modifying the Lines: Following is the Code:

ReturnCode := 0;

FilterString :=
STRSUBSTNO(‘WHERE(15=CONST(%1),(1=CONST(%2))’,
DecodeXML.GetValueByFieldIDFromLineData(XMLDocInLine,IndLine.FIELDNO(IndLine.“Requisition No.”)),
DecodeXML.GetValueByFieldIDFromLineData(XMLDocInLine,IndLine.FIELDNO(IndLine.Line)));

LineRecordRef.OPEN(DATABASE::“Indent Line”,FALSE);
LineRecordRef.SETVIEW(FilterString);

xLineRecordRef.OPEN(DATABASE::“Indent Line”,FALSE);
xLineRecordRef.SETVIEW(FilterString);
IF xLineRecordRef.FIND(’-’) THEN;

IF SupportFunctions.CompareHashValues(DecodeXML.GetHashValue(XMLDocInLine),LineRecordRef) THEN BEGIN
EncodeXML.AddFieldToValidationDoc(XMLDocValField,IndLine.FIELDNO(IndLine.“No.”));
EncodeXML.AddFieldToValidationDoc(XMLDocValField,IndLine.FIELDNO(IndLine.“Req.Date”));
EncodeXML.AddFieldToValidationDoc(XMLDocValField,IndLine.FIELDNO(IndLine.Quantity));

DecodeXML.ModifyRecord(XMLDocInLine,LineRecordRef,XMLDocValField,DATABASE::“Indent Line”,
FALSE,TRUE,AdditionalValues[1],AdditionalValues[2]);

LineRecordRef.MODIFY(TRUE);
END ELSE BEGIN
ReturnCode := 20;
END;

LineFieldRef := LineRecordRef.FIELD(IndLine.FIELDNO(IndLine.“Requisition No.”));
tmpValue := LineFieldRef.VALUE;
SupportFunctions.CreateTempHeadFilterTable(IndLine.FIELDNO(IndLine.“Requisition No.”),tmpValue,GUID);

SupportFunctions.CreateTempHeadFilterKeys(IndLine.FIELDNO(IndLine.“Requisition No.”),GUID);

Error : Navision error (10500): You cannot enter ‘WHERE(15=CONST(REQ-014),(1=CONST(10000))’ in FieldNo.

I don’t know where i did the mistake… :(

Thanks…

Aswini