Home > Ask the SAP Experts > Questions & Answers > Clarifying BAPIs, IDocs and Partners
Ask The SAP Expert: Questions & Answers
EMAIL THIS

Clarifying BAPIs, IDocs and Partners

Axel Angeli EXPERT RESPONSE FROM: Axel Angeli

Pose a Question
Other SAP Categories
Meet all SAP Experts
Become an Expert for this site
>
QUESTION POSED ON: 02 March 2003

In IDOC PARTNER definition, the partner is linked with an IDOC TYPE and PROCESS CODE for inbound processing. This process code is in turn linked with a FUNCTION MODULE to process the IDoc such as IDOC_INPUT_INVOIC_MRM. Questions:
1. Are BAPIs just another function module and can BAPIs be invoked from an external system without coming via the IDoc?
2. Is it possible to link a BAPI to a Partner for inbound processing rather that IDoc function module?


>
EXPERT RESPONSE

1. A BAPI function is indeed an RFC function module and can be called from an external system directly via RFC.

Details:
A BAPI is the official programming interface to a SAP business object. A BAPI (see transaction BAPI) consists usually of several BAPI function modules. For a function module to become a BAPI function module it has to comply to some preconditions:

* A BAPI function must be RFC enabled
(which answer the second question: a BAPI can be called via RFC from any external systems without going through an IDoc)

* A BAPI function should be used within a BAPI

* BAPI function parameter should have self-explaining, English-language parameter names

* BAPIs are published in the SAP Interface Repository (ifr.sap.com)

A typical BAPI is BUS2032 (SalesOrder) and a BAPI function mapped to method CreateFromDat2 is Function BAPISALESORDERCREATEFROMDAT2. The BAPI is defined with transaction SWO1 and published in transaction BAPI. Those who are using the Mini-SAP version on Linux for training may want to have a look at BAPI BUS1093 (ExchangeRates).
An IDoc is a data file format used by SAP to exchange data in a unified way. Before you send an IDoc you have to pack your data into the IDoc envelope. A received IDoc must be unpacked, as the handling routine usually cannot interpret the raw data format of the IDoc (have a look at the EDID4-SDATA segment in SE11).

2. In the IDoc partner definition the partner is linked with an IDOC TYPE and PROCESS CODE for inbound processing. This process code is in turn linked with a FUNCTION MODULE to process the IDOC such as IDOC_INPUT_INVOIC_MRM.

Practically there is hardly a BAPI that allows processing an IDoc directly. The background is, that IDocs are effectively a data container and the contained data must be freed from the surrounding envelope fist. If you want to use BAPIs, you would have to create an own receiver function module that complies to the restriction of the IDoc engine. This function would unpack the IDoc and convert it into the format that is required by the BAPI.

Every IDoc handler that is to be called via the standard IDoc engine, must comply to the following function interface format, because it is called dynamically:

      call function function_name
           exporting
                input_method          = input_method
                mass_processing       = mass_processing
           importing
                workflow_result       = workflow_result
                application_variable  = application_variable
                in_update_task        = in_update_task
                call_transaction_done = call_transaction_done
           tables
                idoc_contrl           = idoc_contrl
                idoc_data             = idoc_data
                idoc_status           = idoc_status
                return_variables      = return_variables
                serialization_info    = serialization_info
           exceptions
                wrong_function_called = 1
                others                = 2.


Additional parameters will be simply ignored, if you leave out a parameter the data cannot be seen within the function. For more details have a look in my book: "The SAP R/3 Guide to EDI and Interfaces", which guides you through all steps of creating your own IDoc processing routines.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



SAP White Paper Topics
HomeNewsTopicsBlogsTipsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2000 - 2008, TechTarget | Read our Privacy Policy
SearchSAP.com is a search service provided by TechTarget and is completely
independent of and not affiliated with SAP AG.
  TechTarget - The IT Media ROI Experts