Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3523

Screen Personas 3.0 Function Call for HR Data

$
0
0

Hello Experts,

 

I want to create an overview page for HR data with SAP Screen Personas 3.0. The user enters the employee number and gets back main hr data of this employee, for example salary, weekly working hours, tarif group, etc. The fastest way to display these data is via function call. HR data however are added into infotypes with a begin date and an end date. How do I define the scripting to get the data of the currently valid record of an infotype?

 

I started with BAPI_BASICPAY_GETDETAIL. This BAPI needs the correct begda and endda of the record of infotype 0008. I added the BAPI_BASICPAY_GETLIST in front to get the begda and endda of the current record. The result was always "undefined".

 

It would be great, if somebody could help me with a sample coding.

 

Here is my coding so far:

 

var pernr = session.findById("wnd[0]/usr/txtPersonas_1438765613506").text;

 

var today = new Date();

var dd = today.getDate();

var mm = today.getMonth()+1; //January is 0!

var yyyy = today.getFullYear();

 

 

if(dd<10) {

    dd='0'+dd

}

 

if(mm<10) {

    mm='0'+mm

}

 

var today = yyyy + mm + dd;

 

var FMTrfDetail = session.createRFC("BAPI_BASICPAY_GETLIST");

FMTrfDetail.setParameter("EMPLOYEENUMBER",pernr);

FMTrfDetail.setParameter("TIMEINTERVALLOW",today);

FMTrfDetail.setParameter("TIMEINTERVALHIGH",today);

FMTrfDetail.requestResults(JSON.stringify(["BASICPAYEMPKEY"]));

FMTrfDetail.send();

 

var basic = JSON.parse(FMTrfDetail.getResult("BASICPAYEMPKEY"));

 

session.findById("wnd[0]/usr/textEditPersonas_1438766133084").text = basic.EMPLOYEENO;

var begda = basic.VALIDBEGIN;

 

var endda = basic.VALIDEND;

 

var subtype = 0;

var objid = "";

var spkz = "";

var nbr = 000;

 

 

var FMTarif = session.createRFC("BAPI_BASICPAY_GETDETAIL");

FMTarif.setParameter("EMPLOYEENUMBER",pernr);

FMTarif.setParameter("SUBTYPE",subtype);

FMTarif.setParameter("OBJECTID",objid);

FMTarif.setParameter("LOCKINDICATOR",spkz);

 

FMTarif.setParameter("VALIDITYBEGIN", begda);

FMTarif.setParameter("VALIDITYEND",endda);

FMTarif.setParameter("RECORDNUMBER",nbr);

 

FMTarif.requestResults(JSON.stringify(["PAYSCALEGROUP", "PAYSCALELEVEL", "ANNUALSALARY"]));

FMTarif.send();

 

session.findById("wnd[0]/usr/txtPersonas_1438766068787").text = JSON.parse(FMTarif.getResult("PAYSCALEGROUP"));

session.findById("wnd[0]/usr/txtPersonas_1438766074769").text = JSON.parse(FMTarif.getResult("PAYSCALELEVEL"));

session.findById("wnd[0]/usr/txtPersonas_1438766082096").text = JSON.parse(FMTarif.getResult("ANNUALSALARY"));

 

Thank you.

Bye,

Heike


Viewing all articles
Browse latest Browse all 3523

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>