Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Your new function module uses the new interface (Release 3.0 onwards), i.e. it stores the application data
in an internal table. Furthermore, the path without the ALE layer (i.e. without filters) is selected. These two
settings (new FM interface and processing without ALE layer) are identified by the value 3 in the TEDE1-
EDIVRS field, which is also read from RSNASTED.
The function module is called from Purchasing (create purchase order) in the same way as
IDOC_OUTPUT_ORDERS (IDoc type ORDERS01). It fills the segments of your new IDoc type, therefore,
from a purchasing table, i.e. EKKO (purchasing document header). Note that the intention here is not to
simulate a realistic purchase order, but merely to describe how data reaches an IDoc table from an
application table via segment structures.
Procedure
1. Using transaction SE37, create a new function module with the name IDOC_OUTPUT_TEST.
Specify the function group for the module. If you choose a new function group, it will be created
(confirm queries). In this example, the function group is simply called TEST.
2. Under the administration parameters, enter:
3. Choose the following parameters as an interface for the function module (similar to
IDOC_OUTPUT_ORDERS). Ensure that the parameters are globalized (choose Edit
Globalize parameters)
Import parameters
Table
Now create the following global data and form routines in the function group:
FILL_ITABLE_FOR_IDOC Fills internal table for IDoc (data records) with the
data from EKKO; fills the IDoc control record with
sender data
function idoc_output_test.
endfunction.
form read_application_area.
if sy-subrc ne 0.
raising error_message_received.
endif.
endform.
form fill_control_record.
control_record_out-direct = '1'.
control_record_out-serial = sy-datum.
control_record_out-serial+8 = sy-uzeit.
endform.
form fill_itable_for_idoc.
*----Fill item data segment with document number from EKKO
e1edk01-curcy = 'USD'.
"Fill (segment)
"data record
append int_edidd.
clear int_edidd.
clear e1test.
e1test-kontinent = 'America'.
int_edidd-segnam = 'E1TEST'.
append int_edidd.
clear int_edidd.
clear e1edp01.
e1edp01-posex = '10'.
int_edidd-segnam = 'E1EDP01'.
append int_edidd.
endform.
The HLEVEL (hierarchy level of segment) field in the administration section is not filled. This is
carried out by the IDoc interface which receives this value from the definition of the IDoc type
TESTER01.
The segment E1TEST in the INT_EDIDD-SEGNAM field must be written in upper case letters.
Otherwise, the IDoc interface will detect a syntax error.
tables:
EKKO,
E1EDK01,
E1TEST,
E1EDP01,
NAST,
T000.
4. Do not forget to activate your function module afterwards by selecting Function module
Activate from the initial screen of the Function Builder.
Result
You have now written a function module that fills your IDoc type with data in outbound processing. This
data is imported from the transparent table EKKO and the record in the transparent table NAST written
from Purchasing.
In the next step, this function module will be identified by a new process code which is then written to the
partner profiles. Proceed as described in the tutorial Assigning a New Process Code to a New Function
Module and Message (Outbound Processing).