Get New UD from Post Update

I am looking to create a new record in a UD table that will be triggered on a Post BPM for another method. I know nothing about ABL or really working with BPMs in 9. Is this something that can be done/easy to be done?

When a new Year is added to the Fiscal Calendar, I want to run a BPM that creates a record in a UD table for the same year. I also want to do the same thing when a new Fiscal Period is created.

The UD table is going to be used for forecasting and I would like to try to keep it in sync with the fiscal calendar.

Here is an example of creating a new UD04 record in ABL You should be able to change it accordingly

DEFINE VARIABLE hUD04 AS HANDLE.
RUN bo/UD04/UD04.p PERSISTENT SET hUD04.
IF VALID-HANDLE(hUD04) THEN DO:
     
        RUN GetaNewUD04 IN hUD04( {&input-output_dataset_UD04DataSet} ) NO-ERROR.               
            FOR EACH ttUD04 WHERE ttUD04.RowMod = "A":
                ASSIGN  ttUD04.key1 = STRING(order).
                ASSIGN  ttUD04.key2 = STRING(line).
                ASSIGN  ttUD04.key3 = STRING(superLooper1).
            END.
             
        RUN Update IN hUD04({&input-output_dataset_UD04DataSet}) NO-ERROR.
        DELETE OBJECT hUD04.
END.
1 Like

Thanks Jose!!

I’ll play around with that.

@josecgomez

I’m getting an error trying to validate. Here is the code:

DEFINE VARIABLE hUD107 AS HANDLE.
RUN bo/UD107/UD107.p PERSISTENT SET hUD107.
IF VALID-HANDLE(hUD107) THEN DO:
    RUN GetNewUD107 IN hUD107( {&input-output_dataset_UD107DataSet} ) NO-ERROR.               
        FOR EACH ttUD107 WHERE ttUD107.RowMod = "A":
	ASSIGN	ttUD107.Company = STRING(BRUCE).
            ASSIGN  ttUD107.key1 = ttFiscalYr.FiscalYear.
        END.
         
    RUN Update IN hUD107({&input-output_dataset_UD107DataSet}) NO-ERROR.
    DELETE OBJECT hUD107.
END.

And here is the error:

** Unable to understand after -- "RUN". (247)
** Invalid statement. (254)
** E:\Epicor\EpicorData\15117919522888296721716224110914122417121931.p Could not understand line 15. (198)
Unknown or ambiguous table ttUD107. (725)
** E:\Epicor\EpicorData\15117919522888296721716224110914122417121931.p Could not understand line 16. (196)

Switch the slashes I typed that out of my head. I can’t remember if its bo/UD or bo\UD

I tried every combination of slashes and get the same error everytime.

oh yeah! you ahve to add the using stuff… Oy… let me see if I can remember.

Add this to your I forget what is called… Predirective? (its a button you can click and a little text window appears) within the BPM editor. On the bottom right of the screen… If you don’t see it send me a screen shot of your BPM Editor Screen

{bo/UD107/UD107_ds.i}

Working on cleaning out the ABL Cobwebs! Sorry

1 Like

There is no need to apologize! I wouldn’t even be close to doing this without your input.

I am getting an error on the top line for ambiguity since there is 107 and 107A. Code:

FOR EACH ttUD107 WHERE ttUD107.RowMod = "A":
	ASSIGN Company = "BRUCE".
            ASSIGN  ttUD107.key1 = ttFiscalYr.FiscalYear.
        END.

Error:

** Company is ambiguous with ttUD107List.Company and ttUD107A.Company (72)
** E:\Epicor\EpicorData\46244204163361107516511571183220591991.p Could not understand line 18. (196)

HJmm I don’t follow./

UD107 is the Parent to UD107A Child.

Sure I understand that but I’m not following what that has to do with the error.

My bad I think. Trying to get it to work I deleted one of the UD107 from

RUN bo/UD107/UD107.p PERSISTENT SET hUD107.

One last thing though while I have you. How would I convert this to string?

ttFiscalYr.FiscalYear

I think I figured it out.

STRING(ttFiscalYr.FiscalYear)
1 Like