- 程序名:ZABAP1903_07smartforms_resume
*&---------------------------------------------------------------------*
*& Report ZABAP1903_07SMARTFORMS_RESUME
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZABAP1903_07SMARTFORMS_RESUME.
***********************************************************smartforms的调用 名称为ZHQ_RESUME的smartforms *********************************************************************
*参照测试smartforms
DATA: GS_BASIC TYPE ZHQ_RESSUME, "基本信息
GT_BASIC TYPE TABLE OF ZHQ_RESSUME, "基本信息表
GT_INFO TYPE ZHQ_RESSUME_02TAB. "个人信息
DATA: GS_INFO TYPE ZSCHOOL_LPJ_STR. "个人信息的工作区
DATA: NUM TYPE I VALUE 0.
DATA: GV_FM_NAME TYPE RS38L_FNAM. " FUNCTION MODULE的名称
DATA: GV_FORMNAME TYPE TDSFNAME VALUE 'ZHQ_RESUME'. "smartforms的名称
DATA: GS_CONTORL TYPE SSFCTRLOP.
DATA: GS_OUTPUT_OPTION TYPE SSFCOMPOP.
DATA: GS_OUTPUT_INFO TYPE SSFCRESCL.
*打印机参数设置
GS_OUTPUT_OPTION-TDDEST = 'LP01'. "不用输入打印机,直接默认填写
*打印控制
GS_CONTORL-NO_DIALOG = 'X'. "不显示对话框
GS_CONTORL-PREVIEW = 'X'. "预览
*GS_OUTPUT_OPTION-TDNOPREV = 'X'. "不显示打印预览按钮
START-OF-SELECTION.
"基本信息
CLEAR GS_BASIC.
GS_BASIC-NAEM = 'zahngsan'.
GS_BASIC-SEX = 'F'.
GS_BASIC-EDUCATE = 'ouyan'.
GS_BASIC-NATION = 'China'.
GS_BASIC-TEL = '111'.
APPEND GS_BASIC TO GT_BASIC.
CLEAR GS_BASIC.
GS_BASIC-NAEM = 'LISI'.
GS_BASIC-SEX = 'm'.
GS_BASIC-EDUCATE = 'ouyan'.
GS_BASIC-NATION = 'SHANXI'.
GS_BASIC-TEL = '122'.
APPEND GS_BASIC TO GT_BASIC.
CLEAR GS_BASIC.
GS_BASIC-NAEM = 'WANGWU'.
GS_BASIC-SEX = 'F'.
GS_BASIC-EDUCATE = 'XIAN'.
GS_BASIC-NATION = 'China'.
GS_BASIC-TEL = '333'.
APPEND GS_BASIC TO GT_BASIC.
CLEAR GS_BASIC.
GS_BASIC-NAEM = 'AAA'.
GS_BASIC-SEX = 'F'.
GS_BASIC-EDUCATE = 'ouyan'.
GS_BASIC-NATION = 'China'.
GS_BASIC-TEL = '555'.
APPEND GS_BASIC TO GT_BASIC.
"个人信息(通过工作区去传值,所以定义工作区(一行))
CLEAR GS_INFO.
DO 45 TIMES.
NUM = NUM + 1.
GS_INFO-ZSCHOOL = NUM.
IF SY-INDEX < 5.
GS_INFO-ZSNAME = 'OUAY'.
ELSEIF SY-INDEX < 10.
GS_INFO-ZSNAME = 'PEIHUA'.
ELSEIF SY-INDEX < 20.
GS_INFO-ZSNAME = 'XIJING'.
ELSE.
GS_INFO-ZSNAME = 'SHANSHIDA'.
ENDIF.
GS_INFO-ZADD = 'SHANXI'.
APPEND GS_INFO TO GT_INFO.
ENDDO.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = GV_FORMNAME
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
FM_NAME = GV_FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE S000(LPJ) WITH '调用smartforms失败' DISPLAY LIKE 'E'.
EXIT.
* Implement suitable error handling here
ENDIF.
LOOP AT GT_BASIC INTO GS_BASIC. "循环function,分别输出每个人 的个人信息
*实现多个人的信息翻页进行一个人一个人的显示。
GS_CONTORL-NO_OPEN = 'X'. "中间行
GS_CONTORL-NO_CLOSE = 'X'.
"loop循环中的事件
AT FIRST. "第一条执行
GS_CONTORL-NO_OPEN = ''. "属于打印控制里面的属性
ENDAT.
AT LAST. "最后一条执行
* CLEAR GS_CONTORL-NO_CLOSE. "两条语句均可
GS_CONTORL-NO_CLOSE = ''.
ENDAT.
CALL FUNCTION GV_FM_NAME
* CALL FUNCTION '/1BCDWB/SF00000183' "SMARTFORMS输出,函数名是smartforms自动生成
EXPORTING
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = GS_CONTORL
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
OUTPUT_OPTIONS = GS_OUTPUT_OPTION
USER_SETTINGS = '' "'X' :不使用User_setting
* BASIC =
GS_BASIC = GS_BASIC "基本信息
IMPORTING
* DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO = GS_OUTPUT_INFO
* JOB_OUTPUT_OPTIONS =
TABLES
GT_INFO = GT_INFO "个人信息
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
IF SY-SUBRC <> 0. "打印失败
MESSAGE S000(LPJ) WITH 'smartforms调用失败' DISPLAY LIKE 'E'.
ELSE. "操作成功
IF GS_OUTPUT_INFO-OUTPUTDONE = 'X'. "
MESSAGE S000(LPJ) WITH '打印成功'.
ENDIF.
* Implement suitable error handling here
ENDIF.
ENDLOOP.
网友评论