醉逍遥

发表文章数:49

热门标签

首页 » ABAP代码库 » 正文
*定义传输用的内表,抬头数据
  DATA:LT_ITEM   LIKE STANDARD TABLE OF ZTEST001,
       LS_ITEM   LIKE ZTEST001,
       LT_HEADER LIKE STANDARD TABLE OF ZTEST001,
       LS_HEADER TYPE ZTEST001.
*&-----------SMARTFORMS相关定义---------------------&*
  DATA: FM_NAME            TYPE RS38L_FNAM,
        OUTPUT_OPTIONS     TYPE SSFCOMPOP,
        CONTROL_PARAMETERS TYPE SSFCTRLOP,
        OUTPUT_INFO        TYPE SSFCRESCL.
  DATA: OPTION TYPE SSFCRESOP. "控制参数
 
*获取SAP编译后的函数名
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      FORMNAME           = 'ZTEST001' "smartforms 名
    IMPORTING
      FM_NAME            = FM_NAME
    EXCEPTIONS
      NO_FORM            = 1
      NO_FUNCTION_MODULE = 2
      OTHERS             = 3.
 
  IF SY-SUBRC = 0.
    CLEAR CONTROL_PARAMETERS.
    CONTROL_PARAMETERS-NO_DIALOG = ''.
    CONTROL_PARAMETERS-PREVIEW   = ''.
    CONTROL_PARAMETERS-NO_OPEN   = 'X'.
    CONTROL_PARAMETERS-NO_CLOSE  = 'X'.
 
    CALL FUNCTION 'SSF_OPEN'
      EXPORTING
        CONTROL_PARAMETERS = CONTROL_PARAMETERS
      EXCEPTIONS
        FORMATTING_ERROR   = 1
        INTERNAL_ERROR     = 2
        SEND_ERROR         = 3
        USER_CANCELED      = 4
        OTHERS             = 5.
 
    REFRESH: LT_HEADER .
    LOOP AT GT_TAB INTO GS_TAB WHERE CHECK_BOX = 'X'.
*抬头数据
*赋值
      APPEND LS_HEADER TO LT_HEADER.
      CLEAR:LS_HEADER.
    ENDLOOP.
 
*确定打印纬度
    SORT LT_HEADER BY EBELN.
    DELETE ADJACENT DUPLICATES FROM LT_HEADER COMPARING EBELN.
 
    LOOP AT LT_HEADER INTO LS_HEADER.
 
      REFRESH: LT_ITEM.
      LOOP AT GT_TAB INTO GS_TAB.
*赋值
        APPEND LS_ITEM TO LT_ITEM.
      ENDLOOP.
 
      CALL FUNCTION FM_NAME
        EXPORTING
          CONTROL_PARAMETERS = CONTROL_PARAMETERS
          OUTPUT_OPTIONS     = OUTPUT_OPTIONS
          WA_HEADER          = LS_HEADER "传抬头数据
        IMPORTING
          JOB_OUTPUT_OPTIONS = OPTION "输出参数
        TABLES
          GT_TAB             = LT_ITEM "传所选择行项目明细内表
        EXCEPTIONS
          FORMATTING_ERROR   = 1
          INTERNAL_ERROR     = 2
          SEND_ERROR         = 3
          USER_CANCELED      = 4
          OTHERS             = 5.
 
      CLEAR:LS_HEADER.
    ENDLOOP.

    CALL FUNCTION 'SSF_CLOSE'
      IMPORTING
        JOB_OUTPUT_INFO  = OUTPUT_INFO
      EXCEPTIONS
        FORMATTING_ERROR = 1
        INTERNAL_ERROR   = 2
        SEND_ERROR       = 3
        OTHERS           = 4.
  ENDIF.
*记录打印次数,当打印成功时OUTPUTDONE = ‘X’。
  IF OUTPUT_INFO-OUTPUTDONE = 'X'.
 
  ENDIF.
标签:

未经允许不得转载:作者:醉逍遥, 转载或复制请以 超链接形式 并注明出处 SapiShare
原文地址:《SmartForm 模板》 发布于2020-05-11

分享到:
赞(0) 生成海报

评论 抢沙发

评论前必须登录!

  注册



长按图片转发给朋友

Vieu4.0主题
专业打造轻量级个人企业风格博客主题!专注于前端开发,全站响应式布局自适应模板。
切换注册

登录

忘记密码 ?

切换登录

注册