sap-basissapjco3

How to get RZ11 profile parameters details remotely?


I am looking to retrieve following Session time and password profile parameters for SAP via SAP JCo, via the RFC-enabled function module TH_GET_PARAMETER. How to know the details of the parameters of this function module, or any other RFC-enabled function module generally speaking (without access to the SAP backend system).

Examples of profile parameters:

  1. rdisp/gui_auto_logout
  2. login/min_password_lng
  3. etc.

Solution

  • the following code works well:

    It connects to RFC "TH_GET_PARAMETER", which has one input and one output. You need to input the respective parameter and print the output.

    import com.sap.conn.jco.*;
    
    public class GetPasswordParameters {
        public static void main(String[] args) {
            try {
                JCoDestination destination = JCoDestinationManager.getDestination("SAP-ECC");
                JCoFunction function = destination.getRepository().getFunction("TH_GET_PARAMETER");
    
                if (function == null) {
                    throw new RuntimeException("Function TH_GET_PARAMETER not found in SAP system.");
                }
    
                // Set parameters to be retrieved
                String[] parameterNames = {
                        "rdisp/gui_auto_logout",
                        "login/min_password_lng",
                        "login/min_password_digits",
                        "login/min_password_letters",
                        "login/min_password_lowercase",
                        "login/min_password_uppercase",
                        "login/min_password_specials",
                        "login/password_expiration_time",
                        "login/password_change_for_SSO",
                        "login/password_history_size",
                        "login/multi_login_users",
                        "login/fails_to_session_end",
                        "login/update_logon_timestamp"
                };
    
                // Populate the parameter table
                for (String parameterName : parameterNames) {             
            function.getImportParameterList().setValue("PARAMETER_NAME",parameterName);
    function.execute(destination);
    String value = function.getExportParameterList().getString("PARAMETER_VALUE");
    System.out.println(value);
            }
    } catch (JCoException e) {
                e.printStackTrace();
            }
        }
    }