Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

sap scripts

Former Member
0 Likes
810

Can anyone help to knw how to do sap scripts..

step by step

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
785

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.

5 REPLIES 5
Read only

Former Member
Read only

Former Member
0 Likes
785

hi,

Good ...Check out the following links - important

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

regards,

venkat.

Read only

Former Member
0 Likes
785

hi,

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

Hope this helps, Do reward.

Read only

Former Member
0 Likes
786

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.