Newbie: Customizing Sales Order Entry - UD02 to Customer to Orde

Hi Reggie,

You're quite right. You don't need the "Run lib..." statement to
change a temp table.

Glad to be of some help.

Nigel.

--- In vantage@yahoogroups.com, "Reggie Acosta" <racosta@...> wrote:
>
> Hi Nigel,
>
>
>
> I ended up using most of your code. But, statements like the
following
> didn't work for me:
>
> Run lib\UpdateTableBuffer.p(input BUFFER
> ttOrderHed:HANDLE,'UserChar02',Customer.ShortChar02).
>
>
>
> I did get the result I wanted by changing the above statement to:
>
> Assign ttOrderHed.UserChar02 = Customer.ShortChar02.
>
>
>
> Thanks,
>
> Reggie
>
>
>
> [Non-text portions of this message have been removed]
>
I've added a custom field (ultracombo) to the customer maintenance to
select a value from table UD02. That works fine. Next, I need to add a
custom field (for display only which can be ultracombo or textbox) to
sales order entry that is initialized with the value from the customer
table. I've looked and haven't found an example of how to do this.
And, this is only one of several customizations we need where a field
needs to be initialized from a value from a table.

Help please. Ours is a new Vantage implementation. We are on v8.03.406A.

Thanks...
If you just want to display a field from the Customer table, you
could add in a foreign key view.

If you want to copy data from a Customer field into an OrderHed or
OrderDtl field then you should use a BPM.

What exactly are you trying to do?

Nigel.



--- In vantage@yahoogroups.com, "bjcracosta" <racosta@...> wrote:
>
> I've added a custom field (ultracombo) to the customer maintenance
to
> select a value from table UD02. That works fine. Next, I need to
add a
> custom field (for display only which can be ultracombo or textbox)
to
> sales order entry that is initialized with the value from the
customer
> table. I've looked and haven't found an example of how to do this.
> And, this is only one of several customizations we need where a
field
> needs to be initialized from a value from a table.
>
> Help please. Ours is a new Vantage implementation. We are on
v8.03.406A.
>
> Thanks...
>
In one case, we keep what we call a "customer category" code in
ShortChar02 of the Customer table. When a new sales order is created,
we want that value to appear for display only in the Summary tab of
SalesOrderForm. When the sales order is saved, we want that value to
go into UserChar2 of the OrderHed table.

In another case, we keep a discount code in ShortChar01 of the
Customer table. Valid discount codes and their associated discount
percentage are kept in table UD02. At initialization of a new sales
order, we want the discount code in Customer.ShortChar01 to appear in
a new control, (that needs to be bound to OrderHed.UserChar1), in the
Summary tab of SalesOrderForm. Also, the associated discount
percentage needs to appear in the "Discount %" control that's bound to
OrderHed.DiscountPercent. This time, we want to have the ability to
change from that default discount code, if needed, to any valid
discount code that we keep in the UD02 table. When the discount code
is changed, then the "Discount %" should change along with it. When
the sales order is saved, we want the discount code to go into
UserChar1 of the OrderHed table.

I hope that was clear.

Thanks,
Reggie

--- In vantage@yahoogroups.com, "Nigel Kerley" <nigel.kerley@...> wrote:
>
> If you just want to display a field from the Customer table, you
> could add in a foreign key view.
>
> If you want to copy data from a Customer field into an OrderHed or
> OrderDtl field then you should use a BPM.
>
> What exactly are you trying to do?
>
> Nigel.
>
>
>
> --- In vantage@yahoogroups.com, "bjcracosta" <racosta@> wrote:
> >
> > I've added a custom field (ultracombo) to the customer maintenance
> to
> > select a value from table UD02. That works fine. Next, I need to
> add a
> > custom field (for display only which can be ultracombo or textbox)
> to
> > sales order entry that is initialized with the value from the
> customer
> > table. I've looked and haven't found an example of how to do this.
> > And, this is only one of several customizations we need where a
> field
> > needs to be initialized from a value from a table.
> >
> > Help please. Ours is a new Vantage implementation. We are on
> v8.03.406A.
> >
> > Thanks...
> >
>
Hi Reggie,

There's probably a number of ways of doing these, and my way may not
be the best or easiest but for what it's worth:

1. To copy the category/discount code/discount percent, I would
create a BPM against the SalesOrder.ChargeCustomer BO. I would use a
post-processing directive with no conditions - it sounds like you
want this to apply to all new orders. I would add a new action
"synchronously execute 4GL (below) record nothing". The 4GL code
would be:

find first ttOrderHed no-lock.
if available ttOrderHed then do on error undo, leave:
/* Find Customer */
find Customer where Customer.Company = ttOrderHed.Company
and Customer.CustNum = ttOrderHed.CustNum no-lock no-error.
if available Customer then do:
/* Copy Customer Category */
Run lib\UpdateTableBuffer.p(input BUFFER ttOrderHed:HANDLE,
'UserChar02',Customer.ShortChar02).
/* Copy Discount Code */
Run lib\UpdateTableBuffer.p(input BUFFER ttOrderHed:HANDLE,
'UserChar01',Customer.ShortChar01).

/* Find Discount% */
find UD02 where UD02.Company = ttOrderHed.Company and UD02.Key1
= Customer.ShortChar01 no-lock no-error.
if available UD02 then do:
Run lib\UpdateTableBuffer.p(input BUFFER ttOrderHed:HANDLE,
'DiscountPercent', UD02.Number01).
END.
END.
END.

(You may need to change the fields from UD02 to match what you're
using).

Question: why are you using the "UserChar##" fields in OrderHed? Why
not use "ShortChar##"?

In Customisation, you would then add new textboxes onto the form to
display the UserChar1/2 fields.


2. To account for a change in Discount Code, I would create a BPM
against the SalesOrder.Update BO. This time, I would use a pre-
processing directive with a conditions "the ttOrderHed.UserChar1
field has been changed from any to any".

The action would be "synchronously execute 4GL (below) record
nothing". The 4GL code would be:

find first ttOrderHed no-lock.
if available ttOrderHed then do on error undo, leave:
find UD02 where UD02.Company = ttOrderHed.Company and UD02.Key1 =
ttOrderHed.UserChar1 no-lock no-error.
if available UD02 then do:
/* Copy Discount Percent */
Run lib\UpdateTableBuffer.p(input BUFFER ttOrderHed:HANDLE,
'DiscountPercent', UD02.Number01).
END.
else do:
{lib/PublishEx.i &ExMsg = "'Invalid Discount Code. Please change'
" } {&THROW_PRIVATE}.
end.
END.


I haven't tested the above code, but they're similar to things I
already have in place so (fingers crossed!) they should work.

You may want to make the Discount% field on the Sales Order form read-
only. Otherwise users would be able to by-pass the Discount Code and
directly change the percent.


Hope this is of some help to you.

Nigel.

--- In vantage@yahoogroups.com, "bjcracosta" <racosta@...> wrote:
>
> In one case, we keep what we call a "customer category" code in
> ShortChar02 of the Customer table. When a new sales order is
created,
> we want that value to appear for display only in the Summary tab of
> SalesOrderForm. When the sales order is saved, we want that value to
> go into UserChar2 of the OrderHed table.
>
> In another case, we keep a discount code in ShortChar01 of the
> Customer table. Valid discount codes and their associated discount
> percentage are kept in table UD02. At initialization of a new sales
> order, we want the discount code in Customer.ShortChar01 to appear
in
> a new control, (that needs to be bound to OrderHed.UserChar1), in
the
> Summary tab of SalesOrderForm. Also, the associated discount
> percentage needs to appear in the "Discount %" control that's bound
to
> OrderHed.DiscountPercent. This time, we want to have the ability to
> change from that default discount code, if needed, to any valid
> discount code that we keep in the UD02 table. When the discount code
> is changed, then the "Discount %" should change along with it. When
> the sales order is saved, we want the discount code to go into
> UserChar1 of the OrderHed table.
>
> I hope that was clear.
>
> Thanks,
> Reggie
>
> --- In vantage@yahoogroups.com, "Nigel Kerley" <nigel.kerley@>
wrote:
> >
> > If you just want to display a field from the Customer table, you
> > could add in a foreign key view.
> >
> > If you want to copy data from a Customer field into an OrderHed
or
> > OrderDtl field then you should use a BPM.
> >
> > What exactly are you trying to do?
> >
> > Nigel.
> >
> >
> >
> > --- In vantage@yahoogroups.com, "bjcracosta" <racosta@> wrote:
> > >
> > > I've added a custom field (ultracombo) to the customer
maintenance
> > to
> > > select a value from table UD02. That works fine. Next, I need
to
> > add a
> > > custom field (for display only which can be ultracombo or
textbox)
> > to
> > > sales order entry that is initialized with the value from the
> > customer
> > > table. I've looked and haven't found an example of how to do
this.
> > > And, this is only one of several customizations we need where a
> > field
> > > needs to be initialized from a value from a table.
> > >
> > > Help please. Ours is a new Vantage implementation. We are on
> > v8.03.406A.
> > >
> > > Thanks...
> > >
> >
>
Thank you, Nigel, for replying. I've been out of the office and just
saw your solution. I'll give it a shot. Thanks again.

Reggie


--- In vantage@yahoogroups.com, "Nigel Kerley" <nigel.kerley@...> wrote:
>
> Hi Reggie,
>
> There's probably a number of ways of doing these, and my way may not
> be the best or easiest but for what it's worth:
>
> 1. To copy the category/discount code/discount percent, I would
> create a BPM against the SalesOrder.ChargeCustomer BO. I would use a
> post-processing directive with no conditions - it sounds like you
> want this to apply to all new orders. I would add a new action
> "synchronously execute 4GL (below) record nothing". The 4GL code
> would be:
>
> find first ttOrderHed no-lock.
> if available ttOrderHed then do on error undo, leave:
> /* Find Customer */
> find Customer where Customer.Company = ttOrderHed.Company
> and Customer.CustNum = ttOrderHed.CustNum no-lock no-error.
> if available Customer then do:
> /* Copy Customer Category */
> Run lib\UpdateTableBuffer.p(input BUFFER ttOrderHed:HANDLE,
> 'UserChar02',Customer.ShortChar02).
> /* Copy Discount Code */
> Run lib\UpdateTableBuffer.p(input BUFFER ttOrderHed:HANDLE,
> 'UserChar01',Customer.ShortChar01).
>
> /* Find Discount% */
> find UD02 where UD02.Company = ttOrderHed.Company and UD02.Key1
> = Customer.ShortChar01 no-lock no-error.
> if available UD02 then do:
> Run lib\UpdateTableBuffer.p(input BUFFER ttOrderHed:HANDLE,
> 'DiscountPercent', UD02.Number01).
> END.
> END.
> END.
>
> (You may need to change the fields from UD02 to match what you're
> using).
>
> Question: why are you using the "UserChar##" fields in OrderHed? Why
> not use "ShortChar##"?
>
> In Customisation, you would then add new textboxes onto the form to
> display the UserChar1/2 fields.
>
>
> 2. To account for a change in Discount Code, I would create a BPM
> against the SalesOrder.Update BO. This time, I would use a pre-
> processing directive with a conditions "the ttOrderHed.UserChar1
> field has been changed from any to any".
>
> The action would be "synchronously execute 4GL (below) record
> nothing". The 4GL code would be:
>
> find first ttOrderHed no-lock.
> if available ttOrderHed then do on error undo, leave:
> find UD02 where UD02.Company = ttOrderHed.Company and UD02.Key1 =
> ttOrderHed.UserChar1 no-lock no-error.
> if available UD02 then do:
> /* Copy Discount Percent */
> Run lib\UpdateTableBuffer.p(input BUFFER ttOrderHed:HANDLE,
> 'DiscountPercent', UD02.Number01).
> END.
> else do:
> {lib/PublishEx.i &ExMsg = "'Invalid Discount Code. Please change'
> " } {&THROW_PRIVATE}.
> end.
> END.
>
>
> I haven't tested the above code, but they're similar to things I
> already have in place so (fingers crossed!) they should work.
>
> You may want to make the Discount% field on the Sales Order form read-
> only. Otherwise users would be able to by-pass the Discount Code and
> directly change the percent.
>
>
> Hope this is of some help to you.
>
> Nigel.
>
> --- In vantage@yahoogroups.com, "bjcracosta" <racosta@> wrote:
> >
> > In one case, we keep what we call a "customer category" code in
> > ShortChar02 of the Customer table. When a new sales order is
> created,
> > we want that value to appear for display only in the Summary tab of
> > SalesOrderForm. When the sales order is saved, we want that value to
> > go into UserChar2 of the OrderHed table.
> >
> > In another case, we keep a discount code in ShortChar01 of the
> > Customer table. Valid discount codes and their associated discount
> > percentage are kept in table UD02. At initialization of a new sales
> > order, we want the discount code in Customer.ShortChar01 to appear
> in
> > a new control, (that needs to be bound to OrderHed.UserChar1), in
> the
> > Summary tab of SalesOrderForm. Also, the associated discount
> > percentage needs to appear in the "Discount %" control that's bound
> to
> > OrderHed.DiscountPercent. This time, we want to have the ability to
> > change from that default discount code, if needed, to any valid
> > discount code that we keep in the UD02 table. When the discount code
> > is changed, then the "Discount %" should change along with it. When
> > the sales order is saved, we want the discount code to go into
> > UserChar1 of the OrderHed table.
> >
> > I hope that was clear.
> >
> > Thanks,
> > Reggie
> >
> > --- In vantage@yahoogroups.com, "Nigel Kerley" <nigel.kerley@>
> wrote:
> > >
> > > If you just want to display a field from the Customer table, you
> > > could add in a foreign key view.
> > >
> > > If you want to copy data from a Customer field into an OrderHed
> or
> > > OrderDtl field then you should use a BPM.
> > >
> > > What exactly are you trying to do?
> > >
> > > Nigel.
> > >
> > >
> > >
> > > --- In vantage@yahoogroups.com, "bjcracosta" <racosta@> wrote:
> > > >
> > > > I've added a custom field (ultracombo) to the customer
> maintenance
> > > to
> > > > select a value from table UD02. That works fine. Next, I need
> to
> > > add a
> > > > custom field (for display only which can be ultracombo or
> textbox)
> > > to
> > > > sales order entry that is initialized with the value from the
> > > customer
> > > > table. I've looked and haven't found an example of how to do
> this.
> > > > And, this is only one of several customizations we need where a
> > > field
> > > > needs to be initialized from a value from a table.
> > > >
> > > > Help please. Ours is a new Vantage implementation. We are on
> > > v8.03.406A.
> > > >
> > > > Thanks...
> > > >
> > >
> >
>
Oh! And to answer your question: Why are you using the "UserChar##"
fields in OrderHed? Why not use "ShortChar##?

A newbie decision. UserChar## fields looked like they were for "user"
use. Plus, their max length is 30, compared to 50 for the ShortChar##
fields. I figured I'd save the longer field in case it's needed later.

Is there a restriction on using the "UserChar##" fields for "user" use?

--- In vantage@yahoogroups.com, "bjcracosta" <racosta@...> wrote:
>
> Thank you, Nigel, for replying. I've been out of the office and just
> saw your solution. I'll give it a shot. Thanks again.
>
> Reggie
>
>
> --- In vantage@yahoogroups.com, "Nigel Kerley" <nigel.kerley@> wrote:
> >
> > Hi Reggie,
> >
> > There's probably a number of ways of doing these, and my way may not
> > be the best or easiest but for what it's worth:
> >
> > 1. To copy the category/discount code/discount percent, I would
> > create a BPM against the SalesOrder.ChargeCustomer BO. I would use a
> > post-processing directive with no conditions - it sounds like you
> > want this to apply to all new orders. I would add a new action
> > "synchronously execute 4GL (below) record nothing". The 4GL code
> > would be:
> >
> > find first ttOrderHed no-lock.
> > if available ttOrderHed then do on error undo, leave:
> > /* Find Customer */
> > find Customer where Customer.Company = ttOrderHed.Company
> > and Customer.CustNum = ttOrderHed.CustNum no-lock no-error.
> > if available Customer then do:
> > /* Copy Customer Category */
> > Run lib\UpdateTableBuffer.p(input BUFFER ttOrderHed:HANDLE,
> > 'UserChar02',Customer.ShortChar02).
> > /* Copy Discount Code */
> > Run lib\UpdateTableBuffer.p(input BUFFER ttOrderHed:HANDLE,
> > 'UserChar01',Customer.ShortChar01).
> >
> > /* Find Discount% */
> > find UD02 where UD02.Company = ttOrderHed.Company and UD02.Key1
> > = Customer.ShortChar01 no-lock no-error.
> > if available UD02 then do:
> > Run lib\UpdateTableBuffer.p(input BUFFER ttOrderHed:HANDLE,
> > 'DiscountPercent', UD02.Number01).
> > END.
> > END.
> > END.
> >
> > (You may need to change the fields from UD02 to match what you're
> > using).
> >
> > Question: why are you using the "UserChar##" fields in OrderHed? Why
> > not use "ShortChar##"?
> >
> > In Customisation, you would then add new textboxes onto the form to
> > display the UserChar1/2 fields.
> >
> >
> > 2. To account for a change in Discount Code, I would create a BPM
> > against the SalesOrder.Update BO. This time, I would use a pre-
> > processing directive with a conditions "the ttOrderHed.UserChar1
> > field has been changed from any to any".
> >
> > The action would be "synchronously execute 4GL (below) record
> > nothing". The 4GL code would be:
> >
> > find first ttOrderHed no-lock.
> > if available ttOrderHed then do on error undo, leave:
> > find UD02 where UD02.Company = ttOrderHed.Company and UD02.Key1 =
> > ttOrderHed.UserChar1 no-lock no-error.
> > if available UD02 then do:
> > /* Copy Discount Percent */
> > Run lib\UpdateTableBuffer.p(input BUFFER ttOrderHed:HANDLE,
> > 'DiscountPercent', UD02.Number01).
> > END.
> > else do:
> > {lib/PublishEx.i &ExMsg = "'Invalid Discount Code. Please change'
> > " } {&THROW_PRIVATE}.
> > end.
> > END.
> >
> >
> > I haven't tested the above code, but they're similar to things I
> > already have in place so (fingers crossed!) they should work.
> >
> > You may want to make the Discount% field on the Sales Order form read-
> > only. Otherwise users would be able to by-pass the Discount Code and
> > directly change the percent.
> >
> >
> > Hope this is of some help to you.
> >
> > Nigel.
> >
> > --- In vantage@yahoogroups.com, "bjcracosta" <racosta@> wrote:
> > >
> > > In one case, we keep what we call a "customer category" code in
> > > ShortChar02 of the Customer table. When a new sales order is
> > created,
> > > we want that value to appear for display only in the Summary tab of
> > > SalesOrderForm. When the sales order is saved, we want that value to
> > > go into UserChar2 of the OrderHed table.
> > >
> > > In another case, we keep a discount code in ShortChar01 of the
> > > Customer table. Valid discount codes and their associated discount
> > > percentage are kept in table UD02. At initialization of a new sales
> > > order, we want the discount code in Customer.ShortChar01 to appear
> > in
> > > a new control, (that needs to be bound to OrderHed.UserChar1), in
> > the
> > > Summary tab of SalesOrderForm. Also, the associated discount
> > > percentage needs to appear in the "Discount %" control that's bound
> > to
> > > OrderHed.DiscountPercent. This time, we want to have the ability to
> > > change from that default discount code, if needed, to any valid
> > > discount code that we keep in the UD02 table. When the discount code
> > > is changed, then the "Discount %" should change along with it. When
> > > the sales order is saved, we want the discount code to go into
> > > UserChar1 of the OrderHed table.
> > >
> > > I hope that was clear.
> > >
> > > Thanks,
> > > Reggie
> > >
> > > --- In vantage@yahoogroups.com, "Nigel Kerley" <nigel.kerley@>
> > wrote:
> > > >
> > > > If you just want to display a field from the Customer table, you
> > > > could add in a foreign key view.
> > > >
> > > > If you want to copy data from a Customer field into an OrderHed
> > or
> > > > OrderDtl field then you should use a BPM.
> > > >
> > > > What exactly are you trying to do?
> > > >
> > > > Nigel.
> > > >
> > > >
> > > >
> > > > --- In vantage@yahoogroups.com, "bjcracosta" <racosta@> wrote:
> > > > >
> > > > > I've added a custom field (ultracombo) to the customer
> > maintenance
> > > > to
> > > > > select a value from table UD02. That works fine. Next, I need
> > to
> > > > add a
> > > > > custom field (for display only which can be ultracombo or
> > textbox)
> > > > to
> > > > > sales order entry that is initialized with the value from the
> > > > customer
> > > > > table. I've looked and haven't found an example of how to do
> > this.
> > > > > And, this is only one of several customizations we need where a
> > > > field
> > > > > needs to be initialized from a value from a table.
> > > > >
> > > > > Help please. Ours is a new Vantage implementation. We are on
> > > > v8.03.406A.
> > > > >
> > > > > Thanks...
> > > > >
> > > >
> > >
> >
>
I really don't know. That question has been asked before.

I *think* the "User" fields are a carry-over from an much older
version and the common practice nowadays is to use the Character/
ShortChar fields. But maybe someone else know differently?

Nigel.


--- In vantage@yahoogroups.com, "bjcracosta" <racosta@...> wrote:
>
> Oh! And to answer your question: Why are you using the "UserChar##"
> fields in OrderHed? Why not use "ShortChar##?
>
> A newbie decision. UserChar## fields looked like they were for
"user"
> use. Plus, their max length is 30, compared to 50 for the
ShortChar##
> fields. I figured I'd save the longer field in case it's needed
later.
>
> Is there a restriction on using the "UserChar##" fields for "user"
use?
>
> --- In vantage@yahoogroups.com, "bjcracosta" <racosta@> wrote:
> >
> > Thank you, Nigel, for replying. I've been out of the office and
just
> > saw your solution. I'll give it a shot. Thanks again.
> >
> > Reggie
> >
> >
> > --- In vantage@yahoogroups.com, "Nigel Kerley" <nigel.kerley@>
wrote:
> > >
> > > Hi Reggie,
> > >
> > > There's probably a number of ways of doing these, and my way
may not
> > > be the best or easiest but for what it's worth:
> > >
> > > 1. To copy the category/discount code/discount percent, I would
> > > create a BPM against the SalesOrder.ChargeCustomer BO. I would
use a
> > > post-processing directive with no conditions - it sounds like
you
> > > want this to apply to all new orders. I would add a new action
> > > "synchronously execute 4GL (below) record nothing". The 4GL
code
> > > would be:
> > >
> > > find first ttOrderHed no-lock.
> > > if available ttOrderHed then do on error undo, leave:
> > > /* Find Customer */
> > > find Customer where Customer.Company = ttOrderHed.Company
> > > and Customer.CustNum = ttOrderHed.CustNum no-lock no-error.
> > > if available Customer then do:
> > > /* Copy Customer Category */
> > > Run lib\UpdateTableBuffer.p(input BUFFER
ttOrderHed:HANDLE,
> > > 'UserChar02',Customer.ShortChar02).
> > > /* Copy Discount Code */
> > > Run lib\UpdateTableBuffer.p(input BUFFER
ttOrderHed:HANDLE,
> > > 'UserChar01',Customer.ShortChar01).
> > >
> > > /* Find Discount% */
> > > find UD02 where UD02.Company = ttOrderHed.Company and
UD02.Key1
> > > = Customer.ShortChar01 no-lock no-error.
> > > if available UD02 then do:
> > > Run lib\UpdateTableBuffer.p(input BUFFER
ttOrderHed:HANDLE,
> > > 'DiscountPercent', UD02.Number01).
> > > END.
> > > END.
> > > END.
> > >
> > > (You may need to change the fields from UD02 to match what
you're
> > > using).
> > >
> > > Question: why are you using the "UserChar##" fields in
OrderHed? Why
> > > not use "ShortChar##"?
> > >
> > > In Customisation, you would then add new textboxes onto the
form to
> > > display the UserChar1/2 fields.
> > >
> > >
> > > 2. To account for a change in Discount Code, I would create a
BPM
> > > against the SalesOrder.Update BO. This time, I would use a pre-
> > > processing directive with a conditions "the
ttOrderHed.UserChar1
> > > field has been changed from any to any".
> > >
> > > The action would be "synchronously execute 4GL (below) record
> > > nothing". The 4GL code would be:
> > >
> > > find first ttOrderHed no-lock.
> > > if available ttOrderHed then do on error undo, leave:
> > > find UD02 where UD02.Company = ttOrderHed.Company and
UD02.Key1 =
> > > ttOrderHed.UserChar1 no-lock no-error.
> > > if available UD02 then do:
> > > /* Copy Discount Percent */
> > > Run lib\UpdateTableBuffer.p(input BUFFER ttOrderHed:HANDLE,
> > > 'DiscountPercent', UD02.Number01).
> > > END.
> > > else do:
> > > {lib/PublishEx.i &ExMsg = "'Invalid Discount Code. Please
change'
> > > " } {&THROW_PRIVATE}.
> > > end.
> > > END.
> > >
> > >
> > > I haven't tested the above code, but they're similar to things
I
> > > already have in place so (fingers crossed!) they should work.
> > >
> > > You may want to make the Discount% field on the Sales Order
form read-
> > > only. Otherwise users would be able to by-pass the Discount
Code and
> > > directly change the percent.
> > >
> > >
> > > Hope this is of some help to you.
> > >
> > > Nigel.
> > >
> > > --- In vantage@yahoogroups.com, "bjcracosta" <racosta@> wrote:
> > > >
> > > > In one case, we keep what we call a "customer category" code
in
> > > > ShortChar02 of the Customer table. When a new sales order is
> > > created,
> > > > we want that value to appear for display only in the Summary
tab of
> > > > SalesOrderForm. When the sales order is saved, we want that
value to
> > > > go into UserChar2 of the OrderHed table.
> > > >
> > > > In another case, we keep a discount code in ShortChar01 of the
> > > > Customer table. Valid discount codes and their associated
discount
> > > > percentage are kept in table UD02. At initialization of a new
sales
> > > > order, we want the discount code in Customer.ShortChar01 to
appear
> > > in
> > > > a new control, (that needs to be bound to
OrderHed.UserChar1), in
> > > the
> > > > Summary tab of SalesOrderForm. Also, the associated discount
> > > > percentage needs to appear in the "Discount %" control that's
bound
> > > to
> > > > OrderHed.DiscountPercent. This time, we want to have the
ability to
> > > > change from that default discount code, if needed, to any
valid
> > > > discount code that we keep in the UD02 table. When the
discount code
> > > > is changed, then the "Discount %" should change along with
it. When
> > > > the sales order is saved, we want the discount code to go into
> > > > UserChar1 of the OrderHed table.
> > > >
> > > > I hope that was clear.
> > > >
> > > > Thanks,
> > > > Reggie
> > > >
> > > > --- In vantage@yahoogroups.com, "Nigel Kerley"
<nigel.kerley@>
> > > wrote:
> > > > >
> > > > > If you just want to display a field from the Customer
table, you
> > > > > could add in a foreign key view.
> > > > >
> > > > > If you want to copy data from a Customer field into an
OrderHed
> > > or
> > > > > OrderDtl field then you should use a BPM.
> > > > >
> > > > > What exactly are you trying to do?
> > > > >
> > > > > Nigel.
> > > > >
> > > > >
> > > > >
> > > > > --- In vantage@yahoogroups.com, "bjcracosta" <racosta@>
wrote:
> > > > > >
> > > > > > I've added a custom field (ultracombo) to the customer
> > > maintenance
> > > > > to
> > > > > > select a value from table UD02. That works fine. Next, I
need
> > > to
> > > > > add a
> > > > > > custom field (for display only which can be ultracombo or
> > > textbox)
> > > > > to
> > > > > > sales order entry that is initialized with the value from
the
> > > > > customer
> > > > > > table. I've looked and haven't found an example of how to
do
> > > this.
> > > > > > And, this is only one of several customizations we need
where a
> > > > > field
> > > > > > needs to be initialized from a value from a table.
> > > > > >
> > > > > > Help please. Ours is a new Vantage implementation. We are
on
> > > > > v8.03.406A.
> > > > > >
> > > > > > Thanks...
> > > > > >
> > > > >
> > > >
> > >
> >
>
Nigel,

You are right that these were from older versions of the database. They
were the first fields to "customize" your data.


M. Manasa Reddy
manasa@...
P: 630-806-2000
F: 630-806-2001


________________________________

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Nigel Kerley
Sent: Wednesday, December 17, 2008 11:10 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: Newbie: Customizing Sales Order Entry - UD02 to
Customer to OrderHed



I really don't know. That question has been asked before.

I *think* the "User" fields are a carry-over from an much older
version and the common practice nowadays is to use the Character/
ShortChar fields. But maybe someone else know differently?

Nigel.

--- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ,
"bjcracosta" <racosta@...> wrote:
>
> Oh! And to answer your question: Why are you using the "UserChar##"
> fields in OrderHed? Why not use "ShortChar##?
>
> A newbie decision. UserChar## fields looked like they were for
"user"
> use. Plus, their max length is 30, compared to 50 for the
ShortChar##
> fields. I figured I'd save the longer field in case it's needed
later.
>
> Is there a restriction on using the "UserChar##" fields for "user"
use?
>
> --- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ,
"bjcracosta" <racosta@> wrote:
> >
> > Thank you, Nigel, for replying. I've been out of the office and
just
> > saw your solution. I'll give it a shot. Thanks again.
> >
> > Reggie
> >
> >
> > --- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ,
"Nigel Kerley" <nigel.kerley@>
wrote:
> > >
> > > Hi Reggie,
> > >
> > > There's probably a number of ways of doing these, and my way
may not
> > > be the best or easiest but for what it's worth:
> > >
> > > 1. To copy the category/discount code/discount percent, I would
> > > create a BPM against the SalesOrder.ChargeCustomer BO. I would
use a
> > > post-processing directive with no conditions - it sounds like
you
> > > want this to apply to all new orders. I would add a new action
> > > "synchronously execute 4GL (below) record nothing". The 4GL
code
> > > would be:
> > >
> > > find first ttOrderHed no-lock.
> > > if available ttOrderHed then do on error undo, leave:
> > > /* Find Customer */
> > > find Customer where Customer.Company = ttOrderHed.Company
> > > and Customer.CustNum = ttOrderHed.CustNum no-lock no-error.
> > > if available Customer then do:
> > > /* Copy Customer Category */
> > > Run lib\UpdateTableBuffer.p(input BUFFER
ttOrderHed:HANDLE,
> > > 'UserChar02',Customer.ShortChar02).
> > > /* Copy Discount Code */
> > > Run lib\UpdateTableBuffer.p(input BUFFER
ttOrderHed:HANDLE,
> > > 'UserChar01',Customer.ShortChar01).
> > >
> > > /* Find Discount% */
> > > find UD02 where UD02.Company = ttOrderHed.Company and
UD02.Key1
> > > = Customer.ShortChar01 no-lock no-error.
> > > if available UD02 then do:
> > > Run lib\UpdateTableBuffer.p(input BUFFER
ttOrderHed:HANDLE,
> > > 'DiscountPercent', UD02.Number01).
> > > END.
> > > END.
> > > END.
> > >
> > > (You may need to change the fields from UD02 to match what
you're
> > > using).
> > >
> > > Question: why are you using the "UserChar##" fields in
OrderHed? Why
> > > not use "ShortChar##"?
> > >
> > > In Customisation, you would then add new textboxes onto the
form to
> > > display the UserChar1/2 fields.
> > >
> > >
> > > 2. To account for a change in Discount Code, I would create a
BPM
> > > against the SalesOrder.Update BO. This time, I would use a pre-
> > > processing directive with a conditions "the
ttOrderHed.UserChar1
> > > field has been changed from any to any".
> > >
> > > The action would be "synchronously execute 4GL (below) record
> > > nothing". The 4GL code would be:
> > >
> > > find first ttOrderHed no-lock.
> > > if available ttOrderHed then do on error undo, leave:
> > > find UD02 where UD02.Company = ttOrderHed.Company and
UD02.Key1 =
> > > ttOrderHed.UserChar1 no-lock no-error.
> > > if available UD02 then do:
> > > /* Copy Discount Percent */
> > > Run lib\UpdateTableBuffer.p(input BUFFER ttOrderHed:HANDLE,
> > > 'DiscountPercent', UD02.Number01).
> > > END.
> > > else do:
> > > {lib/PublishEx.i &ExMsg = "'Invalid Discount Code. Please
change'
> > > " } {&THROW_PRIVATE}.
> > > end.
> > > END.
> > >
> > >
> > > I haven't tested the above code, but they're similar to things
I
> > > already have in place so (fingers crossed!) they should work.
> > >
> > > You may want to make the Discount% field on the Sales Order
form read-
> > > only. Otherwise users would be able to by-pass the Discount
Code and
> > > directly change the percent.
> > >
> > >
> > > Hope this is of some help to you.
> > >
> > > Nigel.
> > >
> > > --- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
, "bjcracosta" <racosta@> wrote:
> > > >
> > > > In one case, we keep what we call a "customer category" code
in
> > > > ShortChar02 of the Customer table. When a new sales order is
> > > created,
> > > > we want that value to appear for display only in the Summary
tab of
> > > > SalesOrderForm. When the sales order is saved, we want that
value to
> > > > go into UserChar2 of the OrderHed table.
> > > >
> > > > In another case, we keep a discount code in ShortChar01 of the
> > > > Customer table. Valid discount codes and their associated
discount
> > > > percentage are kept in table UD02. At initialization of a new
sales
> > > > order, we want the discount code in Customer.ShortChar01 to
appear
> > > in
> > > > a new control, (that needs to be bound to
OrderHed.UserChar1), in
> > > the
> > > > Summary tab of SalesOrderForm. Also, the associated discount
> > > > percentage needs to appear in the "Discount %" control that's
bound
> > > to
> > > > OrderHed.DiscountPercent. This time, we want to have the
ability to
> > > > change from that default discount code, if needed, to any
valid
> > > > discount code that we keep in the UD02 table. When the
discount code
> > > > is changed, then the "Discount %" should change along with
it. When
> > > > the sales order is saved, we want the discount code to go into
> > > > UserChar1 of the OrderHed table.
> > > >
> > > > I hope that was clear.
> > > >
> > > > Thanks,
> > > > Reggie
> > > >
> > > > --- In vantage@yahoogroups.com
<mailto:vantage%40yahoogroups.com> , "Nigel Kerley"
<nigel.kerley@>
> > > wrote:
> > > > >
> > > > > If you just want to display a field from the Customer
table, you
> > > > > could add in a foreign key view.
> > > > >
> > > > > If you want to copy data from a Customer field into an
OrderHed
> > > or
> > > > > OrderDtl field then you should use a BPM.
> > > > >
> > > > > What exactly are you trying to do?
> > > > >
> > > > > Nigel.
> > > > >
> > > > >
> > > > >
> > > > > --- In vantage@yahoogroups.com
<mailto:vantage%40yahoogroups.com> , "bjcracosta" <racosta@>
wrote:
> > > > > >
> > > > > > I've added a custom field (ultracombo) to the customer
> > > maintenance
> > > > > to
> > > > > > select a value from table UD02. That works fine. Next, I
need
> > > to
> > > > > add a
> > > > > > custom field (for display only which can be ultracombo or
> > > textbox)
> > > > > to
> > > > > > sales order entry that is initialized with the value from
the
> > > > > customer
> > > > > > table. I've looked and haven't found an example of how to
do
> > > this.
> > > > > > And, this is only one of several customizations we need
where a
> > > > > field
> > > > > > needs to be initialized from a value from a table.
> > > > > >
> > > > > > Help please. Ours is a new Vantage implementation. We are
on
> > > > > v8.03.406A.
> > > > > >
> > > > > > Thanks...
> > > > > >
> > > > >
> > > >
> > >
> >
>






[Non-text portions of this message have been removed]
Hi Nigel,



I ended up using most of your code. But, statements like the following
didn't work for me:

Run lib\UpdateTableBuffer.p(input BUFFER
ttOrderHed:HANDLE,'UserChar02',Customer.ShortChar02).



I did get the result I wanted by changing the above statement to:

Assign ttOrderHed.UserChar02 = Customer.ShortChar02.



Thanks,

Reggie



[Non-text portions of this message have been removed]