SAP Script in SAP ABAP

Mayank Chourasia
4 min readSep 6, 2021

ABAP Series Part - 3

In this blog, I will discuss What is SAP Script and How we can create a SAP Script.

SAP script is essentially a tool for the presentation of business data, Also it is used to format and generate business document types like purchase requisitions, requests for quotations, sales orders, delivery notes, invoices, etc. Means it is used of preformatted forms to print preformatted text.

  • It comprises 5 components.
  1. Editor: It is used to enter lines of text and to edit them.
  2. Styles & Layouts Sets: It is used to print layout, and creates individual texts.
  3. Composer: It is a central output module.
  4. Programming interface: It is used for the programmer to include SAP script components in their application programs and to control how the layout sets outputs are displayed.
  5. Database: It is used for storing texts, styles and layout sets.

What is a Layout Set in SAP Script?

Layout set is used to design the document. Layout set on its own does not contain any data. The selection of data for the document is done through the print program.

  • A layouts set consist of following components:
  1. Header
  2. Paragraph and Character Format
  3. Windows and Page Window.

Header

  • It is used for information and control of SAP printing.
    The forms store this information as part of the header information

Paragraph and Character Format

  • In the form element paragraph and Character formats, you specify font type, font size, styling, margins, page protection, etc.
    The paragraph formats are applied to the contents of a form.
    Character formats allow to format entire blocks of text within a paragraph

Windows and Page Window.

  • A page window cannot exist without being assigned to a window. A page window is a physical area on a page format. A page window is defined by the following:
  1. Left margin.
  2. Upper margin.
  3. Width, and Height.
    These dimensions are essential for the definition of a page window. The width and height have to be specified.

Function Modules we can used in SAP Scripts are OPEN_FORM, CLOSE_FORM, START_FORM, WRITE_FORM, END_FORM.

Creating SAP Script.

  • Go to T-Code SE71.
  • Enter the Form Name with starting ‘Z’ or ‘Y’.
  • A pop up will be open with an information dialog, Click on Continue.
  • Now enter the Description and click on save.
  • Now click on Pages Tab.

Create a new page like below.

  • Click on Character Format in the tab.
    It is used to create a character format as shown in the image below.

Note: On a single Page there could be multiple windows.

  • Now click on Paragraph formats to create a new paragraph.

It is used to create a paragraph format as shown in the image below.

  • Now click on Windows Button to create the new window as shown in the image below.
  • Now we can assign the window to the page we have created.
    For that click on Page Windows tab.
  • At the More Tab click on Edit > Create Elements
    Now we can see 2 Window, i.e. Header and Main.
  • By double click we can open the windows. Give the alignment as shown in the image below.
  • Now, click on More> Settings > Form Painter and then go on the SAP Script tab.
    And in the SAP Script tab check both options and continue it.
    It will open Page Layout
  • Save your script And Activate it.
  • Now, Suppose we have to display the Required output in our Script. For that first we would create Text Elements in our MAIN window.
  • Click on Page Windows point cursor on MAIN window. Then go to Edit > Text Elements
  • Now we need to create a report to call our Script. For that go to SE38 transaction code and create a report (i.e. Driver Program).

Write a code which you want and run it, We will se expected Output.

In the code in call function module in that form option you have to give SAP Script name.

Conclusion

In the article, I give an overview of the SAP Script and How to create SAP Script in SAP ABAP.

Thanks for reading.

If you Want to Connect with Me:

LinkedIn: https://www.linkedin.com/in/mayank-chourasia-38421a134/

Twitter: https://twitter.com/ChourasiaMayank.

Thank you, stay safe, stay healthy.

Stay tuned till the next blog.

@sap SAP Conversational AI @sapabap SAP Consultant

--

--

Mayank Chourasia

Hey, My name is Mayank Chourasia. Currently I am working on SAP Utilities as a SAP ABAP Developer. I had written a blogs on SAP ISU, SAP ABAP, Google Cloud .