You are on page 1of 7

General BAPI Interview Questions

1) Define BAPI?

BAPI is a standardized programming interface (method) which enable external


applications to gain access to business processes and data in the R/3 System.

2) What is full form of BAPI or BAPI stands for?

BAPI stands for Business Application Programming Interface.

BAPI For Goods Movements Interview Questions


Q1: Where can I find the documentation for calling the
BAPI_GOODSMVT_CREATE BAPI?

Information about the fields that must be filled for the call
of BAPI_GOODSMVT_CREATE can be found in the documentation under the
following menu path:

Transaction BAPI
-> Materials Management
->Inventory Management
->GoodsMovement
Choose 'CreateFromData' and go to the 'Documentation' tab page

Q2: Which function modules must be called after the BAPI is called to
complete the posting once the material document has been created
successfully? What should I do if there is an error?

The BAPI returns a return table for the error handling, that is, if the posting is
incorrect, this table contains an entry describing the cause of the error. The 'caller' is
responsible for evaluating this table and for triggering the update that is dependent
on this.

If the posting is correct (return table is initial), a 'Commit Work' must be carried out
in order to complete the posting. To do this, call BAPI_TRANSACTION_COMMIT.

The Commit or rollback always applies to the current LUW (Logical Unit of Work).
Therefore, you must make sure that it is carried out at the correct point in the source
code. More information about this is available in the documentation for
BAPI_TRANSACTION_COMMIT or ..._ROLLBACK.

Q3: What do I need to bear in mind when I call BAPI_GOODSMVT_CREATE


with a material number and a reservation number at the same time?

The material for which you want to carry out a goods movement must be the same as
the material in the reservation:

If you assign a reservation number to the BAPI during the call, the system must read
the data from this reservation. This is necessary to be able to update the reservation
correctly. The BAPI only updates the quantity fields, other reservation fields are not
affected.
If the material for the goods movement is not the same as the material from the
reservation, the system updates the quantities for the wrong material. Availability
checks, ATP (Available-to-Promise) and so on refer to the reservation data. Therefore,
it is important to update the reservation for the correct material. Otherwise, these
checks do not work. If the materials do not match, the system issues error message
M7 042.

If the information from the reservation is no longer valid, for example, because the
material has been replaced with a substitute, you should change this reservation
accordingly. You can then call the BAPI with reference to this reservation.

Q4: When I call BAPI_GOODSMVT_CREATE, the system issues one of the


following error messages:

- M7 096: "Goods movement not possible with mvmt type &"


-'Incorrect update control of the movement type (Entry 101 X X)'.

Which fields do I have to fill when calling the BAPI to avoid this error?

The system checks the combination movement type - allowed transactions. Make sure
that you assign a GM_CODE to the BAPI for the required transaction.

Q5: Can I assign a wildcard '*' for the storage location/the batch to the
BAPI, which I can then use for the warehouse stock or batch determination?

No. The determination must take place before the BAPI is called to be able to provide
it with the required information. If you assign a wildcard '*' to the BAPI for the
storage location/batch, the system issues an error message.

Q6: Can I assign the SPEC_MVMT special movement indicator for warehouse
management (displayed as BSSKZ in the program) to the BAPI during the
call?

No, this is not possible:

The SPEC_MVMT field is available as of Release 4.6C or higher. Due to the BAPI
guidelines, you cannot change structure BAPI2017_GM_ITEM_CREATE in Hot Package
systems. One consequence of this is that, for example, it may no longer be possible
to generate the respective IDoc with message type MBGMCR.

Alternatively, you can use the IDoc of message type WMMBXY since structure
E1MBXYJ contains field BSSKZ here.

Note that the BAPI cannot process different special movement indicators at item
level. This function is available only in transaction MIGO. The BAPI, message types
WMMBXY and MBGMCR and the older MB* transactions do not provide this function.
In this case, only one different special movement indicator can be used for each
posting.

Q7: When I try to post a goods receipt for the purchase order using a BAPI,
the system displays error message M7 021 'Deficit of & & & &'. The goods-
receipt based verification is active, and the item in the purchase order may
have already been cancelled once. Which fields do I have to fill when calling
the BAPI to avoid this error?
In this case, you must also transfer fields LFBJA, LFBNR and LFPOS from the purchase
order history (table EKBE); otherwise, the system cannot find the correct document.
Even though this note refers to an IDoc processing, the same logic also applies to
BAPI_GOODSMVT_CREATE.

Fill fields GOODSMVT_ITEM-REF_DOC_YR, GOODSMVT_ITEM-REF_DOC and


GOODSMVT_ITEM-REF_DOC_IT in the BAPI interface and test the system behavior
again.

Q8: When I create a goods receipt for a subcontract order, the system should
explode the bill of material (BOM) in the background. If the subcontracting
components are in special stock O with batch, the BAPI returns error
message M7 018 'Enter batch'.Can I assign a batch number to the BAPI
during the call?

You cannot assign the batch for the component to the BAPI.

You must already specify the batch in the purchase order or you must set the batch
determination in such a way that it runs in the background.

You cannot transfer 'Dummy' lines with the batches for the components to
MB_CREATE_GOODS_MOVEMENT.

The BAPI uses the MB_CREATE_GOODS_MOVEMENT function module for the goods
movement/posting. Only the 101 posting line, for example, is transferred to this
function module. The individual components are not yet known at this time, they are
dynamically determined at a later stage and then proposed by the
ME_READ_COMP_GOODS_RECEIPT function module. Now the system notices that a
component is to be handled in batches and prompts you to enter a batch. In a dialog
posting (transactions MIGO/MB01), you can enter a batch. However, when you are
using the BAPI , the system issues the error message asking you to enter a batch
(see Note 329367).

The same technical restriction also applies to the batch input (for more information,
see Note 40176) and when you are using transaction MIGO up to and including
Release 4.6B (see Note 213318).

Note: As of Release 4.70, you can


also assign the subcontracting components to the BAPI.
For more detailed information, refer to the documentation for method
CreateFromData.
Call transaction BAPI 'BAPI Explorer -> Materials Management
-> Inventory Management -> GoodsMovement -> CreateFromData ==>
Subcontracting components transfer.

Q9: What do I have to keep in mind if I want to trigger the print output of a
goods receipt or goods issue document when I execute the BAPI?

You must make sure that a username is transferred in the PR_UNAME field in the
header structure. This user is used for determining the print parameters. You must
set the value 'X' for the 'NDR' parameter ID for this user. Make sure that all
customizing-related settings have been made for this user.
The GOODSMVT_CODE import parameter is relevant for the print version. The
transaction code is derived from this code (see table T158G, for example, code 04
stands for MB1B). The BAPI uses the print version that is assigned to this transaction
for the goods receipt/goods issue document. This is customized in transaction OMBR.
Check your Customizing and make sure that you have assigned a print version to this
transaction and that a conditional output record exists.

Q10: If you try to execute a goods movement using the Business Connector
and you call the BAPI using Remote Function Call (RFC), this returns a
material document. However, this document does not exist in the R/3
system. What should I do?

The call of BAPI_GOODSMVT_CREATE using RFC does not work because an RFC also
creates a new LUW (Logical Unit of Work). As a result, no Commit or rollback can
take place with reference to this BAPI and therefore, the posting cannot be carried
out.

Instead of a call using RFC, a report can be written that calls the BAPI and then
executes a Commit or a rollback depending on the contents of the return table.

Q11: When I call BAPI_GOODSMVT_CREATE using Visual Basic, the system


does not fill and return the return parameters or any other return value.
What are the reasons for this and what do I have to keep in mind?

To be able to use this BAPI in Visual Basic, you must have SAP BAPI Wizard Type
Library Version 4.5A or higher installed on your system.

In the interface for the R/3 system in Visual Basic, make sure that you specify all
numeric parameters with leading zeros because, unlike in R/3 systems (for example,
transactions SE37 and SE16), this is not linked to any automatic field conversion.

Q12: How can I determine the transaction code that is used by


BAPI_GOODSMVT_CREATE to create the corresponding material document?
Why does the system carry out the posting using an 'older' transaction code
instead of transaction MIGO?

The BAPI uses the T158G table to determine which transaction code is to be used.

The BAPI is available as of Release 4.5. Some transactions, for example transaction
MB01, still exist in Release 4.6. Since there is no difference in the continuous
program components, it is irrelevant whether you use transaction MB01 or
transaction MIGO to carry out the posting.

Q13: Which goods movements should I not post using the


BAPI_GOODSMVT_CREATE BAPI?

You should not post the goods receipt for the inbound delivery using
BAPI_GOODSMVT_CREATE BAPI because the document base and the status of the
inbound delivery are not updated.

Q14: What do I have to consider with goods receipts for purchase orders
that are subject to acknowledgement?
You want to use the BAPI to post a goods receipt for a purchase order that is subject
to acknowledgement.The goods receipt always updates the first order
acknowledgement.

Background: At present, you cannot assign the sequence number for the purchase
order confirmation (EKES-ETENS) to the BAPI at item level in the interface. For this
reason, the system posts all goods receipts against the first order acknowledgement.

Q15: Why do data inconsistencies occur in the previous period after you use
the BAPI_GOODSMVT_CREATE BAPI to post goods movements even though
the data of the current period is consistent?

These data inconsistencies can occur under the following conditions:


A customer-specific transaction exists that uses the BAPI_GOODSMVT_CREATE BAPI
to post goods movements.
There is no guarantee that each goods movement is carried out with a new roll area
in this program.
The users use this transaction and post several goods movements (sometimes for the
same material) in succession without leaving this transaction.
- In Customizing for materials management, "Late Lock" is activated.
In transaction MMPV 'Close Periods', the period is closed during the dialog mode,
before the last day of the month.
Postings with the BAPI_GOODSMVT_CREATE BAPI after the period closing program
runs can cause data inconsistencies in the previous period.

There are two ways to correct this:

1. Implement the modification from Note 194070.


2. The customer-specific program must be designed in such a way (similar to Note
369518) that a new and initial roll area is used whenever you call the
BAPI_GOODSMVT_CREATE BAPI.

Q16: Can BAPI_GOODSMVT_CREATE create a new batch and maintain the


data of the classification at the same time?

As of Release 4.7, use BAPI_BATCH_SAVE_REPLICA to create a new batch with


classification data. Up to Release 4.6C, you can use BAPI_OBJCL_CHANGE.

BAPI in Sales - Interview Questions


1. Question: What can I use the BAPIs in module SD-SLS for?

Answer: BAPIs are RFC-enabled function modules that form a programming interface
to R/3 functions, you can use them to carry out the following sales activities without
dialogs:

- Create and partially change customer inquiries, customer quotations and sales
orders
- Simulate sales orders
- Determine the sales order statuses
- Create a list of orders for the customer

2. Question: How do I find general information on the use of the BAPIs?


Answer: Use the BAPI user guide of the SAP online help to find general information
on the use. To find special information on individual BAPIs and their parameters, you
can use Transaction BAPI or the function module documentation.

3. Question: How can I test a BAPI?

Answer: Goto Transaction SE37 ->Use the Function Builder. Carry out a 'Single test'
(F8) for the corresponding function module. Fill the BAPI parameters in the test
program and execute (F8). Before you do this, you can save the test data so that you
can call them up again using the 'Test data directory' pushbutton. To fix the data on
the database, also link the TRANSACTION_COMMIT BAPI in a test sequence.

4. Question: Which fields are mandatory during the creation of an order and
how do I use the structure (checkbox structure)?

Answer: During the creation, the fields for order type, sales area and sold-to party
are mandatory. The use of the checkbox structure is not mandatory. You can use it to
make sure that only the selected fields are processed. Exception: The checkbox
structure for schedule lines should always be used.

5. Question: Which fields are mandatory during the change of an order and
how do I use the structure (checkbox structure)?

Answer: To change a document, it is absolutely necessary that you enter the


document number and set the update flag of the structure on header level ('U'). In
addition, (only) the fields to be changed have to be specified.

6. Question: The BAPI was processed successfully. Why does the document
still not exist or why was it not changed?

Answer: BAPIs do not execute a COMMIT WORK command that triggers the update.
This is done by the calling program. For this purpose, use the
BAPI_TRANSACTION_COMMIT BAPI.

7. Question: Why do the items in the generated order not have quantities?

Answer: Quantities and dates must be maintained for BAPIs using the schedule line
data. There you must use the item number to specify the reference to the item.

8. Question: How do I find the corresponding field of the BAPI structures for
a given field name of the database or online transaction or vice versa?

Answer: Start Transaction BAPI or SE37 to go from the detail view of a BAPI
parameter to the ABAP Dictionary by means of a double-click. The component type
(the data element) of the component indicates the corresponding DB field. BAPIs use
Include LVBAKF0C to execute the mapping from the external BAPI format into
internal communication structures. Here, you can find the corresponding field names
using a text search and derive the corresponding database tables (VBAKKOM -> DB
table VBAK and so on).

9. Question: In which format does the data have to be transferred to the


BAPI parameter so that it can be processed correctly?

Answer: This depends on the data type of the activated field. Consider that some
fields are translated by the screen processor during the single test in Transaction
SE37. If you assume that there is an error, you can find out by means of a debugging
of the single test from Transaction SE37 in which format the screen processor fills the
parameters.

You might also like