Home » Developer & Programmer » Forms » Messages are displayed Twiced
Messages are displayed Twiced [message #608750] Mon, 24 February 2014 06:58 Go to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Hi,

I selected 12(Inactive),13(Active) item_numbers and clicked on the Button , it displays An Alerts for 12 as " This item_number is Inactive please active" and onhandquantity for the both as " 12,12,13 Does not have Onhandquantity" ...why it displays twice in the messages.Please help

Why it displayed as 12,12,13...twice, but i want 12,13 item_number are not having ONHANDQUANTITY(Alert)

Re: Messages are displayed Twiced [message #608751 is a reply to message #608750] Mon, 24 February 2014 07:09 Go to previous messageGo to next message
cookiemonster
Messages: 13923
Registered: September 2008
Location: Rainy Manchester
Senior Member
Do you really think we can answer that with the amount of information provided?

Do you think that I and others keep asking you to provide your code on your numerous threads for a laugh, or because the rest of us actually need to see it in order to work out what the problem is?
Re: Messages are displayed Twiced [message #608752 is a reply to message #608751] Mon, 24 February 2014 07:10 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
DECLARE 
    alert_button     NUMBER; 
    v_alert          NUMBER; 
    v_message        VARCHAR2(1000); 
   v_count1         NUMBER; -->Added on 14-Feb-2014 
    v_count2         NUMBER; -->Added on 14-Feb-2014 
    v_count          NUMBER := 0; 
    --v_flag           VARCHAR2(1):='N';
    v_onhandquantity NUMBER;
   v_incrval     NUMBER;
     v_itemnumber  VARCHAR2(5000);
BEGIN
	 /**Checking for Item Number is assigned to BRW Or NOT*****/
	 BEGIN 
    Go_block('RHCLANDEDCOSTDET'); 
    first_record; 
    LOOP 
        IF :RHCLANDEDCOSTDET.selected_flag = 'Y' THEN  
          SELECT Count(1) 
          INTO   v_count 
          FROM   regal.regal_inv_landed_cost_tab a1 
          WHERE  organization_id = 81 
                 AND inventory_item_id IN (SELECT inventory_item_id 
                                           FROM   mtl_system_items_kfv a2 
                                           WHERE a1.item_number = a2.concatenated_segments 
                                           --AND a1.inventory_item_id = a2.inventory_item_id 
                                           AND a2.organization_id = 82)
                 AND file_number = :RHCLANDEDCOSTDET.file_number 
                 AND item_number = :RHCLANDEDCOSTDET.item_number; 

          IF v_count = 0 THEN v_incrval := 1; 
            v_itemnumber := v_itemnumber ||:RHCLANDEDCOSTDET.item_number ||','; 
          END IF; 
        END IF; 
        next_record; 
        EXIT WHEN :SYSTEM.last_record = 'TRUE'; 
    END LOOP; 
    first_record; 

    IF v_incrval = 1 THEN 
      fnd_message.Set_string('This' ||Rtrim(v_itemnumber) ||' Number is not assigned into the BRW'); --testing  
      fnd_message.show; 
    END IF;   
	 END; 

    /****Checking for Item Number is Active or Not*******/
    BEGIN 
    Go_block('RHCLANDEDCOSTDET'); 
    first_record; 
    LOOP 
        IF :RHCLANDEDCOSTDET.selected_flag = 'Y' THEN 
          SELECT Count(1) 
          INTO   v_count2 
          FROM   regal.regal_inv_landed_cost_tab a1 
          WHERE  organization_id = 81 
                 AND inventory_item_id IN (SELECT inventory_item_id 
                                           FROM   mtl_system_items_kfv a2 
                                           WHERE a1.item_number = a2.concatenated_segments 
                                           AND a2.organization_id = 82 
                                           AND Nvl(a2.inventory_item_status_code, 'Active' ) = 'Active') 
                 AND file_number = :RHCLANDEDCOSTDET.file_number 
                 AND item_number = :RHCLANDEDCOSTDET.item_number; 

          IF v_count2 = 0 THEN v_incrval := 1; 
            v_itemnumber := v_itemnumber ||:RHCLANDEDCOSTDET.item_number ||','; 
          END IF; 
        END IF; 
        next_record; 
        EXIT WHEN :SYSTEM.last_record = 'TRUE'; 
    END LOOP; 
    first_record; 

    IF v_incrval = 1 THEN 
      fnd_message.Set_string('This' ||Rtrim(v_itemnumber) ||' is in the Inactive Mode Please Active '); --testing  
      fnd_message.show; 
    END IF; 
	 end;	 
	  /****Checking ONHANDQUANTITY in the RHA(81 organization)*******/
	 BEGIN 
    Go_block('RHCLANDEDCOSTDET'); 
    first_record; 
    LOOP 
           IF :RHCLANDEDCOSTDET.selected_flag = 'Y' THEN 
              SELECT NVL(SUM(transaction_quantity),0) ONHANDQUANTITY 
              INTO   v_onhandquantity 
              FROM   mtl_onhand_quantities 
              WHERE  inventory_item_id = :RHCLANDEDCOSTDET.inventory_item_id 
              AND organization_id = 81 
              AND subinventory_code = 'Vessel'; 
          IF v_onhandquantity = 0 THEN v_incrval := 1; 
            v_itemnumber := v_itemnumber ||:RHCLANDEDCOSTDET.item_number ||','; 
          END IF; 
        END IF; 
        next_record; 
        EXIT WHEN :SYSTEM.last_record = 'TRUE'; 
    END LOOP; 
    first_record; 

    IF v_incrval = 1 THEN       
      fnd_message.Set_string('This' ||Rtrim(v_itemnumber) ||' Does not have ONHANDQUANTITY in RHC');
      fnd_message.show; 
    END IF; 
	 end;	 
    	 
    --IF NVL(v_flag,'E') ='N' THEN 
    	  IF nvl(v_incrval,0)=0 then
            v_message := 'Are you sure,you want to move data into Brooklyn Warehouse?'; 

            Set_alert_property('BRW', alert_message_text, v_message); 

            alert_button := Show_alert('BRW'); 

            IF alert_button = alert_button1 THEN 
             commit_form; 

               BEGIN 
                  SELECT Count(1) 
                  INTO   v_count 
                  FROM   regal.regal_inv_landed_cost_tab 
                  WHERE  file_number = :RHCLANDEDCOSTHEADER.file_number 
                  AND selected_flag = 'Y' 
                  AND brw_processed = 'Y' 
                  AND orig_quantity_received = quantity_received; 
             END; 

               IF v_count != 0 THEN 
                  fnd_message.Set_string('You are selecting Processed Records. Please Check '); --testing  
                  fnd_message.show; 
               ELSE 
                  submit_inv_request; 
               END IF; 
           END IF;
       ELSE
          RAISE FORM_TRIGGER_FAILURE;
  END IF;

END;
   
Re: Messages are displayed Twiced [message #608753 is a reply to message #608752] Mon, 24 February 2014 07:29 Go to previous messageGo to next message
cookiemonster
Messages: 13923
Registered: September 2008
Location: Rainy Manchester
Senior Member
So you've got three checks.
Everytime a record fails one of the checks to concatenate its item number into v_itemnumber.
Ask yourself what happens if the same record fails 2 different checks.
Re: Messages are displayed Twiced [message #608754 is a reply to message #608753] Mon, 24 February 2014 07:35 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Quote:
Ask yourself what happens if the same record fails 2 different checks.


It displayed an Alerts twice if i select the only one record.

1) First alert is This item_number is in the Inactive Mode Please Active '
2) Second Alert for same record please see at the screen shot.

  • Attachment: image1.png
    (Size: 7.44KB, Downloaded 744 times)
Re: Messages are displayed Twiced [message #608755 is a reply to message #608754] Mon, 24 February 2014 07:52 Go to previous messageGo to next message
cookiemonster
Messages: 13923
Registered: September 2008
Location: Rainy Manchester
Senior Member
I didn't ask what happens if you only select one record. I asked what happens to v_itemnumber if a record you selected fails mulitple checks.
The number of records selected makes no difference to the answer.
Re: Messages are displayed Twiced [message #608756 is a reply to message #608755] Mon, 24 February 2014 08:01 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member

Quote:
I asked what happens to v_itemnumber if a record you selected fails mulitple checks

If failed then goes to the below Messages and no messages printed on the v_itemnumber
v_message := 'Are you sure,you want to move data into Brooklyn Warehouse?'; 


Could you please help , how to do that?

Thank You
Re: Messages are displayed Twiced [message #608757 is a reply to message #608756] Mon, 24 February 2014 08:08 Go to previous messageGo to next message
cookiemonster
Messages: 13923
Registered: September 2008
Location: Rainy Manchester
Senior Member
You apparently have the opposite deffinition of failed to me. You are checking a number of records to see if they are suitable for some processing. So to me, a failure would result in it not asking that question, but instead displaying the other messages that you are complaining about.
So one last time:
What happens to v_itemnumber if a record you selected fails mulitple checks?

Re: Messages are displayed Twiced [message #608758 is a reply to message #608757] Mon, 24 February 2014 08:18 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
IF v_count = 0 THEN v_incrval := 1; 
            v_itemnumber := v_itemnumber ||:RHCLANDEDCOSTDET.item_number ||','; 
END IF; 



Ok if i selected ,
1) Inactive and No ONHANDQUANTITY

Then i am getting 2 alerts means , i am getting in the v_itemnumber as 12,13 are Inactive and if clicked on OK, then i am getting another Alerts as 12,12,13 are no onhandquantity.

Means v_itemnumber , it adds to the item_number's if ii select more than 1.

If the conditions are satisfied then moved to the another process

Re: Messages are displayed Twiced [message #608759 is a reply to message #608758] Mon, 24 February 2014 08:22 Go to previous messageGo to next message
cookiemonster
Messages: 13923
Registered: September 2008
Location: Rainy Manchester
Senior Member
mist598 wrote on Mon, 24 February 2014 14:18

Then i am getting 2 alerts means , i am getting in the v_itemnumber as 12,13 are Inactive and if clicked on OK, then i am getting another Alerts as 12,12,13 are no onhandquantity.

And why is v_itemnumber getting set to 12,12,13?
Re: Messages are displayed Twiced [message #608762 is a reply to message #608759] Mon, 24 February 2014 08:32 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Quote:
And why is v_itemnumber getting set to 12,12,13?


And i want to set the items in the line only..

Means 12,13,14,15,16,17....in one line
Re: Messages are displayed Twiced [message #608764 is a reply to message #608762] Mon, 24 February 2014 08:42 Go to previous messageGo to next message
cookiemonster
Messages: 13923
Registered: September 2008
Location: Rainy Manchester
Senior Member
I know what you want.
I also know why your code is behaving the way it is.
Thing is, the problem is really obvious, and is solely due to the way you assign values to v_itemnumber. Which is why I keep asking you to think about it.
Think about how it's assigned.
Think about what value it will have at each point in the process.
If you're struggling with that, and you really shouldn't be, add extra messages to check it's value more often.


EDIT: typo

[Updated on: Mon, 24 February 2014 08:47]

Report message to a moderator

Re: Messages are displayed Twiced [message #608773 is a reply to message #608764] Mon, 24 February 2014 10:39 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
IF v_count2 = 0 THEN v_incrval := 1; 
            v_itemnumber := v_itemnumber ||:RHCLANDEDCOSTDET.item_number ||',';   
    IF v_incrval = 1 THEN 
      fnd_message.Set_string('This' ||Rtrim(v_itemnumber) ||' is in the Inactive Mode Please Active '); --testing  
      fnd_message.show; 
    END IF; 


How it will works? Can you please support to me? it is urgently need to me... Smile
Re: Messages are displayed Twiced [message #608776 is a reply to message #608773] Mon, 24 February 2014 10:55 Go to previous messageGo to next message
cookiemonster
Messages: 13923
Registered: September 2008
Location: Rainy Manchester
Senior Member
You should know what that code does, you wrote it didn't you?
Why don't you tell me what you think this line does:
   v_itemnumber := v_itemnumber ||:RHCLANDEDCOSTDET.item_number ||',';   

Re: Messages are displayed Twiced [message #608777 is a reply to message #608776] Mon, 24 February 2014 10:59 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Quote:
v_itemnumber := v_itemnumber ||:RHCLANDEDCOSTDET.item_number ||',';


This line adds the item_numbers and assign to the v_itemnumber ,

12,13,14,14,....right?

ok please let me know what is problem on my code ?
Re: Messages are displayed Twiced [message #608787 is a reply to message #608777] Mon, 24 February 2014 18:37 Go to previous messageGo to next message
cookiemonster
Messages: 13923
Registered: September 2008
Location: Rainy Manchester
Senior Member
this assigns a item_number to v_itemnumber:
v_itemnumber := :RHCLANDEDCOSTDET.item_number;

what does your code do differently?
Re: Messages are displayed Twiced [message #608799 is a reply to message #608787] Mon, 24 February 2014 22:01 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Quote:
v_itemnumber := :RHCLANDEDCOSTDET.item_number;


This takes only one when if i selected 3 records at a time,for examples in 1,2,3 records i am getting current records Alert only that is "3 item_number is Inactive' , where are the other item_numbers Alerts(1,2).

Quote:
v_itemnumber := v_itemnumber ||:RHCLANDEDCOSTDET.item_number ||',';



This lines shows me like , if select only one record for example,i selected 1 record & it shows me "1 is Inactive'

If i select 3 records like 1,2,3...it shows "1,2,3 items are Inactive"

Finally i want to show in the messages as '1,2,3,4 itmes are Inactive', but for me it shows like 1,1,2,3,4...please help
Re: Messages are displayed Twiced [message #608814 is a reply to message #608799] Tue, 25 February 2014 03:32 Go to previous message
cookiemonster
Messages: 13923
Registered: September 2008
Location: Rainy Manchester
Senior Member
Forget about the process in general, I want you to tell me what that line of code does by itself.
If v_itemnumber is set to '1' and item_number is set to '2' what does that line of code do with those values?
Previous Topic: Switch language
Next Topic: missing file c:\layout\awc\mystyle.css
Goto Forum:
  


Current Time: Fri May 17 01:07:28 CDT 2024