Use
In BAPIs that cause database changes (for example, Change() and Create() BAPIs), you must be able to distinguish between parameter fields that are to be modified (change-relevant fields) and parameter fields that are to remain unmodified.
Using an initial value is no solution because an initial value could also represent a valid new value. Also, in the ABAP programming language as well as on other development platforms, the value "NULL" should not be assigned to a data type to indicate an empty field.
Standardized change parameters are used to identify fields with modified values in Change() and Create() BAPIs. You can do this in two ways:
Flagging Fields to Identify Fields Containing Modified Values
In this approach parameter fields containing modified values are identified by including a flag in an additional "change parameter".
This way the BAPI can identify both modified and unmodified fields in the parameter.
Follow the conventions below when you create change parameters to identify modified fields:
This value means that the corresponding parameter field contains a modified value.
This means that the corresponding parameter field does not have to be updated.

A Change() BAPI is used to change the value of the existing distribution channel (Distr_Chan) to Distr_Chan="US". The fields that have been changed should be identified by flagging them.
The program objects in the R/3 System affected by this change are:
Program Object |
Name |
SAP business object type |
PieceOfEquipment |
BAPI |
Change |
Parameter |
EquiSales |
Fields in parameter |
SalesOrg =0001' |
|
Distr_Chan='US' | |
|
Division=' Marketing' | |
Change parameter that identifies modified fields |
EquiSalesX |
Fields in parameter |
SalesOrg=' ' |
|
Distr_Chan='X' | |
|
Division=' ' |
In the parameter EquiSalesX the value in the field Distr_Chan is 'X'. This indicates that the field Distr_Chan of the parameter EquiSales contains a modified value (US).
The Change() BAPI then overwrites the existing value in the field Distr_Chan with the current value in the field Distr_Chan in the parameter EquiSales.
Comparing Fields to Identify Fields Containing Modified Values
In this approach fields containing modified values are identified by comparing two parameters, one containing the current valid data and the other the new, modified data.
When the Change() BAPI is called, the current data in the database and the new, modified data must be entered in the corresponding parameters. The current data set can be transferred, for instance, from a GetDetail() BAPI that has been called.
The following comparisons can be made:
Note the following when you are comparing fields containing modified data.
For example, if the parameter with the current valid data is called EquiSales, the parameter with the modified data is called EquiSalesNew.

A Change() BAPI is used to change the value of the existing distribution channel Distr_Chan="US" to Distr_Chan="EN". The fields containing modified should be identified by comparing them.
The program objects in the R/3 System affected by this change are:
Program Object |
Name |
SAP business object type |
PieceOfEquipment |
BAPI |
Change |
Parameter |
EquiSales |
Fields in parameter |
SalesOrg =' 0001' |
|
Distr_Chan='US' | |
|
Division=' Marketing' | |
Parameter for the new data |
EquiSalesNew |
Fields in parameter |
SalesOrg=' 0001' |
|
Distr_Chan='EN' | |
|
Division=' Marketing' |
The fields are compared by:
Which is the Best Way?
The table below compares the two ways of identifying fields containing modified values in BAPIs, as described above, and should help you decide which way suits your requirements best.
Area |
Comments |
Performance |
Flagging fields: The flag table can be compressed. Data does not have to be compared.If using in a distributed environment (ALE) the amount of data to be transported by flagging fields is not significantly greater. |
Programming |
Flagging fields: BAPI programming is simpler. |
Check facilities |
Comparing fields: Can check against current database to identify and prevent inconsistencies. |
Comprehension |
Flagging fields: Fields containing modifications can be flagged, meaning less demands are placed on the caller. |
Comparison with related data |
Comparing fields: Need to compare with the associated GetDetail() method of the business object type, because all the fields in the Change BAPI() must filled by the calling program. |
Application |
Flagging fields: Better for performance critical applications.Comparing fields: Better for dialog-orientated applications with critical data. |