cancel
Showing results for 
Search instead for 
Did you mean: 

Caching problem two

Former Member
0 Kudos

Hi again,

In the ESS you evaluate the belonging employee record in HR via sy-unane and IT0105.

Problem now.

My user is connected to record number one. The user of a collegue two record number two.

We have created a iview with following RFC function.

We both start the iview with our own users. Be both recive the same values. But we are conected to different employee records and this records have different abcenses.

When we start the function in the backend everything is fine. Different output.

The function in a few words:

User (via sy-uname) checks in INTOTYPE 0105 subtype ESS which personnal number belongs to user.

With this personal number the function evaluates all abcenses and stores it in a table of the function.

This table should be shown in the Iview as output.

****************************

FUNCTION zp_get_absences_from_pernr_new.

*"----

-


""Local interface:

*" IMPORTING

*" VALUE(BEGDA) LIKE PRELP-BEGDA

*" VALUE(ENDDA) LIKE PRELP-BEGDA

*" TABLES

*" ABSENCES STRUCTURE ZPXX_ABSENCES OPTIONAL

*"----

-


DATA: lwa_2001 LIKE p2001,

lt_2001 LIKE TABLE OF lwa_2001.

TABLES : t554t.

DATA: p_usrid LIKE p0105-usrid,

p_usrty LIKE p0105-usrty,

usr_pernr LIKE p0105-pernr,

pernr TYPE prelp-pernr.

p_usrid = sy-uname.

p_usrty = 'ESS'.

TABLES : pa0105.

SELECT SINGLE * FROM pa0105

WHERE usrty = p_usrty

AND usrid EQ p_usrid

AND begda LE sy-datum

AND endda GE sy-datum.

IF sy-subrc = 0.

pernr = pa0105-pernr.

ELSE.

CLEAR pernr.

ENDIF.

CALL FUNCTION 'HR_READ_INFOTYPE'

EXPORTING

  • TCLAS = 'A'

pernr = pernr

infty = '2001'

begda = begda

endda = endda

TABLES

infty_tab = lt_2001

EXCEPTIONS

infty_not_found = 1

OTHERS = 2

.

IF sy-subrc = 0.

LOOP AT lt_2001 INTO lwa_2001.

absences-pernr = pernr.

absences-begda = lwa_2001-begda.

absences-endda = lwa_2001-endda.

absences-awart = lwa_2001-awart.

SELECT SINGLE * FROM t554t

WHERE sprsl = sy-langu

AND moabw = '01' " muß noch geändert werden.

AND awart = lwa_2001-awart.

absences-atext = t554t-atext.

APPEND absences.

ENDLOOP.

ENDIF.

ENDFUNCTION.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Georg,

It is not clear to me how do you refer to the user context in the story board ?

In order to get two different results for two different users, you need to have the user context reffered to in the model.

Regards, Eyal

Former Member
0 Kudos

Hi Eyall,

zp_get_absences_from_pernr_new is a rfc function. Two input fields begda, endda and a table as output. nothing else. When you have a closer look you will find.

something like p_userid = sy-uname.

Here the function evaluates the username and depending on the user name different data.

If you start the function in the backend everything is correct. Depending on the user it shows different data.

best regards Hans Georg

Former Member
0 Kudos

Hi,

The backend system knows which user to run the function on. However, the model you created in Visual Composer gets only two inout fields begda and endda. It does not get an input field about the user name and obiously it does not send it to the backend. As a result all users get the same resutls.

Since in VC GA version you can not refer to the user, the only way you can achieve such a task is by adding a new virtual field to the form on which the user will type his id. This field should be mapped to a parametr of the user in the back end.

Regards, Eyal

Former Member
0 Kudos

Hi Eyal,

right there are only two input fields. But with in the coding you find a system variable 'SY_UNAME'. In this variable you find always the logon user name.

And again , the function is running correct when you start it with different user in the backend.

regards Hans Georg

Former Member
0 Kudos

Hi,

But this is probably because you need to login to the back end and therefore the system can initialize you sy_uname param.

With VC compiled model the user which the back end refers to is the one that the portal's system user mapping is defined for.

If you do the user mapping from the portal system different for each user then you'd get different results.

Thanks, Eyal

Former Member
0 Kudos

Hi Eyal,

I have written a test function to verify with which user the VC is talking to the backend. A function with just one output parameter uname.

Coding like uname = sy-uname.

The result was exactly what I have expected. It was my user name.

And anyway the ID in the VC + portal is the same.

best regards Hans Georg

Former Member
0 Kudos

Hi Eyal,

the problem is solved.

please refer to SDN call 'Caching problem one'. Based on this change this problem is also solved in the function.

Thanks

Best regards Hans Georg