Author Topic: Implementation of onmessage  (Read 8626 times)

Ashfaq Ahmed

  • Administrator
  • Newbie
  • *****
  • Posts: 32
    • View Profile
Implementation of onmessage
« on: January 30, 2020, 10:54:02 PM »
   Purpose:

   
  • > To do error handling and correctly redirecting the error messages, System messages to the Respective screen.
  • > Used to Capture SAP messages.

   Syntax:

                            onscreen 'SAPSCREEN'
                       enter ();
                               onmessage
                                ----------------
                                ----------------

                               enter ();


   
  • Before going further, we need to know the working of goto label in order to Implement onmessage.

   goto-label:
   goto label is used for altering the program flow in Liquid UI.

   Syntax:

                           goto labelname;
                          ---------------------
                           ---------------------

                          labelname:
                          ---------------------
                           ---------------------

   Note:

   •   onmessage should be used after the onscreen/enter block.

   •   An Action is Needed to Exit out of the onmessage block   


   Example:
   Below is the Example that Illustrates the Usage of onmessage.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   onscreen 'SAPLIQS0.0100'

   set('F[Notification type]','&V[z_zguixt_notif]'); // Notification Type

   enter();

   onscreen 'SAPLIQS0.0100'

   set('F[Functional loc.]','&V[z_Functionalloc]'); //Functional Location

   set('F[VIQMEL-QMDAT]', '&V[z_date]');  //Date
      
   enter();

   onmessage

      if (_message. substring(0,2)=='E:') {  --------------------------------------------->If Error found then do the following

      set('F[Functional loc.]',''); ----------------------------------------------------------->Setting the value to Empty

      set('F[VIQMEL-QMDAT]',''); ---------------------------------------------------------->Setting the value to Empty

      message(_message); ---------------------------------------------------------------->Displaying the Message

      enter();

      goto SCRIPT_END;-------------------------------------------------------------------->After Enter go to End of the Function

   }

 else
   {   
     enter();--------------------------------------------------------------------------------->If it is not an Error then continue to the Script
   }
   onscreen 'SAPLIQS0.0100'

   set('F[VIQMEL-QMTXT]', '&V[z_zguixt_Description]');

   enter("=10\\TAB02");

   set('F[Priority]', "&V[z_zguixt_priority]"); //Priority

   enter("=10\\TAB04");

   onscreen ''SAPLSPO1.0500'

   enter("=OPT2");

   set("F[VIQMEL-AUSWK]","&V[z_zguixt_effect]");  //Effect

   enter("/11");    //Save

   SCRIPT_END:;
   }
   



Refer to the Attachment for Clarity.....