ITPub博客

首页 > Linux操作系统 > Linux操作系统 > alv html alv pic

alv html alv pic

原创 Linux操作系统 作者:fengleihen 时间:2009-05-20 09:53:29 0 删除 编辑
REPORT  ZFENGLEIHEN_TEST.

TABLES: BKPF.

TYPE-POOLS: SLIS,SBDST, ABAP.

DATA: IT_BKPF LIKE TABLE OF BKPF WITH HEADER LINE.

DATA: IT_FCAT  TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
      W_TAB_GROUP  TYPE SLIS_T_SP_GROUP_ALV,
      W_LAYOUT     TYPE SLIS_LAYOUT_ALV,
      W_REPID      LIKE SY-REPID.
DATA: W_URL TYPE SBDST_URL.

PARAMETERS: P_BUKRS LIKE BKPF-BUKRS,
            P_GJAHR LIKE BKPF-GJAHR,
            P_BLART LIKE BKPF-BLART.

SELECT-OPTIONS: S_BUDAT FOR BKPF-BUDAT.

START-OF-SELECTION.
  PERFORM. DATA_GET.
  PERFORM. BUILD_FCAT.
  PERFORM. BUILD_LAYOUT.
  PERFORM. GET_URL.
  PERFORM. DISPLAY_ALV_REPORT.

*&---------------------------------------------------------------------*
*&      Form.  DATA_GET
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM. DATA_GET .

  SELECT *
    INTO TABLE IT_BKPF
    FROM BKPF
   WHERE BUKRS = P_BUKRS
     AND GJAHR = P_GJAHR
     AND BLART = P_BLART
     AND BUDAT IN S_BUDAT.

ENDFORM.                    " data_retrieval

*&---------------------------------------------------------------------*
*&      Form.  BUILD_FCAT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM. BUILD_FCAT .

  IT_FCAT-FIELDNAME   = 'BUKRS'.
  IT_FCAT-SELTEXT_L   = '公司代码'.
  IT_FCAT-DATATYPE = 'C'.
  APPEND IT_FCAT.
  CLEAR  IT_FCAT.

  IT_FCAT-FIELDNAME   = 'BELNR'.
  IT_FCAT-DATATYPE = 'C'.
  IT_FCAT-SELTEXT_L   = '会计凭证号码'.
  APPEND IT_FCAT.
  CLEAR  IT_FCAT.

  IT_FCAT-FIELDNAME   = 'GJAHR'.
  IT_FCAT-DATATYPE = 'C'.
  IT_FCAT-SELTEXT_L   = '会计年度'.
  APPEND IT_FCAT.
  CLEAR  IT_FCAT.

  IT_FCAT-FIELDNAME   = 'BLART'.
  IT_FCAT-DATATYPE = 'C'.
  IT_FCAT-SELTEXT_L   = '凭证类型'.
  APPEND IT_FCAT .
  CLEAR  IT_FCAT.

ENDFORM.                    " build_IT_FCAT

*&---------------------------------------------------------------------*
*&      Form.  BUILD_LAYOUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM. BUILD_LAYOUT .

  W_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
  W_LAYOUT-ZEBRA             = 'X'.

ENDFORM.                    " build_layout

*&---------------------------------------------------------------------*
*&      Form.  DISPLAY_ALV_REPORT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM. DISPLAY_ALV_REPORT .

  W_REPID = SY-REPID.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM          = W_REPID
      IS_LAYOUT                   = W_LAYOUT
      IT_FIELDCAT                 = IT_FCAT[]
      I_CALLBACK_HTML_TOP_OF_PAGE = 'TOPOF_PAGE'
      I_HTML_HEIGHT_TOP           = 40
    TABLES
      T_OUTTAB                    = IT_BKPF
    EXCEPTIONS
      PROGRAM_ERROR               = 1
      OTHERS                      = 2.
  IF SY-SUBRC <> 0.

  ENDIF.

ENDFORM.                    " display_alv_report
*&---------------------------------------------------------------------*
*&      Form.  TOPOF_PAGE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->I_DDOC     text
*----------------------------------------------------------------------*
FORM. TOPOF_PAGE USING I_DDOC TYPE REF TO CL_DD_DOCUMENT.

  DATA: LO_LINE     LIKE LINE OF I_DDOC->HTML_TABLE.
* Initializaion
  CALL METHOD I_DDOC->INITIALIZE_DOCUMENT.

  CLEAR: LO_LINE-LINE.
  LO_LINE-LINE = ''.
  APPEND LO_LINE TO I_DDOC->HTML_TABLE.

  CLEAR: LO_LINE-LINE.
  LO_LINE-LINE = '
'.
  APPEND LO_LINE TO I_DDOC->HTML_TABLE.

  CLEAR: LO_LINE-LINE.
  LO_LINE-LINE = '
'.
  APPEND LO_LINE TO I_DDOC->HTML_TABLE.

  CLEAR: LO_LINE-LINE.
  LO_LINE-LINE = '
'.
  APPEND LO_LINE TO I_DDOC->HTML_TABLE.

  CLEAR: LO_LINE-LINE.
  LO_LINE-LINE = ''.
  APPEND LO_LINE TO I_DDOC->HTML_TABLE.

  CLEAR: LO_LINE-LINE.
  LO_LINE-LINE = 'FENGLEIHEN ALV TEST'.
  APPEND LO_LINE TO I_DDOC->HTML_TABLE.

  CLEAR: LO_LINE-LINE.
  LO_LINE-LINE = '
'.
  APPEND LO_LINE TO I_DDOC->HTML_TABLE.

  CLEAR: LO_LINE-LINE.
  CONCATENATE ''
         INTO LO_LINE-LINE.
  APPEND LO_LINE TO I_DDOC->HTML_TABLE.

  CLEAR: LO_LINE-LINE.
  LO_LINE-LINE = '
'.
  APPEND LO_LINE TO I_DDOC->HTML_TABLE.

ENDFORM.                    "TOPOF_PAGE
*&---------------------------------------------------------------------*
*&      Form.  get_url
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM. GET_URL.

* OAOR 上传图片 并把change Attributes中的KEYWORDS设置成FENGLEIHEN_LOGO
  DATA: SIGNATURE  TYPE SBDST_SIGNATURE   WITH HEADER LINE,
        URIS       TYPE SBDST_URI         WITH HEADER LINE.

  MOVE: '1' TO SIGNATURE-DOC_COUNT,
        '1' TO SIGNATURE-COMP_COUNT.
  MOVE: 'BDS_KEYWORD' TO SIGNATURE-PROP_NAME,
        'FENGLEIHEN_LOGO' TO SIGNATURE-PROP_VALUE.
  APPEND SIGNATURE.
  CALL METHOD CL_BDS_DOCUMENT_SET=>GET_WITH_URL
    EXPORTING
      CLASSNAME    = 'PICTURES'
      CLASSTYPE    = 'OT'
      URL_LIFETIME = 'T'
    CHANGING
      URIS         = URIS[]
      SIGNATURE    = SIGNATURE[].
  READ TABLE URIS INDEX 1 .
  IF SY-SUBRC = 0 .
    W_URL = URIS-URI .
  ENDIF .

ENDFORM.                    "get_url

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/139677/viewspace-600525/,如需转载,请注明出处,否则将追究法律责任。

上一篇: TEMP
请登录后发表评论 登录
全部评论

注册时间:2009-03-31

  • 博文量
    24
  • 访问量
    26538