Skip to main content

I am attempting to write a Process Flow to replace lines on Internal Material Orders. The intention here is to replace expensive parts with cheaper parts, but only for certain nodes.

I am using an Event Driven process flow, Trigger: Lines Updated.

First, I have added a PF Query Condition on Sub Document: Material Lines that returns rows where order_id = demand_material.order_id, and the demand_material.bpart_id is in a predefined list.

select
*
from
logistic_order lo
where
lo.logistic_order_id = {order_id}
and { bpart_id } IN (
'D1464062',
'D1862218',
'D1862219',
'D1863054',
'D1496206',
'D1496207',
'D0BQ6141',
'D1504062',
'D1496208'
)

Where this is true, I call a PF Action that looks up the demand ID based on the line order_id and the line bpart_id, deletes the line, and creates a replacement line.
 

<root
xmlns:dt="urn:schemas-microsoft-com:datatypes">
<session email="" alias="">
<state bc_name="log_int_order">
<action name="declare">
<attribute dtype="string" in_var="" out_var="" name="demand" value="" />
</action>
<action name="getdescrtableex">
<attribute in_var="" out_var="demand" table_name="demand_material" element_name="demand_id" search_criteria="bpart_id='{bpart_id}' and order_id='{order_id}'" default_value="-1" />
</action>
<action name="data">
<main>
<row number="1">
<logistic_order_id>{order_id}</logistic_order_id>
</row>
</main>
<log_int_order_xref>
<row delete="true">
<demand_id in_var="demand">in_var</demand_id>
</row>
<row>
<bpart_id>{kit_bpart_id}</bpart_id>
<qty>{qty}</qty>
</row>
</log_int_order_xref>
</action>
</state>
</session>
</root>


The part that I am struggling with is supplying the PF action with the replacement kit part number. It is not stored anywhere in Alliance tables. There appears to be nowhere in the product center that I can store it such that it ends up in the demand material lines.

I was hoping to use PF Data enrichment to provide a lookup, but it doesn’t seem to work as I expected. I can only call enrichment at the start of the PF, and it only returns 1 row. I also can’t do field mapping. 

SELECT
top (1) EDP
FROM
(
VALUES
('418945K', 'D1464062'),
('418948K', 'D1862218'),
('418949K', 'D1862219'),
('418950K', 'D1863054'),
('418946k', 'D1496206'),
('418947K', 'D1496207'),
('419254', 'D0BQ6141'),
('418952K', 'D1504062'),
('418948K', 'D1862218'),
('418949K', 'D1862219'),
('418950K', 'D1863054'),
('418947K', 'D1496207'),
('418951K', 'D1496208'),
('419254', 'D0BQ6141')
) AS kit_parts (EDP, Part_No)
WHERE
Part_No = { bpart_id }

Is there any way for me to achieve this? To populate the kit part EDP at the material line level so that I can use it in the PF action?

 

 

Be the first to reply!

Reply