smortform 创建

1、T-CODE : SMARTFORMS 进入SMARTFORM创建界面

                      SMARTSTYLES 进入创建样式

2、表格接口 -> 表,填写数据源对象TD_DATA

    全局定义 -> 全局数据,定义变量,数据源结构TH_DATA

                        初始化填写代码,将表loop到结构record中

                        IF TH_DATA IS INITIAL.

                           READ TABLE TD_DATA INTO TH_DATA INDEX 1.

                        ENDIF.

3、程序中代码

FORM FRM_SMARTFORM_OUT.

    DATA:

         LW_FMNAME    TYPE  RS38L_FNAM, "通用名,必须 以下2个定义字段为非必须

         LST_OPTIONS   TYPE  SSFCOMPOP,  " 输出设置

         CONTROL             TYPE  SSFCTRLOP,

         LTD_DATA       TYPE  TABLE OF ZCPPS003.  "TH_DATA的结构

 

  LST_OPTIONS-TDNEWID = 'X'.  "新建SPOOL请求

  LST_OPTIONS-TDIMMED = 'X'.  “即时打印

 

  CONTROL-NO_DIALOG = 'X'.

  CONTROL-NO_OPEN    = 'X'.

  CONTROL-PREVIEW     = 'X'.

  LTD_DATA[ ] = MATAB1[ ].

 

  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

     EXPORTING

      FORMNAME = 'ZCCSFFPP020'    "SMARTFORMS名

     IMPORTING

       FM_NAME = LW_FNAME             "通用名

      EXCEPTIONS

      NO_FORM = 1

      NO_FUNCTION_MODULE = 2

      OTHERS = 3.

  IF SY-SUBRC <> 0.

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

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

     LEAVE TO LIST-PROCESSING.

  ENDIF.

 

  CALL FUNCTION  'SSF_OPEN'

    EXPORTING

      USER_SETTINGS = SPACE

      CONTROL_PARAMETERS = CONTROL

      OUTPUT_OPTIONS = LST_OPTIONS.

    EXCEPTIONS

      OTHERS = 3.

    IF SY-SUBRC <> 0.

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

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

       LEAVE TO LIST-PROCESSING.

    ENDIF.

 

  CALL FUNCTION  LW_FMNAME

    EXPORTING

      CONTROL_PARAMETERS = CONTROL

      OUTPUT_OPTIONS = LST_OPTIONS

      USER_SETTINGS = SPACE

    TABLES

      TD_DATA = LTD_DATA   "输出数据

    EXCEPTIONS

      FORMATTING_ERROR = 1

      INTERNAL_ERROR  = 2

      SEND_ERROR  = 3

      USER_CANCELED = 4

      OTHERS = 5.

    IF SY-SUBRC <> 0.

      MESSAGE ID SY-MSGID TYPE 'S' NUMBER  SY-MSGNO

      DISPLAY LIKE 'E'  WITH  SY-MSGV1  SY-MSGV2  SY-MSGV3  SY-MSGV4.

      LEAVE TO LIST-PROCESSING.

    ENDIF.

 

    CALL  FUNCTION  'SSF_CLOSE'.

 

ENDFORM.

                                 

posted on 2018-05-07 14:07  阳光旅人  阅读(269)  评论(0编辑  收藏  举报

导航