cancel
Showing results for 
Search instead for 
Did you mean: 

Screen Personas 3.0 Function Call for HR Data

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

What about setting external breakpoints indide BAPI_ just to make sure your call is in and out the func? Thx.

Br,

Dong

Former Member
0 Kudos

Hi Dong,

We tried the breakpoints. It went into the BAPI. There is no error. The validation of the code is ok. The result is still "undefined".

I would need a sample code how to get the data out of infotypes within PA30.

Thanks.

Best regards,

Heike

Former Member
0 Kudos

Hi Heike,

Perhaps, first just hard code some value in the BAPI_ and see if you can get the right return data, then try to get the data structure back. I did similar thing in Personas 2.0 where I had to compose return struct in my func module. Personas 3.0 does need Func module but direct parse return JSON. There are some example codes in scn somehere.

Br,


Dong

Former Member
0 Kudos

Hi Dong,

sorry for the late answer. I was in vacation.

We finally found a solution using general javascript coding for tables and dates we got in the internet.

With this comment I close the question.

Thanks

Best regards,

Heike