Home » Developer & Programmer » Forms » Need help on Forms Customization
Need help on Forms Customization [message #455632] Wed, 12 May 2010 05:32 Go to next message
dhanasurya
Messages: 33
Registered: May 2010
Member
Hi All,
I have one requirement i.e I developed one form which contails 3 windows.First window is for Query_Find, second one is for orders Summary and third window is for detail.In detail window i have one stacked canvas which displays order details in tabular form.i have written code for inserting data into one custom table in ON-INSERT and ON-UPDATE trigger of that block.
and Commit_Form in the KEY-COMMIT trigger.My requirement if i check the chekbox and change the status(List item ) from status field and when i click on save button it's saving the changes.But i don't want to save the changes at this time.

How can we restict save changes at this point?

Can any one plzz give me some idea.

Thanks in Advance,
Re: Need help on Forms Customization [message #455724 is a reply to message #455632] Wed, 12 May 2010 12:52 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
If I got it right:
-- KEY-COMMIT trigger:

if checkbox_checked('your_checkbox_item') then
   null;
else
   commit;
end if;
Re: Need help on Forms Customization [message #455775 is a reply to message #455724] Wed, 12 May 2010 23:35 Go to previous messageGo to next message
dhanasurya
Messages: 33
Registered: May 2010
Member
Hi Littlefoot,
I have written following code in KET-COMMIT trigger of detail block.
IF :XXMZ_SC_DETAIL.SELECT_CBX = 'Y' THEN
NULL;
ELSE
COMMIT_FORM;
END IF;

It's working fine.But here other changes are not saving.

But I have written code in ON-INSERT and ON-UPDATE Triggers at same block.
if :XXMZ_SC_DETAIL.ADJUSTMENT_ID is not null and :XXMZ_SC_DETAIL.SELECT_CBX = 'Y' then
update table....
else
insert table..
end if;

if i check the chekbox and change the status(List item ) from status field and click on save i don't want to save the changes at this time.

if i check the chekbox and change the status(List item ) from status field and press tab it create a new line give the item and click on save i want to save the changes at this time.

Please give me any other idea.

Thanks in Advance,






Re: Need help on Forms Customization [message #455788 is a reply to message #455775] Thu, 13 May 2010 00:52 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Is it a data block you are talking about (the one that is based on a table)? If so, you do NOT need ON-INSERT or ON-UPDATE triggers - Forms is capable of doing that job by itself, and no additional code is required. Moreover, it means that existing KEY-COMMIT trigger handles both "commit / don't commit" situations.
Re: Need help on Forms Customization [message #455806 is a reply to message #455788] Thu, 13 May 2010 02:02 Go to previous messageGo to next message
dhanasurya
Messages: 33
Registered: May 2010
Member
Hi Littlefoot,
Thanks for your reply.Exactly it's a database block but which is based on a complex view(xxmz_sc_det_v).I used ON-INSERT and ON-UPDATE triggers for inserting and updating data into a custom table.i.e xxmz_sc_tbl.

For that block I changed Key Mode property as Updatable.So i need
ON-INSERT and ON-UPDATE triggers.

Please give me any alternate solution.

Thanks in Advance,

Re: Need help on Forms Customization [message #455812 is a reply to message #455806] Thu, 13 May 2010 02:10 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
When performing manual updates and inserts you need to use 'standard.commit' instead of 'commit' and 'commit_form'.

David
Re: Need help on Forms Customization [message #455850 is a reply to message #455812] Thu, 13 May 2010 03:37 Go to previous messageGo to next message
dhanasurya
Messages: 33
Registered: May 2010
Member
Hi David,
I already tested with 'standard.commit' in KEY-COMMIT Trigger.But it's saving the record if i check the chekbox and change the status(List item ) from status field(here i did't press tab) but i don't want to save the changes at this time.

Thnaks,
Re: Need help on Forms Customization [message #455851 is a reply to message #455850] Thu, 13 May 2010 03:40 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
How does your KEY-COMMIT trigger look now? (Copy-paste the whole code, please)
Re: Need help on Forms Customization [message #455855 is a reply to message #455851] Thu, 13 May 2010 03:49 Go to previous messageGo to next message
dhanasurya
Messages: 33
Registered: May 2010
Member
Hi,
I have written commit_form; in KEY-COMMIT Trigger of Detail Block.

i have written the following code in ON-INSERT & ON-UPDATE Trigger

declare
lv_n_adj_id NUMBER;
lv_status_code VARCHAR2(30);
l_header_id NUMBER;
l_line_id NUMBER;
l_inv_item_id NUMBER;
l_org_id NUMBER;
l_truck_number VARCHAR2(100);
l_shift_id NUMBER;
v_record NUMBER;
lv_tmd_stat VARCHAR2(20);
BEGIN
IF :xxmz_sc_det.adjustment_id IS NULL THEN
SELECT xxmz_seq.NEXTVAL
INTO lv_n_adj_id
FROM DUAL;
END IF;
BEGIN
SELECT DECODE (:xxmz_sc_sum.tmd_status
,'Complete', 'C'
,'Incomplete', 'IC')
INTO lv_tmd_stat
FROM DUAL;
EXCEPTION
WHEN OTHERS THEN
lv_tmd_stat := '';
END;
IF :xxmz_sc_det.adjustment_id IS NOT NULL AND :xxmz_sc_det.select_cbx = 'Y' THEN
UPDATE xxmz_sc_tbl
SET adjustment_id = :xxmz_sc_det.adjustment_id,
completion_date = :xxmz_sc_det.completion_date,
qty_estimated = :xxmz_sc_det.qty_estimated,
qty_actual = :xxmz_sc_det.qty_actual
WHERE adjustment_id = :xxmz_sc_det.adjustment_id;
ELSIF :xxmz_sc_det.adjustment_id IS NULL AND :xxmz_sc_det.select_cbx = 'Y' THEN
BEGIN
SELECT flex_value
INTO lv_status_code
FROM fnd_flex_values_vl ffvv
,fnd_flex_value_sets ffvs
WHERE 1 = 1
AND ffvs.flex_value_set_id = ffvv.flex_value_set_id
AND ffvv.description = :xxmz_sc_det.status_disp
AND ffvv.summary_flag = 'N'
AND ffvs.flex_value_set_name = 'XXMCS_SC_FORM_STATUS';
EXCEPTION
WHEN OTHERS THEN
lv_status_code := 'CO';
END;


INSERT INTO xxmz_sc_tbl
(adjustment_id ,
header_id ,
line_id ,
trip_code ,
completion_date ,
inventory_item_id ,
organization_id ,
qty_estimated ,
qty_actual ,
truck_number ,
status ,
process_code ,
tmd_status ,
ref_line_id ,
shift_id ,
attribute1 ,
attribute2 ,
attribute3 ,
attribute4 ,
attribute5 ,
attribute6 ,
attribute7 ,
attribute8 ,
attribute9 ,
attribute10 ,
attribute11 ,
attribute12 ,
attribute13 ,
attribute14 ,
attribute15 ,
creation_date ,
created_by ,
last_update_date ,
last_updated_by
)
VALUES (lv_n_adj_id,
:xxmz_sc_sum.sales_order_id,
:xxmz_sc_det.line_id,
:xxmz_sc_sum.trip_code ,
:xxmz_sc_sum.schedule_date ,
:xxmz_sc_det.inventory_item_id ,
:xxmz_sc_sum.organization_id ,
:xxmz_sc_det.qty_estimated ,
:xxmz_sc_det.qty_actual ,
:xxmz_sc_sum.truck_code ,
lv_status_code ,
nvl(:xxmz_sc_det.process_code,'N') ,
lv_tmd_stat ,
:xxmz_sc_det.ref_line_id ,
:xxmz_sc_det.shift_id ,
:xxmz_sc_det.attribute1 ,
:xxmz_sc_det.attribute2 ,
:xxmz_sc_det.attribute3 ,
:xxmz_sc_det.attribute4 ,
:xxmz_sc_det.attribute5 ,
:xxmz_sc_det.attribute6 ,
:xxmz_sc_det.attribute7 ,
:xxmz_sc_det.attribute8 ,
:xxmz_sc_det.attribute9 ,
:xxmz_sc_det.attribute10 ,
:xxmz_sc_det.attribute11 ,
:xxmz_sc_det.attribute12 ,
:xxmz_sc_det.attribute13 ,
:xxmz_sc_det.attribute14 ,
:xxmz_sc_det.attribute15 ,
SYSDATE,
fnd_global.user_id,
SYSDATE,
fnd_global.user_id
);


END IF;
EXCEPTION
WHEN others THEN
fnd_message.debug(sqlcode||' : '||sqlerrm);

END;

Thanks,

[Updated on: Thu, 13 May 2010 03:50]

Report message to a moderator

Re: Need help on Forms Customization [message #455875 is a reply to message #455855] Thu, 13 May 2010 04:15 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
I have written commit_form; in KEY-COMMIT Trigger of Detail Block.

How does it handle checkbox and status set to a certain value?
Re: Need help on Forms Customization [message #455886 is a reply to message #455875] Thu, 13 May 2010 04:55 Go to previous messageGo to next message
dhanasurya
Messages: 33
Registered: May 2010
Member
Hi,
I have given "if" condition(:xxmz_sc_det.select_cbx = 'Y' ) in ON-ISERT and ON-UPDATE Triggers.If i select status and press tab @status field it creates new line i enter the fields then click on save changes are saving properly.

If i check checkbox change the status and click on save it's calling same triggers here i need to override these triggers,
i need not save the record when i do not press tab.

How can i handle checkbox and status set to a certain value?
Re: Need help on Forms Customization [message #455896 is a reply to message #455886] Thu, 13 May 2010 05:11 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Did you try (as - partially - previously suggested)
if checkbox_checked('your_checkbox_item') and
   :status_item = 'some value'
then
   do_something;
else
  do_something_different;
end if;
Previous Topic: from-40509 unable to update record
Next Topic: my forms not work on vista or win7 ?
Goto Forum:
  


Current Time: Thu Sep 19 19:42:57 CDT 2024