We are facing an issue during SAP S/4HANA account creation via SailPoint IdentityIQ provisioning. we have configured the password policy at application level.
The create account operation is failing with the following error from SAP BAPI:
“New password cannot begin with ‘?’ or ‘!’”
Observation:
The issue occurs when the generated password includes a special character in the first position
SAP S/4HANA does not accept ? or ! as the initial character of the password.
Need help on the below
Whether there is a recommended configuration in IdentityIQ password policy to prevent specific characters (?, !) from being used in the first position
Or if we need to enforce a custom password generation rule to handle SAP-specific constraints
I think the easiest solution would be to create a SAP_PasswordGeneration_Rule. use something line below which ensures the the first character is never ‘?’ or ‘!’ as SAP BAPI rejects such passwords.
You will have a password attribute in the create Provisioning Policy at the password attribute level using a Generation Rule on that field itself. Use the below rule:
import java.util.Random;
String firstCharPool = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
String remainingCharPool = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@#$%^&*()-_=+[]{}|;:,.<>";
int passwordLength = 12;
Random random = new Random();
StringBuilder password = new StringBuilder();
// First char — never '?' or '!'
password.append(firstCharPool.charAt(random.nextInt(firstCharPool.length())));
// Remaining chars
for (int i = 1; i < passwordLength; i++) {
password.append(remainingCharPool.charAt(random.nextInt(remainingCharPool.length())));
}
return password.toString();
this should fix your issue, as It fires precisely when the password field is being populated before the BAPI call