分享
 
 
 

SAP ABAP/4学习--如何调用SAP SCRIPT

王朝other·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

*-----------------------------------------------------------------------

* Program ID :ZTEST904

* Program Name :ZTEST904

*-----------------------------------------------------------------------

* CREATED DATE :2004/09/04

* CREATED BY :LG

* DESCRIPTION :这个程序是学习如何通过程序来调用

* 已经做好的SCRIPT画面来生成报表的。

*-----------------------------------------------------------------------

* MODIFICATION :

* DATE MODIFIED MODIFIED BY TRANSPORT REQUEST DESCRIPTION

* 2004/09/18 LG VERSION:01/01 学习

*-----------------------------------------------------------------------

REPORT ZTEST904 .

*定义需要使用的表

***********************************************

TABLES: MSEG,

MARA,

MKPF.

*定义一个内部表(带表头)

***********************************************

DATA: BEGIN OF ITAB OCCURS 0,

A LIKE MSEG-MBLNR,

B LIKE MSEG-ZEILE,

END OF ITAB.

* 插入一些使用的数据。

***********************************************

DO 30 TIMES.

ITAB-A = '测试数据'.

ITAB-B = SY-INDEX.

APPEND ITAB.

ENDDO.

* 显示画面数据,显示上面的打印按钮。用户点击打印

* 然后调用打印的SCRIPT。显示答应的数据。

***********************************************

* INITIALIZATION

***********************************************

INITIALIZATION.

* AT SELECTION-SCREEN.

***********************************************

AT SELECTION-SCREEN.

* START-OF-SELECTION

***********************************************

START-OF-SELECTION.

SET PF-STATUS 'ZTEST_904'.

PERFORM PRINT_ITAB TABLES ITAB.

* AT USER-COMMAND.

***********************************************

AT USER-COMMAND.

CASE SY-UCOMM.

WHEN 'USER_PRINT'.

WRITE:/ 'BUTTON CLIKCKED'.

PERFORM OPEN_FORM.

PERFORM START_FORM.

DO 50 TIMES.

PERFORM WRITE_FORM USING '' 'MAIN' 'SET'.

ENDDO.

PERFORM END_FORM.

PERFORM CLOSE_FORM.

ENDCASE.

* TOP-OF-PAGE.

***********************************************

TOP-OF-PAGE.

* END-OF-PAGE.

***********************************************

END-OF-PAGE.

*&----------------------------------------------------------------------

*& FORM : PRINT_ITAB

*&----------------------------------------------------------------------

* <处理概要>

*-----------------------------------------------------------------------

* <种别(入出力) <参数名> <类型> <调用类型参照,值>>

*-----------------------------------------------------------------------

* FORM PRINT_ITAB TABLES JTAB LIKE ITAB[].

FORM PRINT_ITAB TABLES JTAB STRUCTURE ITAB.

LOOP AT JTAB.

WRITE:/ JTAB-A , 10 JTAB-B.

ENDLOOP.

ENDFORM.

FORM PRINT_PAGE.

ENDFORM.

FORM OPEN_FORM.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

* APPLICATION = 'TX'

* ARCHIVE_INDEX =

* ARCHIVE_PARAMS =

DEVICE = 'PRINTER'

* DIALOG = 'X'

FORM = 'ZTEST904'

LANGUAGE = SY-LANGU

* OPTIONS =

* MAIL_SENDER =

* MAIL_RECIPIENT =

* MAIL_APPL_OBJECT =

* RAW_DATA_INTERFACE = '*'

* 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

OTHERS = 11

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM.

FORM CLOSE_FORM.

CALL FUNCTION 'CLOSE_FORM'

* IMPORTING

* RESULT =

* RDI_RESULT =

* TABLES

* OTFDATA =

EXCEPTIONS

UNOPENED = 1

BAD_PAGEFORMAT_FOR_PRINT = 2

SEND_ERROR = 3

SPOOL_ERROR = 4

OTHERS = 5

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM.

FORM START_FORM.

CALL FUNCTION 'START_FORM'

EXPORTING

* ARCHIVE_INDEX =

FORM = 'ZTEST904'

* LANGUAGE = ' '

STARTPAGE = 'FRIST'

* PROGRAM = ''

* MAIL_APPL_OBJECT =

* IMPORTING

* LANGUAGE =

EXCEPTIONS

FORM = 1

FORMAT = 2

UNENDED = 3

UNOPENED = 4

UNUSED = 5

SPOOL_ERROR = 6

OTHERS = 7

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM.

FORM END_FORM.

CALL FUNCTION 'END_FORM'

* IMPORTING

* RESULT =

EXCEPTIONS

UNOPENED = 1

BAD_PAGEFORMAT_FOR_PRINT = 2

SPOOL_ERROR = 3

OTHERS = 4

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM.

FORM WRITE_FORM USING ELE WIN FUNC.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = ELE

FUNCTION = FUNC

* TYPE = 'BODY'

WINDOW = WIN

* IMPORTING

* PENDING_LINES =

EXCEPTIONS

ELEMENT = 1

FUNCTION = 2

TYPE = 3

UNOPENED = 4

UNSTARTED = 5

WINDOW = 6

BAD_PAGEFORMAT_FOR_PRINT = 7

SPOOL_ERROR = 8

OTHERS = 9

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM.

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有