Script to encode OAF page or Form Function parameters

We need to encode form parameters when opening an Oracle form with parameters from OAF page.

Generally, we use standard oracle FND API to generate URL and it automatically encrypts parameters when you pass them.

You can use below script If you have a scenario to prepare page URL externally and needs to pass parameters.

  • Get the responsibility id, Responsibility Application id and security group id
  • Get the database id
  • Prepare the parameters string
  • Call the URLEncrypt API to encrypt the parameters

CREATE OR REPLACE FUNCTION XX_ENCODE_PARAMETERS (p_header_id IN NUMBER)

    RETURN VARCHAR2

AS

    l_db_id               VARCHAR2 (255);

    l_mac_data            VARCHAR2 (2000);

    l_resp_id             NUMBER := FND_PROFILE.VALUE ('RESP_ID');

    l_resp_appl_id        NUMBER := FND_PROFILE.VALUE ('RESP_APPL_ID');

    l_security_group_id   NUMBER := 0;

    l_param_text          VARCHAR2 (2000);

BEGIN

    l_param_text := 'STARTUP_MODE=SALES_ORDERS HEADER_ID=' || p_header_id;

    l_db_id :=

        fnd_profile.value_specific ('APPS_DATABASE_ID',

                                    NULL,

                                    l_resp_id,

                                    l_resp_appl_id,

                                    l_security_group_id);


    IF (l_db_id IS NULL)

    THEN

        l_db_id := fnd_web_config.database_id;

    END IF;


    l_mac_data := fnd_web_sec.URLEncrypt (l_db_id, l_param_text);

    RETURN l_mac_data;

EXCEPTION

    WHEN OTHERS

    THEN

        l_mac_data := SQLERRM;

        RETURN l_mac_data;

END;

*/

No comments:

Post a Comment