Thanks for sharing!
Rob Bucek
Production Control Manager
PH: (715) 284-5376 ext 311
Mobile: (715)896-0590
FAX: (715)284-4084
[Description: cid:1.234354861@...]<http://www.dsmfg.com/>
(Click the logo to view our site)<http://www.dsmfg.com/>
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of Rupert
Sent: Friday, March 30, 2012 6:11 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: Creating a Secondary Salesperson in a customer - and updating sales order
For anyone interested This is the BPM I Finished with - Hope it may help others- I'm not that precious about sharing code, unlike others :)
{ud/csgBPMDataStore.i}
{bo/Salesorder_ds.i}
{lib/globals.i}
{ud/csgBPMexception.i}
procedure UpdateAfter:
define input-output parameter table for ttOrderHed.
define input-output parameter table for ttOrderHedAttch.
define input-output parameter table for ttOHOrderMsc.
define input-output parameter table for ttOrderDtl.
define input-output parameter table for ttOrderDtlAttch.
define input-output parameter table for ttOrderMsc.
define input-output parameter table for ttOrderRel.
define input-output parameter table for ttOrderRelTax.
define input-output parameter table for ttOrderHedUPS.
define input-output parameter table for ttOrderRepComm.
define input-output parameter table for ttHedTaxSum.
define input-output parameter table for ttSelectedSerialNumbers.
define input-output parameter table for ttSerialNumberSearch.
define input-output parameter table for ttSNFormat.
define input-output parameter table for ttTaxConnectStatus.
{&TRY_PRIVATE}
FIND FIRST ttorderhed.
IF AVAILABLE ttorderhed THEN
DO:
putData("orderhed_OrderNum",STRING(ttorderhed.OrderNum)).
END.
DEFINE VARIABLE varOrderNum AS CHARACTER NO-UNDO.
DEF VAR vh-fbo AS HANDLE NO-UNDO.
ASSIGN varOrderNum = getData("orderhed_OrderNum").
DEF BUFFER bttOrderHed FOR ttOrderHed.
FIND FIRST Orderhed WHERE orderhed.Company = CUR-COMP
AND orderhed.Ordernum = INT(varOrderNum) NO-LOCK NO-ERROR.
If AVAILABLE Orderhed Then
Do:
FIND FIRST customer WHERE customer.company = ttorderhed.company
AND customer.custnum = ttorderhed.Custnum NO-LOCK NO-ERROR.
If Avail Customer THEN
DO:
FIND FIRST salesrep WHERE
customer.company = salesrep.company
AND customer.shortchar06 = salesrep.salesrepcode.
If Avail salesrep THEN
DO:
RUN server/bo/salesorder.p PERSISTENT SET vh-fbo.
IF VALID-HANDLE(vh-fbo) THEN
DO:
CREATE bttOrderHed.
BUFFER-COPY OrderHed TO bttOrderHed.
ASSIGN bttOrderHed.dbRowIdent = ROWID(OrderHed)
bttOrderHed.RowIdent = STRING(ROWID(OrderHed)).
CREATE ttOrderHed.
BUFFER-COPY bttOrderHed TO ttOrderHed.
ASSIGN ttorderhed.RowMod = 'U'.
ASSIGN
ttorderhed.salesrepcode1 = customer.salesrep
ttorderhed.salesrepcode2 = customer.shortchar06
ttorderhed.repsplit2 = 100
ttorderhed.reprate2 = salesrep.CommissionPercent
ttorderhed.salesrepname2 = salesrep.Name.
RUN UPDATE IN vh-fbo ({&input-output_dataset_salesorderDataSet}).
DELETE OBJECT vh-fbo.
END. /* avail Salesrep */
END. /* avail Orderhed */
END. /* avail customer */
End.
End.
{&CATCH_PRIVATE}
Rob Bucek
Production Control Manager
PH: (715) 284-5376 ext 311
Mobile: (715)896-0590
FAX: (715)284-4084
[Description: cid:1.234354861@...]<http://www.dsmfg.com/>
(Click the logo to view our site)<http://www.dsmfg.com/>
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of Rupert
Sent: Friday, March 30, 2012 6:11 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: Creating a Secondary Salesperson in a customer - and updating sales order
For anyone interested This is the BPM I Finished with - Hope it may help others- I'm not that precious about sharing code, unlike others :)
{ud/csgBPMDataStore.i}
{bo/Salesorder_ds.i}
{lib/globals.i}
{ud/csgBPMexception.i}
procedure UpdateAfter:
define input-output parameter table for ttOrderHed.
define input-output parameter table for ttOrderHedAttch.
define input-output parameter table for ttOHOrderMsc.
define input-output parameter table for ttOrderDtl.
define input-output parameter table for ttOrderDtlAttch.
define input-output parameter table for ttOrderMsc.
define input-output parameter table for ttOrderRel.
define input-output parameter table for ttOrderRelTax.
define input-output parameter table for ttOrderHedUPS.
define input-output parameter table for ttOrderRepComm.
define input-output parameter table for ttHedTaxSum.
define input-output parameter table for ttSelectedSerialNumbers.
define input-output parameter table for ttSerialNumberSearch.
define input-output parameter table for ttSNFormat.
define input-output parameter table for ttTaxConnectStatus.
{&TRY_PRIVATE}
FIND FIRST ttorderhed.
IF AVAILABLE ttorderhed THEN
DO:
putData("orderhed_OrderNum",STRING(ttorderhed.OrderNum)).
END.
DEFINE VARIABLE varOrderNum AS CHARACTER NO-UNDO.
DEF VAR vh-fbo AS HANDLE NO-UNDO.
ASSIGN varOrderNum = getData("orderhed_OrderNum").
DEF BUFFER bttOrderHed FOR ttOrderHed.
FIND FIRST Orderhed WHERE orderhed.Company = CUR-COMP
AND orderhed.Ordernum = INT(varOrderNum) NO-LOCK NO-ERROR.
If AVAILABLE Orderhed Then
Do:
FIND FIRST customer WHERE customer.company = ttorderhed.company
AND customer.custnum = ttorderhed.Custnum NO-LOCK NO-ERROR.
If Avail Customer THEN
DO:
FIND FIRST salesrep WHERE
customer.company = salesrep.company
AND customer.shortchar06 = salesrep.salesrepcode.
If Avail salesrep THEN
DO:
RUN server/bo/salesorder.p PERSISTENT SET vh-fbo.
IF VALID-HANDLE(vh-fbo) THEN
DO:
CREATE bttOrderHed.
BUFFER-COPY OrderHed TO bttOrderHed.
ASSIGN bttOrderHed.dbRowIdent = ROWID(OrderHed)
bttOrderHed.RowIdent = STRING(ROWID(OrderHed)).
CREATE ttOrderHed.
BUFFER-COPY bttOrderHed TO ttOrderHed.
ASSIGN ttorderhed.RowMod = 'U'.
ASSIGN
ttorderhed.salesrepcode1 = customer.salesrep
ttorderhed.salesrepcode2 = customer.shortchar06
ttorderhed.repsplit2 = 100
ttorderhed.reprate2 = salesrep.CommissionPercent
ttorderhed.salesrepname2 = salesrep.Name.
RUN UPDATE IN vh-fbo ({&input-output_dataset_salesorderDataSet}).
DELETE OBJECT vh-fbo.
END. /* avail Salesrep */
END. /* avail Orderhed */
END. /* avail customer */
End.
End.
{&CATCH_PRIVATE}
--- In vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com>, "Rupert" <r.oo@...> wrote:
>
> All Works now - For info Put BPM only in Post update. For some reason the ordernum is not created until after pre update
>
> --- In vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com>, Rob Bucek <rbucek@> wrote:
> >
> > Nice work
> >
> > Sent from my Verizon Wireless Droid
> >
> >
> > -----Original message-----
> > From: Rupert <r.oo@>
> > To: "vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com>" <vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com>>
> > Sent: Thu, Mar 29, 2012 15:12:54 GMT+00:00
> > Subject: [Vantage] Re: Creating a Secondary Salesperson in a customer - and updating sales order
> >
> >
> >
> > Meant to put this In:
> >
> > (Sub BPM)
> >
> > DEF INPUT parameter varOrdernum AS CHAR NO-UNDO.
> >
> > {&TRY_PRIVATE}
> > {bo/Salesorder_ds.i}
> > {lib/globals.i}
> >
> > DEF VAR vh-fbo AS HANDLE NO-UNDO.
> >
> > DEF BUFFER bttorderhed FOR ttorderhed.
> >
> > FIND FIRST orderhed WHERE orderhed.Company = CUR-COMP
> > AND STRING(orderhed.Ordernum) = varOrdernum NO-LOCK NO-ERROR.
> >
> >
> > IF AVAILABLE orderhed THEN
> > DO:
> >
> > FIND FIRST customer WHERE customer.company = orderhed.company
> > AND customer.custnum = orderhed.Custnum.
> >
> > If Avail Customer THEN
> > DO:
> >
> > FIND FIRST salesrep WHERE
> > customer.company = salesrep.company
> > AND customer.shortchar06 = salesrep.salesrepcode.
> >
> > If Avail salesrep THEN
> > DO:
> >
> > RUN server/bo/Salesorder.p PERSISTENT SET vh-fbo.
> >
> > IF VALID-HANDLE(vh-fbo) THEN
> > DO:
> > CREATE bttorderhed.
> > BUFFER-COPY orderhed TO bttorderhed.
> > ASSIGN bttorderhed.dbRowIdent = ROWID(orderhed)
> > bttorderhed.RowIdent = STRING(ROWID(orderhed)).
> >
> > CREATE ttorderhed.
> > BUFFER-COPY bttorderhed TO ttorderhed.
> >
> > ASSIGN ttorderhed.RowMod = 'U'.
> > ASSIGN ttorderhed.salesrepcode2 = customer.shortchar06
> > ttorderhed.repsplit2 = 100
> > ttorderhed.reprate2 = salesrep.CommissionPercent
> > ttorderhed.salesrepname2 = salesrep.Name.
> >
> > RUN UPDATE IN vh-fbo ({&input-output_dataset_salesorderDataSet}).
> >
> > DELETE OBJECT vh-fbo.
> >
> > END. /* valid-handle (vh-fbo) */
> >
> > END. /* avail Salesrep */
> >
> > END. /* avail Orderhed */
> >
> > END. /* avail customer */
> >
> > {&CATCH_PRIVATE}
> >
> > --- In vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com><mailto:vantage%40yahoogroups.com>, "Rupert" <r.oo@> wrote:
> > >
> > > I had success in putting a 2nd Salesperson in with "Fixed" data via a bpm, however when I tried to link this to the Customer UD field it would not pull the data through.
> > >
> > >
> > >
> > > Fustrating!
> > >
> > > --- In vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com><mailto:vantage%40yahoogroups.com>, Steven Gotschall <sgotschall@> wrote:
> > > >
> > > > The Business Object returns Salesrepcode1,2,3,4,&5 but the field in the database is just one field called SalesRepList and is delineated by a ~. So if you need to update/change it from a BPM, you need to save the rep codes to SalesRepList with something like Rep1~Rep2~Rep3~Rep4~Rep5.
> > > >
> > > >
> > > >
> > > > ________________________________
> > > > From: Rupert <r.oo@>
> > > > To: vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com><mailto:vantage%40yahoogroups.com>
> > > > Sent: Wednesday, March 21, 2012 10:57 AM
> > > > Subject: [Vantage] Creating a Secondary Salesperson in a customer - and updating sales order
> > > >
> > > >
> > > > Â
> > > > Hi All,
> > > >
> > > > I've created a secondary Salesperson Combo Box in Customers and am looking to update sales orders on the "change customer directive". So that sales rep list line one will be the sales person as standard, sales rep list line two will have the customized salesperson details in it.
> > > >
> > > > Has anyone had experience of adding to the sales rep list via BPM before? In the tracing there seems to be a salesrepcode1,2,3.... but they're all held in salesreplist.
> > > >
> > > > Thanks
> > > >
> > > >
> > > >
> > > >
> > > > [Non-text portions of this message have been removed]
> > > >
> > >
> >
> >
> >
> > Reply to sender<mailto:r.oo@?subject=Re%3A%20Creating%20a%20Secondary%20Salesperson%20in%20a%20customer%20-%20and%20updating%20sales%20order> | Reply to group<mailto:vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com>?subject=Re%3A%20Creating%20a%20Secondary%20Salesperson%20in%20a%20customer%20-%20and%20updating%20sales%20order> | Reply via web post<http://groups.yahoo.com/group/vantage/post;_ylc=X3oDMTJwdmtiMDgwBF9TAzk3MzU5NzE0BGdycElkAzIwMzY5BGdycHNwSWQDMTcwNTAwNzE4MQRtc2dJZAMxMDg5MzIEc2VjA2Z0cgRzbGsDcnBseQRzdGltZQMxMzMzMDMzOTcx?act=reply&messageNum=108932> | Start a New Topic<http://groups.yahoo.com/group/vantage/post;_ylc=X3oDMTJjcGEybWg5BF9TAzk3MzU5NzE0BGdycElkAzIwMzY5BGdycHNwSWQDMTcwNTAwNzE4MQRzZWMDZnRyBHNsawNudHBjBHN0aW1lAzEzMzMwMzM5NzE->
> > Messages in this topic<http://groups.yahoo.com/group/vantage/message/108650;_ylc=X3oDMTM2cGJlbGNtBF9TAzk3MzU5NzE0BGdycElkAzIwMzY5BGdycHNwSWQDMTcwNTAwNzE4MQRtc2dJZAMxMDg5MzIEc2VjA2Z0cgRzbGsDdnRwYwRzdGltZQMxMzMzMDMzOTcxBHRwY0lkAzEwODY1MA--> (4)
> > Recent Activity:
> >
> > * New Files<http://groups.yahoo.com/group/vantage/files;_ylc=X3oDMTJldW1vMnJoBF9TAzk3MzU5NzE0BGdycElkAzIwMzY5BGdycHNwSWQDMTcwNTAwNzE4MQRzZWMDdnRsBHNsawN2ZmlsZXMEc3RpbWUDMTMzMzAzMzk3MQ--> 1
> >
> > Visit Your Group<http://groups.yahoo.com/group/vantage;_ylc=X3oDMTJjYjRyMWU3BF9TAzk3MzU5NzE0BGdycElkAzIwMzY5BGdycHNwSWQDMTcwNTAwNzE4MQRzZWMDdnRsBHNsawN2Z2hwBHN0aW1lAzEzMzMwMzM5NzE->
> > Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
> > (1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.<http://groups.yahoo.com/group/vantage/files/>
> > (2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
> > (3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/links
> > [Yahoo! Groups]<http://groups.yahoo.com/;_ylc=X3oDMTJidXBlbGgxBF9TAzk3MzU5NzE0BGdycElkAzIwMzY5BGdycHNwSWQDMTcwNTAwNzE4MQRzZWMDZnRyBHNsawNnZnAEc3RpbWUDMTMzMzAzMzk3MQ-->
> > Switch to: Text-Only<mailto:vantage-traditional@yahoogroups.com<mailto:vantage-traditional%40yahoogroups.com>?subject=Change%20Delivery%20Format:%20Traditional>, Daily Digest<mailto:vantage-digest@yahoogroups.com<mailto:vantage-digest%40yahoogroups.com>?subject=Email%20Delivery:%20Digest> • Unsubscribe<mailto:vantage-unsubscribe@yahoogroups.com<mailto:vantage-unsubscribe%40yahoogroups.com>?subject=Unsubscribe> • Terms of Use<http://docs.yahoo.com/info/terms/>
> >
> >
> > [Non-text portions of this message have been removed]
> >
>
[Non-text portions of this message have been removed]