SAP Adobe Form Tutorial Part XVI Practical Use Case of FormCalc and JavaScript

In this article, SAP Adobe Form Tutorial Part XVI Practical Use Case of FormCalc and JavaScript ,” we will demonstrate the use of totals in FormCalc and then dynamically change fonts using JavaScript in SAP Adobe Forms.

The principal benefit of utilizing prearranging is that we can further develop usefulness and can oversee structures at runtime progressively.

SAP Adobe structure upholds 2 prearranging dialects:

Both prearranging dialects are having advantages and inconveniences so we can conclude in light of our necessities which prearranging language to be utilized. In this blog, we will give not many normal business situations from both the prearranging dialects.

If it’s not too much trouble, note, we have previously distributed and article on use of JavaScript in Adobe Structure. You might allude it for greater clearness.

Prerequisites:

  • Basic knowledge of SAP Adobe form with Tables
  • Basic understanding of JavaScript and FormCalc functions
  • ABAP programming skills

Business Requirements:

1.In the definite articulation shipped off clients, we might want to show aggregate sum and complete units as subtotal at end of all details.

2.In the depiction segment of an assertion, we might want to show header results of the pecking order as Strong and in various style so that recognizing the header item in 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 inward tables in interface “code initialization” and later tie these worldwide inside tables with UI tables in adobe structure design.

P.S. – We could likewise accomplish this by composing handling rationale in driver program and pass the expected interior table as import boundaries of 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

  1. Make a structure interface ELS_TEST_SCRIPTS utilizing TCode SFP

2. Make Worldwide Information for Subtleties and depictions inward table

3. Create global table types ELS_TEST_DESCR and ELS_TEST_DETAILS with following structures :

  • Structure for Description
  • Structure for Details

4. Go to code introduction and fill test information in inner tables as follow :

5. Go to exchange SFP and make another structure. Add interface as ELS_TEST_SCRIPTS

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

7. Presently Goto Design of Adobe structure and make table utilizing these setting information planned with Worldwide factors in interface. If it’s not too much trouble, follow the beneath steps :

a. Go to Data View Palettes from toolbar

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

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

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

Kindly note that assuming we will make table component utilizing table colleague , Footer will be made naturally. Since I went through Information view ranges, I needed to physically make footer.

Now, we will do the interesting step. Write Formcalc Script to calculate SUM for all line item.

8. Select text field in footer under NET_UNITS and go to prearrange supervisor

9. Presently go to Show Occasions drop down and you will find all occasions are turned gray 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 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 gray out.

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

10. Change the UI type for NET UNITS and Complete Eminences fields in Footer column 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 pointer to distinguish text UI or textField UI.

Presently, rehash the stage 8 and 9 for choosing suitable occasion to compose a prearranging rationale.

Do you recollect our business prerequisite? We might want to compute the amount of all the details and show in footer column as subtotal.

11. Select Calculate event from all events dropdown , lang. as Formcalc and write the below code :

12. Presently, make a test pilot program to produce the outcome pdf ( kindly allude the past sites to make a driver program for testing Adobe structures ) and create a pdf with subtotal :

By utilizing only a solitary Aggregate capability and with next to no ABAP rationale, we can compute the all out of details in a table in Adobe structures and print as needs be utilizing FormCalc scripting.

There are additionally different capabilities accessible in FormCalc like Normal, Rate and so forth

Time to play around with some JS (JavaScript) coding in script editor

13. If it’s not too much trouble, rehash stage 7 from a-c and make one more table for depiction utilizing setting table GT_DESCRIPTION from information view.

Recall another business prerequisite? We want to set header Item in the depiction field as Strong and with various text style and things as italic in light of Striking/ITALIC settings at runtime.

14. Select Information column of GT_DESCRIPTION table from Progressive system and go to prearrange manager.

15. Select “structure : prepared” occasion , language as “javascript” and compose the beneath 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 light of itlalic banner, rehash ventures from stage 15 :

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

Result from Driver program :

This article aims to provide real-world examples that developers can replicate in their SAP environment. After going through SAP Adobe Form Tutorial Part XVI Practical Use Case of FormCalc and JavaScript ,” anyone should be able to experiment with their own system and utilize JavaScript and FormCalc scripting languages in Adobe forms.

 

YOU MAY BE INTERESTED IN

SAP consulting services USA vs India companies: A Comparative Analysis

SAP ABAP HANA: Revolutionizing Enterprise Application

4 Useful Tips on ABAP and ABAP on HANA

 

 

X
WhatsApp WhatsApp us