Insert New Record - ABL

Look at topic 121219 I gave the code how to do this 2 years agoÂ


Jose C Gomez
Software Engineer


T: 904.469.1524 mobile

Quis custodiet ipsos custodes?

On Thu, May 30, 2013 at 9:25 AM, Ted Koch <tkoch77@...> wrote:

Â
<div>
  
  
  <p>Thanks again Jose, I will give it a go.<br>

________________________________
From: Jose Gomez <jose@...>
To: Vantage <vantage@yahoogroups.com>
Sent: Thursday, May 30, 2013 8:58 AM
Subject: Re: [Vantage] Insert New Record - ABL




Yes you can just call the business objects as shown

/*
Put this in server/bpm/custom/
call it like so:
run bpm/custom/UD10Maker.p(InvoiceNum, CustNum, Descrip, Amount).
*/
{Bpm/Bpm.i &OBJECT_NAME=UD10 }

DEFINE INPUT PARAMETER InvoiceNum   AS INTEGER.
DEFINE INPUT PARAMETER CustNum       AS INTEGER.
DEFINE INPUT PARAMETER Descrip       AS CHARACTER.
DEFINE INPUT PARAMETER Amount      AS DECIMAL.

{&TRY_PRIVATE}

      define variable morePages as logical.
   define variable i as integer.
   define variable hUD10 as handle.
         RUN bo\UD10.p PERSISTENT SET hUD10.
      if VALID-HANDLE (hUD10) THEN DO:
            RUN GetRows IN hUD10 (input "Key1 = '" + STRING(CustNum) + "' AND
Character01 = '" + STRING(InvoiceNum) + "'", input "",
{&output_dataset_UD10DataSet}, input 0, input 0, output morePages)
NO-ERROR.
            /* Delete existing rows for this sales order before rebuilding */
      for each ttUD10:
         RUN DeleteByID IN hUD10 (input ttUD10.Key1, input ttUD10.Key2,
input ttUD10.Key3, input ttUD10.Key4, input ttUD10.Key5) NO-ERROR.
      end.
            /* rerun to clear out temp tables */     Â
      RUN GetRows IN hUD10 (input "Key1 = '" + STRING(CustNum) + "' AND
Character01 = '" + STRING(InvoiceNum) + "'", input "",
{&output_dataset_UD10DataSet}, input 0, input 0, output morePages)
NO-ERROR.
      RUN GetaNewUD10 IN hUD10 ( {&input-output_dataset_UD10DataSet} ) NO-ERROR.
            for each ttUD10 where ttUD10.RowMod = "A":
         assign ttUD10.Key1 = STRING(CustNum).
         assign ttUD10.Character01 = STRING(InvoiceNum).
         assign ttUD10.Character02 = Descrip.
         assign ttUD10.Number01 = Amount - (Amount * 2).
         assign ttUD10.Date01 = TODAY.        Â
      end.
               RUN Update IN hUD10 ({&input-output_dataset_UD10DataSet}) NO-ERROR.                 Â
   end.
   else do:
      message "Could not create handle to UD10.p!".
   end.  Â
         delete object hUD10.  Â
{&CATCH_PRIVATE}

*Jose C Gomez*
*Software Engineer*
*
*
*
*T: 904.469.1524 mobile
E: jose@...
http://www.josecgomez.com
<http://www.linkedin.com/in/josecgomez>Â <http://www.facebook.com/josegomez>
 <http://www.google.com/profiles/jose.gomez> <http://www.twitter.com/joc85>
 <http://www.josecgomez.com/professional-resume/>
<http://www.josecgomez.com/feed/>
 <http://www.usdoingstuff.com>

*Quis custodiet ipsos custodes?*

On Thu, May 30, 2013 at 8:55 AM, tkoch77 <tkoch77@...> wrote:

> **
>
>
> Curious if it is possible to add a new record (UD01) using ABL code in a
> BPM? If so, anyone have an example?
>
> Thanks!
>
> -Ted
>

>

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

------------------------------------

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/.
(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/linksYahoo! Groups Links

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

</div>
 


<div style="color:#fff;min-height:0;"></div>

Curious if it is possible to add a new record (UD01) using ABL code in a BPM? If so, anyone have an example?

Thanks!

-Ted
Yes you can just call the business objects as shown

/*
Put this in server/bpm/custom/
call it like so:
run bpm/custom/UD10Maker.p(InvoiceNum, CustNum, Descrip, Amount).
*/
{Bpm/Bpm.i &OBJECT_NAME=UD10 }

DEFINE INPUT PARAMETER InvoiceNum AS INTEGER.
DEFINE INPUT PARAMETER CustNum AS INTEGER.
DEFINE INPUT PARAMETER Descrip AS CHARACTER.
DEFINE INPUT PARAMETER Amount AS DECIMAL.

{&TRY_PRIVATE}

define variable morePages as logical.
define variable i as integer.
define variable hUD10 as handle.
RUN bo\UD10.p PERSISTENT SET hUD10.
if VALID-HANDLE (hUD10) THEN DO:
RUN GetRows IN hUD10 (input "Key1 = '" + STRING(CustNum) + "' AND
Character01 = '" + STRING(InvoiceNum) + "'", input "",
{&output_dataset_UD10DataSet}, input 0, input 0, output morePages)
NO-ERROR.
/* Delete existing rows for this sales order before rebuilding */
for each ttUD10:
RUN DeleteByID IN hUD10 (input ttUD10.Key1, input ttUD10.Key2,
input ttUD10.Key3, input ttUD10.Key4, input ttUD10.Key5) NO-ERROR.
end.
/* rerun to clear out temp tables */
RUN GetRows IN hUD10 (input "Key1 = '" + STRING(CustNum) + "' AND
Character01 = '" + STRING(InvoiceNum) + "'", input "",
{&output_dataset_UD10DataSet}, input 0, input 0, output morePages)
NO-ERROR.
RUN GetaNewUD10 IN hUD10 ( {&input-output_dataset_UD10DataSet} ) NO-ERROR.
for each ttUD10 where ttUD10.RowMod = "A":
assign ttUD10.Key1 = STRING(CustNum).
assign ttUD10.Character01 = STRING(InvoiceNum).
assign ttUD10.Character02 = Descrip.
assign ttUD10.Number01 = Amount - (Amount * 2).
assign ttUD10.Date01 = TODAY.
end.
RUN Update IN hUD10 ({&input-output_dataset_UD10DataSet}) NO-ERROR.
end.
else do:
message "Could not create handle to UD10.p!".
end.
delete object hUD10.
{&CATCH_PRIVATE}



*Jose C Gomez*
*Software Engineer*
*
*
*
*T: 904.469.1524 mobile
E: jose@...
http://www.josecgomez.com
<http://www.linkedin.com/in/josecgomez> <http://www.facebook.com/josegomez>
<http://www.google.com/profiles/jose.gomez> <http://www.twitter.com/joc85>
<http://www.josecgomez.com/professional-resume/>
<http://www.josecgomez.com/feed/>
<http://www.usdoingstuff.com>

*Quis custodiet ipsos custodes?*


On Thu, May 30, 2013 at 8:55 AM, tkoch77 <tkoch77@...> wrote:

> **
>
>
> Curious if it is possible to add a new record (UD01) using ABL code in a
> BPM? If so, anyone have an example?
>
> Thanks!
>
> -Ted
>
>
>


[Non-text portions of this message have been removed]
find UD01 where no-error.
If Not available UD01 then do:
Create UD01.
Assign UD01.Company =cur-comp.
Assign UD01.key1 = "value".
Assign UD01.key2 = string(numvalue).
Assign UD01.key3 = "".
Assign UD01.key4 = "".
Assign UD01.key5 = "".

Release UD01.
End.

I think I remember you have to assign all 5 keys and they are string, but otherwise like any other table.

Greg

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of tkoch77
Sent: Thursday, May 30, 2013 8:55 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Insert New Record - ABL



Curious if it is possible to add a new record (UD01) using ABL code in a BPM? If so, anyone have an example?

Thanks!

-Ted


________________________________
CONFIDENTIALITY NOTICE

The information contained in this communication, including attachments, is privileged and confidential. It is intended only for the exclusive use of the addressee. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us at 727-578-6280 and immediately delete the communication.

"This (document/presentation) may contain technical data as defined in the International Traffic In Arms Regulations (ITAR) 22 CFR 120.10. Export of this material is restricted by the Arms Export Control Act (22 U.S.C. 2751 et seq.) and may not be exported to foreign persons without prior approval form the U.S. Department of State."


[Non-text portions of this message have been removed]
Thanks again Jose, I will give it a go.




________________________________
From: Jose Gomez <jose@...>
To: Vantage <vantage@yahoogroups.com>
Sent: Thursday, May 30, 2013 8:58 AM
Subject: Re: [Vantage] Insert New Record - ABL


Yes you can just call the business objects as shown

/*
Put this in server/bpm/custom/
call it like so:
run bpm/custom/UD10Maker.p(InvoiceNum, CustNum, Descrip, Amount).
*/
{Bpm/Bpm.i &OBJECT_NAME=UD10 }

DEFINE INPUT PARAMETER InvoiceNum   AS INTEGER.
DEFINE INPUT PARAMETER CustNum       AS INTEGER.
DEFINE INPUT PARAMETER Descrip       AS CHARACTER.
DEFINE INPUT PARAMETER Amount      AS DECIMAL.

{&TRY_PRIVATE}

      define variable morePages as logical.
   define variable i as integer.
   define variable hUD10 as handle.
         RUN bo\UD10.p PERSISTENT SET hUD10.
      if VALID-HANDLE (hUD10) THEN DO:
            RUN GetRows IN hUD10 (input "Key1 = '" + STRING(CustNum) + "' AND
Character01 = '" + STRING(InvoiceNum) + "'", input "",
{&output_dataset_UD10DataSet}, input 0, input 0, output morePages)
NO-ERROR.
            /* Delete existing rows for this sales order before rebuilding */
      for each ttUD10:
         RUN DeleteByID IN hUD10 (input ttUD10.Key1, input ttUD10.Key2,
input ttUD10.Key3, input ttUD10.Key4, input ttUD10.Key5) NO-ERROR.
      end.
            /* rerun to clear out temp tables */     Â
      RUN GetRows IN hUD10 (input "Key1 = '" + STRING(CustNum) + "' AND
Character01 = '" + STRING(InvoiceNum) + "'", input "",
{&output_dataset_UD10DataSet}, input 0, input 0, output morePages)
NO-ERROR.
      RUN GetaNewUD10 IN hUD10 ( {&input-output_dataset_UD10DataSet} ) NO-ERROR.
            for each ttUD10 where ttUD10.RowMod = "A":
         assign ttUD10.Key1 = STRING(CustNum).
         assign ttUD10.Character01 = STRING(InvoiceNum).
         assign ttUD10.Character02 = Descrip.
         assign ttUD10.Number01 = Amount - (Amount * 2).
         assign ttUD10.Date01 = TODAY.        Â
      end.
               RUN Update IN hUD10 ({&input-output_dataset_UD10DataSet}) NO-ERROR.                 Â
   end.
   else do:
      message "Could not create handle to UD10.p!".
   end.  Â
         delete object hUD10.  Â
{&CATCH_PRIVATE}



*Jose C Gomez*
*Software Engineer*
*
*
*
*T: 904.469.1524 mobile
E: jose@...
http://www.josecgomez.com
<http://www.linkedin.com/in/josecgomez>Â <http://www.facebook.com/josegomez>
 <http://www.google.com/profiles/jose.gomez> <http://www.twitter.com/joc85>
 <http://www.josecgomez.com/professional-resume/>
<http://www.josecgomez.com/feed/>
 <http://www.usdoingstuff.com>

*Quis custodiet ipsos custodes?*


On Thu, May 30, 2013 at 8:55 AM, tkoch77 <tkoch77@...> wrote:

> **
>
>
> Curious if it is possible to add a new record (UD01) using ABL code in a
> BPM? If so, anyone have an example?
>
> Thanks!
>
> -Ted
>

>


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



------------------------------------

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/.
(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/linksYahoo! Groups Links



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