1.创建函数组
2.创建函数
3.函数中参数的定义 和属性的维护
4.函数代码
FUNCTION zfc_test.
*"----------------------------------------------------------------------
*"*"本地接口:
*" IMPORTING
*" REFERENCE(I_VBELN) TYPE VBELN_VA
*" EXPORTING
*" REFERENCE(E_VBAK) TYPE VBAK
*" TABLES
*" T_VBAP STRUCTURE VBAP
*" EXCEPTIONS
*" SALES_NOT_EXIT
*"----------------------------------------------------------------------
*抬头数据
SELECT SINGLE * FROM vbak INTO e_vbak WHERE VBELN = I_VBELN.
IF sy-subrc <> 0.
RAISE sales_not_exit.
ENDIF.
*项目数据
SELECT * FROM vbap INTO TABLE t_vbap.
ENDFUNCTION.