error in my code

hi

Can anyone please tell me what is wrong with my code? I have added a button to the Jnl Entry window which fires off an action with 2 parameters attached: JOURNAL being Journal Type [M:HAE0]TYP and  VCRNUM being journal Number [M:HAE0]NUM. The SPE for this action is as follows

$ACTION

  Case ACTION
    When "OUVRE" : Gosub OUVRE
    When "DEBUT" : Gosub DEBUT
    When "BOUTON" : Gosub BOUTON
  Endcase

Return


$OUVRE

  If !clalev([F:YHAE])
    Local File GACCENTRY [F:YHAE]
  Endif

Return


$DEBUT
 
  Read [F:YHAE]HAE0=PARAM(1)(2)
  If !fstat
    [M:YUGS]STA=[F:YHAE]STA
    [M:YUGS]TYP=[F:YHAE]TYP
    [M:YUGS]NUM=[F:YHAE]NUM
    Affzo [M:YUGS]
  Else
    FIN=1
  Endif

Return


$BOUTON

  If BOUT='z'

    Local Integer SUCCESS

    Trbegin [YHAE]
    Readlock [F:YHAE]HAE0=PARAM(1)(2)
    If !fstat
      [F:YHAE]STA = [M:YUGS]STA
      Rewrite [F:YHAE]
      If !fstat
        SUCCESS=1
      ELSe
        SUCCESS=0
      Endif
    Else
      SUCCESS=0
    Endif

    If SUCCESS=1
      Commit
      FIN=1
    Else
      Rollback
      Infbox('Update failed with status of'-num$(fstat))
    Endif
 
  Endif

Return

When I click on the button, I get bombed out of the screen

Thanks

  • 0
    By bombed out of the screen I take it to mean that you received no error, but simply exited the screen, correct? If that is so, can you put a DBGAFF at the beginning of each label, then go back to the screen, press the button and let us know what the last line of code was that executed just before the ungraceful exit?
  • 0 in reply to Delamater

    thanks for the reply. yes you are correct - straight back to the menu!

    i added Dbgaff at the start of each label viz:


    $OUVRE
    Dbgaff
      If !clalev([F:YHAE])
        Local File GACCENTRY [F:YHAE]
      Endif

    etc...

    validated the screen and the window and the journal entry transac. retry and I get this:

    When I click Continue I'm sent back to the menu.

    PS -  I do normally get error messages for other errors but I seem to get this from time to time when IE can't process the error - not sure why

    thanks for the help

  • 0 in reply to jfly62
    sorry, just realised that the "Navigator has caused an error - Continue or Close Application" box also has a link to the error message and I should have clicked on Details of the error.
    which are:

    Error :
    Nb=[2] P1: P2:[object Object]
    X3BaseModule.receiveX3SUBPRO
    [object Error] 0 7 Error 7

    errn='7'
    errp='@TRAIN.TRT/WGWOGG1PAGE$adx'
    errl='433'
    errm='[M:HAE0] : Class nonexistent'
    Reply='<spgm errl="433" errm="[M:HAE0] : Class nonexistent" errn="7" errp="@TRAIN.TRT/WGWOGG1PAGE$adx" errt="1"><resu size="-1" typ="NULL"/><param num="3" poste="0"><resu size="1" typ="INT"><![CDATA[1]]></resu></param></spgm>
    '
    caller=[setAckCallRep(aReply)]

    thanks
  • 0 in reply to jfly62
    Gotcha.

    Let's just rule out a couple other quick things, then we can move on to your code and maybe the parameter definition on your screen if we need to.

    Some questions:
    When you validated the window, did you perform a global validation on the window, or just press the validate button at the bottom of the screen? If you didn't do the global validation option, please try and let us know. It's located off the menu bar at the top.


    Two posts ago you mentioned you got a message when you validated, but the screenshot for me is showing blank on our forums here. Could you describe what that screenshot was intending to show?

    Is this version 6 of X3?

    What line of code did it die on? Or are you saying that now you cannot enter the function at all? If that is the case, close out of X3 entirely and relaunch. My experience with X3 is that when you exit a screen ungracefully, occasionally there is variable preservation when there shouldn't be and you can get odd results like that.

    In general, your code looks fine. You could define SUCCESS = 0 up top and that way you don't need to re-set that for each condition, but that's just a style thing, no big deal.

    I'd say, if it isn't having challenges on a specific line then it's likely with the screen setup, perhaps with your action you mentioned in the first post. Perhaps the syntax of the action parameters is an issue, not sure at this point. When you respond from above I think that might help push us in the right direction.

    Cheers,
    Bob
  • 0 in reply to Delamater
    Bob
    Not sure if you got the message below which i sent straight after the last one but noticed it was "in reply to jfly62" which is me not you so you may not have got an email.....!!
    i'll also check what you've just suggested about the global validation

    this was the text of my last email:

    sorry, just realised that the "Navigator has caused an error - Continue or Close Application" box also has a link to the error message and I should have clicked on Details of the error.
    which are:

    Error :
    Nb=[2] P1: P2:[object Object]
    X3BaseModule.receiveX3SUBPRO
    [object Error] 0 7 Error 7

    errn='7'
    errp='@TRAIN.TRT/WGWOGG1PAGE$adx'
    errl='433'
    errm='[M:HAE0] : Class nonexistent'
    Reply='<spgm errl="433" errm="[M:HAE0] : Class nonexistent" errn="7" errp="@TRAIN.TRT/WGWOGG1PAGE$adx" errt="1"><resu size="-1" typ="NULL"/><param num="3" poste="0"><resu size="1" typ="INT"><![CDATA[1]]></resu></param></spgm>
    '
    caller=[setAckCallRep(aReply)]

    thanks
  • 0 in reply to Delamater

    Ok just tried this:

    1.  global validation on YUGS (thats the little window that should pop up with the Journal no. and the drop-down Status field and a save button)

    2. global validation on OGGSTD

    3. validated the Journal Entry Transaction 1PAGE

    Tried the button again, same problem: gives me the "Continue or Close Application" window. The details are :

    Error :

    Nb=[2] P1: P2:[object Object]

    X3BaseModule.receiveX3SUBPRO

    [object Error] 0 7 Error 7

    errn='7'

    errp='@TRAIN.TRT/WGWOGG1PAGE$adx'

    errl='433'

    errm='[M:HAE0] : Class nonexistent'

    Reply='<spgm errl="433" errm="[M:HAE0] : Class nonexistent" errn="7" errp="@TRAIN.TRT/WGWOGG1PAGE$adx" errt="1"><resu size="-1" typ="NULL"/><param num="3" poste="0"><resu size="1" typ="INT"><![CDATA[1]]></resu></param></spgm>

    '

    caller=[setAckCallRep(aReply)]

    Yes, every time it bombs out I relaunch from scratch as it won't let me back into the Journal function anyway

    My action has 2 params:

    JOURNAL defined as [M:HAE0]TYP

    VCRNUM defined as [M:HAE0]NUM

    This might be the problem cos I looked at line 433 of TRAIN.TRT/WGWOGG1PAGE and it refers to these params

    In the ACTION itself they are both defined as Character, By Value

    thanks for all the help

    jay

  • 0 in reply to jfly62
    HI,

    What happens if you remove the parameter and globally validate the OGGSTD window again? Does it still bomb upon entry?
    Can you define how you added the button on the OGGSTD window?
    1. What is the button code?
    2. What did you set for the management setting (non-validating?)?
    3. What action code did you assign it?

    Was this the only change you made to this window?

    Any chance you'll be at Summit this week so I can take a look at the system directly?

    Bob
  • 0 in reply to Delamater
    Hi Bob
    thanks for sticking with this!

    When I remove the parameters from the action, globally validate the OGGSTD window and then run the routine and hit the button, I don't get bombed out but i do get the same error message although its directly displayed on screen in the error msg box. i.e.
    errn='7'
    errp='@TRAIN.TRT/WGWOGG1PAGE$adx'
    errl='433'
    errm='[M:HAE0] : Class nonexistent'

    i then have to return to the menu, exit X3 and relaunch

    Your other questions:
    I added the button to OGGSTD in the 2nd tab of the window (Buttons/Menus) by adding a new entry at the bottom defined as:
    Type:button
    Code: z
    Controls: non Validating
    Button text: Update Status
    Action: YUPDGACSTA
    Activity: ZSOV

    the action YUPDGACSTA is defined as follows:
    Module: Accounting
    Template: Window Entry
    Type: Miscellaneous
    Main Window: YUGS
    Std Process: SPEYUGS (the code I usbmitted in my op)
    Specific Process: SUBYUGS (contains no code)
    Criteria Window: blank
    Subprograms: blank
    Expression: blank
    Accessibility: i tried both with 'public' ticked and also unticked

    Parameter Definitions: as mentioned previously
    current field: not ticked
    action before/after field: not ticked

    My window YUGS is defined as follows:
    Active: yes
    Module: supervisor
    Window Type: Sundry
    Display: Dialogue Box
    Header Screen: blank
    tabs: YUPDGACSTA

    On the Buttons/Menus tab i have one entry
    Type: Button
    Code: z
    Controls: validating
    Button Text: Save
    Action: SPE
    NO Parameters

    the Screen YUPDGACSTA is defined as follows:
    Module: supervisor
    Size: Dialogue Box 5 x 40
    Std Process: SUBYUGS
    Specific Process: SPEYUGS

    The block type is List

    There are 3 fields defined in the Fields tab


    yes this was the only change I made to the OGGSTD window

    unfortunately, no I won't be at the summit

    cheers and thanks again
    jay