Lawson AGS Caching

If you’ve done much work at all with Lawson AGS calls, you’ve no doubt noticed the _CACHE property.  Ever wonder what it does?

Simply put, if you set the _CACHE property to true, you can make subsequent AGS calls to update a single field without having to pass back all of the values on a form.  This is extremely useful for forms that have a lot of fields and you just want to change one or two.  Something like GL10 (GL Company setup) that has hundreds of fields, but you only want to change the company description.

Note: this is not necessary for all forms because some forms implicitly only require the fields you are changing (like PA52).

So how to use the _CACHE property?  First you inquire on the form with caching, get the _TRANSID that is returned to you, and then pass back the fields that you want to change.

In this example, we’re going to be using the PO25.6 screen.  For those unfamiliar with this screen, it is the Vendor Agreement Line form where we can maintain the lines of an Agreement (Vendor contract).  There are 126 detail fields on the screen.   All we want to do is execute a change on the line.  We don’t even want to change anything *.

Inquire:
_PDL=PROD&_TKN=PO25.6&_EVT=CHG&FC=I&_CACHE=TRUE&_DTLROWS=FALSE&_LFN=TRUE&_INITDTL=TRUE&PVN-PROCURE-GROUP=PROC&PVN-VEN-AGRMT-REF=GP2MS01111&PVN-LINE-NBRr0=44

Response looks like:

<?xml version="1.0" encoding="ISO-8859-1" ?> 
<XPO25.6>
<PO25.6>
<_PDL>PROD</_PDL> 
<_TKN>PO25.6</_TKN> 
<_CACHE>TRUE</_CACHE> 
<_TRANSID>1280852223366.24</_TRANSID>
<_LFN>TRUE</_LFN> 
<TC>PO25.6</TC> 
<FC>I</FC> 
<PVN-PROCURE-GROUP>PROC</PVN-PROCURE-GROUP> 
<PCG-PROC-GRP-DESC>PROCUREMENT GROUP</PCG-PROC-GRP-DESC>
...
<PO25.6>
<XPO25.6>

Change Call (to make a change to line 44 with no value changes)
_PDL=PROD&_TKN=PO25.6&_EVT=CHG&FC=C&_DTLROWS=FALSE&PVN-PROCURE-GROUP=PROC&PVN-VEN-AGRMT-REF=GP2MS01111&LINE-FCr0=C&PT-PVN-LINE-NBR=44&_TRANSID=1280852223366.24

Response:

<?xml version="1.0" encoding="ISO-8859-1" ?> 
<XPO25.6>
<PO25.6>
<_PDL>PROD</_PDL> 
<_TKN>PO25.6</_TKN> 
<_TRANSID>1280852223366.24</_TRANSID> 
<_PRE>TRUE</_PRE> 
<_f0>PO25.6</_f0> 
<_f1>C</_f1> 
<_f2>PROC</_f2> 
<_f3>PROCUREMENT GROUP</_f3> 
<_f4 /> 
<_f5 /> 
<_f6>L</_f6> 
<_f7>LINE</_f7> 
<_f8>GP2MS01111</_f8> 
...
<_f855>PROCGP2MS01111</_f855> 
<Message>Change Complete - Continue</Message> 
<MsgNbr>000</MsgNbr> 
<StatusNbr>001</StatusNbr> 
<FldNbr>_f0</FldNbr> 
</PO25.6>
</XPO25.6>

Wasn’t that easy?

*We actually use this as part of a process flow that runs every day.  We do this because we’re on 9.0 apps and when a change is made to the date on the agreement header, it doesn’t propagate to the lines.  All that’s necessary is to go to the PO25.6 and make a change on the line without changing any data (you can’t change the date anyway, it’s a calculated field), but the users seem to find this too tedious.  Imagine that.

UPDATE — Part 2 is here
HTH

Advertisements

5 comments

  1. I love this and have used it in vb and javascripts. I have not figured out how to capture the _TRANSID field in process flow. when I try Transaction1234_fieldname it does not like it because of the _ in front of TRANSID. I have also tried performing the functions as a webrun and parsing the result to get the _TRANSID which works but then when I try to input this into the second transaction it ignores it and gives a different _TRANSID in the response. I’m guessing it has something to do with how a webrun opens and closes it’s web call?? Any suggestions?

    1. The fact that _TRANSID is not available as a result from the AGS call in processflow (or LPA) has nothing to do with the underscore. I’m not sure what the correct term is, but any of the elements related to the service itself are not returned like _PDL, _TKN, etc. The fact that FC is not returned either proves that the underscore is not the issue. We’re on LPA and it’s been a while since I’ve tried to do this on Process flow, but if I recall correctly –
      1) Run your WebRun
      2) Pass the XML result into an Assign Node and replace the period (.) in the root node and _TKN element
      3) Parse the resulting string from the Assign node in an XML node
      4) Update the XML object with another assign node to whichever values you need to change – be sure to change the action from Inquire to Change, etc – OR – Build a new AGS call string from the xml output
      5) Either run a WebRun with the XML output or and AGS call with your string

      For the basic concept of the flow (excluding the _CACHE) see this post.

  2. Thanks for sharing your ideas.
    I have difficulty in getting TRANSID from the Transection Node or Webrun call. Can you share with me a sample flow which show how you are utilizing the TRANSID to update the form?
    Thanks,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s