CodeUnit 80 Sales-Post, few first lines

j.marseloj.marselo Member Posts: 102
OnRun(VAR Rec : Record "Sales Header")
IF PostingDateExists AND (ReplacePostingDate OR ("Posting Date" = 0D)) THEN BEGIN
"Posting Date" := PostingDate;
VALIDATE("Currency Code");
END;

IF PostingDateExists AND (ReplaceDocumentDate OR ("Document Date" = 0D)) THEN
VALIDATE("Document Date",PostingDate);
. . .

my darkness is, when and where those vars 'PostingDateExists' and 'ReplacePostingDate' assigned or called?
please help. thank you.
Kind regards, Joe Marselo | see my NAV blog joemarselo.wordpress.com | twitter @joemarselo

Answers

  • MaximusMaximus Member Posts: 105
    Hi,

    PostingDateExist is a function that is called as codeunit 80 is executed. It is not called from a different location. It is used to check if the user has rights to post using the Posting Date (see User Rights Setup) and to check if the Posting Date is allowed according to the G/L Setup.

    ReplacePostingDate is set when you use Batch Invoicing or Combine Shipments. Check the Options Tab and Help from these Reports to see what it does.

    Regards
  • SPost29SPost29 Member Posts: 148
    Maximus's answer is not accurate.

    PostingDateExists is a Boolean variable in CU 80 not a function

    It is set when the function SetPostingDate is called from a function external to CU 80.
    As you can see SetPostingDate does not check any user rights.
    SetPostingDate(NewReplacePostingDate : Boolean;NewReplaceDocumentDate : Boolean;NewPostingDate : Date)
      PostingDateExists := TRUE;
      ReplacePostingDate := NewReplacePostingDate;
      ReplaceDocumentDate := NewReplaceDocumentDate;
      PostingDate := NewPostingDate;
    

    SetPostingDate is usually called by the batch posting functionality

    SetPostingDate allows you to set a consistent posting date and, if required, a consistent document date on a batch of orders during posting.

    Steve
  • MaximusMaximus Member Posts: 105
    Sorry, SPost29 is right. I confused the PostingAllowed with the PostingDateExists function. :oops:
  • j.marseloj.marselo Member Posts: 102
    of course !!! batch posting routine!!! yeah ... i have overlooked it.

    Thanx thanx thanx ... Maximus , Spost
    Kind regards, Joe Marselo | see my NAV blog joemarselo.wordpress.com | twitter @joemarselo
Sign In or Register to comment.