cancel
Showing results for 
Search instead for 
Did you mean: 

sap script

Former Member
0 Kudos

hai,

what is sap script? for what purpose it is used for? give the step wise procedure to create the script .

regards

surender

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

SAPSCRIPTS:

-


This is a tool used to redirect SAP data to output devices. SE71 is the Tcode

to create SAPScript.

Components of a SAPScript tool are:

1. BASIC SETTINGS.

Paragraph format, character format.

2. ADMINISTRATIVE SETTINGS.

Name of the form, short description.

Layout is used to create a form in SAPScript. Layout is a collection of pages.

Page is a collection of Windows.

Types of Windows:

-


1. Main Window - This is a common window for all pages. This is a default window.

2. Constant Window - This window is used to create footer space, header space for a particular page.

3. Variable Window - This is a subwindow.

4. Graphical Window - This is an optional window, which is used to create logos or some other graphics for the page.

NAVIGATIONS FOR CREATING A SAPSCRIPT:

-


SE71 -> Specify Form name starting with Z or Y (ZSHABFORM) -> Click on Create -> Opens an interface -> Enter short description -> Click on 'Paragraph Format' from Appn. toolbar -> Specify Paragraph Name (P1)-> Press Enter -> Enter short description -> Click on 'Definitions' pushbutton from application toolbar -> Specify Default Paragraph (P1) created -> Click on Layout pushbutton from appn. toolbar -> Opens a layout with a default window 'MAIN' -> Right click on Main Window -> Select 'Edit Text' -> Opens a Line Editor -> Specify a statement -> Come back -> Save -> Activate the form -> A SAPscript is created.

To invoke the form created, we have to create a print program. Create an Executable Program

and specify the following:

CALL FUNCTION 'OPEN_FORM'

EXPORTING

FORM = 'ZSHABFORM'

LANGUAGE = SY-LANGU.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'ELEMENT'

WINDOW = 'MAIN'.

CALL FUNCTION 'CLOSE_FORM'.

-> Save -> Activate -> Execute -> Opens an interface -> Specify output device as LP01 -> Click on Print Preview (F8) pushbutton -> Executes the form.

The FM 'OPEN_FORM' is used to call the sapscript form. Here, we have to specify the name of the form as an argument.

'WRITE_FORM' is used to specify the name of the text elements and window types.

'CLOSE_FORM' is used to save and close the form attributes.

The function modules OPEN_FORM and CLOSE_FORM are mandatory ones.

PASSING ARGUMENTS TO THE FORM:

-


In Line editor, specify an argument enclosed by an ampersand symbol (&).

eg. &KARTHIK&.

Save -> Activate the form.

To pass a value from the print program to the form, declare the variable as follows in Print PRogram:

DATA KARTHIK(10) VALUE 'CHENNAI'.

....OPEN_FORM

...

....CLOSE_FORM

Save -> Activate -> Execute.

PASSING TABLE VALUES AS AN ARGUMENT TO SAPSCRIPT:

-


In the line editor, specify the table field arguments enclosed by '&' symbol as follows:

/E ELEMENT

&KNA1-KUNNR& ,, &KNA1-NAME1& ,, &KNA1-LAND1&

Save -> Activate.

In the Print Program, specify following code:

TABLES KNA1.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

FORM = 'ZSHABFORM1'

LANGUAGE = SY-LANGU.

SELECT * FROM KNA1.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'ELEMENT'

WINDOW = 'MAIN'.

ENDSELECT.

CALL FUNCTION 'CLOSE_FORM'.

Save -> Activate -> Execute.

PASSING INTERNAL TABLE AS AN ARGUMENT TO THE FORM:

-


In line editor, specify following arguments:

/E ELEMENT

&ITAB-KUNNR& &ITAB-NAME1& &ITAB-LAND1&

Save -> Activate.

In Print Program, specify following code:

DATA ITAB LIKE KNA1 OCCURS 0 WITH HEADER LINE.

SELECT * FROM KNA1 INTO TABLE ITAB.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

FORM = 'ZSHABFORM1'

LANGUAGE = SY-LANGU.

LOOP AT ITAB.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'ELEMENT'

WINDOW = 'MAIN'.

ENDLOOP.

CALL FUNCTION 'CLOSE_FORM'.

-> Save -> Activate -> Execute.

ADDING IMAGES TO THE FORM:

-


Create a .bmp file and save it in a directory

-> Goto SE78 Tcode -> Double click BMAP Bitmap images

-> Click on Import icon from appn. toolbar -> Opens an interface

-> Specify the path of .bmp file from the OS

-> Specify the name for the image -> Select Color bitmap image radiobutton

-> Click on Continue -> Image is imported.

To add the imported image into the form, right click on the form layout

-> Select Create Graphic -> Opens an interface

-> Select image from the form directory

-> Select Color bitmap image radiobutton

-> Specify resolution as 100 -> Continue

-> An image is added to the script.

Simply call the form from the print program.

To upload .TIFF files into the SAPscript directory, make use of a predefined executable program called as RSTXLDMC.

In SE38 Tcode, specify the above name, click on execute pushbutton from application toolbar -> Opens an interface -> Specify the file path -> Execute.

Text Elements in the line editor are used to avoid data duplication.

Regards,

Priya.

Former Member
0 Kudos

HI,

THX A LOT. REALLY UR SNIPPET IS VERY HELPFUL TO ME.

REGARDS

SURENDER

Answers (7)

Answers (7)

Former Member
0 Kudos
Former Member
0 Kudos
Former Member
0 Kudos

hi Surender , Can u Guess who is this???????/

Scripts like template which v can use it for some printing purposes..

For that v need to have SE71 transaction,

Here U need to design ur Screen..

and after u have to use Se38 to create one report (driver program) to tune ur script..

in Se38 u need to call Form Function Like

1.Open Form

2.Start Form

3.Write Form

4.Close Form

5.End form

these Al things are same like ur Favourite File Handling(OOPS).. One Thing u have to keep in mind is Except Write Form Al Things Sshould be called once..

With this I attach one Code Snippet of mine.. Analyse it..


*&---------------------------------------------------------------------*
*& Report  ZSCRIPT_PRAC                                                *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT  ZSCRIPT_PRAC                            .

TABLES : VBAP.
SELECT-OPTIONS:  s_vbeln for vbap-vbeln.
types: begin of t_vbap,
        posnr type posnr_va,
        matnr type matnr,
        arktx type arktx,
        kwmeng type kwmeng,
        vrkme type vrkme,
       end of t_vbap.
data:  it_vbap type standard table of t_vbap with header line.



select posnr matnr arktx kwmeng vrkme from vbap into table it_vbap  where vbeln in s_vbeln.


CALL FUNCTION 'OPEN_FORM'
 EXPORTING
   FORM                              = 'ZFORM_PRAC'
   LANGUAGE                          = 'E'
          .
IF SY-SUBRC <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


CALL FUNCTION 'WRITE_FORM'   
 EXPORTING
   ELEMENT                        = 'HEADER'
   WINDOW                         = 'MAIN'
          .
IF SY-SUBRC <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

LOOP AT IT_VBAP.
CALL FUNCTION 'WRITE_FORM'     "can be called > 1 see  i am caling tat inside a loop.
 EXPORTING
   ELEMENT                        = 'TEXT'
   WINDOW                         = 'MAIN'
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


ENDLOOP.

CALL FUNCTION 'CLOSE_FORM'
          .
IF SY-SUBRC <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Former Member
0 Kudos

i cant guess u. bcoz i have a three friends whose names are karthik. plz tell who is this.

Former Member
0 Kudos

hi

I asked Surender only to guess me.. be panic..

Former Member
0 Kudos

hi,,

Who r al d frenz u hav named karthik.. I hope i also one of that.. DO I

Former Member
0 Kudos

ya, its caritor karthik, is it right? thx for ur response. how do u do?

Former Member
0 Kudos

Hi,

What IS SApScript?

SAPscript is a template that simplifies the process of designing business forms. You need SAPscript forms to print, distribute or display business forms.

Use:-

Forms are defined and formatted using layout sets.

SAP documents are printed using forms.

SAPscript is a tool that SAP provides for creating layout sets.

SAPScript TranSction Code:-

SE71 : Form Painter

SE72: Style Maintenance

SE78: Graphics Managements

S010: Create Standard Text Module

For Detailed Steps You Can Go Through The Link

[http://www.thespot4sap.com/Articles/SAPscript_Introduction.asp]

Regards

Sandipan

Former Member
0 Kudos

Language

Language in which the data coming on to the layout set will be printed. Generally, this will be the language that has been set up as default in the SAP system

Header

Section to define the various attributes of the layout set on a global level. Changing these attributes will affect all the components of the layout set.

The various components of the header are explained below

Administration Information

This shows the information about the layout set – details of the designer, details of changes occurring to the design, development class of the layout set and the language details for the layout set

Standard Attributes

Description - Brief description or title of the layout set

Default paragraph - The base paragraph that is globally applicable to the document. This can be overridden at lower level of the layout set by using other paragraphs

Tab Stop - The base tab-stop that is globally applicable to the document. These can be overridden at lower level of the layout set by using other tab stops

First Page - The start page of the layout set

Page Format

Orientation - The direction of printing the data on a page – P for portrait (vertical) and L for landscape (horizontal)

Lines per inch

Characters/inch

Font Attributes

Here the various attributes and the base font applicable to the document can be defined. This font setting can be overridden at a lower level using the character strings

Paragraphs

Used to define the start and end positions for the different texts and objects that need to be printed on the output document.

Character Strings

Used to define the fonts and the formatting and printing styles for each and every character that needs to be printed on the output document. The start of the character string is indicated by <string name>, while the end of the character string is indicated by

Pages

The designer needs to organise the template as a series of pages. When an actual output document is printed, it will refer to each page for putting the data coming from the ABAP program. The order of pages is also taken from the template i.e the layout set defined.

Windows

Various parts of the output document can be conveniently organised on the pages using windows. Thus the data stream coming from the ABAP program can be logically grouped into various parts and can be placed on different locations on a page

There are 2 main types of windows that can be used in a layout set:

MAIN - A layout set can have only one MAIN window which is created by default. This window can flow over multiple pages.

CONSTANT - A layout set can have any number of constant windows. A constant window can be used once per page

Text Elements

Any text that needs to be written on the output document should be placed within a text element. This includes constant text as well as variable data like internal table data coming from the ABAP program.

It is advisable to group logically related data within one text element.

The fields of various tables defined in the ABAP program will be included under these text elements. These fields are carriers of data. Every field should be included in a pair of & characters. (e.g. &aufk-aufnr&)

Page Windows

The graphical element (like company logo) should be in valid graphic file format like .bmp or .jpg

Use appropriate software to convert the above file into a .TIFF file

Use report RSTXLDMC to upload this file as a text module in SAP

Execute the above program from the ABAP /4 editor

Enter the location of the .TIFF file on the PC

Specify BMON or BCOL as the raster image type

The SAP system suggests a name for the file ( like ZHEX-MARCO-* ). The * indicates the type of file. For e.g. if the file contains a logo then the name can be ZHEX-MACRO-LOGO

The ID should be ‘ST’ and give the logon language

Running the program will convert this .TIFF file into a text element

Incorporate this converted logo in the appropriate window under the appropriate text element by giving

INCLUDE ZHEX-MACRO-LOGO OBJECT TEXT ID ST in the first line

-


The graphical element (like company logo) should be in valid graphic file format like .bmp or .jpg

Use appropriate software to convert the above file into a .TIFF file

Use report RSTXLDMC to upload this file as a text module in SAP

Execute the above program from the ABAP /4 editor

Enter the location of the .TIFF file on the PC

Specify BMON or BCOL as the raster image type

The SAP system suggests a name for the file ( like ZHEX-MARCO-* ). The * indicates the type of file. For e.g. if the file contains a logo then the name can be ZHEX-MACRO-LOGO

The ID should be ‘ST’ and give the logon language

Running the program will convert this .TIFF file into a text element

Incorporate this converted logo in the appropriate window under the appropriate text element by giving

INCLUDE ZHEX-MACRO-LOGO OBJECT TEXT ID ST in the first line

see links here u an find good example also.

http://www.thespot4sap.com/Articles/SAPscript_Introduction.asp

http://www.sap-img.com/sapscripts/a-sample-sap-scripts-reports.htm

SAP Scripts

https://forums.sdn.sap.com/click.jspa?searchID=1811669&messageID=2969311

https://forums.sdn.sap.com/click.jspa?searchID=1811669&messageID=2902391

https://forums.sdn.sap.com/click.jspa?searchID=1811669&messageID=3205653

https://forums.sdn.sap.com/click.jspa?searchID=1811669&messageID=3111402

http://www.sap-img.com/sapscripts.htm

http://sappoint.com/abap/

http://www.henrikfrank.dk/abapexamples/SapScript/sapscript.htm

http://help.sap.com/saphelp_crm40/helpdata/en/16/c832857cc111d686e0000086568e5f/content.htm

http://www.sap-basis-abap.com/sapabap01.htm

http://www.sap-img.com/sapscripts.htm

http://searchsap.techtarget.com/tip/1,289483,sid21_gci943419,00.html

http://sap.ittoolbox.com/topics/t.asp?t=303&p=452&h2=452&h1=303

http://www.sapgenie.com/phpBB2/viewtopic.php?t=14007&sid=09eec5147a0dbeee1b5edd21af8ebc6a

Other Links

http://www.virtuosollc.com/PDF/Get_Reporter.pdf

http://help.sap.com/saphelp_47x200/helpdata/en/da/6ada3889432f48e10000000a114084/frameset.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/66/bc7d2543c211d182b30000e829fbfe/frameset.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/5b/d22cee43c611d182b30000e829fbfe/frameset.htm

http://www.virtuosollc.com/PDF/Get_Reporter.pdf

http://help.sap.com/saphelp_47x200/helpdata/en/da/6ada3889432f48e10000000a114084/frameset.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/66/bc7d2543c211d182b30000e829fbfe/frameset.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/5b/d22cee43c611d182b30000e829fbfe/frameset.htm

drawing lins, boxes and shadings

http://help.sap.com/saphelp_46c/helpdata/en/d1/802ec5454211d189710000e8322d00/frameset.htm

http://www.thespot4sap.com/Articles/Code_CostCentreReport.asp

http://www.allsaplinks.com/dialog_programming.html

http://help.sap.com/saphelp_webas630/helpdata/en/9f/db9cdc35c111d1829f0000e829fbfe/frameset.htm

http://www.allsaplinks.com/files/using_table_in_screen.pdf

http://www.geocities.com/ZSAPcHAT

http://www.sap-img.com/sapscripts/create-scripts-of-your-own-using-standard-scripts.htm

http://www.sap-img.com/sapscripts/a-sample-sap-scripts-reports.htm

http://www.sap-img.com/sapscripts.htm

http://www.sap-img.com/ts003.htm

http://www.sap-img.com/sapscripts/faq-for-sap-scripts.htm

Hope this helps <REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Mar 18, 2008 5:25 PM

SantoshKallem
Active Contributor
0 Kudos

step by step procedures with screen shots

http://www.saptechnical.com/Tutorials/Smartforms/SFMain.htm

regards.

santhosh reddy