Hi Expert,
I am using SAPJco3.x api for reset password by using java client.Should it work for Following Code .BY executing below code reset password across user not happening.Any suggestion on this.
public static void resetSAPPwd()
{
String userId="myid";
String newPassword ="mypwd";
try{
JCoDestination destination = JCoDestinationManager.getDestination(DESTINATION_NAME2);
JCoContext.begin(destination);
JCoFunction bapiUserChange = destination.getRepository().getFunctionTemplate("BAPI_USER_CHANGE").getFunction();
if(bapiUserChange != null){
JCoParameterList userChangeInput = bapiUserChange.getImportParameterList();
JCoStructure sPassword = userChangeInput.getStructure("PASSWORD");
JCoStructure sPasswordx = userChangeInput.getStructure("PASSWORDX");
sPassword.setValue("BAPIPWD",newPassword);
sPasswordx.setValue("BAPIPWD",'X');
userChangeInput.setValue("USERNAME",userId);
userChangeInput.setValue("PASSWORD",sPassword);
userChangeInput.setValue("PASSWORDX",sPasswordx);
bapiUserChange.execute(destination);
System.out.println("SAP Pasw0rd reset done :");
}
}catch(Exception e){
e.getStackTrace();
System.out.println(e.getMessage());
}
}