不用SE11建Structure傳Internal Table到Smartforms的方法

qiujun發表於2007-09-22

通常我們在做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&就可以了.

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/90072/viewspace-970891/,如需轉載,請註明出處,否則將追究法律責任。

相關文章