Liquid UI - Documentation - 23.15 Get exception detail of a function module call

23.15 Get exception detail of a function module call


Prerequisites

Purpose

Learn how to display the exception that occurred during the function module call. You can capture the exception that occurred during the function module call using the variable.exception. To demonstrate the process, we will walk you through the following steps:

  • Delete the image container on the SAP Easy Access screen
  • Call the BAPI_USER_GET_DETAIL function
  • Add a condition to check if an exception occurred during the function call

User Interface

//Create the file SAPLSMTR_NAVIGATION.E0100.sjs inside your scripts folder for customizing the SAP Easy Access screen 
//Now, let's add the Liquid UI script to the above file and save it

Customization

  1. Delete the image container on the SAP Easy Access screen using the del command.
     
    //Deletes the Image container on the screen
    del("X[IMAGE_CONTAINER]");
    
     
     
  2. Call the BAPI_USER_GET_DETAIL function using call().
     
    //Calls a function module 
    rfcresult = call("BAPI_USER_GET_DETAIL", {"in.USERNAME":"&V[_user]", "out.LOGONDATA":"z_logondata", "table.PARAMETER":"z_parameters"});
    
     
  3. Add a condition to check if an exception occurred during the function call. If the exception occurs it displays a notification.
     
    // Checks if an exception occurred while calling the function
    if(rfcresult.exception){
       message('E: Exception occurred');
    } 
    
     

SAP Process

  1. Refresh the SAP screen.
    • If no exceptions occur, the existing RFC details will be displayed in the Cornelius window, as shown below.
       
       
    • If an exception arises, a notification stating Exception occurred is displayed, as shown below.
       
       
 

Note: To know more about how to call a function module, click here.


Next Steps

Display event performed using eventid option and _eventid system variable
Learn how to demonstrate the event performed on the screen.

5 min

This article is part of the Conditional scripts tutorial.


Can't find the answers you're looking for?