‎2009 May 19 7:51 AM
Hi Experts,
I have a requirement to create a report where the report will calculate the bonus of employee's based on certain calculation and then post it to infotype 14/15/267. What I wanna do now is how to create a batch session which can be executed via SM36 so my program can be in background and anytime they want to. Basically what I want to have is to have a batch input session folder like the report RHINTE00 can generate.
Please kindly share any knowledge about this batch session programming.
Thanks in advance.
‎2009 May 19 2:27 PM
Hi friend,
I recommend you to use the HR Function modules to update the infotypes. It's most seccure. Here an example:
*********************************************************************************************************************
First, you have to see the FM parameters:
Here is a list of the fm's parameters and how they are used, obviously not all parameters will be used depending on what function you are performing i.e. insert, change, delet etc
infty - Infotype being updated
objectid - object id from infotype
number - Personnel number
validityend - validity end date
validitybegin - validity begin date
record - infotype record values to be updated, inserted etc (will be structure of infortyoe you are updating)
recordnumber - sequence nunber from infotype record you are updating
Operation - describes what operation is to be performed
COP = Copy
DEL = Delete
DIS = Display
EDQ = Lock/unlock
INS = Create
LIS9 = Delimit
MOD = Change
INSS = Create for Actions is not converted to Change
nocommit - commit yes('X') / no(' ')
dialog_mode - dialog mode or not, default is '0'
-> Now, the examples codes...
Example coding for MODIFY infotype operation
CONSTANTS: change TYPE pspar-actio VALUE 'MOD'.
"This code is requred and locks the record ready for modification
CALL FUNCTION 'HR_EMPLOYEE_ENQUEUE'
EXPORTING
number = p_pernr.
"loop at p0071 into p_p0071. "added to put code in context
validitybegin = p_record-begda.
validityend = p_record-endda.
p_record-endda = pn-begda - 1.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = '0071'
subtype = p_record-subty
objectid = P_record-objps
number = p_record-pernr "employeenumber
validityend = validityend
validitybegin = validitybegin
record = p_record
recordnumber = p_record-SEQNR
operation = change
nocommit = nocommit
dialog_mode = '0'
IMPORTING
return = return_struct
key = personaldatakey
EXCEPTIONS
OTHERS = 0.
"endloop.
"unlock record after modification
CALL FUNCTION 'HR_EMPLOYEE_DEQUEUE'
EXPORTING
number = p_pernr.
*********************************************************************************************************************
Example coding for INSERT infotype operation
CONSTANTS: insert TYPE pspar-actio VALUE 'INS'.
"This code is requred and locks the record ready for modification
CALL FUNCTION 'HR_EMPLOYEE_ENQUEUE'
EXPORTING
number = p_pernr.
validitybegin = p_record-begda.
validityend = p_record-endda.
p_record-pernr = p_pernr
p_record-begda = pn-begda.
p_record-endda = validityend.
p_record-subty = p_SUBTY. "subtype of new entry
p_record-SCREF = p_SUBTY. "subtype of new entry
"plus populate any other fields you need to update
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = '0071'
subtype = p_record-subty
number = p_record-pernr "employeenumber
validityend = validityend
validitybegin = validitybegin
record = p_record
operation = insert
nocommit = nocommit
dialog_mode = '0'
IMPORTING
return = return_struct
key = personaldatakey
EXCEPTIONS
OTHERS = 0.
"unlock record after modification
CALL FUNCTION 'HR_EMPLOYEE_DEQUEUE'
EXPORTING
number = p_pernr.
I really hope it help you...!!!!
‎2009 May 19 6:00 PM
Is there any specific reason you are going for BDC to update your infotype records. Actaully I have see lot of implementatios where BDC is used for the same.
Anyways to answer your question.
1) Go to SHDB and enter transaction you want to do recording for. PA30 in your case
2) Do the recording,as per recording fill BDC_DATA
3) BDC_OPEN_GROUP BDC_CLOSE_GROUP
Here is [sample|http://www.abapprogramming.net/2007/11/abap-bdc-session-method-sample-code.html] code
Hope this helps.
‎2009 May 20 2:05 AM
Hi Shital,
What i'm talking about batch processing is not about recording. I understand already how do u do bdc programming. What I want to know is how you can create a folder job like the one you can see using t-code sm35 or the one which is created with lsmw when we use batch recording method.
Thanks.
‎2009 May 20 2:12 AM
Hi Shital,
What i'm talking about batch processing is not about recording. I understand already how do u do bdc programming. What I want to know is how you can create a folder job like the one you can see using t-code sm35 or the one which is created with lsmw when we use batch recording method.
Thanks.