Solved

Get IFS Error Message formatted

  • 21 March 2022
  • 6 replies
  • 950 views

Userlevel 1
Badge +3

Is there an oracle/ifs api or function that I can invoke to get the client facing error message that I see in IFS when there is a soft error?

 

For example when the user tries to report on a shop order operation that is closed, the IFS client will show an error message that states
         “Operation is closed. Not allowed to modify qty complete.”

 

However when I call that function through PLSQL I will get the entire stack trace, such as:

 

ORA-20110: ShopOrderOperation.OPERCLOSED2: Operation is closed. Not allowed to modify qty              complete. ORA-06512: at "IFSAPP.ERROR_SYS", line 1017 ORA-06512: at "IFSAPP.ERROR_SYS", line 92 ORA-06512: at "IFSAPP.SHOP_ORDER_OPERATION_API", line 11735 ORA-06512: at "IFSAPP.SHOP_ORDER_OPERATION_API", line 12283 ORA-06512: at "IFSAPP.SHOP_ORDER_OPERATION_API", line 10169 ORA-06512: at "IFSAPP.SHOP_ORDER_OPERATION_API", line 10190 ORA-06512: at "IFSAPP.SHOP_ORDER_OPERATION_API", line 10213 ORA-06512: at line 1

 

Since the ORA- will be different depending on the error, and the stack trace will obviously be different depending on the error, is there a way to extract just this client facing error message?

 

Thanks!

icon

Best answer by Tomas Ruderfelt 23 March 2022, 08:07

View original

This topic has been closed for comments

6 replies

Userlevel 6
Badge +12

Hi @tfturco 

There is a way to find those details using Debug Console.

Open Debug console and select Framework.

 

 

You will see the error highlighted in red.

PLSQL Trace tab will show you the error stack. You can copy the line and it will be as follows.

__anonymous_block at line 10 SHOP_ORDER_OPERATION_API.MODIFY__ at line 10213 SHOP_ORDER_OPERATION_API.MODIFY__.CORE at line 10190 SHOP_ORDER_OPERATION_API.MODIFY__.BASE at line 10164 SHOP_ORDER_OPERATION_API.CHECK_UPDATE___ at line 12288 SHOP_ORDER_OPERATION_API.CHECK_UPDATE___.CORE at line 11758 ERROR_SYS.RECORD_GENERAL at line 92 ERROR_SYS.RAISE_APPLICATION_ERROR___ at line 1006 ERROR_SYS.RAISE_APPLICATION_ERROR___.FORMAT_CALL_STACK___ at line 1000
 

You can find the ORA error in Exception tab.

 

More information can be found in Server Trace tab as well.

To be able to view these information, SQL Trace must be enabled.

 

Hope this helps.

Userlevel 7
Badge +18

Sometime there are both client-side and database side validations related to the functional flows.

In your scenario “Operation is closed. Not allowed to modify qty complete.” is a database side validation which is defined in Shop_Order_Operation_API (method Check_Update___ )

IF (vrec_.reported_qty != 0 AND oldrec_.oper_status_code = op_closed_db_) THEN  Error_SYS.Record_General(lu_name_, 'OPERCLOSED2: Operation is closed. Not allowed to modify qty complete.');

  END IF;

This database Error contains the error which popup from the client side and additionally some other technical information which is useful for debugging the error. As per my understanding, this is how oracle behaves.

So you couldn't just get a popup the error in DB end as same from the client end.

But As Randini mentioned above you can see the error message without debugging related information from debug console client trace section. But still it has Oracle error Number.

Userlevel 1
Badge +3

Hi @tfturco 

There is a way to find those details using Debug Console.

Open Debug console and select Framework.

 

 

You will see the error highlighted in red.

PLSQL Trace tab will show you the error stack. You can copy the line and it will be as follows.

__anonymous_block at line 10 SHOP_ORDER_OPERATION_API.MODIFY__ at line 10213 SHOP_ORDER_OPERATION_API.MODIFY__.CORE at line 10190 SHOP_ORDER_OPERATION_API.MODIFY__.BASE at line 10164 SHOP_ORDER_OPERATION_API.CHECK_UPDATE___ at line 12288 SHOP_ORDER_OPERATION_API.CHECK_UPDATE___.CORE at line 11758 ERROR_SYS.RECORD_GENERAL at line 92 ERROR_SYS.RAISE_APPLICATION_ERROR___ at line 1006 ERROR_SYS.RAISE_APPLICATION_ERROR___.FORMAT_CALL_STACK___ at line 1000
 

You can find the ORA error in Exception tab.

 

More information can be found in Server Trace tab as well.

To be able to view these information, SQL Trace must be enabled.

 

Hope this helps.

 

Thanks for your help Randini! I do know how to get this information from the debugging window as well as through PL/SQL.

 

My problem is simply with the format of the error. Since this is a database error I get the entire stack trace I was mentioning in my original post. This is the database error I recieve from PL/SQL:

 

“ORA-20110: ShopOrderOperation.OPERCLOSED2: Operation is closed. Not allowed to modify qty              complete. ORA-06512: at "IFSAPP.ERROR_SYS", line 1017 ORA-06512: at "IFSAPP.ERROR_SYS", line 92 ORA-06512: at "IFSAPP.SHOP_ORDER_OPERATION_API", line 11735 ORA-06512: at "IFSAPP.SHOP_ORDER_OPERATION_API", line 12283 ORA-06512: at "IFSAPP.SHOP_ORDER_OPERATION_API", line 10169 ORA-06512: at "IFSAPP.SHOP_ORDER_OPERATION_API", line 10190 ORA-06512: at "IFSAPP.SHOP_ORDER_OPERATION_API", line 10213 ORA-06512: at line 1”

 

I can also see in the debug window in IFS that this full error is sent to the IFS Client. However, the error message is formatted down to just the “Operation is closed. Not allowed to modify qty              complete.” string.

 

I was wondering how IFS accomplishes this? Is there a function I can invoke through PL/SQL to get this stack trace formatted to be user friendly? Or is this all handled through application code on the client?

 

 

Userlevel 7
Badge +19

Yes, there is a method to remove the ORA error + the LuName and error text identifier:

Error_SYS.Strip_Ora_Error(SQLERRM)

Userlevel 1
Badge +3

Yes, there is a method to remove the ORA error + the LuName and error text identifier:

Error_SYS.Strip_Ora_Error(SQLERRM)

Hi Tomas, exactly what I was looking for! Is this an IFS 10 method? I don’t see that method in the ERROR_SYS package in my IFS 9 db.

 

 

Userlevel 7
Badge +19

Yes, unfortunately it is new in APP10. Here is a piece of code to make the same thing manually in APP9:

DECLARE
sqlerrm_ VARCHAR2(32000);
sqlcode_ NUMBER;
text_ VARCHAR2(32000);
BEGIN
-- sqlerrm_ := 'ORA-06502: PL/SQL: numeric or value error: character to number conversion error';
sqlerrm_ := 'ORA-20110: ShopOrd.NOPRODUCTSTRUCTHD: Product Structure Header for shop order part does not exist.';
sqlcode_ := to_number(SUBSTR(sqlerrm_, 4, INSTR(sqlerrm_, ':') - 4));

IF Error_SYS.Is_Foundation_Error(sqlcode_) THEN
text_ := trim(SUBSTR(sqlerrm_, INSTR(sqlerrm_, ':', 1, 2) + 2));
ELSE
text_ := trim(SUBSTR(sqlerrm_, INSTR(sqlerrm_, ':') + 2));
END IF;

dbms_output.put_line('Text: '|| text_);
END;