HowTo modify a screen behaviour

SOLVED

Good day everyone!

I'm developing some new features in SAGE X3 V9 for my company, by the way I'm stuck in a point and that's why I come to the forum to ask, all the help would be really appreciated.

I'm still quite new coding in 4GL but I have been already able to create new screens and to add functionality to them.

We have an activity code (all new fields,tables, modification are being tagged with this activity code in order to protect our modifications against updates) and I would like to add for example to the screen/window Supplier (BPS0-> GESBPS)  an INSERT to one of the table that I already created with some fields that I have in the current form.

The question is:

Where/How I can add code to the ACTION SAVE in that form to create an insert statement to our own table keeping the current functionality of the screen and of course should be protected with our activity code? Which one is the best way to achieve this? Maybe about the activity code I should add to the screen BPS0 our activity code to protect the screen against any changes made by updates?

Thanks for the help I hope I explained correctly the question :)

  • 0
    SUGGESTED
    You can put code in the specific processing SPEBPS for the CREATION and MODIF actions. Have a look at the source for SUBBPS and the help documentation for the Object Template and that should give you a few hints.
  • 0 in reply to bbarnes
    Hi bbarnes, thanks a lot for your answer I really appreciate it.

    I tried the option that you suggested, I checked the specific script and the standard script. I think I achieve what I wanted but please confirm if i'm correct about what I have done.

    I added at the specific script ACTIONS for create and modify the record. And at the standard script I added at the end of the creation/modify routine the next instruction:

    Gosub MYPROC From SPECIFICSCRIPT: If GOK<1 Return : Endif

    Is that the correct approach? This modifications will be protected if SAGE X3 ERP if will get updated?

    Thanks again for your help!
  • 0 in reply to JackMorton
    verified answer
    You're almost there.

    The main rule to follow when customising code is - don't modify the standard scripts. These will be overwritten whenever X3 is updated, which means that you'll lose any changes.

    The good thing is that X3 provides plenty of options for customising without changes being overwritten. The option I was thinking of actually uses the object script template. This is documented in online help. Go to Technical help -> Templates (under the Classic pages column) -> Object. Click on Functioning to read general information about how the template works.

    To include your custom code, you'll need to put it in a script named SPEBPS - in your folder/TRT directory, not the reference folder/TRT DIRECTORY - and include an $ACTION label at the beginning of the script, with cases for the CREATION and MODIF actions. These will run for creation and modification respectively. Have a look at the top of SUBBPS for an existing $ACTION label, although this one will have many more cases than you will need for SPEBPS.

    Keeping in mind that your code may be slightly different depending on whether the object is being created or modified, you could actually have a label called MYPROC with 'Gosub MYPROC' in both the creation and modif cases.

    Best of luck.
  • 0 in reply to bbarnes
    bbarnes thank you so much for your assistance!

    I have been working on this all weekend and I finally achieved because of your help, I found the documentation and I have my first example working! I really appreciate your help and your assistance.

    Thank you so much!
    Kind regards.