cancel
Showing results for 
Search instead for 
Did you mean: 

HCM P&F: User Events unable to change field values, and losing PERNR

bryan_cain
Contributor
0 Kudos

Hi All,

I'm in the midst of my first foray into MSS via HCM P&F.

I'm having two issues that may be related.

Netweaver 7.00 SP14, LiveCycle Designer 8.00, MSS EP2 (HR? Anyway, we have the design time studio).

Issue 1)

I have created a button on the form which triggers a user event. The user event is defined as a check event (I've tried initialize, doesn't seem to help). This button is supposed to calculate the Comp Ratio for an employee's new base pay. In other words, the user will enter an amount and click the button, and the button should populate a field with the new comp ratio. I can successfully manipulate the field in the INITIALIZE method, but when I try to change the field in DO_OPERATIONS, those changes are not reflected in the form.

Issue 2)

Same scenario as above - when I press the button and trigger the user event, PERNR (typed as ASR_AFFECTED_EE_PERNR, not tied to an infotype in SAP_PA) is not populated. It is populated on the screen, and I can see the value in the INITIALIZE method, but when I press the button, the field is empty in the DO_OPERATIONS method. This actually causes the form to error saying 'Please enter a personnel number'.

I imagine these two issues might be related, but I don't know.

Thanks in advance for any assistance.

Bryan

Accepted Solutions (1)

Accepted Solutions (1)

ChrisSolomon
Active Contributor
0 Kudos

I think part of the problem might be understanding "User Events" and what they do/dont do. I detailed how badly I think this is designed in my blog (the "gotchas" one about HCM P&F).

Basically, when you define a "user event", all you are really doing is grabbing a bunch of fileds in a YET ANOTHER field group. Yes, this field group has nothing .....NOTHING ....to do with any other you defined in services. That's fine. Whatever. It's a big "library" of fields.

Then you say what you want to do with those fields...either a "initialize" or "check" operation. Great. Whatever.

So what a "user event" does....it goes through all the fields in your "user event" field group and will then find any (AND ALL) services they are used in based on the opertation (ie. check or initialize). Those services get added to your list of "operations" to fire off. Hey, thanks SAP! haha Now, they will also look for ALL other fields needed in those services. For each of THOSE added fields, it will do the same thing....find any services they are needed in and add those to the list. It's an odd iterative thing...but again, whatever. Lastly, it filters out the list so services don't get called multiple times. Hey, at least they got that part right...kinda.

So now...for the catch...and the kicker....SAP will add "effective date" in your "user event" field group whether you have it in there or not. By doing that...then SAP_PA becomes one of the services in your list. By doing that, then you get all the fields that SAP_PA requires...namely, PERNR, MASSN, MASSG and effective date. And yep, if those fields are used in other services, they get pulled to.

So, now, you need to go back to your user event and make sure in the field group, you might have to add PERNR, MASSN, and MASSG.....even if you have NO intent or need of ever using them.

Arrgggg!!! Just typing about it makes me so pissed! hahahaha

And of course....this is not documented anywhere. Thankfully, for you, some of us have fought this battle before...and have the scars to show it.

Again, check out my blog for even more detailed info on it. Hope this helps.

bryan_cain
Contributor
0 Kudos

Thanks for chiming in Chris - I was hoping you would after reading some of your blogs.

So let me make sure I understand.

I must have EFFECTIVE_DATE, PERNR, MASSN, and MASSG as part of every back-end service?

Do they have to be specified in get_field_info or get_special_fields or both?

I wonder if the problem lies in the fact that I created a separate back-end service to build a drop down list, and that service doesn't use PERNR. If that service is getting called, PERNR might be getting wiped there.

I'll do some testing on that.

Thanks again.

ChrisSolomon
Active Contributor
0 Kudos

hehe I was trying to edit my post and add more but you were posting and it wouldn't let me.....here is what I was going to add....

For the actual "service" you intend to use for your event, at least in my experience, we had to add in PERNR and EFFECTIVE DATE as "fields" (not special fields, but in "get_field_info" and define them as attributes as well) and pass them in the service even though we did nothing with them. Otherwise, the PERNR would "drop out" as many have seen. Again, this seems to be for the services you wish to use for "check" and not "initialize" type events.

ARGGGGGGG!!!!!!

To your question, here is an example....we had a input box. The user could put in part of a name and click "search". This would then populate a drop down of all employees that matched that search. As an "event", they should be able to do this as much as they like. So, we SHOULD simply have:

-searchstring

-employee number (list-value for dropdown options)

-employee name (list-display value for dropdown)

However, we had to add to this, MASSN, MASSG, PERNR and EFFECTIVE_DATE....and we didn't need them at all. Fun huh! Even more fun to find with no help at all and many hours of debugging.

For more fun, turns out, we had another service that we were setting MASSN in based on the country of the user. That service had an additional field "MASSN_EVENTCODE" which got added to our list of course because MASSN was used.

So we went from NEEDING only those 3 little fields for a search for ONE service. To having, 8 fields and 3 services called.....just for a simple "search" event.

Again, I think this entire model needs to be re-thought, re-designed, etc.

bryan_cain
Contributor
0 Kudos

OK, I've fixed the problem.

I think the fact that my first service worked even though I didn't include pernr & effective date threw me off a bit.

Steps I took to fix it.

1) Made sure PERNR, MASSG, MASSN, & EFFECTIVE_DATE were all specified for each back end service.

2) Created a User Event (and corresponding field group) for the drop down box I created. I missed this step originally because populating a drop down shouldn't really require a user event - except I guess it does.

Thanks for all the assistance Kevin & Chris.

Be on the lookout for my next thread regarding how to handle infotype 8....

Bryan

bryan_cain
Contributor
0 Kudos

Oh, and FYI - fixing the dropped PERNR issue fixed the second issue about not being able to maniuplate the comp ratio field. Once the app stopped the throwing the "Enter a personnel number error" my changes to that field started showing up.

ChrisSolomon
Active Contributor
0 Kudos

(1) good to hear

(2) it shouldn't....it depends on your drop-down control and what you want to do. If you want to re-populate it whenever something else occurs on the form, then yes, a user event is needed. (ie. like selecting a manager and then populating a drop-down with all positions reporting to that manager).

Now, a BIG "gotcha" here...and one I just went through explaining to folks here only moments ago....you user event "field groups" are NOT related in any way to your services field groups. It's just a way of organizing fields together that you want to relate to your "user event"....like building a list of "these are the fields I am interested in". Likewise, the NAME of your user event doesn't mean jacksh&%&.Yep....I said that. It is just a name you want to call it when your button or whatever on your form gets pushed or triggered to pass through the framework. The name of the event is then used to look into config and locate what fields are related to that "user event"...again, our list of fields in our "user event field groups". Then, it will look at the list of fields in our field group and what operation to look at ..."check" or "initialize".....and then will go through all the services using those fields (and the ones that get added too....as I mentioned above).

So yeh...the thing I am saying, is don't get confused by user event "field groups" and the user event's name with the backend service "field groups" and operations. They are NOT related.

I am trying to come up with a better, easy way to visually depict all this user event confusion (and "gotchas") to make another blog. I get asked about this stuff a lot in emails straight to me instead of posted on here. It would be easier to reply "see this blog!" haha. Stay tuned!

Answers (2)

Answers (2)

Former Member
0 Kudos

disregard post... double of previous one

Cheers,

Kevin

Former Member
0 Kudos

Hi Bryan,

Ok, so issue #1...

Are you calling an operation from the button you are clicking on the form? I'm sure you are, so the field group that you have associated with the operation needs to contain the fields that you want to use, even if you are not manipulating. If you want to use them, they need to be in the field group.

You also have to make sure that your operation is not set up as an Initialize opertaion, but a Check operation.

Issue #2...

This might be the same thing... make sure that you have the PERNR associated with your field group for your operation, otherwise you can't see it. What I usually do with the PERNR, because for my situations, it doesn't change, is make it a special field.


*-----  W O R K I N G   A R E A S  -----*
  DATA: wa_fields LIKE LINE OF special_fields.


*=====  M A I N   M E T H O D   C O D E  =====*

  wa_fields = "PERNR".
  APPEND wa_fields TO special_fields.

Hope this helps...

Cheers,

Kevin

bryan_cain
Contributor
0 Kudos

Hi Kevin,

Thanks for your response.

1) Yes, I'm calling the operation from the button. All fields that I need are assigned to the field group, and the field group is assigned to the operation in config. My operation is set up as a check operation. To clarify - I can SEE all the fields in the service_datasets parameter - but if I change a value, that change is not reflected on the form.

2) This is where it gets weird. I tried making the field a special field. It still comes back blank when I press the button and enter the debugger. (I tried this last week, actually, I just forgot to mention it in my original post).

Thanks Again,

Bryan

Edited by: Bryan Cain on Mar 9, 2009 3:55 PM

Former Member
0 Kudos

Hey Bryan,

If you run the "Check Consistency of Form Scenarios" transaction in the IMG, do you get all green, or do you get any red?

Cheers,

Kevin

bryan_cain
Contributor
0 Kudos

I'll have to get back to you tomorrow on that. The functional analyst is in the middle of making some changes.

Thanks.

Former Member
0 Kudos

Hi Kevin,

I am working on the project with Bryan. The consistency check is all good. Follow up question: When you make PERNR your special field, do you still keep it in your list of fields for the check service? Thanks for your posts.

Former Member
0 Kudos

Hey Jeff,

You mean is it in the list for the field group? Yes. I found that even if it is a special field, if you don't include it in the field group for the operation, then it didn't show up.

Cheers,

Kevin

bryan_cain
Contributor
0 Kudos

The field was in the field group - I just didn't have it defined in the get_field_info method. It was only defined in the get_special_fields method.

However, even when PERNR was not a special field, the same thing happened.

Jeff made a bunch of config changes last night, for one thing pernr will be tied to an infotype. Maybe that will fix it.