‎2004 Nov 25 3:39 AM
Hi People,
I am trying to Update employee record in IT0380 based on field PCT01. But I'm having difficulty, since IT0380 can only be updated in <i>Compensation Administration</i>. How can the updates be forced in this infotype? Is there an available function module for this? I would really appreciate all the help. Thanks
‎2004 Nov 25 9:20 AM
Hi,
Use function HR_INFOTYPE_OPERATION. Action is MOD I think.
If you need any further help, please let me know.
Kind regards
Colin
‎2004 Nov 25 9:44 AM
Hi Colin,
Thanks for the reply
yep... i already tried HR_INFOTYPE_OPERATION earlier. A part of the code is attached:
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = '0380'
number = i0380-pernr
record = i0380
operation = 'INS'
IMPORTING
return = v_ret
key = v_key.
IF sy-subrc = 0.
WRITE: /'Successfully Updated'.
ENDIF.
However, even if the sy-subrc returns a successful value, the table has not been updated. By the way, I think I must also include the information that i am coding using LSMW.
‎2004 Nov 25 10:06 AM
Hi,
Where are the parameters for validity start and end period and the subtype for this function module ?
You should also check V_RET after this function not SY-SUBRC. This contains whether it worked or not. If it is initial then it worked ok otherwise it will contain the message for the issue.
Kind regards
Colin
‎2004 Nov 25 8:54 PM
Hi
Here is a small code snippet illustrating the usage of the function module.
DATA ls_data LIKE p0380 .
DATA ls_return LIKE bapireturn1 .
*--Fill "ls_data" as required here
*- Be careful about the checks that will be done during
* execution of the function module. The checks it will
*do, will be more or less like when you insert the
*record using the tcode "PA30". e.g. you must fill
*obligatory fields
CALL FUNCTION 'ENQUEUE_EPPRELE'
EXPORTING
mode_prel = 'E'
mandt = sy-mandt
pernr = ls_data-pernr
infty = '0380'
subty = 'SSSS'
endda = ls_data-endda
begda = ls_data-begda
_scope = '1'
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc NE 0 .
*...
EXIT.
ENDIF.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = '0380'
number = ls_data-pernr
subtype = ls_data-subty
validityend = ls_data-endda
validitybegin = ls_data-begda
record = ls_data
operation = 'INS'
tclas = 'A'
nocommit = space
IMPORTING
return = ls_return .
CALL FUNCTION 'DEQUEUE_EPPRELE'
EXPORTING
mode_prel = 'E'
mandt = sy-mandt
pernr = ls_data-pernr
infty = '0380'
subty = 'SSSS'
endda = ls_data-endda
begda = ls_data-begda.
Some Basics:
i. You may wonder why I locked the personel but as far as I remember, there is a problem in the FM "HR_INFOTYPE_OPERATION" about this. Locking the personel overcomes the problem. But it may have been solved. So, if you want first try without locking.
ii. The FM calls the dialog module for the program MPXXXX00 (XXXX: Infotype number, here MP038000) of the infotype.
iii. "ls_data" which is passed to the parameter "record" should be type "PXXXX" (here P0380).
iv. If the infotype has subtypes, pass the subtype you want to the parameter "subtype" .
v. You must give the validity period to the parameters "validityend" and "validitybegin".
vi. The operation type to insert a record is "INS". You can see other values from the fixed values of the domain of the parameter "operation".
vii. Since some infotypes are common for both employee an applicants data, you should pass 'A' to the parameter "tclas". This way the record is inserted to the table PAXXXX. In case of 'B', it behaves your record as to be an applicant data.
viii. You have the option to force the FM not to commit at the end.
ix. The exporting parameter "return" of the FM is of type "BAPIRETURN1". That is, it can be used like other BAPI returns. You can analyze the result of the execution from this table. It will consist of messages given during the execution in standard message format (i.e. message type (E,I,A,S,X), message id, message number and message variables)
Hope this addition helps
*--Serdar
‎2004 Nov 26 2:12 AM
Hi
Thanks for the replies Colin and Serdar
However, as what i've said in the first post, I could not use PA30 for IT0380. Maintaining it is via Compensation Administration. As much as possible I don't want to force the fields because it was requested that i use a function module. Does that funcion module work even if I'm not using PA30?
Regards,
Vance
‎2004 Nov 26 12:58 PM
Hi,
You should be ok.
The FM calls the dialog module for the program MPXXXX00 (XXXX: Infotype number, here <b>MP038000</b>) of the infotype.
This program does exist so give it a go.
Kind regards
colin
‎2004 Nov 26 10:13 PM
Hi Vance
As Colin mentioned, since the program MP038000 exists (and as I guess the corresponding dialog module exists), the FM can be used. However, one should inspect the program MP038000 (and may be the FM itself) whether there is a restriction to prevent maintenance.
Nevertheless, give a try which conveniently applies the FM as described in my previous post.
*--Serdar