• WDA基础十三:常用模板管理


    常用的模板一般是SMW0和OAOR,根据不同需求来的。

    WAD有个不好的地方就是不支持GUI上的OLE和DOI,所以需要做转换,下面是常用的方式:

    FUNCTION ZCRM_DOWNLOAD_TEMPLATE
    *"----------------------------------------------------------------------
    *"*"Local Interface:
    *"  IMPORTING
    *"     REFERENCE(IV_OBJID) TYPE  W3OBJID
    *"----------------------------------------------------------------------
      DATA:
        LS_FILEKEY TYPE          WWWDATATAB,
        LT_MIME    TYPE TABLE OF W3MIME.
    
      DATA:
        LV_XSTRING          TYPE XSTRING,
        LV_FILENAME         TYPE STRING,
        LV_MIME_TYPE        TYPE STRING.
    
      LS_FILEKEY-RELID = 'MI'.
      LS_FILEKEY-OBJID = IV_OBJID.
    
      CALL FUNCTION 'WWWDATA_IMPORT'
        EXPORTING
          KEY    = LS_FILEKEY
        TABLES
          MIME   = LT_MIME
        EXCEPTIONS
          OTHERS = 1.
    
      IF sy-subrc <> 0.
        RETURN.
      ENDIF.
    
      CALL METHOD CL_BCS_CONVERT=>SOLIX_TO_XSTRING
        EXPORTING
          IT_SOLIX   = LT_MIME
    *     IV_SIZE    =
        RECEIVING
          EV_XSTRING = LV_XSTRING.
    
      SELECT SINGLE VALUE INTO LV_MIME_TYPE
        FROM WWWPARAMS
        WHERE RELID = LS_FILEKEY-RELID
        AND OBJID = LS_FILEKEY-OBJID
        AND NAME = 'fileextension'.
    
      SELECT SINGLE VALUE INTO LV_FILENAME
        FROM WWWPARAMS
        WHERE RELID = LS_FILEKEY-RELID
        AND OBJID = LS_FILEKEY-OBJID
        AND NAME = 'filename'.
    
      CL_WD_RUNTIME_SERVICES=>ATTACH_FILE_TO_RESPONSE(
        EXPORTING
          I_FILENAME      = LV_FILENAME
          I_CONTENT       = LV_XSTRING
          I_MIME_TYPE     = LV_MIME_TYPE
          I_IN_NEW_WINDOW = ABAP_FALSE
          I_INPLACE       = ABAP_FALSE ).
    
    
    
    ENDFUNCTION.

    后来做FTP的时候就想到了另一个办法:

    文件上传下载类型的模板。。。

  • 相关阅读:
    Docker
    dcoker-componse-2
    MyBatis的基本使用
    SpringMVC实现文件上传和下载
    CF817E Choosing The Commander
    CSP 2020 游记
    COCI2014-2015 Contest#1 题目选做
    CF590D Top Secret Task
    LuoguP1937 [USACO10MAR]Barn Allocation G
    CF741C Arpa’s overnight party and Mehrdad’s silent entering
  • 原文地址:https://www.cnblogs.com/sapSB/p/7656535.html
Copyright © 2020-2023  润新知