¿Cómo restablecer la contraseña en SAP usando BAPI?

Estoy tratando de restablecer la contraseña para SAP usando bapi pero recibo un error porque "la contraseña no es un tipo de entrada de campo".

Estoy publicando mi código a continuación.

aquígetRandomString() es una función definida por el usuario. Copié este código de Internet y no estoy al tanto de esto.

String newPassword = getRandomString();

try{
      JCO.Function bapiUserChange = repository.getFunctionTemplate("BAPI_USER_CHANGE").getFunction();
      if(bapiUserChange != null){
           JCO.ParameterList userChangeInput = bapiUserChange.getImportParameterList();

           JCO.Structure sPassword = userChangeInput.getStructure("PASSWORD");

           //sPassword.setValue(newPassword, ????) //what do I assign it to?

           userChangeInput.setValue(userId, "USERNAME");
           userChangeInput.setValue(newPassword, "PASSWORD");  // this gives an error
           userChangeInput.setValue("X","PASSWORDX"); //I know "X" is true, this will give an error too I believe

           mConnection.execute(bapiUserChange);

           //send E-mail
           boolean emailSent = sendEmail(userId, newPassword, "XXX200");
           msgMgr.reportSuccess("Password Reset Done");     

           if(mConnection != null){
                mConnection.disconnect();
           }

      }
}catch(Exception e){
     msgMgr.reportException("Could not change password " + e.getMessage(),true);
}

peroString newPassword = getRandomString(); aquí está dando error porquegetRandomString() es una función definida por el usuario y no estoy al tanto de esto. ¿Hay alguna función de esto al restablecer la contraseña o puedo usar directamenteString newpassword=" ";

Respuestas a la pregunta(2)

Su respuesta a la pregunta