Question

Custom menu one action (PL/SQL) for multiple rows

  • 1 February 2021
  • 8 replies
  • 766 views

Userlevel 1
Badge +5

Hey,

Is there a way to create custom menu PL/SQL block that will run only once on multiple rows selected?

For instace im selecting 3 lines all for same supplier but with different qty then code is storing qty’s from all those lines and doing one action. By default it will do the action dependant of rows selected.

 


This topic has been closed for comments

8 replies

Userlevel 7

Hey,

Is there a way to create custom menu PL/SQL block that will run only once on multiple rows selected?

For instace im selecting 3 lines all for same supplier but with different qty then code is storing qty’s from all those lines and doing one action. By default it will do the action dependant of rows selected.

 

Yes, you can (caveat, not 100% as I don’t know exactly what you are trying to do). You can use an ampersand (&) to pick up the value for each row e.g. &SUPPLIER_ID would use the Supplier ID on screen.

Userlevel 1
Badge +5

Thanks asmise for your reply.

 

Let’s say I want to sent email to one supplier with all of those quantities at one shot, selecting 3 lines acts as doing PL/SQL code 3 times right?

Userlevel 7

Thanks asmise for your reply.

 

Let’s say I want to sent email to one supplier with all of those quantities at one shot, selecting 3 lines acts as doing PL/SQL code 3 times right?

I see, I read that a bit too quickly. I don’t know of a way, but if we get a little bit creative it could probably be solved. I’m assuming there isn't a common key for these lines e.g. you want to send the quantities from a PO and we could just pass the Order No into a loop? 

If not, off the top of my head, you could probably have the code set a value on each of the lines (i.e. code sets custom field ‘send qty’ to TRUE) and then use that to identify which lines you should include in your email. Then you could clear them if this is a repetitive action. It would be a little bit convoluted, but I’m fairly sure that would work. 

DECLARE

qty_list_txt_ VARCHAR2(4000) := 'The following quantities are on order';

CURSOR get_qty IS
SELECT buy_qty_due,
part_no
FROM ifsapp.purchase_order_line_part
WHERE order_no = &ORDER_NO;

BEGIN
FOR rec_ IN get_qty LOOP
IF LENGTH(qty_list_txt_) < 3946 THEN
qty_list_txt_ := qty_list_txt_ || CHR(13) || CHR(10) || ' ' || rec_.part_no || ': ' || rec_.buy_qty_due;
END IF;
END LOOP;
IF qty_list_txt_ != 'The following quantities are on order XX' THEN
Error_SYS.Appl_General('PurchaseReqLinePart', 'ERROR: ' || qty_list_txt_);
END IF;

END;

 

 

 

Userlevel 1
Badge +5

Thanks André, now I just  need to figure it out how to collect all selected lines and run procedure only once, that request came from MRP action proposal so there is no option for custom fields

Userlevel 7

Thanks André, now I just  need to figure it out how to collect all selected lines and run procedure only once, that request came from MRP action proposal so there is no option for custom fields

I’m assuming that you are sending these emails externally i.e. not to another user in the system?

All I can think of is to toggle the Action Taken from ‘Action not taken’ to ‘Action taken’ and then back? It would be a tricky screen to solve this from.

Userlevel 1
Badge +5

What do you mean by those action taken things? Yes sending externaly

Userlevel 7

What do you mean by those action taken things? Yes sending externaly

That’s the one editable field on MRP Action Proposals I can think of, MRP_ACTION_TAKEN. 
Don’t know if it’ll work, but when you set it to ‘Action Taken’ it will also set an ‘Action Taken Date’ which you could then use to find the lines that you want to include in the email. 

 

Userlevel 1
Badge +5

Ah ye forgot about it, perhaps that’s the best solution in this case