cancel
Showing results for 
Search instead for 
Did you mean: 

Bapi_Absence_Create BAPI not working

babuilyas
Participant
0 Kudos

I'm trying to create an absence from asp.net web page in c sharp. But the effect is not scene on the data.

Bapi returns "Employee/applicant is not locked yet" and record is not created even after commit the bapi.

Kindly help me.

string LockIndicator, ObjectId, RecordNo,SubType;
            ThalAdmin_SAPRFC.BAPIRETURN1 BAPIRETURN1 = new ThalAdmin_SAPRFC.BAPIRETURN1();
 
            string EmployeeNo = "20001287";
            string ValidityBeging = "20090523";
            string ValidityEnd = "20090523";
 
            AbsenceCreate.Bapi_Absence_Create(
                      Convert.ToDecimal(7.5),
                      "1050",
                      "20090523",
                      "",
                      "20090523",
                      out LockIndicator,
                      out ObjectId,
                      out RecordNo,
                      out BAPIRETURN1,
                      out SubType,
                      ref EmployeeNo,
                      ref ValidityBeging,
                      ref  ValidityEnd);

            AbsenceCreate.CommitWork();

I'm trying above code.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Before you call the BAPI to update the data use the below BAPI to lock the employee so that mean time no1 else update the data.

BAPI_EMPLOYEE_ENQUEUE Lock employee

Then call the BAPI to update the date.

Then unlock the employee with the below BAPI.

BAPI_EMPLOYEE_DEQUEUE Unlock employee

Br/Manas

Answers (4)

Answers (4)

babuilyas
Participant
0 Kudos

resolveed...

babuilyas
Participant
0 Kudos

Thank you all... This is great to see your responses.. I'm trying it and getting back to forum

Former Member
0 Kudos

Hi,

According to my knowledge you first need to lock the employee before making any changes to the employee records. I suggest you try the bapi BAPI_EMPLOYEE_ENQUEUE before calling the bapi for absence creation. The above mentioned bapi will lock the employee so that no other user can maintain data for that employee. After the above process (once absence is created) you need to unlock the employee, so use the bapi BAPI_EMPLOYEE_DEQUEUE for the same. So in short the order of execution should be:

- BAPI_EMPLOYEE_ENQUEUE

- BAPI_ABSENCE_CREATE

- BAPI_EMPLOYEE_DEQUEUE

I also suggest that you use commit statement after every bapi call.

Hope this helps.

Former Member
0 Kudos

Muhammed,

Lock the employee using the BAPI 'BAPI_EMPLOYEE_ENQUEUE' before using the BAPI 'Bapi_Absence_Create '.