You are currently viewing How to bulk inactivate the Document Types using HDL?
How to bulk inactivate the Document Types using HDL?

In this article we will look into inactivating the document types in bulk using hdl.

One approach is to create a security profile which provides access to only specified document types and attach security role to users.

Another approach is to inactivate the not to be used document types, so that they will not show up to the end users while creating document of records. If there is a permanent need to remove the document types, then using the HDL to inactivate will help.

We have the HDL Business Object DocumentType.dat using which we can load/modify the document types.

We have a flag ActiveInactiveFlag which can be set to N to inactivate the document types.

METADATA|DocumentType|DocumentType|Country|CategoryCode|ActiveInactiveFlag
MERGE|DocumentType|T4A Register Amended|Canada|Payroll|N

If we need to inactivate the Document Type of “T4A Register Amended” for Canada, we can use the below sample to inactivate it. We need to pass the DocumentType, Country and CategoryCode as they are the mandatory user keys required.

If we need to inactivate all Document Types, we need to query them and get details and then prepare HDL file to inactivate them.

SELECT DISTINCT HDTT.DOCUMENT_TYPE AS "Document Type"
	,(
		SELECT DISTINCT hl.meaning
		FROM fnd_common_lookups hl
		WHERE hl.lookup_code = HDTB.CATEGORY_CODE
			AND hl.lookup_type = 'DOCUMENT_CATEGORY' and rownum = 1
		) AS "Category Code"
	,HDTB.SUB_CATEGORY_CODE
	,CASE 
		WHEN HDTB.ACTIVE_INACTIVE_FLAG = 'Y'
			THEN 'Active'
		ELSE 'Inactive'
		END AS "Status"
	,NVL((
			SELECT DISTINCT hl.meaning
			FROM fnd_lookup_values hl
			WHERE hl.lookup_code = 'ORA_' || HDTB.LEGISLATION_CODE
				AND hl.lookup_type = 'ORA_HER_COUNTRY_CODE' and rownum = 1
			), 'All Countries') AS "Country"
			, HDTB.LEGISLATION_CODE
	,HDTB.MULTIPLE_OCCURENCES_FLAG
	,HDTB.AUTHORIZATION_REQUIRED
	,HDTB.DOCUMENT_NAME_REQUIRED
	,HDTB.DOCUMENT_NUMBER_REQUIRED
	,HDTB.DATE_FROM_REQUIRED
	,HDTB.DATE_TO_REQUIRED
	,HDTB.ISSUING_AUTHORITY_REQUIRED
	,HDTB.ISSUED_DATE_REQUIRED
	,HDTB.ISSUING_COUNTRY_REQUIRED
	,HDTB.ISSUING_LOCATION_REQUIRED
	,HDTB.COMMENTS_REQUIRED
	,HDTB.PUBLISH_REQUIRED
	,HDTB.SYSTEM_DOCUMENT_TYPE
FROM HR_DOCUMENT_TYPES_B HDTB
	,HR_DOCUMENT_TYPES_TL HDTT
WHERE 1 = 1
	AND HDTB.DOCUMENT_TYPE_ID = HDTT.DOCUMENT_TYPE_ID
	AND HDTB.ACTIVE_INACTIVE_FLAG = 'Y'