This is a perfect problem for a BPM, you will need two BPM's to cover
all your bases. Both BPM's will be on the update method of the
SalesOrder.
The first BPM will be a pre-processing and covers a user adding a second
release to an order line.
. There will be no conditions and for the actions select "Execute 4GL
Code" . Once you are in it click 'execute code below' and paste in the
following code:
find first ttOrderRel where ttOrderrel.rowmod = 'A' NO-ERROR.
IF AVAIL ttOrderRel THEN DO:
find first orderhed where orderhed.Company = ttorderrel.company
and orderhed.ordernum = ttorderrel.ordernum
no-lock no-error.
if avail orderhed then do:
ttorderrel.number01 = orderhed.custnum.
end.
END.
The second BPM will be a post-processing and covers adding a new line an
order.
. There will be no conditions and for the actions select "Execute 4GL
Code" . Once you are in it click 'execute code below' and paste in the
following code:
find first ttorderdtl where ttorderdtl.rowmod = "" no-error.
if avail ttorderdtl then do:
find first orderrel where orderrel.company = ttorderdtl.Company
and orderrel.ordernum = ttorderdtl.OrderNum
and orderrel.orderline = ttorderdtl.orderline
no-error.
if avail orderrel then do:
find first orderhed where orderhed.Company = orderrel.company
and orderhed.ordernum = orderrel.ordernum no-lock
no-error.
if avail orderhed then do:
orderrel.number01 = orderhed.custnum.
end.
release orderrel.
message "found orderrel and wrote " orderhed.custnum.
end.
end.
Note that on the first BPM your are updating the ttorderrel record and
letting the save update field number01, when you create a new line
there is not ttorderrel record available so you need to wait until after
update has done its stuff then find the REAL orderrel it saved and
update number01 on that directly.
That should do the trick.
________________________________
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Lynn
Sent: Tuesday, February 10, 2009 4:23 PM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: Customization: Need CustNum on OrderRel
The BTCustNum is the Key that I have been using.
It brings in the ShipToNum from the OrderHed table. My releases have
different ShipToNum's than the Header.
After reading your reply, I just now re-checked my Data Definition
and tested my Crystal Report again on a Sales Order with multiple
ShipToNum's. The report displayed the same ShipToNum from the Order
Header for every line & release.
Thanks for the suggestion anyway.
Lynn
--- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ,
"kam4085" <kmaclennan@...> wrote:
all your bases. Both BPM's will be on the update method of the
SalesOrder.
The first BPM will be a pre-processing and covers a user adding a second
release to an order line.
. There will be no conditions and for the actions select "Execute 4GL
Code" . Once you are in it click 'execute code below' and paste in the
following code:
find first ttOrderRel where ttOrderrel.rowmod = 'A' NO-ERROR.
IF AVAIL ttOrderRel THEN DO:
find first orderhed where orderhed.Company = ttorderrel.company
and orderhed.ordernum = ttorderrel.ordernum
no-lock no-error.
if avail orderhed then do:
ttorderrel.number01 = orderhed.custnum.
end.
END.
The second BPM will be a post-processing and covers adding a new line an
order.
. There will be no conditions and for the actions select "Execute 4GL
Code" . Once you are in it click 'execute code below' and paste in the
following code:
find first ttorderdtl where ttorderdtl.rowmod = "" no-error.
if avail ttorderdtl then do:
find first orderrel where orderrel.company = ttorderdtl.Company
and orderrel.ordernum = ttorderdtl.OrderNum
and orderrel.orderline = ttorderdtl.orderline
no-error.
if avail orderrel then do:
find first orderhed where orderhed.Company = orderrel.company
and orderhed.ordernum = orderrel.ordernum no-lock
no-error.
if avail orderhed then do:
orderrel.number01 = orderhed.custnum.
end.
release orderrel.
message "found orderrel and wrote " orderhed.custnum.
end.
end.
Note that on the first BPM your are updating the ttorderrel record and
letting the save update field number01, when you create a new line
there is not ttorderrel record available so you need to wait until after
update has done its stuff then find the REAL orderrel it saved and
update number01 on that directly.
That should do the trick.
________________________________
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Lynn
Sent: Tuesday, February 10, 2009 4:23 PM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: Customization: Need CustNum on OrderRel
The BTCustNum is the Key that I have been using.
It brings in the ShipToNum from the OrderHed table. My releases have
different ShipToNum's than the Header.
After reading your reply, I just now re-checked my Data Definition
and tested my Crystal Report again on a Sales Order with multiple
ShipToNum's. The report displayed the same ShipToNum from the Order
Header for every line & release.
Thanks for the suggestion anyway.
Lynn
--- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ,
"kam4085" <kmaclennan@...> wrote:
>I
> I had the same issue with the SO Pick List. Add the table to the
> report (I added OrderHed as the parent and ShipTo as the child)
> I then selected BTCustNum as the key and everything worked for me.
> believe that the key is created suing the ship to in the releasetable
>"Lynn" <lynn.khalife@> wrote:
>
> --- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ,
> >turned
> > I need to get the Customer Ship To Address from the Order Release
> > printed on the Vantage Material Queue Report.
> >
> > Because each Order Release can have a different ship-to address,
> the
> > ShipToNum must come from the OrderRel table.
> >
> > Since I need the actual address printed on the report, not the
> > ShipToNum, I added the ShipTo table to the MtlQueue report.
> >
> > Here's the problem:
> > In order to retrieve the correct address from the ShipTo table, I
> > need to link Company, CustNum, and ShipToNum. However, CustNum
> does
> > not exist in the OrderRel table.
> >
> > If I leave Vantage and use ODBC/SQL, I would successfully get my
> > information with these links:
> > pub.OrderHed.Company = pub.OrderRel.Company AND
> > pub.OrderHed.OrderNum = pub.OrderRel.OrderNum AND
> > pub.OrderHed.Company = pub.ShipTo.Company AND
> > pub.OrderHed.CustNum = pub.ShipTo.CustNum AND
> > pub.OrderRel.ShipToNum = pub.ShipTo.ShipToNum
> >
> > However, if I attempt to do this same linking in the Vantage Data
> > Definitions, I get an error that reads, "There cannot be 2 parent
> > tables for the same child table". (The child table being the
> ShipTo
> > table)
> >
> > After I ran into this limitation, I was going to try to add a
> Custom
> > Field Map from OrderHed.CustNum to OrderRel.Number01. This
> > out not possible. OrderHed is not an available Source table forcustomer
> > Target table OrderRel.
> >
> > Next, I turned to a customization to send the OrderHed.CustNum to
> > OrderRel.Number01 during Order Entry. I created a FKV (column
> > OrderRel.CustomerCustID like column Customer.CustID using
> > adapter) which will successfully display the CustNum on thethis
> OrderRel
> > tab. However, the only way that I have been able to store the
> value
> > of this control to OrderRel.Number01 is to add an Event of Got
> Focus.
> >
> > It technically works, but it is not adequate for my needs.
> >
> > Very often there will only be 1 Release for a Order Line. In
> > case, the data entry person will have no reason to click or tabto
> > any field on the Release maintenance screen. Since the user isnot
> > taking any action on this screen, my "Got Focus" control isuseless.
> >I
> > I have been trying to use the Form Event Wizard to automatically
> > store the CustNum to OrderRel.Number01 upon saving a Order Line.
> > have been unsucessful so far.message.
> >
> > Can anyone either describe what Form Event will meet my needs or
> > point me in another direction which will work?
> >
> > Thank you to anyone who has the patience to read this long
> >[Non-text portions of this message have been removed]
> > Lynn
> > 8.03.404 Progress
> >
>