Skip to Content
avatar image
Former Member

BAPI_PERSDATA_CHANGE to update user data using SAP JCo 3

Hello i'm using the following code snippet. The goal is to update the user lastname firstname and co using the BAPI_PERSDATA_CHANGE bapi. But somehow it's not working, I tried a lot of possibilities but it's not working. The message to the function related to BAPI_PERSDATA_CHANGE is:

No data stored for 0002 in the selected period
public boolean writeData(long id, HashMap<String, String>  userData) throws Exception{
        String DST1 = "ABAP_AS";
        JCoDestination dest = JCoDestinationManager.getDestination(DST1);
        JCoFunctionTemplate template = dest.getRepository().getFunctionTemplate("BAPI_PERSDATA_CHANGE");
        JCoFunction jcoFunction = template.getFunction();
        jcoFunction.getImportParameterList().setValue("EMPLOYEENUMBER", id);
        //jcoFunction.getImportParameterList().setValue("SUBTYPE", "002");
        //jcoFunction.getImportParameterList().setValue("OBJECTID", "");
        //jcoFunction.getImportParameterList().setValue("LOCKINDICATOR", "");
        jcoFunction.getImportParameterList().setValue("VALIDITYBEGIN", "19570101"); //"1994-04-24");
        jcoFunction.getImportParameterList().setValue("VALIDITYEND", "99991231");
        jcoFunction.getImportParameterList().setValue("RECORDNUMBER", "000");
        jcoFunction.getImportParameterList().setValue("FIRSTNAME", "FOfie modifier");
        JCoFunction jCoFunction1 = dest.getRepository().getFunctionTemplate("BAPI_TRANSACTION_COMMIT").getFunction();
        JCoFunction BAPI_EMPLOYEE_DEQUEUE = dest.getRepository().getFunction("BAPI_EMPLOYEE_DEQUEUE");
        BAPI_EMPLOYEE_DEQUEUE.getImportParameterList().setValue("NUMBER", id);
        return false;

Am i missing something ? Thanks for helping.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jan 08, 2018 at 05:08 AM

    Hello, Delly. Could you refer the link below? It seems that It's the same issue. You could try to use the same solution. thanks.

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 17, 2018 at 11:58 AM

    You could first call BAPI_PERSDATA_GETDETAILEDLIST and/or BAPI_PERSDATA_GETDETAIL to get actual current values, then depending on required changes, call BAPI_PERSDATA_CHANGE and/or other BAPI like DELIMIT or CREATE.

    Add comment
    10|10000 characters needed characters exceeded