Using the CL_JAVA_SCRIPT Class

This documentation covers the details of Using the CL_JAVA_SCRIPT Class in ABAP programming

Using the CL_JAVA_SCRIPT Class 

The areas where the CL_JAVA_SCRIPT class is used can be split up as follows:

Executing JavaScript Programs

You can use the CL_JAVA_SCRIPT class to execute JavaScript programs that, for example, have been loaded from external resources or programmed in an Editor you have written yourself: The following are the methods you use, in the sequence in which they are called:

  1.  
  2. CREATE to create a JavaScript context
  3.  
  4. CREATE to compile a JavaScript source in the current context
  5.  
  6. EXECUTE to execute a compiled JavaScript
  7.  
  8. EXECUTE to delete a compiled JavaScript from the context

Methods 2 to 4 are combined in the method EVALUATE.

Binding between JavaScript and the ABAP program

JavaScript programs can access data objects and objects in ABAP programs. This technique is based on two methods:

BIND allows you to link variables and objects in JavaScript with data objects and references to objects in ABAP. Changes made in the JavaScript program also change the objects in ABAP. You can also bind objects from ABAP objects directly using BIND_INSTANCE.

You can also access the public instance attributes of bound objects and call public instance methods.

As well as binding JavaScript objects to ABAP objects, you can set or get values from JavaScript objects directly using the SET and GET methods respectively.

Debugging

If you want to include and test JavaScript programs in an ABAP development environment, the following methods are available to support you:

Handling breakpoints

Executing programs step by step

Evaluating the call stack

Example

The ABAP program DEMO_JAVA_SCRIPT_MINI_EDITOR from the Examples Library (transaction ABAPDOCU) is an example of a basic JavaScript Editor, where you can edit, execute, and test JavaScript programs. The program was created using ABAP exclusively and uses the CL_JAVA_SCRIPT class. This mini-editor is only a demonstration for the purposes of this documentation, but it shows what you can do using CL_JAVA_SCRIPT in ABAP.

Most readed SAP Tutorials

Latest Added SAP documents

Custom Search
ABAP Tutorials ABAP Syntax BAPI SAP Jobs SAP Glossary SAP Netweaver SAP XI SAP Download SAP Interview questions

Complete SAP Study materials | SAP JOBS | PDF Tutorials   List of SAP Companies India

Google-Translate-Chinese (Simplified) BETA Google-Translate-English to French Google-Translate-English to German Google-Translate-English to Italian Google-Translate-English to Japanese BETA Google-Translate-English to Korean BETA Google-Translate-English to Russian BETA Google-Translate-English to Spanish

All of the product names here are trademarks of their respective companies. The site sapbrainsonline.com no way affiliated with SAP AG. Use information on this site at your own risk. Information furnished in the site is collected from various sites and posts from users. This site does not host any files on its server. If any compliants about the posts please contact us at sapbrain.support@gmail.com

Sitemap
web counter