on 09-22-2015 3:06 PM
Hi,
How can I retrive data from a Function Module Tables??
var FM = session.createRFC("BAPI_ISUPARTNER_GETDETAIL");
FM.setParameter("PARTNER",BP);
FM.requestResults(JSON.stringify(["PARTNERDATA","RETURN","TADDRESS"]));
FM.send();
var partnerdata = JSON.parse(FM.getResult("PARTNERDATA"));
var FejlKode = JSON.parse(FM.getResult("RETURN"));
var taddress = JSON.parse(FM.getResult("TADDRESS"));
session.findById("wnd[0]/usr/lblPersonas_1442834785123").text = taddress.CITY1;
The TADDRESS is a type TABLES but this doesn't Work like the Type EXPORT.
Any suggestions??
Mik
Please refer to the corresponding wiki page which has an example of handling table parameters.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tamas,
I have found that page and used for inspiration. I when I do the examples from the wiki everything Works. But when I want to use output fields from the FM type TABLES I get an error like when I try to Parse the result:
Error during script execution:
TypeError: The property 'textContent' can not be retrieved for reference, which is undefined or null
the getResult
After trying with the wiki examples I found that the TABLES Works as the EXPORT just that is always an array even thou there is only on record in the TABLE.
So from my example I need to get the data via a FOR loop like:
var FM = session.createRFC("BAPI_ISUPARTNER_GETDETAIL");
FM.setParameter("PARTNER",BP);
FM.requestResults(JSON.stringify(["PARTNERDATA","TADDRESS"]));
FM.send();
var partnerdata = JSON.parse(FM.getResult("PARTNERDATA"));
var taddr = FM.getResult("TADDRESS");
var ta = JSON.parse(taddr);
for(var i=0; i<ta.length; i++){
session.findById("wnd[0]/usr/lblPersonas_1442929113660").text = ta[i].ADDRNUMBER;
}
A little extra: The "session.utils.log" is a nice functionality to do your debugging.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.