cancel
Showing results for 
Search instead for 
Did you mean: 

How to retrive data from a TABLE in a FM call from Screen Personas 3.0

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

tamas_hoznek
Product and Topic Expert
Product and Topic Expert
0 Kudos

Please refer to the corresponding wiki page which has an example of handling table parameters.

Former Member
0 Kudos

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


Answers (1)

Answers (1)

Former Member
0 Kudos

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.