I need to submit a RDF report on Book order button click in sales order form. I used when-button-pressed event in seeded library code and it is running pretty good. The problem is i shouldn't customize seeded code. Only alternative left is using custom.pll. In custom.plll as we can't use the when-button-pressed event i tried to use WHEN-NEW-ITEM-INSTANCE. Then on button click(book order) the report is been submitted to concurrent manager repeatedly. I need to submit a report when you book entered orders.
How can i submit a report when the order changes it status.
Here is the code that i am using.
if (v_form_name = 'OEXOETEL' and event_name ='WHEN-NEW-ITEM-INSTANCE' and v_item_name ='ORDER.SOLD_TO'
and v_block_name IN ('ORDER','LINE') and (name_in('ORDER.FLOW_STATUS_CODE')='ENTERED')) THEN
APP_STANDARD.APP_VALIDATE(RECORD_SCOPE);
l_organization_id := '101';
l_order_number := name_in('ORDER.ORDER_NUMBER');
select to_number(oe_sys_parameters.value ('SET_OF_BOOKS_ID')) into l_sob_id from dual;
l_flex_code := fnd_profile.value('OE_ID_FLEX_CODE');
l_new_request_id := FND_REQUEST.SUBMIT_REQUEST('ONT','OEXOEACK', --- Submit the request for SO Ack Order RDF Report
null,null,FALSE,l_sob_id,l_organization_id,l_flex_code ,'D',NULL,
NULL,l_order_number ,l_order_number,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Y',NULL,
NULL,'N','N','N','',chr(0), '', '', '', '',
'', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '', '', '', '', '', '', '');
fnd_message.set_name('ONT','ONT_CONCURRENT_REQUEST_ID');
fnd_message.set_token('REQUEST_ID',l_new_request_id);
fnd_message.show;
IF (l_new_request_id = 0) THEN
FND_MESSAGE.RETRIEVE;
FND_MESSAGE.ERROR;
else
l_commit_result := APP_FORM.QuietCommit;
END IF;
copy('NULL','parameter.ACTIONS');
IF (l_print_request_id = 0) THEN
FND_MESSAGE.RETRIEVE;
FND_MESSAGE.ERROR;
else
l_commit_result := APP_FORM.QuietCommit;
END IF;
IF(name_in('ORDER.FLOW_STATUS_CODE')='BOOKED')
THEN
null;
fnd_message.set_string('Starting Flow status code : '||name_in('ORDER.FLOW_STATUS_CODE'));
fnd_message.show;
END IF;
END IF;
This is an urgent requirement. If you know the solution for the problem please try to reply me ASAP.
Your help will be highly appreciated..
|