matinal:SAP script

2024-05-14 08:29:17 浏览数 (2)

1.sap script 是用来设计单据格式并打印的工具

2.事务码:se71 或者选择 Tools->SAPscript->Form

3.工作流程 program:open_form->start_form->write_form->close_form.

CALL FUNCTION 'OPEN_FORM' EXPORTING FORM = SPACE " you can enter a form name here, if you leave the parameter blank,you must call start_form with a valid formname before "starting any output functions LANGUAGE = SY-LANGU " system language DEVICE = 'PRINTER' DIALOG = 'X' OPTIONS = SPACE APPLICATION = 'TX' ARCHIVE_INDEX = SPACE ARCHIVE_PARAMS = SPACE IMPORTING LANGUAGE = RESULT = NEW_ARCHIVE_PARAMS = EXCEPTIONS CANCELED = DEVICE = FORM = “ OPTIONS = UNCLOSED =

”DEVICE: VALUE: 'PRINTER' print output 'TELEX' telex output 'TELEFAX' telefax output 'ABAP' screen output as ABAP list 'SCREEN' screen output as ABAP list

"DIALOG": VALUE: 'X' display print parameter screen

' ' display no 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. Structure:ITCPO Default value: space

CALL FUNCTION 'START_FORM' EXPORTING FORM = SPACE UNOPENED = LANGUAGE = SPACE STARTPAGE = SPACE PROGRAM = SPACE ARCHIVE_INDEX = SPACE IMPORTING LANGUAGE = EXCEPTIONS FORM = FORMAT = UNENDED = UNUSED =

"unopened: The current form function could not be executed, since the form output was no yet initialized using OPEN_FORM

"unused :One of the parameters FORM or LANGUAGE contains only blanks and no form has been opened yet whose name or language could be used as defaults.

CALL FUNCTION 'WRITE_FORM' WINDOW = 'MAIN' TYPE = 'BODY' IMPORTING PENDING_LINES = UNOPENED = EXPORTING ELEMENT = SPACE FUNCTION = 'SET' EXCEPTIONS ELEMENT = FUNCTION = TYPE = UNSTARTED = WINDOW =

ELEMENT Specify the name of the text element you want to output into the form window specified in the parameter WINDOW. The element must be defined in that form window. If you specify no element, the system uses the default element, if one is defined in the form. Default value: SPACE WINDOW Specify the name of the window into which you want to output the form element specified in the parameter ELEMENT. Default value: 'MAIN'

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'

CALL FUNCTION 'CLOSE_FORM' IMPORTING RESULT = TABLES OTFDATA = ?... EXCEPTIONS UNOPENED =

4. form

(1).图片上传:RSTXLDMC 或者 Tcode:se78,出现图形管理界面,Store on document sever->graphics general graphics->Bmap grid screens单击导入. se78 transfer 对应的图片,或者在对应的系统中import 图片,可以在smartforms(running) 或者script form (print testing)中预览.

(2).变量传递:变量的定义和传递在form设计中用“&变量名&”,在程序中只需定义好变量名就可以了,在调用“write_form”函数时会自动传递变量.

(3).查看代码:找到想要查看的window name,比如:main->text->goto>change editor

可以根据Windows 和element确定要显示的块,一般所有的选取数据、数据操作、逻辑判断都在program中进行,少部分的判断在script中添加,或者在program中写好数据处理在form 中使用call.........的形式进行数据处理。字体格式在style中设计

(4).debug: script se71 utilies active debugger 或 RSTXDBUG smartforms 在对应的function module里进行打断点 (5). 利用事务码:NACE,去追踪form的print program ,同样也可以使用NACE分配给一个标准的打印程序 (6).格式上传和下载: 整体格式上传:RSTXSCRP 图形元素上传:RSTXLDMC 下载格式信息:Utilities->Layout set info

0 人点赞