cancel
Showing results for 
Search instead for 
Did you mean: 

Personas 3.0 RFC calls returning null values

0 Kudos
508

Hello,

I am trying to incorporate RFC calls into some Personas scripts but they seem to be returning null values.  I tested in SE37 the same function modules, same inputs and the expected values are returned.  I decided to try one of the simple examples from the portal the and get the same result.  Here is the code:

var rfc = session.createRFC("BAPI_USER_GET_DETAIL");

rfc.setParameter("USERNAME", "*******");

rfc.requestResults(JSON.stringify(["ADDRESS","RETURN"]));

rfc.send();

var address = JSON.parse(rfc.getResult("ADDRESS"));

Here is the error:

Error during script execution:

TypeError: Cannot read property 'textContent' of null

at sap.personas.scripting.scriptingEngine.GuiRFC.getResult (http://svrsaperpdev.mcc.local:8100/sap/bc/personas3/core/script/sap/personas/fw/its/scripting/Script...)

at eval ([AppID:VA01]>[Flavor:VA01_RM_01_TEMP]>[Script:wnd[0]/scrptPersonas_0-GOTO_DETAIL]:50:30)

at Object.self.executeScriptInternal (http://svrsaperpdev.mcc.local:8100/sap/bc/personas3/core/script/sap/personas/fw/its/scripting/Script...)

at Object.sap.personas.scripting.executeScriptInternal (http://svrsaperpdev.mcc.local:8100/sap/bc/personas3/core/script/sap/personas/fw/its/scripting/Script...)

at eval (http://svrsaperpdev.mcc.local:8100/sap/bc/personas3/core/script/sap/personas/fw/its/scripting/Runtim...)


Since I get the same error on all FMs I have tried could this be something related to the RFC connection?  How to find out what RFC connection is used in this case?

Accepted Solutions (1)

Accepted Solutions (1)

cris_hansen
Advisor
Advisor
0 Kudos

Hello Rob,

Have you maintained the FM in the whitelist?

/n/personas/admin -> menu "Goto" -> "Whitelists" -> "FM Whitelist".

Please also visit the Wiki "How to call Remote Enabled ABAP Function Modules in Personas 3.0"

Kind regards,

Cris

0 Kudos

Hi Cris,

Thanks for replying.  Good question, but I have maintained the FMs in the FM whitelist.  I have also reviewed the Wiki and other information on FM calls but do not see any steps I am missing.

Rob

cris_hansen
Advisor
Advisor
0 Kudos

Hello Rob,

I just tested the example 1 from the wiki page.

It is working on IE11, FF and Chrome.

My test system runs kernel 7.42, pl 328 + Personas 3.0 SP02, with client note 2222774 v16 (I am about to update to v21).

Do you have a similar environment?

Regards,

Cris

0 Kudos

Cris,

Our environment is almost identical, except we are on patch level 325.  I guess it is worth trying 328? Or whatever latest patch level is?

Thanks,

Rob

cris_hansen
Advisor
Advisor
0 Kudos

Hello Rob,

I don't think the kernel plays a role here. There are 5 corrections in ITS from pl 325 to pl328 (pl 329, available in the Support Portal, don't have ITS changes).

Have you validated the script? What do you see in the logging tab?

Thanks,

Cris

0 Kudos

Hi Cris,

Yes, the script validates without any errors in the logging tab, just "Script validation successful."

Thanks,

Rob

sushant_priyadarshi
Product and Topic Expert
Product and Topic Expert
0 Kudos

rob,

have you implemented http://service.sap.com/sap/support/notes/2247087

-Sushant

cris_hansen
Advisor
Advisor
0 Kudos

Hello Rob,

Please clarify about the SAP_BASIS version and support package level: SAPKB7xxyy ?

Thanks,

Cris

cris_hansen
Advisor
Advisor
0 Kudos

I have this note implemented.

Probably the reason why it is working in my test system.

Thanks Sushant!

0 Kudos

Thanks, will check if we have this note.

0 Kudos

Guys,

We did not have that note applied, so it has now been applied and now the "User detail" RFC example works as expected.  Thank you!  However, I having trouble with the actual FM I need to use, BAPI_CUSTOMER_GETDETAIL2.  No error message but value returned is blanks.  I verified the input parameters in SE37 test mode and I am getting the expected values returned.  I am using the same syntax as with the example:

var rfc1 = session.createRFC("BAPI_CUSTOMER_GETDETAIL2");

rfc1.setParameter("CUSTOMERNO", ship_to);

rfc1.requestResults(JSON.stringify(["CUSTOMERGENERALDETAIL", "RETURN"]));

rfc1.send();

var customergeneraldetail = JSON.parse(rfc1.getResult("CUSTOMERGENERALDETAIL"));

var taxjurcode = customergeneraldetail.TAXJURCODE;

session.utils.log(taxjurcode);

When the code above is executed, the variable taxjurcode has a blank value, whereas in SE37 it returns the correct value.  The FM is included in the whitelist and the script validates without errors.

Any help is appreciated.

Thanks,

Rob Howery

tamas_hoznek
Product and Topic Expert
Product and Topic Expert
0 Kudos

Do you pass the customer number with leading zeroes and in length 10? The FM test interface does that for you automatically, but this doesn't happen in a real RFC call.

Check the content of the RETURN parameter to see if there is any error message supplied by the BAPI.

0 Kudos

Thanks so much Tamas.  I was capturing the customer number from the actual field in the transaction, but it seems it does not include the leading zeros when doing so.  I have added some code to insert the leading zeros and it is working as expected.

Answers (0)