smartforms如何调用自定义内表

1.程序方面:
*&---------------------------------------------------------------------*
*& Report  ZTEST001_ABAP08
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ztest001_abap08.

INCLUDE zinc_sf_helper .

DATA: BEGIN OF it_itab OCCURS 0,
        num1 TYPE i,
        num2 TYPE i,
        num3 TYPE i,
      END OF it_itab.

START-OF-SELECTION.
  PERFORM frm_get_data.
  PERFORM frm_print_data.

*&---------------------------------------------------------------------*
*&      Form  frm_get_data
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM frm_get_data.
  DO 20 TIMES.
    it_itab-num1 = it_itab-num1 + 1.
    it_itab-num2 = it_itab-num2 + 2.
    it_itab-num3 = it_itab-num3 + 3.
    APPEND it_itab.
  ENDDO.
ENDFORM.                "frm_get_data

*&---------------------------------------------------------------------*
*&      Form  frm_print_data
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM frm_print_data.
  DATA: m_fm TYPE rs38l_fnam.
  DATA: headername(22) TYPE c.
  DATA: itemsname(22) TYPE c.
  DATA: c_tst(22) TYPE c.
  DATA: l_tst TYPE timestampl.

  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname           = 'ZTEST001_ABAP08'
    IMPORTING
      fm_name            = m_fm
    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.
  ENDIF.

  GET TIME STAMP FIELD l_tst.    "long form
  MOVE l_tst TO c_tst.

  CONCATENATE 'ZTEST001_ABAP08' c_tst+8(14) INTO itemsname .
  savebuffer it_itab[]  itemsname .  如果要传入多个表的数据就接着savebuffer
* savebuffer xxxxxxxxxxxxxxxxxx.


  CALL FUNCTION m_fm
    EXPORTING
      ptr_items        = itemsname  "这里可以传入多个表,和方法1中的接口使用是一样
*   xxxxxxxx         = xxxxxxxxxx
    EXCEPTIONS
      formatting_error = 1
      internal_error   = 2
      send_error       = 3
      user_canceled    = 4
      OTHERS           = 5.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

  clearbuffer itemsname .
ENDFORM.                    "frm_print_data

2.INCLUDE部分
*&---------------------------------------------------------------------*
*&  包括                ZINC_SF_HELPER
*&---------------------------------------------------------------------*

TYPES buffer_id(80) TYPE c.
DATA wa_indx TYPE indx.

DEFINE savebuffer.
  perform save_to_buffer using &1 &2.
END-OF-DEFINITION.

DEFINE clearbuffer.
  perform clear_buffer using &1.
END-OF-DEFINITION.
*&--------------------------------------------------------------------*
*&      Form  Get_Unique_Id
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
*      -->ID         text
*---------------------------------------------------------------------*
*FORM get_unique_id USING typeid TYPE c CHANGING id TYPE c.
*  DATA: m_buff(32) TYPE c.
*  CALL FUNCTION 'TH_GET_SESSION_ID'
*   IMPORTING
*     session_id       =  m_buff
**     ID_LEN           =
*            .
*  CONCATENATE sy-repid '_' m_buff typeid INTO id.
*ENDFORM.                    "Get_Unique_Id


*&--------------------------------------------------------------------*
*&      Form  Save_To_Buffer
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
*      -->T          text
*      -->BUFF_ID    text
*---------------------------------------------------------------------*
FORM save_to_buffer USING t TYPE table typeid TYPE c .
wa_indx-aedat = sy-datum.
wa_indx-usera = sy-uname.
wa_indx-pgmid = sy-repid.
*  PERFORM get_unique_id USING buff_id CHANGING buff_id.
  EXPORT t TO DATABASE indx(hk) ID typeid from wa_indx.
ENDFORM.                    "Save_To_Buffer

*&--------------------------------------------------------------------*
*&      Form  Clear_Buffer
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
*      -->BUFF_ID    text
*---------------------------------------------------------------------*
FORM clear_buffer USING buffid TYPE c.
  DELETE FROM DATABASE indx(hk) ID buffid.
ENDFORM.                    "Clear_Buffer

form Restor_buffer using typeid type c changing t type table.
import t from database indx(hk) id typeid.
endform.

3.smart form 方面我就截图了
全局设置->表格接口



你可能感兴趣的:(session,function,Module,database,buffer,Types)