Options

Posting Issue

rajinivmrajinivm Member Posts: 42
Dear All,
I'm calling Posting Code from my Customized form - Button - On Push Trigger:

CODEUNIT.RUN(CODEUNIT::"Sales-Post (Yes/No)",recSalesHd);

I got this following Error message from this code:

IF Invoice THEN BEGIN
IF NOT ("Document Type" IN ["Document Type"::"Return Order","Document Type"::"Credit Memo"]) THEN
{ TESTFIELD("Due Date");}
Window.OPEN(
'#1#################################\\' +
Text002 +
Text003 +
Text004 +
Text005)
END ELSE
Window.OPEN(
'#1#################################\\' +
Text006);

Error message:

"Form name" cannot be closed, because it is locked by 'Microsoft Business Solutions-Navision'. Please finish 'Microsoft Business Solutions-Navision' before closing.

Please find the attachment error Screen shot.

Can you help me on this? How can I avoid this bug?

Regards,
Rajini

Comments

  • Options
    DenSterDenSter Member Posts: 8,304
    That code doesn't cause that error, it is caused by closing NAV while a certain form is still open. You have to close the form before you close the NAV client.
  • Options
    rajinivmrajinivm Member Posts: 42
    Thanks Daniel.
    Absolutely....Still some form is opened. But, I don’t how to close these forms from current form. Before calling the posting code.

    Please help me on this if you have any idea?

    Regards,
  • Options
    DenSterDenSter Member Posts: 8,304
    You're going to be much more detailed in what you are doing, because the code that you pasted does not cause this issue. Turn on the debugger and see where it breaks.
  • Options
    rajinivmrajinivm Member Posts: 42
    But, I didn't try to close NAV client. Code is breaking at Window.open message.
    Just I'm calling posting engine.
    Even, I closed all opened forms except current form. But, still I got this error.
    I don't know why its trying to close NAV client automatically while posting.
  • Options
    DenSterDenSter Member Posts: 8,304
    I'll say it again: this would not cause that error. The error is cause by a form closing, and Window.OPEN does not close a form. The posting routine does not use any forms either, so unless you have changed the code in the posting routines to use forms (which is a very scary thought) that's not where the error happens either.

    If you don't provide any more information, then I won't be able to help you further.
  • Options
    lakshmivallurulakshmivalluru Member Posts: 168
    Hi,

    Is the form you got this button on which you wrote code called "Pending Delivery challen"?
    What is the full code you wrote on this Button onpush trigger?
    LR
  • Options
    rajinivmrajinivm Member Posts: 42
    Finally we cracked this issue. Current form is referring NAV original table. We are calling NAV posting code unit from this window. Posting code unit is not allowing us to display the record through form when code unit is running for posting.

    Thanks for all.
    Rajini
Sign In or Register to comment.