Skip to main content
Solved

Programmatic call to scrap_part in API

  • September 23, 2024
  • 7 replies
  • 73 views

Forum|alt.badge.img+1

We have a request to scrap a large number of parts with the information being provided via an Excel file.  I have been trying to call the inventory_part_in_stock_api scrap_part procedure after first using the find_part procedure.

 

When calling find_part I get the results I expect.  However, using the same information to try to call scrap_part always returns a part in stock does not exist.  This is the exact error message.

 

Could someone guide me on where to find the information necessary to properly call this API procedure?

 

Thank you in advance!

Best answer by Mathias Dahl

If you can do the same thing from IEE, use the Debug Console to identify the necessary PL/SQL block to call, and the parameters/values used.

7 replies

Mathias Dahl
Superhero (Employee)
Forum|alt.badge.img+32
  • Superhero (Employee)
  • Answer
  • September 23, 2024

If you can do the same thing from IEE, use the Debug Console to identify the necessary PL/SQL block to call, and the parameters/values used.


Forum|alt.badge.img+1
  • Author
  • Do Gooder (Customer)
  • September 23, 2024

I was able to call the find_part procedure using this:
 

DECLARE
qty_available NUMBER := -1;
location_no VARCHAR2(60);
lot_batch_no VARCHAR2(60);
serial_no VARCHAR2(60);
eng_chg_level VARCHAR2(60);
waiv_dev_rej_no VARCHAR2(60);
configuration_id VARCHAR2(60);
activity_seq NUMBER := 0;
handling_unit_id NUMBER := 0;
BEGIN
inventory_part_in_stock_api.find_part(
qty_available,
location_no,
lot_batch_no,
serial_no,
eng_chg_level,
waiv_dev_rej_no,
configuration_id,
activity_seq,
handling_unit_id,
'MX',
'311-0256-583',
'*',
'*',
'*',
'*'
);

dbms_output.put_line('Quantity Avail = ' || nvl(to_char(qty_available), 'Blank'));
dbms_output.put_line('Location # = ' || nvl(to_char(location_no), 'Blank'));
dbms_output.put_line('Lot/Batch No = ' || nvl(to_char(lot_batch_no), 'Blank'));
dbms_output.put_line('Serial No = ' || nvl(to_char(serial_no), 'Blank'));
dbms_output.put_line('Eng_Chg_Level = ' || nvl(to_char(eng_chg_level), 'Blank'));
dbms_output.put_line('Waiv_Dev_Reg_No = ' || nvl(to_char(waiv_dev_rej_no), 'Blank'));
dbms_output.put_line('Coniguration ID = ' || nvl(to_char(configuration_id), 'Blank'));
dbms_output.put_line('Activity Sequence = ' || nvl(to_char(activity_seq), 'Blank'));
dbms_output.put_line('Handling Unit ID = ' || nvl(to_char(handling_unit_id), 'Blank'));

dbms_output.put_line(serial_no.count);
END;

However, when I tried scrap_part using this:


DECLARE
catch_quantity NUMBER := 0;
contract VARCHAR2(60) := 'MX';
part_no VARCHAR2(60) := '311-0256-583';
configuration_id VARCHAR2(60);
location_no VARCHAR2(60) := '20642';
lot_batch_no VARCHAR2(60);
serial_no VARCHAR2(60);
eng_chg_level VARCHAR2(60) := '1';
waiv_dev_rej_no VARCHAR2(60);
activity_seq NUMBER := 0;
handling_unit_id NUMBER := 0;
quantity NUMBER := 1;
scrap_cause VARCHAR2(60) := 'MXSCRA01';
scrap_note VARCHAR2(60) := '8';

BEGIN
inventory_part_in_stock_api.Scrap_Part(
catch_quantity,
contract,
part_no,
configuration_id,
location_no,
lot_batch_no,
serial_no,
eng_chg_level,
waiv_dev_rej_no,
activity_seq,
handling_unit_id,
quantity,
scrap_cause,
scrap_note
);

dbms_output.put_line('catch_quantity = ' || nvl(to_char(catch_quantity), 'Blank'));
END;

I get the error I mentioned.  I’m afraid I don’t know about the debug console.  I used System Info to find the Api and procedure name.


Forum|alt.badge.img+1
  • Author
  • Do Gooder (Customer)
  • September 23, 2024

If you can do the same thing from IEE, use the Debug Console to identify the necessary PL/SQL block to call, and the parameters/values used.

Thank you for suggesting the debug console.  I was able to use that to see I was missing a NUMBER value that needed to be null instead of 0.  I appreciate your quick response!


Mathias Dahl
Superhero (Employee)
Forum|alt.badge.img+32
  • Superhero (Employee)
  • September 23, 2024

You can open the Debug Console from one of the top menus in IEE.


Mathias Dahl
Superhero (Employee)
Forum|alt.badge.img+32
  • Superhero (Employee)
  • September 23, 2024

Seems we replied at the same time there 🙂 


Forum|alt.badge.img+1
  • Author
  • Do Gooder (Customer)
  • September 23, 2024

So, one related question.  Is there a way to undo scrapping a part, after a commit?

Thanks in advance.


Mathias Dahl
Superhero (Employee)
Forum|alt.badge.img+32
  • Superhero (Employee)
  • September 24, 2024

Sounds like a question that might get a better answer in a supply chain forum, but we will see...