I’ve been searching for a while now and am at a loss.
How would I get a value in a tt table so I can then assign that value to another field in another table?
I know I can get to a single row by using RowMod, but I haven’t the foggiest on the syntax.
aidacra
(Nathan your friendly neighborhood Support Engineer)
2
Here is an example.
Conceptually, you need to pull both the tt and non-tt records into the buffer, and then do an assign. If you provide your tt table name and non tt table name, and the columns names in question, we can mock something closer to what you are looking for.
/*
Purpose: Copy UD fields from QuoteHed to OrderHed and QuoteDtl to OrderDtl
Business Object: Quote
Method: CreateOrder
Created: NJA
Directive: Post Processing
Explanation: This BPM will be triggered when a Sales Order is being created from the Quote Entry screen (Actions > Quote > Create Sales Order > Create) . It uses a user-defined field (OrderDtl.Checkbox20) to evaluate if the copying process from Quote to Order has been executed before(which it should only execute once anyway because of the method this BPM is being triggered from). If it hasn’t, it copies the fields over and at the end of the process it changes the OrderDtl/OrderHed.Checkbox20 field from false to true so this BPM isn’t triggered again for this Order. With how this BPM is being triggered, you can safely remove the Checkbox20 evaluation and assignment however, you can leave it to indicate which orders were created using this BPM.
*/
FOR EACH ttQuoteHed, FIRST OrderHed FIELDS(ShortChar03 Checkbox20) WHERE OrderHed.Company = CUR-COMP AND OrderHed.OrderNum = OrderNum AND OrderHed.CheckBox20 = FALSE EXCLUSIVE-LOCK.
IF avail OrderHed THEN DO:
ASSIGN OrderHed.ShortChar03 = ttQuoteHed.ShortChar03.
ASSIGN OrderHed.Checkbox20 = TRUE.
END.
END.
FOR EACH ttQuoteDtl, FIRST OrderDtl FIELDS(ShortChar03 Checkbox20) WHERE OrderDtl.Company = CUR-COMP AND OrderDtl.OrderNum = OrderNum AND OrderDtl.QuoteLine = ttQuoteDtl.QuoteLine EXCLUSIVE-LOCK.
IF AVAIL OrderDtl THEN DO:
ASSIGN OrderDtl.ShortChar03 = ttQuoteDtl.ShortChar03.
ASSIGN OrderDtl.Checkbox20 = TRUE.
END.
END.
It’s evaluating ok but it is still not creating the new record with the field value. It creates the record with a null in Key1.
DEFINE VARIABLE hUD107 AS HANDLE.
RUN bo/UD107/UD107.p PERSISTENT SET hUD107.
IF VALID-HANDLE(hUD107) THEN DO:
RUN GetaNewUD107 IN hUD107({&input-output_dataset_UD107DataSet}) NO-ERROR.
FOR EACH ttUD107 WHERE ttUD107.RowMod = "A", FIRST ttFiscalYr FIELDS(FiscalYear) WHERE ttFiscalYr.RowMod = "A" EXCLUSIVE-LOCK.
IF avail ttFiscalYr THEN DO:
ASSIGN ttUD107.Key1 = STRING(ttFiscalYr.FiscalYear).
END.
END.
RUN Update IN hUD107({&input-output_dataset_UD107DataSet}) NO-ERROR.
DELETE OBJECT hUD107.
END.
aidacra
(Nathan your friendly neighborhood Support Engineer)
4