smartforms调用自定义内表
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
用方法2自己编了一个小例子,写得不好老鸟不要嘲笑。
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 方面我就截图了
全局设置->表格接口
全局定义->类型
全局定义->全局数据
全局定义->初始化
全局定义->格式化程序。