‎2015 Jul 12 9:02 AM
Hi ,
I am facing issue while creating subtypes '0003' and '0010' for the infotype 0105.
The requirement is in PA40 when a new user is created and when it comes to infotype 0105 with type 0001 (subtype) and
the user clicks on save , automatically the subtypes 0003 and 0010 has to be created.
For this I have implemented the badi 'HRPAD00INFTY' and in the method 'BEFORE_OUTPUT', I am calling the function module
''HR_INFOTYPE_OPERATION'. . I am calling the function module to lock the user and then the function module ''HR_INFOTYPE_OPERATION' is called.I am passing the following parameters.to the function module.
I am checking whether the employee exists in the table PA0105 then calling the FM.as
INFTY = '0105'.
NUMBER = <new pernr created >
SUBTYPE = '0003'.
RECORD = <DATA from the pa0105.>
OPERATION = 'INS'
NOCOMMIT = ' '.
I am calling the function module to unlock the user .
It is not creating the subtypes but it goes again to the begenning of the code for locking the user.
Similarly in pa30 also when a record for '0001' is changed (delimited), I need to create a new record for subtypes '0003' and for '0010'.
For this I have used the same badi in method 'AFTER_INPUT' . . Here too it creates a record but some times it is not creating.
How ever I am checking the sy-tcode and sy-ucomm in both methods while calling any function module.
Can any one help me to solve this issue. It is on high priority .
Points will be rewarded
Thanks
sathya
‎2015 Jul 13 1:53 PM
Hi Sathya
I did the same with BAPI_HRMASTER_SAVE_REPL_MULT
Hope this helps you too.
Regards,
Harsh
‎2015 Jul 13 6:39 AM
‎2015 Jul 14 8:55 AM
Hello Vijay,
I could have pasted my code . But the dev server is down for us.
This is the requirement.
1. When a new user is created in pa40 , when it comes to 0105 infotype screen it is saved with 0001 subtype. Automatically the subtypes 0003 and 0010 are created
As I told you I am using the HRPAD00INFTY and the method 'BEFORE_OUTPUT'' because by the time this methos is trigerred there is a record created in pa0105 with subtype 0001.
Similarly in pa30 when there is a change a record is delimited i.e there is a change in the start date for infotype 105 and subtype 0001 and the user clicks save , a new record needs to be created for subtypes 0001 and 0010 subtypes. For this I am using the badi HRPAD00INFTY and the method 'AFTER_INPUT'
Thanks
Sathya
‎2015 Jul 16 10:41 AM
Hello vijay,
Our development server is up .
This is the piece of code in the BADI and the method BEFORE_OUTPUT.. Any suggestions
IF sy-tcode = 'PA40'.
CLEAR: w_innn,w_p0105,w_infty,w_pernr, w_subty.
w_innn = INNNN.
w_infty = '0105'.
w_subty2 = '0001'.
w_subty = '0003'.
IF w_innn-infty = '0105'.
w_number = w_innn-pernr.
SELECT * from pa0105 INTO table t_pa0105 WHERE pernr = w_number.
IF sy-subrc = 0.
read table t_pa0105 into wa_pa0105 index 1.
*
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
number = w_number
* IMPORTING
* return =
.
*
*** ***** for subtype 0105.
MOVE-CORRESPONDING WA_PA0105 TO W_P0105.
* w_p0105-pernr = w_innn-pernr.
* w_p0105-infty = w_innn-infty.
* w_p0105-infty = w_infty.
w_p0105-subty = w_subty.
* w_p0105-objps = w_innn-objps.
* w_p0105-endda = w_innn-endda.
* w_p0105-begda = w_innn-begda.
w_p0105-usrty = '0003'.
* w_p0105-usrid = w_innn-data1+4(15).
* w_pernr = w_innn-pernr.
* w_number = w_innn-pernr.
 
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = w_infty
number = w_pernr
subtype = w_subty
* objectid =
* lockindicator =
validityend = wa_pa0105-endda
validitybegin = wa_pa0105-begda
* recordnumber =
record = w_p0105
operation = 'INS'
* tclas = 'A'
dialog_mode = '0'
nocommit = ' '
* view_identifier =
* secondary_record =
IMPORTING
return = w_return
key = w_empkey .
 
*
*
**** for subtype 0010.
w_infty = '0105'.
w_subty1 = '0010'.
w_usrid = w_innn-data1+4(15).
CONCATENATE w_usrid '@' 'mail.ad.ge.com' INTO w_mailid.
w_p0105-pernr = w_innn-pernr.
w_p0105-infty = w_innn-infty.
w_p0105-subty = w_subty1.
w_p0105-objps = w_innn-objps.
w_p0105-endda = w_innn-endda.
w_p0105-begda = w_innn-begda.
w_p0105-usrty = '0010'.
w_p0105-usrid_long = w_mailid.
w_p0105-usrid = w_innn-data1+4(15).
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = w_infty
number = w_pernr
subtype = w_subty1
* objectid =
* lockindicator =
* validityend =
* validitybegin =
* recordnumber =
record = w_p0105
operation = 'INS'
* tclas = 'A'
* dialog_mode = '0'
nocommit = ' '
* view_identifier =
* secondary_record =
IMPORTING
return = w_return
key = w_empkey
.
 
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
number = w_number
* IMPORTING
* return =
.
*
ENDIF.
ENDIF.
ENDIF.
‎2015 Jul 13 7:00 AM
Hi,
The HR_INFOTYPE_OPERATION , will not work inside the BADI because of LUW ...
Create a Z Function module as same as the HR_IFOTYPE_OPERATION (IMPORT and EXPORT PARAMETERS ONLY)
Call the FM inside the ZFM, pass the parameters...
while calling the ZFM, please write destination 'NONE' like below
CALL FUNCTION 'ZFUNCTION_MODULE' destination 'NONE'.
Thanks,
Vijay SR
‎2015 Jul 13 8:59 AM
Hi,
Try with Enhancement PBAS0001, and use Update statement and Insert statements to Update/Create Records in the Infotypes.
Hope this helps.
‎2015 Jul 13 9:18 AM
Hi Gaurav,
Is it the best to use UPDATE/INSERT data directly into infotypes????
Before suggest Please know the impact of the same...
Please don't suggest these types of suggestions
Thanks,
Vijay SR
‎2015 Jul 13 1:37 PM
Hi,
Its not the best way, but for your requirement I think this will be a useful way to update/create data in Infotypes.
Hope this helps.
‎2015 Jul 16 11:17 AM
‎2015 Jul 13 1:53 PM
Hi Sathya
I did the same with BAPI_HRMASTER_SAVE_REPL_MULT
Hope this helps you too.
Regards,
Harsh
‎2015 Jul 14 9:03 AM
Hello Harsh ,
Will the bapi BAPI_HRMASTER_SAVE_REPL_MULT work in the BADI in which I am working .
‎2015 Jul 14 4:18 PM
‎2015 Jul 17 6:21 AM
Hi,
The HR_INFOTYPE_OPERATION , will not work inside the BADI because of LUW ...
Create a Z Function module as same as the HR_IFOTYPE_OPERATION (IMPORT and EXPORT PARAMETERS ONLY)
Call the FM inside the ZFM, pass the parameters...
while calling the ZFM, please write destination 'NONE' like below
CALL FUNCTION 'ZFUNCTION_MODULE' destination 'NONE'.
Thanks,
Vijay SR