Steps for creating a new BAPI function module

Hello experts,
Can any one send me steps for creating a new BAPI function module , I got a requirement to do like this,but I dont have any clue about how to create.
Please help !!!

BAPI stands for Business Application Programming Interface.
There are 5 different steps in BAPI.
- Create BAPI Structure  
- Create BAPI Function Module or API Method.  
- Create BAPI object  
- Release BAPI Function Module.  
- Release BAPI object.
Step1. Creating BAPI Structure:  
- Go to <SE11>. 
- Select Data Type & Enter a name. 
- Click on Create.
- Note: Always BAPI should be in a development class with request number (Not Local Object).
- Select Structure & hit ENTER.
- Enter the fields from your database. Make sure that the first field is the Primary Key Field.
- Then SAVE & ACTIVATE.
Step 2. Creating BAPI module: 
- Enter TR.CODE <SE37>.
- Before entering any thing, from the present screen that you are in, select the menu
   Goto -> Function Groups -> Create Group.
   Enter a name (Note: This name Must start with ZBAPI)
   Let this screen be as it is and open another window and there, enter TR.CODE <SE80).
   Click on the Third ICON that says Inactive Objects. 
   Select the group that you just created and click on Activate. 
   Notice that the group you created will disappear from the list of inactive objects.
- Go back to <SE37> screen and enter a name and hit <ENTER>. Then enter the group name that you just created and activated.
NOTE: When you release a function module the respective group will be attached to that particular application. It cannot be used for any other application. NEVER include an already existing group that is attached to another module.
Now click on the first Tab that says [ATTRIBUTES] and select the radio button that says remote-enabled module since we will be accessing this from any external system.
Then click on the second tab that says [IMPORT].
Enter a PARAMETER NAME, TYPE and the structure you created in the first step. Also select the check box ‘Pa’. All remotely enabled functional modules MUST be Pa enabled, where Pa means ‘Passed by Value’ and if you don’t select ‘Pa’, then that means it will be passed by reference..
Then click on tab that says [EXPORT].
Enter the following as is in the first three fields 
  RETURN        TYPE        BAPIRETURN (These 3 field values are always same)
  Here also select ‘Pa’ meaning Pass by value.
Note: BAPIRETURN contains structure with message fields.
Then SAVE and ACTIVATE.
Step 3. Creating BAPI object: 
- Enter Tr.Code <SWO1>   (Note. It is letter ‘O’ and not Zero).
- Enter a name and then click on create. Enter details. 
NOTE: Make sure that that Object Type and Program name are SAME.   
- Enter Application ‘M’, if you are using standard table Mara. If you are using your own database then select ‘Z’ at the bottom. 
- Then hit <ENTER>. 
- Now we have to add ‘Methods’. High light METHODS and then select the following from the menu: 
Goto Utilities -> API Methods -> Add Methods.
- Enter function Module name and hit <ENTER>.
- Select the second FORWARD ARROW button (>)to go to next step. 
- Check if every thing looks ok and again click on FORWARD ARROW button (>).
- Then select ‘YES’ and click on <SAVE>.
-  Now on a different screen goto TR.CODE <SE37>.  Enter Function Module name and select from the top menu  Function Module -> Release -> Release.
- Goback to TR.CODE <SWO1>.
Here select the menu combination shown below in the same order.
- Edit -> Change Release Status -> Object Type Component -> To Implemented.
- Edit -> Change Release Status -> Object Type Component -> To Released.
- Edit -> Change Release Status -> Object Type -> To Implemented.
- Edit -> Change Release Status -> Object Type -> To Released.
- Then click on <SAVE>.
- Then click on Generate Button (4th button from left hand side looks like spinning wheel).
- Then Click on the button that says ‘PROGRAM’ to see the source code.
To check if this is present in work flow goto TR.CODE <BAPI>. 
Here it shows business object repository.
- First click on the middle button and then select “ALL” and hit ENTER.
- Goto tab [ALPHABETICAL] and look for the object that you created. This shows that the BAPI object has been created successfully.
regards,
aswin

Similar Messages

  • Search for Top GTS BADIs/BAPIs/Function Modules

    Hi All,
    Reaching out to collect list of the most common BADIs/BAPIs/Function Modules in GTS.
    Been searching the web and I can find lists for other SAP areas, but not ours.
    Thanks, Jeff

    https://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=190743879
    RH_GET_MANAGER_ASSIGNMENT

  • Create/Copy New Inbound Function Module

    I have created a new process code MBGM pointing to function module IDOC_INPUT_MBGMCR.
    Currently I do not have function module IDOC_INUT_MBGMCR.
    Can I easily copy from an existing function module to create my own new function module?

    Hi Janice,
    Open se37, enter the FM name, now on the toolbar , there is a double-square ICON, click on this..and rest is easy.
    In detail,
    First of all you must know to which function group(FG) your r copying the FM, that is in which FG your z-fm will be residing.
    now se37-> enter the FM (original one) -> click on the copy icon (a square on another square, third from left)->now you will have a pop up-> "from" input box(leave it as it is)
    and "to" input box : here you write your z FM name,
    in Function group box: you enter the FG name where your z-FM should belong.
    click on copy..thats it.
    cheers,
    Prashanth
    P.S : Please mark helpful answers

  • Material creation for All VIEW using BAPI Function modules

    Dear All,
                 I want to create materials for all views using BAPI F.Ms. By using BAPI_MATERIAL_SAVEDATA i have extended materials for for only specified views. now my requirement is to create Material with All views including Classfication view also. For this i found BAPI_OBJCL_CREATEFM.
             Tell me that shall i use both Fm's at time to create material.Will it work? According to my knowledge we need to create Characters first ,then we should  assign this character to this class, then while creation of material we should select this class .
            so pls guide me the procedure to follow for both FM's .
    Note : Pls don't suggest me LSMW OR BDC procedure.
    regards,
    Prashanth Maturu.

    Hi prashanth,
    U can use both the FM. using BAPI_MATERIAL_SAVEDATA u can create all the views and for classification view use BAPI_OBJCL_CREATE. before assigning class to material u hve to make sure that the characteristics are uploaded and is attched to the class using transaction CL03.
    Regards,
    Anil N.

  • Webdynpro java  calling bapi function module

    Hi all,
         I am webdynpro java developer, In my application i created model using bapi function module and fetch those values using iviews mapping to custom controller . While running that application i got an error as shown below
    **Application error occurred during request processing.**
      Details:   com.sap.tc.webdynpro.services.sal.core.DispatcherException: The requested deployable object 'ram.com/getdata' and application 'Searchapp' are not deployed on the server. Please check the used URL for typos.
    Exception id: [BCAEC58D04E400870000019500000DF80004B20FE3921612]
    Please help me anyone
    Thanks in advance.

    Hi,
    Have you deployed your application?because it is mentioned that the "Searchapp"(which i suppose is your application) is not deployed.
    Take the "Deploy and Run" option by right clicking the application(i mn Seachapp). It will prompt you to enter the SDM password. Give the pwd and it will open the explorer and will show you the output.
    Hope this helps you.
    Regards,
    Jithin

  • Any BAPI/Function Module for adding new record with dates in PA0027

    Hi all,
    I am tryig to find is there any BAPI/Function module for updating new record with Start Date and End date for specified Personal Number in PA0027 Table.
    In PA0027 table i will be passing start date and end date for selected personal number, it needs to add new record with this details in the table checking the condition that this start date and end dates should not be between any of of start date and end dates for the specified personal number.
    thanks for ur time.
    Murali

    Hi Raj/Suresh thanks for ur answers.
    but i am having a problem,i gave this values.
    INFTY               -
                0027
    NUMBER              -
                00000010
    SUBTYPE             -
                010
    OBJECTID
    LOCKINDICATOR
    VALIDITYEND         -
                03/12/2006
    VALIDITYBEGIN       -
                03/01/2006
    RECORDNUMBER        -
                000
    RECORD              -
                P0027
    OPERATION           -
                CHK
    TCLAS               -
                A
    DIALOG_MODE         -
                0
    NOCOMMIT            -
                Y
    VIEW_IDENTIFIER
    SECONDARY_RECORD
    i am getting short dump saying that
    The source field is too short.
    The current program, "SAPLHRMM", tried to assign a field to a field symbo
    However, the field is shorter than the type of the field symbol, which
    is not allowed.
    The statement in question is in the form ASSIGN f TO <fs> CASTING or
    ASSIGN f TO <fs> with a field symbol that was created using the
    STRUCTURE addition.
    I tried  operation - Chage,Create (same thing for all inputs)
    is this correct funtion moduel for my requirment?
    what ever i am passing the start and end dates this should check in the table records with this personal number and if this start date and end dates are not between of any start and end dates then it should add new record with this dates.
    Thanks for ur time.
    Murali.

  • BAPI/ Function Modules for creating Settlement rules for Project in CJ01 .

    Hi Experts ,
    I need to create Settlement rules for WBS elements in Projects . Please let me know if there are any BAPI or Function Modules for the same . The Function Modules "k_settlement_rules_update" , "IBAPI_ALM_ORDERSRULE_CREATE" & 'K_SRULE_CREATE'
    are in "Not Released" status . so our practices does not allow us to use them .. please suggest any other BAPI or FM for creating Settlement rules .
    Thanks in advance ...
    Anil

    Hi ,
    Thanx for ur prompt reply , This function module is used for creating WBS elements . I didnot find any parameters or process to create settlement rule .. Please let me know how to use this or if there are any other BAPI available .
    Thanks
    Anil

  • Create Web Service Option not available for BAPI Functional Module

    Hello Experts
    I am trying to create a web service from a standard BAPI functional module referring following document
    http://help.sap.com/saphelp_nw04/Helpdata/EN/e9/ae1b9a5d2cef4ea4b579f19d902871/content.htm
    I am facing the same issue as mentioned in this thread (But for me answer is not OK)
    Web Service Creation
    When I click the FLIGHT Business Object and navigate to the Tools tab, I cannot see Create Web Service option.
    Also when I try to start the web service wizard from (SE37 -> BAPI_FLIGHT_GETLIST) Utilities Menu, after specifying all the details, after clicking Finish, I get an error "Access Refused"
    I verified the authorization to current user and gave him all the authorization required viz. (SAP_BC_WEBSERVICE_ADMIN, SAP_BC_WEBSERVICE_ADMIN_BIZ, SAP_BC_WEBSERVICE_CONSUMER etc) all 7 of them.
    My system is ECC 6.0 700 Release
    Thanks
    Paresh

    Hello,
    For creating Web service definition, you have to be a registered developer. In SAP Service Market place, you will get developer access key. This should be entered in DEVACCESS table by creating any development object.
    Thanks,
    Venu

  • BAPI Function Module for SCM APO Tcode /SAPAPO/AC42

    Hi,
      I want to know the BAPI Function Modules for SCM APO Tcode /SAPAPO/AC42.
       This BAPI FM should return the column values "Remaining Prod Alloc"  and "Incoming Order Quantity" when we give
       below details as inputs for the Tcode /SAPAPO/AC42
            Product Allocation Group
            Product
            Allocation Procedure
            prod Alloc step
            Product Alloc Object (Characteristics of Product Alloc Group)
            Plant (Characteristics of Product Alloc Group)
            Customer Group 5 (Characteristics of Product Alloc Group)
        Reward points if helpful.
    Thanks,
    Mich

    Hi,
    You should be able to get the information using the standard BAPI (Assuming you are using SCM5.0) BAPI_APOPAL_INSERT in the transaction BAPI.
    ProductAllocationAPO.DataInsert
    Interface to Import Product Allocation Data  Functionality
    This method is used to adopt data from OLTP systems for product allocation in the global availability check.
    You can do the following using the method:
    Adopt new data
    You can adopt new characteristics combinations or new time series. Newly created characteristics combinations have the status Active and are therefore included in the product allocation check.
    Change existing data
    You can overwrite existing data if you have set the interface parameter ALLOW_UPDATE. You can set the status of existing characteristics combinations to Active if you set the interface parameter UPDATE_STATUS. If the characteristics combination does not exist, the system creates it.
    The product allocation quantity is overwritten for existing time series. If you also want to change the incoming orders quantity, you must set the interface parameter UPDATE_INCOMING_ORDER_QTY. If the time series does not exist, the system creates it.
    Prerequisite
    To be able to use this method, you must have made all the Customizing settings for product allocation. For more information, see the Implementation Guide (IMG) for SAP APO under Global Available-to-Promise -> Product Allocation.
    Regards
    Vinod

  • BAPI Function Module for SCM APO Trans code /SAPAPO/AC42

    Hi,
       Is there any BAPI Function Modules for SCM APO Tcode /SAPAPO/AC42.
       This BAPI FM should return the column values "Remaining Prod Alloc"  and "Incoming Order Quantity" when we give
       below details as inputs for the Tcode /SAPAPO/AC42
            Product Allocation Group
            Product
            Allocation Procedure
            prod Alloc step
            Product Alloc Object (Characteristics of Product Alloc Group)
            Plant (Characteristics of Product Alloc Group)
            Customer Group 5 (Characteristics of Product Alloc Group)
        Reward points if helpful.
    Thanks,
    Mich

    Hi,
    You should be able to get the information using the standard BAPI (Assuming you are using SCM5.0) BAPI_APOPAL_INSERT in the transaction BAPI.
    ProductAllocationAPO.DataInsert
    Interface to Import Product Allocation Data  Functionality
    This method is used to adopt data from OLTP systems for product allocation in the global availability check.
    You can do the following using the method:
    Adopt new data
    You can adopt new characteristics combinations or new time series. Newly created characteristics combinations have the status Active and are therefore included in the product allocation check.
    Change existing data
    You can overwrite existing data if you have set the interface parameter ALLOW_UPDATE. You can set the status of existing characteristics combinations to Active if you set the interface parameter UPDATE_STATUS. If the characteristics combination does not exist, the system creates it.
    The product allocation quantity is overwritten for existing time series. If you also want to change the incoming orders quantity, you must set the interface parameter UPDATE_INCOMING_ORDER_QTY. If the time series does not exist, the system creates it.
    Prerequisite
    To be able to use this method, you must have made all the Customizing settings for product allocation. For more information, see the Implementation Guide (IMG) for SAP APO under Global Available-to-Promise -> Product Allocation.
    Regards
    Vinod

  • Creating/confirming transfer order (WM) using bapi/function modules

    Hi,
    I usually use BDC to create transfer orders or other documents in WM, but i've been told that using BAPI is more correct. I'm new to this concept, so could you please tell me how i can find the apropriate BAPI/function modules available for this purpose in 46C ?
    I thank you in advance,
    Bruno

    Hi Gisk,
    i am trying ot create a TO based on a material document and year. Same function as transaction LB12. Do you know which function module i can use for this.
    I am trying to use the function module L_TO_CREATE_SINGLE, i fill in the T_LTAK-MBLNR and T_LTAK-MJAHR. But do not know which fields to fill in.
    Hope you can help me.
    Grtz
    Coeno

  • BAPI/Function module for BATCH SPLIT

    Hi,
    is there a BAPI/Function module to enter BATCH SPLIT data in an outbound delivery. I used tcode VL02N to create an Outbound delivery(FOR an STO). I can use 'BAPI_DELIVERYPROCESSING_EXEC' to creat an Outbound delivery, but need to know what to use to add BATCH SPLIT data.
    Thanks
    Raj

    Hi Raj,
    Check this thread..
    Re: Inserting Batch Split Items in Delivery
    Cheers
    VJ

  • Bapi function module for ME32k Transaction

    Hi all,
            Can any one tell me what is the BAPI function module for ME32K transaction . I am trying to create service agreements in this transaction.
    Even you can tell me if any other alternative procedure is there to create the service agreements in ME32K.
    Bye
    Srinivas

    Hi srinivas p ,
    Do you find some solution for this?! I have the same problem...
    Can you help-me?
    Patrícia.

  • BAPI/Function Module for approve Appropriation Request?

    Hi Friends,
    Please guide me for
    BAPI/Function Module for approve Appropriation Request?
    Regards
    Ricky

    Hello
    Check these BAPI
    BAPI_APPREQUEST_ADDVARIANT     Add a Variant to an Appropriation Request
    BAPI_APPREQUEST_CHANGE         Change an Appropriation Request
    BAPI_APPREQUEST_CHANGEVARIANT  Change Appropriation Request Variant
    BAPI_APPREQUEST_CREATE         Create Appropriation Request
    BAPI_APPREQUEST_DELETE         Deletion of an Appropriation Request
    BAPI_APPREQUEST_GETDETAIL      Display of an Appropriation Request
    BAPI_APPREQUEST_GETSTATUS      Display Status of an Appropriation Request
    BAPI_APPREQUEST_REMOVEVARIANT  Delete an Appropriation Request Variant
    BAPI_APPREQUEST_SETSTATUS      Setting System and User Status of Appropriation Request
    BAPI_APPREQUEST_SETSTATUSVARNT Setting of User and System Status on Variants

  • BAPI/Function Module in CRM to create Credit Memo

    Hi,
    It will be great if some one can help me in finding out whether there is any <b>BAPI/Function Module</b> in <b>CRM</b> to create <b>Credit Memo</b>?
    Rgds,
    Sam.

    Hi Venkatesh,
    Thanks you for your post, your post has helped me a ton in my work, Infact I was working on BAPI to
    Create Credit Memo request i.e BAPI_SALESORDER_CREATEFROMDAT2 as expected i got the same error as "Unpermitted combination of business object BUS2032 and sales doc. category K" and i tried on  other BAPI it worked, Just i need to know BUS2032 doesn't support Credit Memo Request, How we can find it
    to what Sales document it support?

Maybe you are looking for