通常我们在做smartforms时都會自己建一个结构,以方便适用,
但是有时候多建个结构很麻烦,
我们在程序里都建了Internal table的结构了,
其实我们可以不建这个结构。
在smartforms的 global settings->global definitions 里有个 types。
我们可以在这里定义一个和程序里Internal table一样的结构。
但是,在form interface 里定义参数的时候不是刚才定义的结构,激活的时候会报错。
例如:在程式中定义一个Internal table
*** Internal table for item
DATA: BEGIN OF it_item OCCURS 0,
ebeln LIKE zpudnrlma0001-ebeln,
ebelp LIKE zpudnrlma0001-ebelp,
matnr LIKE ekpo-matnr,
maktx LIKE makt-maktx,
menge LIKE ekpo-menge,
meins LIKE ekpo-meins,
lgort LIKE ekpo-lgort,
lgpbe LIKE mard-lgpbe,
werks LIKE ekpo-werks,
labst LIKE mard-labst,
END OF it_item.
转data到smartforms
CALL FUNCTION func_module_name
EXPORTING
control_parameters = control_parameters
wa_header = wa_header
it_item = it_item[]
IMPORTING
document_output_info = l_ssfcrespd
EXCEPTIONS
user_canceled = 4.
到smartforms定义Internal table
path: global settings->global definitions->types
*** Internal table for item
TYPES: BEGIN OF st_item,
ebeln LIKE zpudnrlma0001-ebeln,
ebelp LIKE zpudnrlma0001-ebelp,
matnr LIKE ekpo-matnr,
maktx LIKE makt-maktx,
menge LIKE ekpo-menge,
meins LIKE ekpo-meins,
lgort LIKE ekpo-lgort,
lgpbe LIKE mard-lgpbe,
werks LIKE ekpo-werks,
labst LIKE mard-labst,
END OF st_item.
TYPES: tt_item TYPE STANDARD TABLE OF st_item.
然后再定义smartforms的Internal table
path: global settings->form interface->import
IT_ITEM TYPE TT_ITEM
输出时用& IT_ITEM-ebeln&就可以了.
欢迎关注订阅号:SAP学习记录 (SAPlearning )