43: END IF;
44:
45: d_progress := '100';
46:
47: -- See if this location is in HR_LOCATIONS or if it
48: -- is a drop ship location
49: BEGIN
50: SELECT hrl.location_id
51: INTO l_temp_location_id
48: -- is a drop ship location
49: BEGIN
50: SELECT hrl.location_id
51: INTO l_temp_location_id
52: FROM hr_locations hrl
53: WHERE hrl.location_id = p_location_id;
54:
55: d_progress := '110';
56:
91: , x_state_or_province
92: , x_postal_code
93: , x_territory_short_name
94: , x_iso_territory_code
95: FROM hr_locations_all hrl
96: , fnd_territories fte
97: , fnd_territories_tl ftel
98: , fnd_lookup_values flv1
99: , fnd_lookup_values flv2
281: **
282: ** Procedure get_address
283: ** Created for ER 2291745
284: ** Logic
285: ** 1. The x_temp_location_id will be set if the location exists in hr_Locations
286: ** 2. Based on the x_temp_location_id the address will be selected from either
287: ** hr_locations or from hz_locations
288: **
289: ********************************************************************************/
283: ** Created for ER 2291745
284: ** Logic
285: ** 1. The x_temp_location_id will be set if the location exists in hr_Locations
286: ** 2. Based on the x_temp_location_id the address will be selected from either
287: ** hr_locations or from hz_locations
288: **
289: ********************************************************************************/
290:
291: PROCEDURE get_address
295: Address_line_3 OUT NOCOPY Varchar2,
296: Territory_short_name OUT NOCOPY VArchar2,
297: Address_info OUT NOCOPY Varchar2 )
298: IS
299: l_town_or_city HR_LOCATIONS_ALL.town_or_city%TYPE;
300: l_state_or_province HR_LOCATIONS_ALL.region_1%TYPE;
301: l_postal_code HR_LOCATIONS_ALL.postal_code%TYPE;
302: l_iso_territory_code FND_TERRITORIES.iso_territory_code%TYPE;
303:
296: Territory_short_name OUT NOCOPY VArchar2,
297: Address_info OUT NOCOPY Varchar2 )
298: IS
299: l_town_or_city HR_LOCATIONS_ALL.town_or_city%TYPE;
300: l_state_or_province HR_LOCATIONS_ALL.region_1%TYPE;
301: l_postal_code HR_LOCATIONS_ALL.postal_code%TYPE;
302: l_iso_territory_code FND_TERRITORIES.iso_territory_code%TYPE;
303:
304: Begin
297: Address_info OUT NOCOPY Varchar2 )
298: IS
299: l_town_or_city HR_LOCATIONS_ALL.town_or_city%TYPE;
300: l_state_or_province HR_LOCATIONS_ALL.region_1%TYPE;
301: l_postal_code HR_LOCATIONS_ALL.postal_code%TYPE;
302: l_iso_territory_code FND_TERRITORIES.iso_territory_code%TYPE;
303:
304: Begin
305:
327: **
328: ** Procedure get_address (with over loading)
329: ** Created for FPJ PO Communication Enhancement
330: ** Logic
331: ** 1. The x_temp_location_id will be set if the location exists in hr_Locations
332: ** 2. Based on the x_temp_location_id the address will be selected from either
333: ** hr_locations or from hz_locations
334: **--Change Hisotry: bug#3438608 added the out variables x_town_or_city
335: --x_postal_code and x_state_or_province
329: ** Created for FPJ PO Communication Enhancement
330: ** Logic
331: ** 1. The x_temp_location_id will be set if the location exists in hr_Locations
332: ** 2. Based on the x_temp_location_id the address will be selected from either
333: ** hr_locations or from hz_locations
334: **--Change Hisotry: bug#3438608 added the out variables x_town_or_city
335: --x_postal_code and x_state_or_province
336: ********************************************************************************/
337: PROCEDURE get_address
344: x_location_name OUT NOCOPY Varchar2,
345: x_contact_phone OUT NOCOPY Varchar2,
346: x_contact_fax OUT NOCOPY Varchar2,
347: x_address_line_4 OUT NOCOPY Varchar2,
348: x_town_or_city OUT NOCOPY HR_LOCATIONS.town_or_city%type,
349: x_postal_code OUT NOCOPY HR_LOCATIONS.postal_code%type,
350: x_state_or_province OUT NOCOPY varchar2)
351:
352: IS
345: x_contact_phone OUT NOCOPY Varchar2,
346: x_contact_fax OUT NOCOPY Varchar2,
347: x_address_line_4 OUT NOCOPY Varchar2,
348: x_town_or_city OUT NOCOPY HR_LOCATIONS.town_or_city%type,
349: x_postal_code OUT NOCOPY HR_LOCATIONS.postal_code%type,
350: x_state_or_province OUT NOCOPY varchar2)
351:
352: IS
353: l_town_or_city Varchar2(240);
355: l_postal_code Varchar2(240);
356: l_temp_location_id Number := NULL ;
357: Begin
358:
359: /* Select the location id from hr_locations. If the location is in hr_locations
360: it will be populated. Else the l_temp_location_id will be made NULL */
361:
362: Begin
363: Select location_id into l_temp_location_id
360: it will be populated. Else the l_temp_location_id will be made NULL */
361:
362: Begin
363: Select location_id into l_temp_location_id
364: from hr_locations
365: where location_id = p_location_id;
366: exception
367: WHEN NO_DATA_FOUND THEN
368: l_temp_location_id := NULL;
370:
371:
372: if (l_temp_location_id is not null) then
373:
374: /* If the l_addr_select_qry location id is not null then get the address from hr_locations */
375:
376: Begin
377: /*Bug 5084855 Adding the NVL to get the Country value for Generic Address Style */
378: Select HLC.ADDRESS_LINE_1,
400: x_location_name,
401: x_contact_phone,
402: x_contact_fax
403: FROM
404: HR_LOCATIONS HLC,
405: FND_TERRITORIES_TL FTE,
406: FND_LOOKUP_VALUES FCL1,
407: FND_LOOKUP_VALUES FCL2,
408: FND_LOOKUP_VALUES FCL3,
467: x_location_name := '';
468: x_contact_phone := '';
469: x_contact_fax := '';
470:
471: End; /* hr_locations */
472:
473: else
474:
475: /* If the l_addr_select_qry location id is null then select the address from hz_locations */
604: /*********************************************************************************************
605: **
606: ** Procedure: get_alladdress_lines
607: ** This procedure is used to retriev the address values mapped to
608: ** HR_LOCATIONS or HZ_LOCATIONS.
609: **
610: ** The prompts and the columns names where the prompts are mapped to
611: ** HR_LOCATIONS table is retrieved by using fnd_dflex package. fnd_dflex package is
612: ** is having functions and procedures to retrieve prompts names and the column names
607: ** This procedure is used to retriev the address values mapped to
608: ** HR_LOCATIONS or HZ_LOCATIONS.
609: **
610: ** The prompts and the columns names where the prompts are mapped to
611: ** HR_LOCATIONS table is retrieved by using fnd_dflex package. fnd_dflex package is
612: ** is having functions and procedures to retrieve prompts names and the column names
613: ** of HR_LOCATIONS where the address details are stored.
614: ** Note: Some look up codes are stored in HR_LOCATIONS table. Current procedure is not
615: ** retrieving the loop up values for these codes.
609: **
610: ** The prompts and the columns names where the prompts are mapped to
611: ** HR_LOCATIONS table is retrieved by using fnd_dflex package. fnd_dflex package is
612: ** is having functions and procedures to retrieve prompts names and the column names
613: ** of HR_LOCATIONS where the address details are stored.
614: ** Note: Some look up codes are stored in HR_LOCATIONS table. Current procedure is not
615: ** retrieving the loop up values for these codes.
616: **
617: ** There is no package available to retrieve the prompts and column names
610: ** The prompts and the columns names where the prompts are mapped to
611: ** HR_LOCATIONS table is retrieved by using fnd_dflex package. fnd_dflex package is
612: ** is having functions and procedures to retrieve prompts names and the column names
613: ** of HR_LOCATIONS where the address details are stored.
614: ** Note: Some look up codes are stored in HR_LOCATIONS table. Current procedure is not
615: ** retrieving the loop up values for these codes.
616: **
617: ** There is no package available to retrieve the prompts and column names
618: ** that are mapped to HZ_LOCATIONS. But HZ_FORMAT_PUB package is having a procedure
637: x_location_name OUT NOCOPY Varchar2,
638: x_contact_phone OUT NOCOPY Varchar2,
639: x_contact_fax OUT NOCOPY Varchar2,
640: x_address_line_4 OUT NOCOPY Varchar2,
641: x_town_or_city OUT NOCOPY HR_LOCATIONS.town_or_city%type,
642: x_postal_code OUT NOCOPY HR_LOCATIONS.postal_code%type,
643: x_state_or_province OUT NOCOPY varchar2)
644:
645: IS
638: x_contact_phone OUT NOCOPY Varchar2,
639: x_contact_fax OUT NOCOPY Varchar2,
640: x_address_line_4 OUT NOCOPY Varchar2,
641: x_town_or_city OUT NOCOPY HR_LOCATIONS.town_or_city%type,
642: x_postal_code OUT NOCOPY HR_LOCATIONS.postal_code%type,
643: x_state_or_province OUT NOCOPY varchar2)
644:
645: IS
646:
658: l_addr_col_names varchar2(4000) :=NULL; -- Contains list of column names
659: --l_addr_into_qry varchar2(4000) :=NULL;
660:
661: /*Bug 5854013 l_style_code holds the address_style from hz_locations also.Hence declaring the variable
662: to hold the length same as of HZ_LOCATIONS.ADDRESS_STYLE which is bigger than HR_LOCATIONS.STYLE
663: l_style_code HR_LOCATIONS.STYLE%type := null; */
664: l_style_code HZ_LOCATIONS.ADDRESS_STYLE%type := null;
665:
666: l_temp_location_id Number := NULL ;
659: --l_addr_into_qry varchar2(4000) :=NULL;
660:
661: /*Bug 5854013 l_style_code holds the address_style from hz_locations also.Hence declaring the variable
662: to hold the length same as of HZ_LOCATIONS.ADDRESS_STYLE which is bigger than HR_LOCATIONS.STYLE
663: l_style_code HR_LOCATIONS.STYLE%type := null; */
664: l_style_code HZ_LOCATIONS.ADDRESS_STYLE%type := null;
665:
666: l_temp_location_id Number := NULL ;
667: l_addr_select_qry varchar2(4000);
689:
690:
691: Begin
692:
693: /* Select the location id from hr_locations. If the location is in hr_locations
694: it will be populated. Else the l_temp_location_id will be made NULL */
695:
696: Begin
697: Select location_id, style into l_temp_location_id, l_style_code
694: it will be populated. Else the l_temp_location_id will be made NULL */
695:
696: Begin
697: Select location_id, style into l_temp_location_id, l_style_code
698: from hr_locations
699: where location_id = p_location_id;
700: exception
701: WHEN NO_DATA_FOUND THEN
702: l_temp_location_id := NULL;
705:
706:
707: if (l_temp_location_id is not null) then
708:
709: /* If location id is not null then get the address from hr_locations */
710:
711: Begin
712: IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_STATEMENT) THEN
713: FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head, l_api_name ||'Retreiving data from HR_LOCATIONS');
709: /* If location id is not null then get the address from hr_locations */
710:
711: Begin
712: IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_STATEMENT) THEN
713: FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head, l_api_name ||'Retreiving data from HR_LOCATIONS');
714: END IF;
715: IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_STATEMENT) THEN
716: FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head, l_api_name ||'location Id:'|| p_location_id);
717: END IF;
745: x_location_name,
746: x_contact_phone,
747: x_contact_fax
748: FROM
749: HR_LOCATIONS HLC,
750: FND_TERRITORIES_TL FTE,
751: FND_LOOKUP_VALUES FCL1,
752: FND_LOOKUP_VALUES FCL2,
753: FND_LOOKUP_VALUES FCL3,
892: END IF;
893:
894: END LOOP;
895:
896: -- Query to retrieve the address values from HR_LOCATIONS.
897: l_addr_select_qry := 'select '|| l_addr_col_names || ' from hr_locations where location_id = :1 ' ;
898: IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_STATEMENT) THEN
899: FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head, l_api_name ||'select query:'||l_addr_select_qry);
900: END IF;
893:
894: END LOOP;
895:
896: -- Query to retrieve the address values from HR_LOCATIONS.
897: l_addr_select_qry := 'select '|| l_addr_col_names || ' from hr_locations where location_id = :1 ' ;
898: IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_STATEMENT) THEN
899: FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head, l_api_name ||'select query:'||l_addr_select_qry);
900: END IF;
901:
956: -- End bug#3622675
957: g_addr_prompt_query(l_addr_prompt_query_count).query := l_addr_select_qry;
958: END IF;
959: IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_STATEMENT) THEN
960: FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head, l_api_name ||'Before executing the HR_LOCATIONS query');
961: END IF;
962:
963: execute immediate l_addr_select_qry INTO g_address_details(l_table_count).addr_data_1, g_address_details(l_table_count).addr_data_2, g_address_details(l_table_count).addr_data_3,
964: g_address_details(l_table_count).addr_data_4, g_address_details(l_table_count).addr_data_5, g_address_details(l_table_count).addr_data_6,
967: g_address_details(l_table_count).addr_data_13, g_address_details(l_table_count).addr_data_14, g_address_details(l_table_count).addr_data_15,
968: g_address_details(l_table_count).addr_data_16, g_address_details(l_table_count).addr_data_17, g_address_details(l_table_count).addr_data_18,
969: g_address_details(l_table_count).addr_data_19, g_address_details(l_table_count).addr_data_20 USING p_location_id ;
970: IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_STATEMENT) THEN
971: FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head, l_api_name ||'After executing the HR_LOCATIONS query');
972: END IF;
973:
974:
975:
978:
979: Exception
980: WHEN OTHERS then
981: IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_STATEMENT) THEN
982: FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head, l_api_name ||'Exception while retrieving data from HR_LOCATIONS');
983: END IF;
984: x_address_line_1 := '';
985: x_address_line_2 := '';
986: x_address_line_3 := '';
991: x_location_name := '';
992: x_contact_phone := '';
993: x_contact_fax := '';
994:
995: End; /* hr_locations */
996:
997: else
998:
999: /* If location id is null then select the address from hz_locations */