Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member572868
Discoverer

(exclusively for beginners)


 

While creating my first ADOBE FORM I have faced many errors and as a beginner it took a lot of time for me to solve those errors by surfing different websites.

I am writing this blog post by keeping SAP ADOBE FORM beginners in mind so that they can find the solution for most of the difficulties and errors faced by them in one blog.

This blog post contains below topic:

  • No Usage / System error.

  • Data not flowing to next page.

  • How to format text field and caption separately.

  • Hide or repeat sub form in required pages.

  • Set Page number and usage of floating fields.

  • Setting page margins and type of page and usage of drawing aids.

  • Repeating item table header in all pages

  • Usage of numeric, decimal and date field in layout

  • Displaying long text of item

  • Adding styles to text-field.

  • Translating text and captions in ADOBEFORM.

  • Sending adobe spool to application server.


Before going into the details, I would like to highlight the basic steps to be flowed while creating adobe form:

  • On creating form, we will have, one master page, content area and unnamed sub form (Page 1) by default in layout. Make sure there is at least one page for your form.

  • Decide type of layout portrait or landscape and set accordingly

  • Make sure your page is in flowed

  • Based on the requirement decide header level and item level fields and create a structure for header level fields and table type for item level fields.

  • Decide data to be printed in one page and data to be printed in all pages. According design master page with date to be printed in all pages and design view with data to be printed on one page.


Function Modules used for ADOBE FORMS:

  • FP_JON_OPEN (set printer parameters, spool parameters, email or fax parameters etc.)

  • FP_FUNCTION_MODULE_NAME (Get Function module name from form name)

  • FP_JOB_CLOSE (Close Spool job)


No Usage / System error:



This error occurs with STANDARD TEXT or if there is any binding error.

As shown in the below screen shot, we should check the “NO ERROR IF TEXT DOESN'T EXISTS” option in the adobe form.



As show in the below screen shot, binding should be like $.field but not $.record.field. This mainly happens when we have multiple sub forms wrapped one inside the other and there is difference in binding sequence (in deep structure).



Data not flowing to next page:

We must create at least one page for each form. Right click on data and select new page.





Make sub form flowed top to bottom and set the over flow to content area of first page

 

Format text field and caption separately:

Every text field has two parts, Caption and Value. We can set the paragraph format as show below.



 

Hide or repeat sub form in required pages.

To hide or repeat the subform in any page, first subfrom should be in master page and write the formcalc for hiding.

In the below screenshot we have our subform in master page, which to be displayed only in first page



Now click on subform, open pallets and select script editor and formcalc





var curpage = $layout.page ( ref ( $ ) )

var totpages = $layout.pageCount()

if ( curpage ne totpages ) then

$.presence = "hidden"

else

$.presence = "visible"

endif

 

Hide Field when it is empty:

If the caption of the text field is dynamic, then create two text fields without caption. Bind data to one field and caption to one field. wrap two text fields on one sub form and make the sub form flowed as western text. If data is empty, we should hide both the text fields in sub form. In this case use below code.





if ( not HasValue($)) then

$.parent.presence = "hidden"

Endif

 

If you want to hide only field, then use below code.

 

if ( not HasValue($)) then

$.presence = "hidden"

endif

 

Set Page number and usage of floating fields:



This page n of m is nothing but text with floating fields. we can directly edit the type of format the user wants to display, like page 1 of 2 or  1 / 2  or 1-2.

 

Now what are floating fields?

Now, if we have a constant text and if we want to make one of the word as dynamic (which is coming from driving program), then we can go with floating field concept.

Here, let as suppose that we must display the title of the document as below



Where customer number KUNNR is coming from driver program.

For this, create a text, place the cursor where you want dynamic field, here it is next to customer and right click and select floating field . It comes as below. Now we can bind any data to text field here.



Setting page margins and type of page and usage of drawing aids:

We must set our page layout format, margins in cm or inches etc. using drawing aids option in pallets.



We have many options like show grid, hide grid, horizontal ruler, vertical ruler, styles, guideline definitions etc.



Here by using units, we can set whether units should be in cm or inches.



If there is a requirement like address should be printed in X 10 cm and Y 6 cm, you can set guidelines in the layout using guideline Definitions.



In master page we must set whether page is A4 and format portrait or landscape.



We can also set the print parameters like print on one side, both sides etc.



Repeating item table header in all pages:

We will have requirement as, we should repeat item table header in all the pages where item data is flowing. For this we must create header with TEXT and wrap it in sub form and make this sub form as over flow header to item table.

NOTE: If the headings are populated through driver program, we cannot repeat the header. In other words, Dynamic text cannot be repeated.

Steps:

Create sub form with texts and keep the accessibility as header row.



Similarly create body subform with accessibility as body row and keep as flowed top to bottom.



Repeat the item subform for each data.



Now go to item sub form and select overflow header as header sub form.



 

Usage of numeric, decimal and date field in layout:

ADOBEFORMS are more convenient than scripts or smart forms because we can set the date format or decimal format or display %  or display currency format directly in the layout, there by avoiding any unnecessary coding in driver program for date conversion or any type of concatenation. But we must be careful while using these types because any error in the format will lead to usage error as said in the first point and it will be very difficult for us to find the reason for usage error.

Numeric:

This is used to set separators like thousand separators or display % next to value using num{z,zzz,zzz,zz9},num{($zzzz9.99)} , num{z,zzz,zz9%}.







Decimal :

Decimal field is also like numeric field. Let us suppose we have field as 12.34566 and we need to display to 2 decimals, we can use this format. For setting this, make sure you use num{($zzzz9.99)} format.

Date:

This is very useful function in adobe layout but we have an exception that date cannot be changed to dd/mm/yyyy.

We can change date form mate to mm/dd/yyyy,   date month year etc.



 

Displaying long text of item:

We will come across the requirement to display long text of item to be printed in item table. For this we use READ_TEXT in driver program and we have to use output field format as TDLINE. In layout create a text node in context and make it as dynamic text.





Standard text:

To use standard text in the layout, create a text node in context and make it as include text. We can also add styles to the Standard text.



Create styles in SMARTSTYLES and use it in context.



We must mention as <CF> text </>. Here CF is character format and AS is paragraph format.



Translating text and captions in ADOBEFORM:

While creating ADOBE FORMS, some time we will be creating a global form which will be used by multiple countries. In that case we need to display text with country specific. For this we can translate our text and caption as shown below.

Goto -> translations -> give language



Below screen appears with all the text in adobe layout and adobe form



Click on the adobe form texts highlighted in red above. Below screen appears.



Select copy source text, then all the text from source will be copied. So edit the text as you want to display and activate it.

Now goto SLXT transaction, give the workbenck TR number and select the date from to. Here texts which are translated in the given date will be captured in your TR. You must edit manually and delete the text which are irrelevant to your form.

 



 

Sending adobe spool to application server:

If we see the adobe FP_JOB_OPEN function module, we can see that adobe forms can be sent to either spool (print preview) or (email or fax). This will be decided from NAST-NACHA configuration. If NAST-NACHA  = 1 then it is print preview if it is 5 then email etc. this will be handled by functionals.

When NAST-NACHA other than 1 system will set print parameter in FP_JOBOPEN OUTPUTPDF-PDF as ‘X’ to get pdf as XSTRING. So, we can use this xstring in our open data set logic to send PDF to application server.

But when NAST-NACHA = 1, OUTPUTPDF-PDF = ‘ ’ , so we will not get PDF in xstring but pdf will be sent to Spool. We can write logic to get PDF content from spool and pass it to application server.



Commonly use FMS to convert spool to PDF is CONVERT_ABAPSPOOLJOB_2_PDF(spool is in text form) and CONVERT_OTFSPOOLJOB_2_PDF(spool id in OTF format).





When we must convert ALV output to PDF we will use CONVERT_ABAPSPOOLJOB_2_PDF. This FM convert data to PDF with XML format.

When we must convert forms to PDF we will use CONVERT_OTFSPOOLJOB_2_PDF. This FM converts data to OTF format.

So in our case we must use CONVERT_OTFSPOOLJOB_2_PDF, but it will not work in adobe form case.

Unlike scripts and smart forms, adobe form spool will be in ‘TEXT’ format. In the below screen shot first spool is from adobe form and second is from smartforms.

 

How to check the spool format?







By using FM shown in screen shot we can check the spool format.

So if we use  CONVERT_OTFSPOOLJOB_2_PDF our form will not be converted because CONVERT_OTFSPOOLJOB_2_PDF should be used only when spool is in OTF format. But our spool will be in text format.

If we use CONVERT_ABAPSPOOLJOB_2_PDF our form will be converted to PDF and will be successfully placed in application server. But on downloading we will end up facing error like PDF does not contain any data.

Then What should be done for adobe forms ?



The above FM will convert spool in TEXT format to OTF format. So we can use this in our open data set.

 

Hope the blog post is useful.

You can also check the below link for SAP SCREEN PERSONAS for beginners.

https://blogs.sap.com/2018/04/26/sap-screen-personas-3.0-tutorial-on-va02-simplification/

 

Regards,

Vasudha.
15 Comments
Labels in this area