on 09-15-2006 6:50 AM
how to create a BAPI
Hello Rajesh:
I don't think that question belongs to this forum. Anyway, to create a BAPI in a nutshell you need access to an ABAP Workbench editor, ABAP knowledge and Developer privileges:
1) BAPIs in General are created in two parts, first a Function Group and then the Function Modules.
Both user defined Group/Modules names must start with Z or Y.
2) Using the Object navigator (SE80) we must click on "EDIT OBJECT" ->"FUNCTION GROUP". Some dataFields
must be maintained:
FunctionGroupName
Short Description
Development Class / Package
3) With the previously created FunctionGroup, a new FunctionModule can be added. In Object Navigator
mark the option "EDIT OBJECT" ->"FUNCTION MODULE" and click CREATE (F5) The following steps must be
performed:
Set the FunctionGroupName (as defined above).
Short Text as description
Maintain technical data:
After the creation of the FunctionModule, we must define the Interface (parameters for
external use) and the processing logic (the code itself).
4) Possible values for parameters are:
Import parameters.- Input for the RFC.
Export parameters.- What the RFC will return
Tables.- Internal tables that can be transferred to/from the RFC
Exceptions.- Definitions for possible errors inside the RFC
When defining this parameters, the data and dataTypes must be available globally, that is, in the
ABAP Dictionary, also, NO GENERIC DATA TYPES MAY BE USED FOR A VARIABLE IN THE INTERFACE, such as int,
char, etc.
5) An example for import/export parameters definition is as follows
Import:
ParameterName.- PORTAL_LOGON_NAME
Type.- LIKE
Associated type.- Z_LOGON_ID (previously defined in the Dictionary)
Optional .- OK
PassValue.- OK
Export
ParameterName.- CLIENT_DATA
Type Spec.- LIKE
Associated type.- Z_CLIENTS_1 (a table in the Dictionary, meaning that a structure
will the result of this RFC)
PassValue.- OK
Exceptions
Exception.- ERROR_CLIENT_DOES_NOT_EXIST
6) Now he actual processing logic must be set, as ABAP source code. In this case, we get a name for User
logon (e.g. "Reporter") and fetch it's user ID in a mapping table. Afterwards, with this id, go to
clients table and get the client details.
TYPES: BEGIN OF client_eq_type,
client_logon TYPE int4,
client_number TYPE int4,
END OF client_eq_type .
DATA: client_eq TYPE client_eq_type,
temp_client_id TYPE int4.
First find out the logon username and get the equivalence. The client_id is stored in a
temporary structure
SELECT SINGLE client_number
FROM zclients_code_eq
INTO CORRESPONDING FIELDS OF client_eq
WHERE client_logon = portal_logon .
IF sy-subrc <> 0.
RAISE error_client_does_not_exist .
ENDIF .
temp_client_id = client_eq-client_number.
SELECT SINGLE *
FROM zalex_clients_1
INTO CORRESPONDING FIELDS OF client_data
WHERE client_id = temp_client_id.
IF sy-subrc <> 0 .
RAISE error_client_does_not_exist .
ENDIF .
ENDFUNCTION.
7) Test the function and activate.
😎 Now this is very important. Go to attributes in the SE80 function Module and <b>enable the Remote Call for this function, in order
to set it as RFC. PROCESSING TYPE -> REMOTE ENABLED MODULE</b>
I hope that helps
Alejandro
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
follow this is link.......
this is the perfect material for bapi...
otherwise give ur email..id i will send it to ur mail id...
http://www.erpgenie.com/abap/bapi/index.htm
http://www.erpgenie.com/abap/bapi/example.htm
regards
anilreddy
reward points if helpful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.