Remote Enabled Function Modules in Personas 3.0
Just captured all the mandatory checks and steps to call remote enable function modules in Personas 3.0
Reference Link: http://wiki.scn.sap.com/wiki/display/Img/How+to+call+Remote+Enabled+ABAP+Function+Modules+in+Personas+3.0
Requirement: Fetch Employee Full Name and Last Logon Date using Personas 3.0
Step 1:
Personas SP level in our landscape:
Step 2:
Mandatory Checks
- Make sure, Function module is Remote Enabled in SAP System
- Function module to be included in Table/View ‘/PERSONAS/C_RFCW’
Step 3:
SICF Path for the Personas URL
Transaction SICF -> Click ‘F8’ -> Navigate to Path-> default_host->sap->bc->personas
Step 4:
URL: http://FQDN/sap/bc/personas?sap-client=100
- Provide Credentials of your personas system
- It will take you to initial login screen
- Also, check whether it contains ‘P’ icon ( Screen Personas )
Step 5:
Execute “SU01” transaction in the command prompt
Step 6:
Click on “P” icon, Create a flavor for “SU01” transaction. It opens below screen
Step 7:
In our case “SU01_3.0” is the new flavor which we created as a copy to standard “SU01” transaction.
Step 8:
We modified the flavor “SU01_3.0” as below
i) Introduced two new fields Full Name and Last Logon in the screen.
ii) Introduced Script button.( Details )
iii) Changed the background colors, Font colors etc..
Step 9:
Click on Scripting button as shown below
It will open the below screen, add the below code and replace the session id’s with your screen session id’s for ( Full Name and Last Logon Date ). Save it.
***************************************************************************************************
var uname=session.findById(“wnd[0]/usr/ctxtSUID_ST_BNAME-BNAME”).text;
var FM = session.createRFC(“BAPI_USER_GET_DETAIL”);
FM.setParameter(“USERNAME”,uname);
FM.requestResults(JSON.stringify([“ADDRESS”,”ADMINDATA”,”RETURN”]));
FM.send();
var address = JSON.parse(FM.getResult(“ADDRESS”));
var admindata = JSON.parse(FM.getResult(“ADMINDATA”));
session.findById(“wnd[0]/usr/txtPersonas_1441340599673”).text = address.FULLNAME;
session.findById(“wnd[0]/usr/txtPersonas_1441340612163”).text = admindata.TRDAT;
***********************************************************************************************
In the Script button “Details” , Import above script
Step 10:
Enter the user name and click on Details button, it will fetch the data using Remote Function module “BAPI_USER_GET_DETAIL” and populate the date in the respective fields
Note: This approach will also be help full for all other Remote Enabled Function Modules
We are done!
Let’s say that I also want the date & number format. These are in the DEFAULTS structure as DATFM and DCPFM. When you retrieve these from this BAPI, they come across as with domain values. I want to translate these to the text. For example, my user has chosen YYYY-MM-DD as her format. For domain XUDATFM, this is value 6. I want "YYYY-MM-DD" to appear in my flavor's label. I have been trying with RFC_READ_TABLE to read from DD07T but have not been successful getting results. Any suggestions?
Hi ,
I am new to SAP Screen Personas , I tried this script exactly same as written below but its showing me error on line where we are using set parameter:
FM.setParameter(“USERNAME”,uname);
its saying - Argument of type 'string' is not assignable to parameter of type 'object'.
I am not able to understand , am I missing something over here.
Please your help would be great!
Thanks