A key parameter is used to model the situation where the BAPI has got an additional
parameter that has to be supplied by a (logical) key field. This is necessary if the name of
the corresponding BAPI parameter is not identical to the name of the (logical) key
field.
Prerequisites
The following conditions have to be fulfilled:
- A method has to be flagged as an API method.
- For the corresponding BAPI, a new parameter has been defined due to an incompatible change
to a key field.
- This parameter is not yet mapped to a method parameter or key field.
Context
To specify a Key parameter, proceed as follows:
Procedure
- Open the parameter list of an API method and create a new parameter:

Figure 1:
Screen for defining the parameters of the BUS1017 object type
A dialog appears in which the name of the (logical) key field as well as the name of
the BAPI parameter can be chosen from drop-down lists.
- Choose the relevant names from the lists and confirm the dialog.
The new key parameter is added to the parameter list.
- Ensure that the if_swo_key_converter~get_key_field_from_parameters method is implemented correctly.
This method computes the current value of a key field from BAPI parameters.
Calls of the BAPI function module can use the old parameter that was used for the original
key field and/or the new parameter that corresponds to the current key
field.
This method is to compute the correct value of the key field based on the passed parameter
values. The default implementation is straightforward and illustrates what
the method is supposed to do:
method if_swo_key_converter~get_key_field_from_parameters.
if i_new_key_field_value is not initial.
r_current_value = i_new_key_field_value.
else.
r_current_value = i_old_key_field_value.
endif.
endmethod.
If the key change is a pure length extension, this default implementation is already
sufficient. This method has to be redefined if more sophisticated mappings
are required. This is the case, for example, for the material number in the
context of DIMP-LAMA.
Results
The object type can now be used for IDocs.