Abap Faq,Reports,Scripts,Lsmw,Bdc, Smart Forms,Ale Idocs,Badi,User Exits,Bapis,Performance Tunning,Debugger,Sample Programs.
Wednesday, August 8, 2007
What is the difference between a BAPI,Idoc and an RFC?
BAPI stands for Business Application Programming Interface. It is a library of functions that are released to the public as an interface into an existing SAP system from an external system.
RFC is the protocol used to call functions in an R/3 system by a caller external to R/3 or to call programs external to R/3 from an R/3 system.
Functions can only be called via RFC, if they are tagged as RFC functions in the SAP development workbench. They are then called RFC function modules. BAPIs are complete sets of (BAPI) function modules that model a business application.When you are familiar with web developments: RFC can be compared to HTTP and BAPIs are CGI applications.
In other words: A BAPI function is a function module that can be called remotely using the RFC technology.
BAPIs, RFCs and IDOCs are often confused. This section will help you to understand how RFCs relate to BAPIs.
BAPI is a business object. An RFC is functional code. IDOCs OR intermediate documents are standard data structures for electronic data interchange (EDI) between application programs. IDocs are used for asynchronous transactions: each IDoc generated exists as a self-contained text file that can then be transmitted to the requesting workstation without connecting to the central database.
IDoc
IDoc (for intermediate document) is a standard data structure for electronic data interchange (EDI) between application programs written for the popular SAP business system or between an SAP application and an external program. IDocs serve as the vehicle for data transfer in SAP's Application Link Enabling (ALE) system. IDocs are used for asynchronous transactions: each IDoc generated exists as a self-contained text file that can then be transmitted to the requesting workstation without connecting to the central database. Another SAP mechanism, the Business Application Programming Interface (BAPI) is used for synchronous transactions.
A large enterprise's networked computing environment is likely to connect many geographically distributed computers to the main database. These computers are likely to use different hardware and/or operating system platforms. An IDoc encapsulates data so that it can be exchanged between different systems without conversion from one format to another.
IDoc types define different categories of data, such as purchase orders or invoices, which may then be broken down into more specific categories called message types. Greater specificity means that an IDoc type is capable of storing only the data required for a particular transaction, which increases efficiency and decreases resource demands.
An IDoc can be generated at any point in a transaction process. For example, during a shipping transaction process, an IDoc may be generated that includes the data fields required to print a shipping manifest. After a user performs an SAP transaction, one or more IDocs are generated in the sending database and passed to the ALE communication layer. The communication layer performs a Remote Function Call (RFC), using the port definition and RFC destination specified by the customer model. The IDoc is transmitted to the receiver, which may be an R/3, R/2, or some external system.
Remote Function Call
RFC is also an abbreviation for Request for Comments.
A Remote Function Call (RFC) is an application program interface to R/3 applications from SAP, the German company that sells a coordinated set of applications and databases to Fortune 1000 companies. SAP customers who wish to write other applications that communicate with R/3 applications and databases can use the RFC interface to do so.
Thursday, August 2, 2007
How to find a Badi for a program or TCODE
First go to any transaction->iN THE menu bar SYSTEM->STATUS->Get the program name ->double click->u will go to the program attached to the tcode. Now search term will be CALL CL_EXITHANDLER. Now u will get list of BADI'S available..
Goto SE24->Give class name as CL_EXITHANDLER->Display->double click on get_instance mathod->Now u will go inside the method->Now put break point on the cl_exithandler. Now go to any transaction code and pass dat..U will see that it will be stopped on the break point which u set on the cl_exithandler...In the exit name u can find list of badi's attached to the tcode..
There are multiple ways of searching for BADI.
Ø Finding BADI Using CL_EXITHANDLER=>GET_INSTANCE
Ø Finding BADI Using SQL Trace (TCODE-ST05).
Ø Finding BADI Using Repository Information System (TCODE- SE84).
1. Go to the Transaction, for which we want to find the BADI, take the example of Transaction VD02. Click on System->Status. Double click on the program name. Once inside the program search for ‘CL_EXITHANDLER=>GET_INSTANCE’.Make sure the radio button “In main program” is checked. A list of all the programs with call to the BADI’s will be listed.The export parameter ‘EXIT_NAME’ for the method GET_INSTANCE of class CL_EXITHANDLER will have the user exit assigned to it. The changing parameter ‘INSTANCE’ will have the interface assigned to it. Double click on the method to enter the source code.Definition of Instance would give you the Interface name.
2. Start transaction ST05 (Performance Analysis).Set flag field "Buffer trace" Remark: We need to trace also the buffer calls, because BADI database tables are buffered. (Especially view V_EXT_IMP and V_EXT_ACT)Push the button "Activate Trace". Start transaction VA02 in a new GUI session. Go back to the Performance trace session. Push the button "Deactivate Trace".Push the button "Display Trace".The popup screen "Set Restrictions for Displaying Trace" appears.Now, filter the trace on Objects: • V_EXT_IMP • V_EXT_ACT Push button "Multiple selections" button behind field Objects Fill: V_EXT_IMP and V_EXT_ACT All the interface class names of view V_EXT_IMP start with IF_EX_. This is the standard SAP prefix for BADI class interfaces. The BADI name is after the IF_EX_.So the BADI name of IF_EX_CUSTOMER_ADD_DATA is CUSTOMER_ADD_DATA
3. Go to “Maintain Transaction” (TCODE- SE93).Enter the Transaction VD02 for which you want to find BADI.Click on the Display push buttons.Get the Package Name. (Package VS in this case) Go to TCode: SE84->Enhancements->Business Add-inns->DefinitionEnter the Package Name and Execute. Here you get a list of all the Enhancement BADI’s for the given package MB. The simplese way for finding BADI is 1. chooes Tcode Program & package for that Tcode.2. Go to Tcode se18. Press F4. search by package or by program.