Thursday, 23 July 2026

Query to find the organization location

SELECT
    hou.organization_id,
    hou.name operating_unit,
    hl.location_code,
    hl.description,
    hl.address_line_1,
    hl.town_or_city,
    hl.region_1,
    hl.postal_code,
    hl.country
FROM
    hr_operating_units         hou,
    hr_all_organization_units  haou,
    hr_locations_all           hl
WHERE
        hou.organization_id = haou.organization_id
    AND haou.location_id = hl.location_id
    AND hou.organization_id IN ( 101)
ORDER BY
    hou.name;

Query to display output in json format

 SELECT JSON_OBJECT(

    'PRODUCT_CLASS' VALUE flv.lookup_code,
    'PRODUCT_CLASS_DESCRIPTION' VALUE flv.description    
     ) AS json_output
FROM
    fnd_lookup_values flv
WHERE
        flv.lookup_type = 'PRODUCT_CLASS'
    AND flv.enabled_flag = 'Y'
    AND trunc(nvl(flv.end_date_active, sysdate)) >= trunc(sysdate);

Query to find AR invoice Amount

 SELECT
    rcta.trx_number,
    rcta.trx_date,
    rcta.creation_date,
    apsa.amount_due_original,
    apsa.amount_line_items_original,
    apsa.tax_original
FROM
    ra_customer_trx_all       rcta,
    ar_payment_schedules_all  apsa
WHERE
        1 = 1
    AND rcta.customer_trx_id = apsa.customer_trx_id
    AND rcta.trx_number = '70682380'
    ;

Thursday, 2 July 2026

Script to update customer account (update hz_cust_accounts table) in oracle apps

 set serveroutput on


DECLARE
p_cust_account_rec      HZ_CUST_ACCOUNT_V2PUB.CUST_ACCOUNT_REC_TYPE;
p_object_version_number NUMBER;
x_return_status         VARCHAR2(2000);
x_msg_count             NUMBER;
x_msg_data              VARCHAR2(2000);

BEGIN
-- Setting the Context --
mo_global.init('AR');
fnd_global.apps_initialize ( user_id      => 233158
                            ,resp_id      => 58900
                            ,resp_appl_id => 222);
mo_global.set_policy_context('S',111);
fnd_global.set_nls_context('AMERICAN');

-- Initializing the Mandatory API parameters
p_cust_account_rec.cust_account_id := 6525878;
p_cust_account_rec.ATTRIBUTE5   := '6317668';
p_cust_account_rec.ATTRIBUTE7   := 'Test1';
p_object_version_number            := 1; --object_version_number from hz_cust_accounts table

DBMS_OUTPUT.PUT_LINE('API Starts');

HZ_CUST_ACCOUNT_V2PUB.UPDATE_CUST_ACCOUNT
                  (
                    p_init_msg_list         => FND_API.G_TRUE,
                    p_cust_account_rec      => p_cust_account_rec,
                    p_object_version_number => p_object_version_number,
                    x_return_status         => x_return_status,
                    x_msg_count             => x_msg_count,
                    x_msg_data              => x_msg_data
                          );

IF  x_return_status = fnd_api.g_ret_sts_success THEN
    COMMIT;
    DBMS_OUTPUT.PUT_LINE('Customer Account updated Successful ');
 
ELSE
    DBMS_OUTPUT.put_line ('Customer Account update failed:'||x_msg_data);
    ROLLBACK;
    FOR i IN 1 .. x_msg_count
    LOOP
      x_msg_data := fnd_msg_pub.get( p_msg_index => i, p_encoded => 'F');
      dbms_output.put_line( i|| ') '|| x_msg_data);
    END LOOP;
END IF;
DBMS_OUTPUT.PUT_LINE('API completed');
END;
/