Online Tutorials & Training Materials | STechies.com
Register Login

BAPIs related Error messages, tips & tricks and FAQ

|| 0

BAPIs related Error messages, tips & tricks and FAQ
Stechies

1.) When you use BAPIs or the corresponding function modules for these BAPIs, error messages occur even though the user is certain that he has entered all data correctly. Error messages are output, stating that a product, location, resource, PPM, GUID, order or another object cannot be found.

Problem: Error messages are output, stating that a product, location, resource, PPM, GUID, order or another object cannot be found.

Solution:

- Check that you have filled all relevant fields.For example, in many cases you need to specify the location type in addition to the location (LOCTYPE field) in order to identify a location explicitly.

- If an object (such as location) could not be found, even though you are sure that it exists, this may be due to problems with upper/lower case, leading zeros or spaces.Note that an object is displayed (such as product) in the APO system with the internal key, whereas the external code is usually used in the BAPIs.
For more detailed information, see the documentation on the BAPIs (Function module documentation) under the "General information" section, with particular reference to the part on "Using GUIDs".Refer in particular to the points "internal / external key" and "Special features of different data elements".

-If you are accessing an object via its GUID, note that you usually need to specify the 32-digit GUID here instead of the 22-digit GUID.

For conversions, you can use the 'GUID_CONVERT' function module.

For more detailed information, see the documentation on the BAPIs (Function module documentation) under the "General information" section, with particular reference to the part on "Using GUIDs".

- Since the external keys are mainly used in the BAPIs (for products and locations, for example) the external keys are mapped onto the internal keys in the BAPIs.The logical system (LOGICAL_SYSTEM field) is used so that you can decide which external system to apply the mapping to.If an incorrect logical system is specified, an object key may not be found (e.g. resource).

For more detailed information on the meaning of the logical system, refer to the LOGICAL_SYSTEM field in the BAPI documentation.

- Notes for consultants:The mapping entries are saved in the following tables.Using these, you can check whether or not a particular entry exists for an object and whether the correct key was specified.

You can also use them to check whether an object is not found simply due to leading zeros or spaces.In the case of most BAPIs, you must indicate the external key as described above.

Product:   /SAPAPO/MATMAP
Location:  /SAPAPO/LOCMAP
Resource: /SAPAPO/RESKEY
Plan:      /SAPAPO/PLANMAP

***********************************************************************
Problem: An error message is output that may appear meaningless at first, or several error messages may be displayed.

Solution:

- This may be a followup error.This means that an error causes a series of other error messages (for example, because a field was not filled correctly).Here, it is recommended that you analyze the errors that occurred first.

- Also check whether all relevant required entry fields for the BAPIs have been filled.

***********************************************************************

2.) No error messages occur when you are using BAPIs or the function modules related to these BAPIs.

Solution:

- You may be using a BAPI with external COMMIT- control.This means that the COMMIT or ROLLBACK is not executed in the BAPI, but must be carried out in the calling program instead.The data is not updated either, if no COMMIT is sent after you call a BAPI with the external COMMIT- control.As a result, the BAPI does not return an error message since it was called correctly.

BAPIs usually have an external COMMIT control.

If the BAPIs have an internal COMMIT control instead, this is described in the related BAPIs.More detailed information about the update or transaction concept for BAPIs is available in the BAPI programming guide.You can find this, for example, in the BAPI Explorer (transaction BAPI) in the menu item for documentation.

With reference to the BAPIs in APO, most BAPIs for master data (e.g. product, location, PPM) have an external COMMIT control, while the BAPIs for movement data have an internal COMMIT control.

Some BAPIs also have a COMMIT_CONTROL field which you can used to control the COMMIT behavior.

The business object 'BapiService' (SAP0001) and methods 'TransactionCommit' or 'TransactionRollback' are available for sending a COMMIT WORK or ROLLBACK WORK from an external system.

- Many BAPIs contain change parameters that you can use to specify which fields of an object you want to change.Usually, these change parameters have the same name as a normal BAPI table parameter, except that another'X' was added (e.g. LOCATION_HEAD and LOCATION_HEAD_X).

If individual fields of an object are not changed, this can be because no entries were made in the change parameter.

For more detailed information, see the documentation on the BAPIs (Function module documentation) under the "General information" section, with particular reference to the part on "Using GUIDs".In particular, refer to the point "Change parameter (X fields)".

Documentation on the change parameter is usually also contained in the BAPI itself.

********************************************************************

3.) You do not know which BAPIs are available in a particular APO release and how to obtain the documentation for this BAPI.

Solution:

- All available BAPIs for the APO are listed in the BAPI-Explorer (transaction BAPI).When you call the BAPI-Explorer, only released BAPIs are displayed as standard.The relevant BAPI and its parameter is documented in the BAPI- Explorer, which also contain references to general BAPI documentation.References to general BAPI documentation are also provided.

- -Alternatively, these BAPIs are contained in the Interface Repository (http://ifr.sap.com).This includes all BAPIs released for APO, as well as BAPIs that can be used, but for which there are no guarantees of compatibility.

The documentation on the individual BAPIs and their parameters is also provided here.

- Before you use a BAPI, we recommend that you read the relevant BAPI documentation (which tells you what the BAPI can be used for).This usually also contains documentation on most of the BAPI parameters. This mainly provides information on the fields that must be used for a parameter and which ones are optional.

Most BAPIs also contain a reference to "General information" which provides additional important information that applies to many BAPIs in APO.

********************************************************************

4.) When you use the ALE/IDOC interfaces of the BAPIs or when you call the BAPIs from a non-SAP system or ABAP, the BAPI appears to behave incorrectly, even though the BAPI worked without problems in previous tests (SE37, for example).

Problem: A BAPI was tested with transaction SE37 or another test function of the ABAP Workbench.During these tests, the BAPI works perfectly, but problems still occur despite apparently identical data when you call it from a program or via the ALE/IDOC interface.

Solution:

Note that calling the BAPIs from SE37 or a test workbench is not identical to how you call the BAPIs from a program or using the ALE/IDOC interface.

There are differences in the following areas:

- When you enter data in SE37 or the test Workbench, conversion exits (if present) are run for each of the fields during input or output.These conversion exits will not run if a BAPI is called from a program.In SE37, a conversion exit can initiate a conversion in upper case, or allow date fields to be entered as 12/23/2001, for example, while the actual format in the BAPI is 20011223. Entering 12/23/2001 as the date in a BAPI would not be allowed.For more detailed information, see the documentation on the BAPIs (Function module documentation) under the "General information" section, with particular reference to the part on "Using GUIDs".

For more detailed information, see the documentation on the BAPIs (Function module documentation) under the "General Information" section, with particular reference to the part on "Special features of different fields".

- Some import parameters are defined as "optional" in the function module of a BAPI and have default values.

However, these default values are only set if the BAPI is called from ABAP or SE37 and the parameter was not specified during the call.

If you call the BAPI via an ALE/IDOC interface or from an external system, these default values are not set.We therefore recommended that you specify the import parameters explicitly and fill them with the relevant default values if you are calling the BAPI using an ALE/IDOC interface or from an external system.

********************************************************************

5.) When you call a BAPI, it returns messages in the parameter RETURN.However, only the short text of the message is contained in the parameter and you want to see the long text of the message.This may be the case, for example, if the short text is not adequate enough to describe the problem and its solution.

Problem: Long texts for messages in the RETURN parameter.

Solution:

In the RETURN parameter of the BAPIs, only the short text is contained in the MESSAGE field.To keep the long text for this message (provided this exists), you have the following options:

Use the "BapiService.MessageGetDetail" BAPI (BAPI_MESSAGE_GETDETAIL function module).By calling this BAPI, you get the particular long text for a message in the RETURN parameter.

If an application log was written when you called the BAPI, you can see the long text in the application log (this depends on the BAPI).You can display the application log through transaction /SAPAPO/C3.By specifying the object, subobject, external number or program, you can restrict which log entries should be displayed.

For developers only:Using transaction SE91, you can also display individual messages and their long text.The particular variables are not displayed here, however.

********************************************************************

6.) When using "GetList" methods or the corresponding function module, no data is selected and, in addition, error messages are not returned in the RETURN parameter.

Problem: A "GetList" method does not select any data.

Solution:

Check the following points:

Are you using the correct method for the selection?Note that there are separate methods for selecting according to stocks, in-house production orders, procurement orders and sales orders.

Did you specify a valid selection combination?You can find out what valid selection combinations are from the documentation.

Is the specified logical system (LOGICAL_SYSTEM field) correct?If the selection is made according to order numbers (for example, ORDER_KEYS parameter), only orders for the specified logical system are selected.

When selecting according to order numbers:Is the length of the order number and the format right?Are leading zeros possibly used?Note that leading zeros are not displayed in the APO system.The order numbers must be specified exactly.For example, this differentiates whether a blank character was more or less specified in the order number.To find out which format the orders are saved in, you can use the liveCache Datebrowser (/SAPAPO/OM16) or you can first make a selection according to products/locations to get the orders.

When selecting according to products/locations:Is the specified logical system correct?Were the products/locations created for the same SAP system group?The importance of the logical system is documented in the relevant "GetList" method.

********************************************************************

7.) It is not clear which messages are returned in the parameter RETURN when you call a "request" method ("RequestList", for example).

Problem:

It is not clear which messages are returned in the RETURN parameter when you call a "request" method ("RequestList", for example).

Solution:

As described in the relevant documentation, the "request" method is used in conjunction with the corresponding "Receive" method to model a synchronous call (such as this "GetList") asynchronously (for example, using "RequestList" and "ReceiveList").

In the parameter RETURN of the "Request" method, only those messages that are not from the synchronous method are returned ("GetList", for example).These could, for example, be messages if errors have occurred during the target system determination or communication errors during the call of the "Receive" method.

You will also find additional information on the use of these methods in the documentation of these methods (RequestList, for example) or the corresponding function modules.