2007 Jul 19 8:18 AM
What is the easiest way to use the sapscripts?
How can I learn this topic easily?
I just know the transaction code of the sapscripts: se71
Nothing else.
I wait for your directions.
Thanks in advance.
Deniz.
2007 Jul 19 8:22 AM
Hi,
chk this:
http://www.esnips.com/doc/99f8f94d-e784-4f64-bad5-65c8865311f0/SAPSCRIPTS-Guide
http://www.henrikfrank.dk/abapuk.html
http://esnips.com/doc/1ff9f8e8-0a4c-42a7-8819-6e3ff9e7ab44/sapscripts.pdf
http://esnips.com/doc/1e487f0c-8009-4ae1-9f9c-c07bd953dbfa/script-command.pdf
http://esnips.com/doc/64d4eccb-e09b-48e1-9be9-e2818d73f074/faqss.pdf
http://esnips.com/doc/cb7e39b4-3161-437f-bfc6-21e6a50e1b39/sscript.pdf
http://esnips.com/doc/fced4d36-ba52-4df9-ab35-b3d194830bbf/symbols-in-scripts.pdf
http://www.sap-img.com/sapscripts.htm
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://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
<b>Reward points</b>
Regards
2007 Jul 19 8:24 AM
Hi
There are some Standard Sap Scripts in SAP. We cant directly execute them in scripts we have to use some T-codes and by giving some input to the required fields we can see the output printform.
I will show one example. There are some Standard Sap Scripts such as MEDRUCK which is a standard Sap Script for Purchase Order and RVINVOICE01 for billing and so on...
To see oupt of MEDRUCK go to T-code ME9F give purchase order number and execute select one number and click on dislplay messages button on application tool bar you can find the print form of MEDRUCK.
You cannot change the Standard Sap Scripts but you can use Standard Sap Scripts and Copy them to userdefined Script and can make changes to them and replace standard Sap Script with usedefind script.
Ex: Go to SE71,
on menu bar u find Utilities->copy from Client. click on it u ll find new screen showing
Form name:
Source Clinet:
Target Form:
give Form name as usedefined form name EX: ZFORM1
Source client as 000 and
Target form as MEDRUCK.
execute.
Now, the standard from MEDRUCK is copyied to your form ZFORM1.
NOW, go to SE71 and give form name as ZFORM1 and do some changes to the form such as adding logo any thing. save and Activate.
Now, you have done changes to the Form ZFORM1 and u have to replace your form with standard SAP Script.
Go to NACE Transaction.
on Applications select EF for purchase order and click Output types button on application tool bar.
now select NEU as output types dobule click on Processing Routines.
now click on Change option on application tool bar and on right side u find MEDRUCK in form place replace MEDRUCK with ZFORM1 and SAVE.
go back twice and now go to T-code ME9F give the purchase order number and execute and select one option and click on display messges button .
you will find the changes that you have done in ZFORM1. so we cant chage the standard Sap Scripts by copying the Standard Sap Scripts we can chage and replace with our forms.
Function Modules Used in Script:
In the Driver Program we must use all or some of the function modules that are listed below to transfer the data.
Open_Form
Close_Form
Start_Form
Write_Form
Write_Form_Lines
End_Form
Control_Form
Read_Form_elements
Read_Form_Lines
Any driver program must contain Open_Form, Close_Form and Write_Form. Other function modules are optional.
OPEN_FORM: This function module opens layout set printing. One must call this function module before he uses any of other layout set function modules like Write_Form, Start_Form, Control_Form etc., You need specify a layout set name in the export parameters of this function module. If nothing is passed to Open_Form then one should use Start_Form function module to open layout set before starting the output. The layout set opened by Open_Form should be closed by Close_Form function module, other wise output doesnt appear. We can use any number of Open_Form, Close_Form functions in one single program. But Close_Form must be there for every Open_Form in the program.
Some of the important export parameters we have to pass to Open_Form function module.
Form: Enter the Layout set name here, which then controls the output formatting. If nothing is specified then we must use Start_Form for opening layout set.
Language: Layout sets are Language dependent. Enter the desired language here. If the entered layout set is not in that language, then the function tries to open the Form entered in its original language. The default value is SY-LANGU.
Device: SAP Script can format a text on different device types. The device can be PRINTER or TELEX, TELEFAX, ABAP and SCREEN.
Dialog: Use parameter DIALOG to determine whether to display a dialog box before printing, in which the user can set several spool parameters for print formatting. Possible values: SPACE displays no print parameter screen. 'X' display print parameter screen. Default value: 'X'
Options: Use parameter OPTIONS to set several options for print formatting. The parameter has the structure ITCPO. The user can change some of the defined settings on the print control screen. The default value for Options is . We will discuss about ITCPO structure in detail later.
Other Export, Import and Exceptions are self-explanatory.
Close_Form: The function module closes the layout set opened using OPEN_FORM. The system executes any terminating processing steps for the last opened layout set. No Export parameters for this Function Module.
Start_Form: In-between the function modules OPEN_FORM and CLOSE_FORM, we can use different layout sets. This allows us to combine several different layout sets into one print output. However, we can combine only those layout sets that have the same page format. To switch layout sets, use the function module START_FORM. If another layout set is still open, we must close it first using END_FORM. If we specify no layout set name when calling START_FORM, the system restarts the last open layout set. If after OPEN_FORM no layout set was activated yet, the system leaves the function module with the exception UNUSED. Some of the important export parameters for this function module are
Form: The parameter contains the name of the layout set you want to use for printing. If you specify no layout set here, the system restarts the last active layout set.
Language: Layout sets are language-dependent. Enter the desired language here. If the layout set does not exist in this language, the system tries to call the layout set in its original language. If the parameter LANGUAGE is empty, the system uses the language of the last active layout set.
Startpage: Usually, SAP script starts with the page specified as start page in the layout set definition. If we want to start output with another layout set page, enter the name of the desired layout set page here. If the desired page is not defined, the system uses the start page defined in the layout set.
Program: To replace program symbols, SAP script must know which active program contains the work areas for the values to be passed. If we omit the parameter, the system searches for the field values in the program that was specified in the parameter OPTIONS (field TDPROGRAM) of OPEN_FORM. If we enter a program name, the system replaces the program symbols with the values from this program up to the next END_FORM.
Exceptions and other Export, Import parameters are self-explanatory.
Write_Form: The system outputs the layout set element specified in parameter ELEMENT into the currently opened layout set. In the parameter WINDOW we can specify the name of a window for the output. Remember that the layout set element must be defined in this window. The parameter FUNCTION specifies how to merge the text lines to be output with any existing contents in the window. In this case, there are differences between the different window types or areas. Some of the important export parameters used in Write_Form.
Element: Specify the name of the text element you want to output into the layout set window specified in the parameter WINDOW. The element must be defined in that layout set window. If you specify no element, the system uses the default element, if one is defined in the layout set.
Window: Specify the name of the window into which you want to output the layout set element specified in the parameter ELEMENT. Default value for Window is MAIN.
Function: The parameter determines how to output the text element into the respective window. The output type depends on the window type and area:
Window Type: MAIN Area: BODY
SET/APPEND: Appends to previous output.
Window Type: Main Area: Top/Bottom and
Window Type: Other than Main and all areas
SET : Delete the old element contents and prints the new elements
APPEND: Appends the new content to existing elements.
Type: The system interprets this parameter only for output to the main window. The parameter determines the area of the main window into which we want to output the element. Possible values: 'TOP' header area
'BODY' main area
'BOTTOM' footer area
Default value: 'BODY'
Write_Form_Lines: This function module outputs the text lines in table LINES into the specified layout set window. The text lines must have the SAP script ITF format. From the data in the text header, the system uses only the field TDSTYLE to apply the formatting attributes defined in the specified style for this text. If the field is empty, the system uses the identically named formatting attributes (character and paragraph formats) of the layout set.
Use parameter WINDOW to specify into which of the windows defined in the layout set we want to output the text. We can specify any window used in the layout set. The parameter FUNCTION determines how to merge the text lines to be output with any existing contents in the window. There are differences between the different window types or areas.
Header: This parameter contains the header of the text module we want to output in the current layout set. For the formatting process, the system uses only the entries in the header fields TDSTYLE and TDFORM. Structure: THEAD
WINDOW: Enter the name of the window into which we want to output the layout set element specified in parameter ELEMENT. Default value: 'MAIN'
FUNCTION: This parameter determines how to output the text element into the respective window. The output type depends on the window type and area: Window type MAIN, area BODY: 'SET' append to previous output 'APPEND' same as SET. DELETE' no effect. Window type MAIN, areas TOP and BOTTOM; all other windows: 'SET' delete old window or area contents and output the element 'APPEND' append the element to the existing elements 'DELETE' no effect Default value: 'SET'
TYPE: The system interprets this parameter only for output to the main window. The parameter determines the area of the main window into which you want to output the element. Possible values: 'TOP' header area 'BODY' main area 'BOTTOM' footer area Default value: 'BODY'
END_FORM: END_FORM ends the currently open layout set and executes the required termination processing. After calling this function module, no more layout set is active. For further output, we must start a new layout set using START_FORM. No Export parameters.
CONTROL_FORM: Use this function module to pass SAP Script Control Commands to the layout set. The Control command is passed through the export parameter COMMAND in quotes.
READ_FORM_ELEMENTS: This function module fills a table with all text elements that appear in one layout set. If we specify no layout set name, the system includes all elements of the currently open layout set. If we specify a layout set, the system uses the information about the active version of the layout set, retrieved from the database. Here we have two export parameters, Form and Language and a table parameter Elements.
READ_FORM_LINES: Use this function module to transfer the lines of a layout set element into an internal table. If we specify no layout set name, the system transfers the text lines of the currently open layout set. If we specify a layout set, the system uses the text lines of the active version of the layout set from the database. The Export parameters are Form, Language, Window and Element. If we pass these 4 parameters the function module returns a table with the lines from layout set.
SAPScripts
http://esnips.com/doc/1ff9f8e8-0a4c-42a7-8819-6e3ff9e7ab44/sapscripts.pdf
http://esnips.com/doc/1e487f0c-8009-4ae1-9f9c-c07bd953dbfa/script-command.pdf
http://esnips.com/doc/64d4eccb-e09b-48e1-9be9-e2818d73f074/faqss.pdf
http://esnips.com/doc/cb7e39b4-3161-437f-bfc6-21e6a50e1b39/sscript.pdf
http://esnips.com/doc/fced4d36-ba52-4df9-ab35-b3d194830bbf/symbols-in-scripts.pdf
SAP SCRIPT FIELDS
http://help.sap.com/saphelp_erp2005vp/helpdata/en/d1/8033ea454211d189710000e8322d00/content.htm
scripts easy material
http://www.allsaplinks.com/sap_script_made_easy.html
Sample program;
&----
*& Report ZTEST12121
*& SAPScripts Example 1
&----
REPORT ztest12121.
*DATABASE TABLES
TABLES: ekko,ekpo,lfa1.
*INTERNAL TABLES AND STRUCTURES
DATA i_ekko LIKE ekko.
DATA i_ekpo LIKE ekpo OCCURS 0 WITH HEADER LINE.
DATA i_lfa1 LIKE lfa1.
*PARAMETERS
PARAMETERS: p_ebeln LIKE ekko-ebeln.
*VARIABLES
DATA MAT TYPE STRING VALUE 'MAT NO'.
DATA iTe TYPE STRING VALUE 'ITEM NO'.
DATA QTY TYPE STRING VALUE 'QTY'.
DATA UOM TYPE STRING VALUE 'UOM'.
DATA NET TYPE STRING VALUE 'NET PRICE'.
Data var type integer value 0.
*DATABASE SELECTS
*Header data
SELECT SINGLE * FROM ekko INTO i_ekko WHERE ekko~ebeln = p_ebeln.
IF sy-subrc = 0.
*Item Data
SELECT * FROM ekpo INTO TABLE i_ekpo WHERE ekpo~ebeln = p_ebeln.
IF sy-subrc NE 0.
WRITE 'PURCHASE DOCUMENT ITEM DATA ERROR'.
ELSE.
*Vendor Details
SELECT SINGLE * FROM lfa1 INTO i_lfa1 WHERE lfa1~lifnr = i_ekko-lifnr.
IF sy-subrc NE 0.
WRITE 'VENDOR DOCUMENT ITEM DATA ERROR'.
ENDIF.
ENDIF.
ELSE.
WRITE 'THIS PURCHASE DOCUMENT NUMBER DOESNOT EXISTS'.
ENDIF.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
DEVICE = 'PRINTER'
DIALOG = 'X'
form = 'ZSCRIPT_1'
language = sy-langu
OPTIONS =
MAIL_SENDER =
MAIL_RECIPIENT =
MAIL_APPL_OBJECT =
RAW_DATA_INTERFACE = '*'
SPONUMIV =
IMPORTING
LANGUAGE =
NEW_ARCHIVE_PARAMS =
RESULT =
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
CODEPAGE = 11
OTHERS = 12
.
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 = 'OFFICEAD'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'OFFICEAD'
.
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 = 'PODET'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'PODET'
.
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 = 'TOP'
FUNCTION = 'SET'
TYPE = 'TOP'
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 I_EKPO.
var = i_ekpo-netpr * i_ekpo-menge.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'BODY'
FUNCTION = 'SET'
TYPE = 'BODY'
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'
IMPORTING
RESULT =
RDI_RESULT =
TABLES
OTFDATA =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
CODEPAGE = 5
OTHERS = 6
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
<b>Reward points for useful Answers</b>
Regards
Anji
2007 Jul 19 8:30 AM
hi
SAPScripts
http://esnips.com/doc/1ff9f8e8-0a4c-42a7-8819-6e3ff9e7ab44/sapscripts.pdf
http://esnips.com/doc/1e487f0c-8009-4ae1-9f9c-c07bd953dbfa/script-command.pdf
http://esnips.com/doc/64d4eccb-e09b-48e1-9be9-e2818d73f074/faqss.pdf
http://esnips.com/doc/cb7e39b4-3161-437f-bfc6-21e6a50e1b39/sscript.pdf
http://esnips.com/doc/fced4d36-ba52-4df9-ab35-b3d194830bbf/symbols-in-scripts.pdf
SAP SCRIPT FIELDS
http://help.sap.com/saphelp_erp2005vp/helpdata/en/d1/8033ea454211d189710000e8322d00/content.htm
9872519407
scripts easy material
http://www.allsaplinks.com/sap_script_made_easy.html
regards
ravish
<b>plz dont forget to reward points if helpful</b>
2007 Jul 19 11:32 AM
Hi,
Check the following links:
http://www.sap-img.com/sapscripts.htm
http://www.sapbrainsonline.com/TUTORIALS/TECHNICAL/SAPSCRIPTS_tutorial.html
http://www.sapmaterial.com/sap_scripts.html
Regards,
Bhaskar