on 10-17-2016 9:54 PM
Hello, I am writing a custom ABAP to hire a new employee and I am using HR_PAD_HIRE_EMPLOYEE. I am not having an luck in getting it to work but I see from other posts that it does work. My problem is that it is failing on the function HR_FEATURE_BACKFIELD when it is dealing with the NUMKR feature because thestructure passed to this feature is PME01 and the feature uses structure P0000.
When I traced it though with the debugger this is what happens within HR_PAD_HIRE_EMPLOYEE:
The Method CL_HRPA_PERNR_CHECKS->CREATE_PERNR has this code in it:
* evaluate feature NUMKR
CALL METHOD cl_hrpa_feature=>get_valueEXPORTING
feature = 'NUMKR'
struc_content = pme01IMPORTING
return_value = nr_range_nr.
Which Runs the function HR_FEATURE_BACKFIELD passing in the structure pme01 from above. Here is the code (in hr_feature_backfield) used to call the feature:
PERFORM CALL_549B IN PROGRAM (PROGNAM)USING BACK
STATUS
STRUC_CONTENT.
The problem is that the feature uses structure P0000 so it is dumping with PERFORM_PARAMTER_TOO_SHORT. This is SAP Code which of course I cannot change and I don’t know a whole lot about features and am cautious as our SAP Implementation and this feature has been in place for many years.Any suggestions?
Just in case anyone else is having this problem, I finally did get something to work. I used HR_MAINTAIN_MASTERDATA to hire an employee. Here is a simplified version of the code (of course I used variables for much of what I have hardcoded below):
DATA:
ls_return TYPE bapireturn1,"Return Messages Structure
lt_proposed_values LIKE STANDARD TABLE OF ls_proposed_values, "Proposed Values Table,
*Populate all required fields at a minimum on each infotype you use .. e.g.,:
ls_proposed_values-infty = '0002'.
ls_proposed_values-fname = 'P0002-VORNA'. "First Name
ls_proposed_values-fval = 'SMITH'.
APPEND ls_proposed_values TO lt_proposed_values.
ls_proposed_values-infty = '0002'.
ls_proposed_values-fname = 'P0002-NACHN'. "Last Name
ls_proposed_values-fval = 'DARLING'.
APPEND ls_proposed_values TO lt_proposed_values.
CALL FUNCTION 'HR_MAINTAIN_MASTERDATA'EXPORTING
* PERNR = '00000000' "Remarked this out as we generate our own #'s
MASSN = '71' "Hire
ACTIO = 'INS'
TCLAS = 'A'
BEGDA = '20161013'
ENDDA = '99991231'
WERKS = '2115'
PERSG = '9'
PERSK = '82'
PLANS = '60025055'
DIALOG_MODE = '0'
NO_EXISTENCE_CHECK = 'X'
IMPORTING
RETURN1 = ls_return
TABLES
proposed_values = lt_proposed_values.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HR_INFOTYPE_OPERATION works too
you can create infotype 0000 without passing a personnel#.
The IMPORTING parameter KEY will return the internally created personnel# so you can pass it when creating the other infotypes
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Volker, I thought I would try HR_INFOTYPE_OPERATION again and after playing with it finally figured out that I just have to pass a 0 to the number parameter and it works as you said - thx Volker!!! Now I have 2 options 🙂
DATA:
s_return LIKE bapireturn1,
s_key LIKE bapipakey.
INFOTYPES: 0000.
p0000-massn = '71'.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = '0000'
number = 0
validityend = '99991231'
validitybegin = '20161021'
record = p0000
operation = 'INS'
tclas = 'A'
dialog_mode = '0'
IMPORTING
return = s_return
key = s_key.
thx Volker. Yes it is failing because the 2 structures are different PME01 and P0000. I took a look at
HR_INFOTYPE_OPERATION but it requires a personnel #. Our SAP system was set up so this is generated at the time of hire - I cannot pre-determine the employee #. Unless you have any thoughts on how I can get around this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
PME01 uses fields of infotype 0001.
I never used HR_PAD_HIRE_EMPLOYEE, but HR_INFOTYPE_OPERATION instead.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.