SPE Actions Stock Change control

Hello, 

I am very new to trying to develop on SAGE and my only resource is the French bits of vertical already in the system so I apologise in advance. 

Ultimately what I am trying to do is, put a control on the ITMREF field on the GESSCS (Stock Change) function for a particular entry transaction. 

What I want it to do is to only allow products to be entered when the product category starts with "03" which is our intermediate manufactured good. 

What I have tried is the below

Subprog AS_ITMREF(VALEUR)
     Variable Char VALEUR()
     READ[F:ITM]ITM0 = VALEUR
     IF TSICOD <> "03AA"
          mkstat = 2
          GMESSAGE = Product entered not BULK please review
     Endif 
End

The idea is that it looks at the ITMREF entered > uses that to find the ITMMASTER record > Evaluates whether it is the correct category > Error with message if it returns TRUE. 

I am using a hardcoded Category with <> as I do not know what the operation for "Startswith" or "LIKE" is and anything starting with 03 our intermediaries.

Any pointers in the right direction is appreciated it is all guess work right now. 

  • 0

    hi

    Do you want to control the product category= TCLCOD or the statiscal groups = TSICOD(x)?

  • +1 in reply to Julien Patureau
    verified answer

    I don't know how to code but I believe we can do the control you need using the control table function.
    Assuming, you want to ensure that the transaction named 'JACK' only select products with a category starting with 'FI' 
    Step 1 - Create the following control table named 'JACK':

    In your case, to select products with a category starting with '03', you should use the formula: left$([F:ITM]TCLCOD,2)="03" 

    Step 2 - Assign the newly control table 'JACK' to the screen of the function (SCS1 in your case) and product field (on which you want to apply the control):

    Step 3 - Revalidate only the entry transaction to apply the change

    The down side is: if you revalidate the other transaction linked to stock change the control will be applied too...

    To limit this risk, you can undo step 2 but in this case, if you revalidate the transaction 'JACK', then the control will be lost.

    As a result, you will have the blocking message if you select a product from a different category:


     

  • 0 in reply to Julien Patureau

    that you are right TCLCOD is the one, I was a touch to hasty it would seem. 

  • 0 in reply to Julien Patureau

    Great stuff, this does work as stated for blocking none 03 category however. I do get this error for 03 products (which should pass)  

    G:\SafeX3\UKBCMDEVX3\folders\PRDDEV\TRT\SPVSCS.adx : File nonexistent
    @PRDDEV.TRT/W1WT03REL1$adx(1349) : Call C_STADESH(VALEUR) From SPVSCS
    G:\SafeX3\UKBCMDEVX3\folders\PRDDEV\TRT\SPVSCS.adx : File nonexistent
    PRDDEV.TRT/W1WT03REL1$adx(1433) : Call IB_NBLIG From SPVSCS

    I will work on looking into this but any potential clues would be useful in the meantime I have the below question.

    To avoid the issue you raise regarding validating the screen. Is there any reason I can't just apply this control table to the screen for the entry transaction. so SCS1 is the overarching stock change screen but W1WT0REL1 is the version of SCS1 that is for the transaction I am applying it to, this way I am only validating this screen? Perhaps this is part of the cause of the error? 

  • 0 in reply to Jack Robinson

    I don't know where the error comes from but it's working well on a standard environment. I suspect, you have some bespoke interfering here because the script leading to the error is hosted in the PRDDEV folder and not X3. As mentionned, I don't know how to code.

    => To check, replicate this setup on SEED to check if you have the same error.

    You can as well assign the control table directly on the generated screen (the one starting with W) and it will work. No need to go thru SCS1, it's for me good practice to assign to the main screen and revalidate the transaction. In your case, it meaningful to apply it directly on the generated screen. But you will lose the control, when revalidating the entry transaction.

  • 0 in reply to Julien Patureau

    Hello Julien, 

    Thank you for the input. This has ultimately resolved the issue. The errors were to do with Vertical script that I have now resolved. 

    I found out in my testing that revalidating the entry transaction removes the control on the generated screen. I can have a discussion as to which method is preferred. 

    thank you for your input and ultimate solution.