SendIndentApproval Request.

rranjanerprranjanerp Member Posts: 70
Hello,

If any one can suggest me some code sample for adding function SendIndentApprovalRequest. in the same codeunit 439 . I needed approval mngmt for indent ,but code is not getting complied.

Thanks,

Comments

  • rranjanerprranjanerp Member Posts: 70
    I am sorry , If I am directly asking for codeunit sample..

    Plz suggest my main problem is how to use document type here , though i have not made any field in indent header with name document type ..i am using
    varDocumentType::"None". how to correct this code..

    // sendindentapprovalrequest//
    TestSetup;
    WITH IndentHeader DO BEGIN
    IF Status <> Status::Open THEN
    EXIT(FALSE);

    IF NOT ApprovalSetup.GET THEN
    ERROR(Text004);

    IF NOT IndentLinesExist THEN
    ERROR(Text015,'Indent',"No.");

    TemplateRec.SETCURRENTKEY("Table ID","Document Type",Enabled);
    TemplateRec.SETRANGE("Table ID",DATABASE::"Indent Header");

    //Test := 'None';
    //EVALUATE(TemplateRec."Document Type",Test);


    TemplateRec.SETRANGE("Document Type",varDocumentType::None);
    TemplateRec.SETRANGE(Enabled,TRUE);
    IF TemplateRec.FIND('-') THEN BEGIN
    REPEAT
    IF TemplateRec."Limit Type" = TemplateRec."Limit Type"::"Credit Limits" THEN BEGIN
    ERROR(STRSUBSTNO(Text025,FORMAT(TemplateRec."Limit Type"),FORMAT(varDocumentType::None),
    "No."));
    END ELSE BEGIN
    IF NOT FindApproverIndent(IndentHeader,ApprovalSetup,TemplateRec) THEN
    ERROR(Text010);
    END;
    UNTIL TemplateRec.NEXT = 0;
    FinishApprovalEntryIndent(IndentHeader,ApprovalSetup,MessageType);
    CASE MessageType OF
    MessageType::AutomaticPrePayment:MESSAGE(Text128,varDocumentType::None,"No.");
    MessageType::AutomaticRelease:MESSAGE(Text003,varDocumentType::None,"No.");
    MessageType::RequiresApproval: MESSAGE(Text001,varDocumentType::None,"No.");
    END;
    END ELSE
    ERROR(STRSUBSTNO(Text129,varDocumentType::None));

    END;

    //makeapproval entry //
    //The function make approval entry is showing error of type conversion code :=Record


    WITH ApprovalEntry DO BEGIN
    SETRANGE("Table ID",TableID);
    SETRANGE("Document Type",DocType);
    SETRANGE("Document No.",DocNo);
    IF FIND('+') THEN
    NewSequenceNo := "Sequence No." + 1
    ELSE
    NewSequenceNo := 1;
    "Table ID" := TableID;
    "Document Type" := DocType;
    "Document No." := DocNo;
    "Salespers./Purch. Code" := SalespersonPurchaser;
    "Sequence No." := NewSequenceNo;
    "Approval Code" := ApprovalCode;
    "Sender ID" := USERID;
    Amount := ApprovalAmount;
    "Amount (LCY)" := ApprovalAmountLCY;
    "Currency Code" := CurrencyCode;
    "Approver ID" := ApproverId;
    IF ApproverId = USERID THEN
    Status := Status::Approved
    ELSE
    Status := Status::Created;
    "Date-Time Sent for Approval" := CREATEDATETIME(TODAY,TIME);
    "Last Date-Time Modified" := CREATEDATETIME(TODAY,TIME);
    "Last Modified By ID" := USERID;
    "Due Date" := CALCDATE(ApprovalSetup."Due Date Formula",TODAY);
    "Approval Type" := AppTemplate."Approval Type";
    "Limit Type" := AppTemplate."Limit Type";
    "Available Credit Limit (LCY)" := ExeedAmountLCY;
    INSERT;
    END;
Sign In or Register to comment.