DME query to L_HAPI table

 8 Replies
 0 Subscribed to this topic
 12 Subscribed to this forum
Sort:
Author
Messages
KHessing
Basic Member Send Private Message
Posts: 10
Basic Member
Has anyone attempted to do a DME call to the L_INDEX table? Or any of the 'L_' tables? I am able to do a DME call to APINVOICE and get my results but not to the L_INDEX. Was wondering if these tables can be used in Design Studio. Here is my code that is not returning results:

var x = portalWnd.DMEPath;
 x += "?PROD="+strPDL;
 x += "&FILE=L_HAPI";
 x += "&FIELD=OBJECT;NAME";
 x += "%26SELECT=L_INDEX=" + result;
 x += "&OUT=CSV&DELIM=~&NOHEADER";

var objhttp=portalWnd.objFactory.createInstance("http");
 objhttp.Open("GET",x,false);
 objhttp.Send("UserInfo");
 var sReturn2=objhttp.responseTEXT

alert(sReturn2);

My alert displays 'OBJECT' and 'NAME' but not the values for the fields. Any help would be appreciated. Thanks!
KHessing
Basic Member Send Private Message
Posts: 10
Basic Member
FYI, I have another DME that runs prior to this one and is returning the variable result. This has a valid value that is in my database table L_HAPI in L_INDEX field. Thanks.
Robert Spurr
Veteran Member Send Private Message
Posts: 130
Veteran Member
As far as I know you can't DME the tables in question. You have to use a CGI call like (cgi-lawson/writeattach.exe) or (cgi-lawson/getattachrec.exe)
KHessing
Basic Member Send Private Message
Posts: 10
Basic Member
Thanks for your response Robert! Do you have any documentation on the getattachrec.exe? I found some in Lawson Support but does not provide alot of information. I am trying to retrieve the Invoice Image for the vendor invoice combination on AP20. Does anyone have an example of this nature? Thanks much!
Robert Spurr
Veteran Member Send Private Message
Posts: 130
Veteran Member
I wish it was that easy. The best way to start is go to AP20 and click on the comment button followed by an Crtl+Alt+A and there you will find the syntax used by AP20. From there you can tweak the URL to your liking.
Sample: (cgi-lawson/getattachrec.exe?_AUDT=A&_IN=APISET1&K1=1000&K2=272&_FN=APINVOICE&K3=632625802&K4=0&_ATYP=C&K5=0&_TYP=CMT&_OPM=C&_OUT=XML&_ATTR=TRUE&_DRIL=TRUE&_AOBJ=TRUE&_PDL=TRAIN&_ON=Invoice+Note%2FReport%2FCheck+Comments) The K1-K9 match to the index used.
KHessing
Basic Member Send Private Message
Posts: 10
Basic Member
Thanks again Robert!! I appreciate your help!! I will give this a try..
KHessing
Basic Member Send Private Message
Posts: 10
Basic Member

Unfortunately I am still having issues with this. Here is my code I am trying to use:

//code for getattachrec.exe
var x = "http://lawson.fbfs.com:7740/cgi-lawson/getattachrec.exe";
x += "?_OUT=XML";
x += "&_PDL= TRAIN9";
x += "&_FN=APINVOICE";
x += "&_IN=APISET1";
x += "&K1=" + vComp;
x += "&K2=" + vVen;
x += "&K3=" + vInv;
x += "&K4=" + vSuff;
x += "&K5=" + vCanSeq;
x += "&_ATYP=U";
x += "&_AUDT=I";
x += "&_USCH=HTTP";
x += "&_KS=zz";
x += "&_OPM=A";
x += "&_DATA=TRUE";
 alert(x);

//Return value from call
var objhttp=portalWnd.objFactory.createInstance("http");
//var objhttp = new ActiveXObject("Msxml2.XMLHTTP")
objhttp.Open("GET", x, false)
objhttp.Send("UserInfo")

//Display value from call
var vURL = objhttp.responseTEXT
alert("URL:" + vURL)

Please see attached document with values of 'x' and 'URL'  along with error message. Does anyone have any thoughts on what I am doing wrong? I have tried several different ways of doing this procedure but this seems to be the closest I have come. Any help would be much appreciated. Thanks!

Attachments
Robert Spurr
Veteran Member Send Private Message
Posts: 130
Veteran Member
It takes some trail and error. The following works for me in a browser:

(With data elements)
https://{Server}/cgi-lawson/getattachrec.exe?
&_PDL=TRAIN&_FN=APINVOICE&_IN=APISET1&_ATYP=C&_OPM=C
&_DATA=TRUE&_ECODE=FALSE&K1=1160&K2=272&K3=641767014&K4=0
&K5=0&_OUT=XML

(Data element place holders)
https://{Server}/cgi-lawson/getattachrec.exe?
&_PDL={Prodcutline}&_FN=APINVOICE&_IN=APISET1&_ATYP=C&_OPM=C
&_DATA=TRUE&_ECODE=FALSE&K1={Company}&K2={Vendor}&K3={Invoice}&K4={Suffix}
&K5={Cancel Seq}&_OUT=XML
KHessing
Basic Member Send Private Message
Posts: 10
Basic Member
Thank you so much for your help!! I was able to get this to work!! What a great way to end the week!!