Options

Print PO only if Status is RELEASED

lavanyaballurgilavanyaballurgi Member Posts: 235
Hello guys,

Here is my requirement - do not allow printing of Purchase ORder untill the status is RELEASED.

Here is my code -

Purchase Header - OnPreDataItem()
IF NOT CurrReport.PREVIEW THEN BEGIN
IF STATUS =<> STATUS::RELEASED THEN
ERROR(TEXT50000, "No.");
END;

It throws the error for OPEN as well as RELEASED purchase orders. What might be wrong?

Answers

  • Options
    KeeperRUKeeperRU Member Posts: 58
    IF STATUS =<> STATUS::RELEASED THEN
    

    What the =<> ??
    I know only <>.
    :D
  • Options
    vijay_gvijay_g Member Posts: 884
    Use it. TESTFIELD(Status,Status::Release);
  • Options
    lavanyaballurgilavanyaballurgi Member Posts: 235
    Oh thats typo :)
    Its actually <>
  • Options
    KeeperRUKeeperRU Member Posts: 58
    Error is here:
    Purchase Header - OnPreDataItem()

    At that moment you don't have a Record. (it's empty)
    And Status always = 0
  • Options
    lavanyaballurgilavanyaballurgi Member Posts: 235
    Yes keeperRU you are right... using the debugger I could see that the STATUS is always empty. So where else do you suggest me to keep this code?
  • Options
    lavanyaballurgilavanyaballurgi Member Posts: 235
    Thanks KeeperRU ... placing my code on <Purchase Header - OnAfterGetRecord()> did the trick.
    Thanks vijay_g for suggesting TESTFIELD.
    I am marking this post as resolved :thumbsup:
Sign In or Register to comment.