Opening Files Within A BPL

Primary tabs

I have two files that I ultimately need to combine.  The first file contains data from a PO.  The second file contains tracking information.  What I thought about doing was create a BS that grabs the first file, loads it into a record map and transfers it to a BPL.  Then, the BPL would open the second file where I would write code to load the file into a second record map and then insert the tracking information to the correct places in the first file based on PO line items.

First, is this the best approach?  Second, how do I open the second file in the BPL?  I assume I would have to open and load the file to a stream, but am unsure how to perform this task.

Any help would be greatly appreciated.  Thanks.

Replies

A few of questions:

  1. Can we assume that the tracking information will be received asynchronously, after the PO?
  2. Will there be only one tracking file per PO, or will there be a distinct file per line item in the PO?
  3. Can the tracking file name be somehow derived from data found in the PO, or must the file(s) be scanned/parsed to determine its related PO?

1. Luckily, no.  This workflow will be instantiated after both files have been received.  

2. It's actually more than just tracking number.  Serial number, part number and a few others.  The tracking file will contain data for all POs in the main file.

3. The tracking file will be named the same thing daily, containing tracking information for all POs in the main file.  There are not multiple files (for either one).

One possibility:

You can handle the two files with two separate interfaces:

The interface for the tracking file would just load it into a record map and then stop. This has the effect of saving the information as a row in a database table.

The BPL for the PO file interface would just query the tracking file record map table to find the relevant entry, open it, and add the necessary info to the PO. To avoid timing issues where a PO file is processed before the corresponding tracking file you could add a check in the BPL: if a row doesn't exist in the tracking table for this PO, delay for 5 seconds using the BPL "Delay" action and try again before failing with an error.