I wrote the script below to test this and the resulting Work Request always ends up with Anonymous in the Created By when reviewed in the App. As you can see I try and do an UPDATE after the CREATE as well.
DECLARE
v_work_request_rec wip_eam_work_requests%ROWTYPE;
d_work_request_rec wip_eam_work_requests%ROWTYPE;
v_user_id NUMBER;
o_work_request_id wip_eam_work_requests.work_request_id%TYPE;
o_return_status VARCHAR2(50);
o_msg_count NUMBER;
o_msg_data VARCHAR2(2000);
v_organization_code mtl_parameters.organization_code%TYPE;
v_lookup_type fnd_lookup_values.lookup_type%TYPE;
v_description_240 wip_eam_work_requests.description%TYPE;
v_dummy VARCHAR2(1);
o_oracle_work_request_id NUMBER;
o_oracle_work_request_number VARCHAR2(100);
o_status VARCHAR2(100);
o_error_msg VARCHAR2(2000);
CURSOR c_get_work_request_number IS
SELECT work_request_number
FROM wip_eam_work_requests
WHERE organization_id = 10179
AND work_request_id = o_work_request_id;
BEGIN
—
o_status := ‘SUCCESS’;
—
IF o_status = ‘SUCCESS’ THEN
v_work_request_rec.asset_group := 1135865;
v_work_request_rec.asset_number := ‘VALV-442-MDV-0001’;
v_work_request_rec.description := ‘Test WR with Requestor’;
v_work_request_rec.work_request_priority_id := 5;
v_work_request_rec.work_request_owning_dept := 1578;
v_work_request_rec.work_request_status_id := 3;
v_work_request_rec.work_request_type_id := 11;
v_work_request_rec.organization_id := 10179;
v_work_request_rec.creation_date := SYSDATE;
v_work_request_rec.expected_resolution_date := SYSDATE+60;
v_work_request_rec.work_request_created_by := 120066; –This is a valid user in fnd_user
v_work_request_rec.created_for := NULL;
v_work_request_rec.created_by := 120066; –This is a valid user in fnd_user
v_work_request_rec.last_update_date := SYSDATE;
v_work_request_rec.attribute15 := 2;
—
— wip_eam_workrequest_pub.work_request_import
wip_eam_workrequest_pub.work_request_import
(p_api_version => 1.0
,p_init_msg_list => FND_API.G_FALSE
,p_commit => FND_API.G_TRUE
,p_validation_level => FND_API.G_VALID_LEVEL_FULL
,p_mode => ‘CREATE’
,p_work_request_rec => v_work_request_rec
,p_request_log => ‘Test WR with Requestor Created by Paul G’
,p_user_id => v_user_id
,x_work_request_id => o_work_request_id
,x_return_status => o_return_status
,x_msg_count => o_msg_count
,x_msg_data => o_msg_data
);
IF o_return_status <> ‘S’ THEN
o_status := ‘FAILURE’;
o_error_msg := ‘Error in CREATE call to wip_eam_workrequest_pub.work_request_import – ‘||o_msg_data||’ – ‘||SUBSTR(SQLERRM,1,200);
ELSE
OPEN c_get_work_request_number;
FETCH c_get_work_request_number
INTO o_oracle_work_request_number;
IF c_get_work_request_number%NOTFOUND THEN
o_status := ‘FAILURE’;
o_error_msg := ‘Error in retrieving work request number after successful call to api for org id ‘||
‘10179’||’ and work request id ‘||o_work_request_id||’ and ivara request ‘||’1’;
END IF;
CLOSE c_get_work_request_number;
–Issue 063452 – ( Oracle eAM) Work request long description is not being sent to Oracle
IF o_work_request_id IS NOT NULL AND o_status = ‘SUCCESS’ THEN
v_work_request_rec := d_work_request_rec;
v_work_request_rec.organization_id := 10179;
v_work_request_rec.work_request_id := o_work_request_id;
v_work_request_rec.work_request_created_by := 120066;
v_work_request_rec.created_for := 120066;
v_work_request_rec.created_by := 120066;
v_work_request_rec.attribute15 := o_oracle_work_request_number;
–wip_eam_workrequest_pub.work_request_import
wip_eam_workrequest_pub.work_request_import
(p_api_version => 1.0
,p_init_msg_list => FND_API.G_FALSE
,p_commit => FND_API.G_TRUE
,p_validation_level => FND_API.G_VALID_LEVEL_FULL
,p_mode => ‘UPDATE’
,p_work_request_rec => v_work_request_rec
,p_request_log => ‘Test WR with Requestor Created by Paul G’
,p_user_id => v_user_id
,x_work_request_id => o_work_request_id
,x_return_status => o_return_status
,x_msg_count => o_msg_count
,x_msg_data => o_msg_data
);
IF o_return_status <> ‘S’ THEN
o_status := ‘FAILURE’;
o_error_msg := ‘Error in UPDATE call to wip_eam_workrequest_pub.work_request_import – ‘||o_msg_data;
END IF;
END IF;
END IF;
END IF;
END;
by default who columns as (CREATED_BY) is one of them is handled automatically from oracle by database triggers like HRMS and when you call any API’s from sql*plus or sql developer. who columns are set also automatically by anonymous user.
but still you can control of this behavior by calling
before call your API. but keep in mind that it is your responsibility to pass in valid values, as incorrect values are not rejected.
Regards.