SAP Adobe Form Tutorial. Part XVI. Practical Use Case of FormCalc and JavaScript
In this article, we would exhibit the utilization of Aggregate in FormCalc and afterward progressively change text style involving JavaScript in SAP Adobe structures
The fundamental benefit of utilizing prearranging is that we can further develop usefulness and can oversee structures at runtime powerfully.
SAP Adobe form supports 2 scripting languages:
- FormCalc
- JavaScript
Both prearranging dialects are having advantages and hindrances, so we can conclude in view of our necessities which prearranging language to be utilized. In this blog, we will give not many normal business situations from both the prearranged dialects.
If it’s not too much trouble, note that we have previously distributed an article on the utilization of JavaScript in Adobe Structure. You might allude to it for greater lucidity.
Additionally Read: Powerfully Stow away and Show Fields involving Javascript in Adobe Structure In view of Conditions
Requirements:
Fundamental information on SAP Adobe structure with Tables
Essential comprehension of JavaScript and FormCalc capabilities
ABAP programming abilities
Business Requirements:
- In the definite explanation shipped off clients, we might want to show aggregate sum and absolute units as subtotal at the end of all details.
- In the depiction segment of an assertion, we might want to show header results of the order as striking and in various style so that recognizing the header item in the entire statement is simple. Solution:
We would have to make an Adobe structure and point of interaction with worldwide information. We will add some test information in these worldwide information interior tables in interface “code instatement” and later tie these worldwide interior tables with UI tables in Adobe Structure format.
P.S. We could likewise accomplish this by composing handling rationale in the driver program and passing the necessary interior table as import boundaries of the Adobe structure. Since this blog is more on utilization of contents, we have not considered the best methodology for information handling.
Step-by-step process
- Make a structure interface ZPB_TEST_SCRIPTS utilizing T-Code SFP

- Make Worldwide Information for Subtleties and depictions inside table

- Structure for Depiction

- Structure for Subtleties

- Go to code instatement and fill test information in inner tables as follows:


- Drag Worldwide information of connection point from passed on side board to Setting of structure in right side board

- Presently Go to Design of Adobe structure and make table utilizing these setting information planned with Worldwide factors in interface. Kindly follow the underneath steps :
a. Go to Information View Ranges from toolbar

b. Select GT_DETAILS table as featured and drop on Detail page of structure design

c. You would see a table made and naturally binded with GT_DETAILS.


d. Make a footer column for “Subtotal.”. For that, go to Order Ranges, Grow GT_DETAILS Table, and make another column after Information. Go to Protest Ranges for the new column ( DATA[1] )and change the line type to “Footer.”.

Kindly note that assuming we will make a table component utilizing a table collaborator , a footer will be made accordingly. Since I went through information view ranges, I needed to physically make a footer.
Presently, we will do the intriguing step. Compose Formcalc Content to ascertain aggregate for all details.
- Select text field in footer under NET_UNITS and go to arrange supervisor

- Presently, go to the Show Occasions drop-down, and you will find all occasions are turned grayed out. WHY?

- This is on the grounds that for few UI fields, prearranging isn’t permitted, and that is the reason every one of the occasions are in show mode as it were. To empower the occasions and compose the content rationale, we really want to change the kind of UI component from “text” to “text field.”.
Check the beneath picture. At the point when the Sort is Text, the Show occasions are turned grayed out.

At the point when we transformed it to Text Field, every one of the occasions got empowered.

- Change the UI type for NET UNITS and Absolute Eminences fields in Footer line as “Text Field”

You can see that for featured fields above, line variety has been changed to red, and for different fields, it stayed blue. It is a marker to recognize text UI or textField UI.
Presently, rehash stages 8 and 9 for choosing a suitable occasion to compose a prearranged rationale.
Do you recall our business necessity? We might want to compute the amount of all the details and show it in the footer line as a subtotal.
- Select Ascertain occasion from the all occasions dropdown , lang. as Formcalc, and compose the underneath code :


- Presently, make a test pilot program to produce the outcome pdf ( if it’s not too much trouble, allude the past web journals to make a driver program for testing Adobe structures ) and create a pdf with subtotal :

By utilizing only a solitary Total capability and with next to no ABAP rationale, we can compute the all out of details in a table in Adobe structures and print likewise utilizing FormCalc prearranging.
There are additionally different capabilities accessible in FormCalc like Normal, Rate and so on
Time to mess with some JS (JavaScript) coding in script manager
- Kindly recurrent stage 7 from a-c and make one more table for portrayal utilizing setting table GT_DESCRIPTION from information view.

Recollect another business necessity? We really want to set header Item in the portrayal field as Striking and with various text style and things as italic in view of Strong/ITALIC settings at runtime.
- Select Information line of GT_DESCRIPTION table from Order and go to prearrange manager.

- Select “structure : prepared” occasion , language as “javascript,” and compose the underneath code :


- Run the driver program made in sync 12 and actually take a look at the outcomes:

For text to be changed in italic in view of the italic banner, rehash ventures from stage 15 :
- Select “structure : prepared” occasion , language as “javascript,” and compose the below code :
Result from Driver Program:

Result

This article was to give genuine case models that engineers can imitate in their SAP scene. Subsequent to going this instructional exercise, anybody can evaluate in their own framework and utilize Java scripts and FormCalc prearranging dialects in Adobe structures. In the event that you actually face an issue, kindly go ahead and compose your inquiries in the remarks segment underneath or reach us straightforwardly at
Assuming you think our page is useful, remember to impart our connections to your companions, partners and colleagues. Do like our facebook page and follow us at twitter and instagram. Kindly buy into our youtube feed with the expectation of complimentary start to finish video courses.
YOU MAY LIKE THIS
SAP ABAP Checkpoint Group – Chase the Mysterious SAP Issues with a Smile
Best Practices for SAP ABAP Development: A Comprehensive Guide