5

Practical Way Of Enhancing Adobe/Smartforms Form Output

 1 year ago
source link: https://blogs.sap.com/2022/10/27/practical-way-of-enhancing-adobe-smartforms-form-output/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
October 27, 2022 2 minute read

Practical Way Of Enhancing Adobe/Smartforms Form Output

In this post, I would like to share with you, how we can enhance a standard adobe or smart forms output by applying MVC.

As business requirements may differ from SAP standard form format, we may require to enhance an existing form. What usually happens is, functional consultant tells the name of output program and form and developer copies both to Z versions. And worst, all enhancement code is written under code block of form and many new fields are added to global data of interface.

Actually you do not need to copy program. Why? Because, all the inputs those exists on program are already given to form as input. Therefore, simply copy only the form, create a class and process required data from input in that model class to create a single deep structure for output, that is to be used in form.

How I do that is, I create a class and call that class in code block of form’s code interface. And as return parameter, I create a deep structure to be used in form context.

Here is an example. In this example adobe form is copied from standard form, and interface is copied as well. In interface code block, model object is called and get_data method fills global docstc deep structure. docstc structure contains all required extra data. Instead of using many fields, use single deep structure. In that way if you need to add a new field, that can be achieved simply by adding it to structure. Instead of editing interface and form’s related blocks.

Adobe-Form.png

Interface Code Block

Form%20Code%20Interface

Form Code Interface

Interface Global Data – this data is passed to form context.

Interface-Global-Data.png

Simple as that, all the complexity is encapsulated in class. And If a new format of the form is required, same class can be used.

Writing code directly under forms code block is a bad practice, it is against mvc, against code reusability and makes developers life definitely more difficult. Simply, using code block just as a controller to pass input parameters to model class and retrieve return data is easier and better practice. Makes code reusable, testable and also modular.

Hope that helps to you.

To have more idea about applying MVC, you can have a look at  Applying MVC in ABAP blog post.

Thanks for reading.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK