SAP Scripts - Create a Script in the System



To start a script, you have to run Transaction SE71 and this will open the Form Painter.

In the Form Painter, request screen, enter a name and language for a SAPscript form in the Form and Language fields, respectively. Let’s enter 'RVINVOICE01' and 'EN' respectively in these fields.

RVINVOICE01

Paragraph provides all the information required to format a paragraph of text and fonts. To create a Paragraph, click the Paragraph Formats tab as shown in the following screenshot.

Enter the left margin, right margin, alignment and line spacing to define the Paragraph format.

Paragraph Format

Click the Character Formats tab to enter character format and meaning as shown in the following screenshot.

Format Tab

Enter the following settings for format option −

  • Format
  • Meaning
  • Size
Format Option

Then, you have to define Layout of the document. Click the Layout tab to design the window.

Layout Document

Using Layout, gives a GUI editor where you can drag the window position and it is easy to use.

By default, you can see the Main Window in the Layout. To create a new window, you can right-click on Layout → Create Window as seen in the following screenshot.

GUI Editor

You can also add graph/logo to the layout part. Go to the Graph button next to Window tab and enter the details.

Logo

To make an element on the respective window, click the Edit text button.

You can define a driver program under Transaction SE38 to call this script. Use function modules to define the calling program −

  • START_FORM
  • WRITE_FORM
  • END_FORM
  • CLOSE_FORM

This is how you can develop a script and add multiple windows and define the paragraph and layout of the form.

Form OPEN_FORM 
CALL FUNCTION 'OPEN_FORM' 
EXPORTING 
Form        = 'FormName' 
Endform                    “OPEN_FORM 

Form START_FORM  
CALL FUNCTION 'START_FORM' 
EXPORTING 
Form        = 'FormName'. 
Endform                    “START_FORM 

CALL FUNCTION 'WRITE_FORM' 
EXPORTING 
Window      = 'GRAPHNAME’ 

CALL FUNCTION 'WRITE_FORM' 
EXPORTING 
Element     = 'ELEMENTNAME' 
FUNCTION    = 'SET' 
TYPE        = 'BODY' 
Window      = 'MAIN’ 
endform.                   " WRITE_FORM 

CALL FUNCTION 'END_FORM' 
IMPORTING 
RESULT      = 
EXCEPTIONS 
UNOPENED    =  1 
OTHERS      =  5 
endform.                    " END_FORM 

CALL FUNCTION 'CLOSE_FORM'  
IMPORTING 
RESULT      = 
EXCEPTIONS 
UNOPENED    =  1 
OTHERS      =  5 
endform.                    "CLOSE-FORM 
Advertisements