cancel
Showing results for 
Search instead for 
Did you mean: 

how to Run Multiple BAPI's

Former Member
0 Kudos

Hi All,

i was trying to run multiple BAPI's using Jco. but no luck. it giving error message like "Employee/person not locked yet".

the BAPI's i'm trying are

1. BAPI_EMPLOYEET_ENQUEUE

2. BAPI_ABSENCE_REQUEST

3. BAPI_TRANSACTION_COMMIT

4. BAPI_EMPLOYEET_DEQUEUE

i'm using connection pooling to get connection.

the code

JCoDestination destination = JCoDestinationManager.getDestination(ABAP_AS_POOLED);
JCoFunction function = destination.getRepository().getFunction("BAPI_EMPLOYEET_ENQUEUE");
function.getImportParameterList().setValue("NUMBER", "00000002");
function.execute(destination);

function = destination.getRepository().getFunction("BAPI_ABSENCE_REQUEST");
function.getImportParameterList().setValue("EMPLOYEENUMBER", "00000002");
function.getImportParameterList().setValue("VALIDITYBEGIN", c.getTime());
function.getImportParameterList().setValue("VALIDITYEND", c1.getTime());
function.getImportParameterList().setValue("ABSENCETYPE", "0014");

function = destination.getRepository().getFunction("BAPI_TRANSACTION_COMMIT");
function.execute(destination);

function = destination.getRepository().getFunction("BAPI_EMPLOYEET_DEQUEUE");
function.getImportParameterList().setValue("NUMBER", "00000002");
function.execute(destination);

i don't know where i'm going wrong. Plx help me out.

thanks in Advance.

Ravi.

Accepted Solutions (0)

Answers (2)

Answers (2)

manuel_garcia3
Explorer
0 Kudos

Hi.

I found the correct form to use.

BAPI_EMPLOYEE_ENQUEUE

BAPI_PERSDATA_CHANGE

BAPI_EMPLOYEE_DEQUEUE

In a java file need use JCoContext to generate a group functions to will be execute

try {

JCoContext.begin(destination);

     if (JCoContext.isStateful(destination))

          bloqFunction.execute(destination);

          cambFunction.execute(destination);

          desbFunction.execute(destination);

} finally {

JCoContext.end(destination);

}

Declarated:

JCoFunction bloqFunction = destination.getRepository().getFunction(

                    "BAPI_EMPLOYEE_ENQUEUE");

JCoFunction cambFunction = destination.getRepository().getFunction(

                                        "BAPI_PERSDATA_CHANGE");

JCoFunction desbFunction = destination.getRepository().getFunction(

                                        "BAPI_EMPLOYEE_DEQUEUE");

I hope help with this.

Former Member
0 Kudos

Hello Sir,

Correcting the forum to the Java WD one.

Regards,

Bentow.