Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Difference between lsmw,bdc & bapi

Former Member
0 Kudos

Hi,

What is the exact difference between BDC,LSMW and BAPI and why we are going for LSMW ,BAPI, if BDC is suitable or viceversa (for uploading legacy data).

kindly expecting replies

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

<b>main diff</b>

LSMW offers different technique for migrating data: Direct input, BAPI, Idoc, Batch input recording. While BDC basically uses batch input sessions and CALL TRANSACTION method.

Limit on number of records which can be uploaded in one session of BDC (999 records). No such limit in LSMW.

LSMW is more to do with configuration while BDC involves programming.

<b>Rward if suefull</b>

7 REPLIES 7

former_member404244
Active Contributor
0 Kudos

Former Member
0 Kudos

Hi Satish,

Difference between BDC and BAPI

BDC is traditional way of coding the transactions for uploading the legacy data, Sap is changing all transactions to Object oriented programming. Since BAPI is Object based and supports all the new transactions it is preffered over BDC. More over BAPI's process data faster than BDC.

BAPI is a SAP-supplied function module with a defined interface, which allows you to interact with various business objects. SAP guarantees the integrity of your database for anything updated using a BAPI. BDC is a method of driving screens programatically, for updating SAP data. BAPIs are generally faster than BDCs.

A BAPI is faster because it is updating the DB "directly". Whereas BDC with call

transaction goes through the whole screen sequence like any user would do, simply put, fills screens.

However - there is not always a BAPI for a particular transaction and not all functions that are performed by a transaction can be done by a BAPI. BDCs produce error sessions which can be processed by the user, while BAPIs don't.

First choose the BAPI ,if there is no BAPI go for BDC.

why BAPI first not BDC.

SAP comes up with Change in Version, so each and every time they will change the screens/number etc.

so you have to change your BDC programs accordingly.

and also Most of the Latest versions transactions are Enjoy Transaction. they will not support BDC's in Background.

But Using BAPI's No such disadvantages.

A BAPI is faster because it is updating the DB "directly" through ABAP code.

A BDC with call transaction goes through the whole screen sequence like any user would do, simply put, it is filling screens.

Actually it depends on your requirement but BAPI is more effective as it is standard function module to update SAP databases rather than BDC.

using bdc over bapi has advantages and also disadvantages

advantages:

1. using bdc we can upload data into database tables using 2 ways

1. foreground -


means that user interaction is there for each and every record.

2. back ground -


no user interaction and tasks are done automatically.

using these two options is one of the greatest advantage over bapi.

2. in bdc call transaction method we can control the display of screen resolution which is not possible with bapi's

3. bdc is generally used for transferring of large amount of data than bapi's

4.session method of bdc allows us to place data directly in application server and then finally transfered into sap database tables

disadvantages:

1.bdc is only used for sap to sap system data transferring

2. bapis's generally works more faster than bdc's

3. using bapis we can connect to remote systems and also to non sap systems.

if useful reward some points.

A BAPI is a method of a SAP Business Object. BAPI enables SAP and third party applications to interact and integrate

with each other at the Business Object / Process level.

Check this link to know more about BAPI.

http://www.sapgenie.com/abap/bapi/example.htm

http://sappoint.com/abap/

Batch Data Communication (BDC) is the oldest batch interfacing technique that SAP provided since the early versions of R/3. BDC is not a

typical integration tool, in the sense that, it can be only be used for uploading data into R/3 and so it is not bi-directional.

BDC works on the principle of simulating user input for transactional screen, via an ABAP program. Typically the input comes in the form

of a flat file. The ABAP program reads this file and formats the input data screen by screen into an internal table (BDCDATA). The

transaction is then started using this internal table as the input and executed in the background.

In ‘Call Transaction’, the transactions are triggered at the time of processing itself and so the ABAP program must do the error handling.

It can also be used for real-time interfaces and custom error handling & logging features. .

To know more about BDC,

check the link.

http://sappoint.com/abap/

Main differences are...

In case of bdc data transfer takes place from flat file into sap system ie the file existing in sap system to sap sytem

where is bapi's r remotly enabled function modules which are assigned to some business objects n used to transfer the data between different business partners who are using different systems other than sap.

not only that...

when you plan to upgrade your system version then bdc willnot support those upgradations where as bapi's will support.

Difference between LSMW and BDC

<b>Reward points if this helps.

Manish</b>

Former Member
0 Kudos

Hi

<b>main diff</b>

LSMW offers different technique for migrating data: Direct input, BAPI, Idoc, Batch input recording. While BDC basically uses batch input sessions and CALL TRANSACTION method.

Limit on number of records which can be uploaded in one session of BDC (999 records). No such limit in LSMW.

LSMW is more to do with configuration while BDC involves programming.

<b>Rward if suefull</b>

Former Member
0 Kudos

Hi Satish,

<b>BDC:</b>

About Data Transfer In R/3 System

When a company decides to implement the SAP R/3 to manage business-critical data, it usually does not start from a no-data situation. Normally, a SAP R/3 project comes into replace or complement existing application.

In the process of replacing current applications and transferring application data, two situations might occur:

• The first is when application data to be replaced is transferred at once, and only once.

• The second situation is to transfer data periodically from external systems to SAP and vice versa.

• There is a period of time when information has to be transferred from existing application, to SAP R/3, and often this process will be repetitive.

The SAP system offers two primary methods for transferring data into SAP systems. From non-SAP systems or legacy system. These two methods are collectively called “batch input” or “batch data communication”.

1. SESSION METHOD

2. CALL TRANSACTION

3. DIRECT INPUT

Advantages offered by BATCH INPUT method:

1. Can process large data volumes in batch.

2. Can be planned and submitted in the background.

3. No manual interaction is required when data is transferred.

4. Data integrity is maintained as whatever data is transferred to the table is through transaction. Hence batch input data is submitted to all the checks and validations.

To implement one of the supported data transfers, you must often write the program that exports the data from your non-SAP system. This program, known as a “data transfer” program must map the data from the external system into the data structure required by the SAP batch input program.

The batch input program must build all of the input to execute the SAP transaction.

Two main steps are required:

• To build an internal table containing every screen and every field to be filled in during the execution of an SAP transaction.

• To pass the table to SAP for processing.

Prerequisite for Data Transfer Program

Writing a Data Transfer Program involves following prerequisites:

Analyzing data from local file

Analyzing transaction

Analyzing transaction involves following steps:

• The transaction code, if you do not already know it.

• Which fields require input i.e., mandatory.

• Which fields can you allow to default to standard values.

• The names, types, and lengths of the fields that are used by a transaction.

• Screen number and Name of module pool program behind a particular transaction.

<b>LSMW:</b>

This one is the most complete document for the same

http://sapabap.iespana.es/sapabap/manuales/pdf/lsmw.pdf

http://service.sap.com/lsmw.

http://saptechnical.com/Tutorials/LSMW/LSMWMainPage.htm

Here is a step by step guide on LSMW

http://sapabap.iespana.es/sapabap/manuales/pdf/lsmw.pdf

http://myweb.dal.ca/hchinni/sap/lsmw_home.htm

http://www.sap-img.com/sap-data-migration.htm

http://www.sapgenie.com/saptech/lsmw.htm

http://sapabap.iespana.es/sapabap/manuales/pdf/lsmw.pdf

http://www.sap.info/public/INT/int/glossary/int/glossaryletter/Word-17643ed1d6d658821_glossary/L#Wor...

<b>BAPI</b>

BAPI-step by step procedure

http://www.sapgenie.com/abap/bapi/example.htm

list of all BAPI's

http://www.planetsap.com/LIST_ALL_BAPIs.htm

<b>Reward Points for help ful answers</b>

Regards,

Satish

Former Member
0 Kudos

Hi

<b>main diff</b>

LSMW offers different technique for migrating data: Direct input, BAPI, Idoc, Batch input recording. While BDC basically uses batch input sessions and CALL TRANSACTION method.

Limit on number of records which can be uploaded in one session of BDC (999 records). No such limit in LSMW.

LSMW is more to do with configuration while BDC involves programming.

<b>Significance of data migration</b>

Data migration comes in the end of R/3 implementation.

To start with Data Migration first configuration should be fully completed

Data migration is about 20% to 40% oft the total implementation expenses.

<b>Basic Principles of LSM workbench:-</b>

Most of the functions should reside in R/3. No collection of individual programs on different platforms.

The quality and consistence of the data imported into R/3 should be more important than speed and performance of data migration.

Existing knowledge and coding should be used.

The developed ”mapping" and rules should be reusable and thus be used repeatedly in projects.

<b> Features:-</b>

Integrated in R/3 and thus independent of individual platforms

The import technique to be used in an individual case, depends on the business object as well as on the availability of standard input programs

Data consistency due to standard import techniques:

Batch input

Direct input

BAPIs (Business Application Programming Interfaces)

IDocs (Intermediate Documents)

Structured way of working, because you have to finish every step before starting the next step

<b>Pre-requisites for LSMW</b>

Make sure that SAP customizing is finished.

Run the relevant transaction in the SAP system manually with test data from the legacy system and see which fields must be filled. There may be required fields that do not correspond to data fields in the legacy system. In such a case, one should better assign a fixed value or establish an optional field for data transfer.

Map the fields in advance in written form: Assign the source fields to the target fields.

Determine the form in which non-SAP data will be transferred into the SAP system (e.g. via "Move" or according to a rule).

<b>Preferred methods of input are described in order of preference:</b>

IDOC’s

Advantages: Fast to load, easy processing, low programming for standard IDOC’s

Disadvantages: Good knowledge of IDOC processing required, time consuming if changes have to be made to a created IDOC

2. BAPI’s

Advantages: Fast to load, easy processing, logical interface for functional/end user based on the business processes involved.

Disadvantages: Not always complete with all input fields of a transaction

3. Standard/Direct Input

Advantages: Well tested method, Fast to load, easy processing.

Disadvantages: No enjoy transactions, not always complete with all input fields of a transaction.

4. Batch Input

Advantages: Easy modifiable, all fields are available, easy re-processing.

Disadvantages: Comparatively slow, to use new screens or tabs a new recording has to be created, not easily usable for enjoy transactions, dependant on user settings, difference in foreground and background processing may occur.

<b>Reward if usefull</b>

Former Member
0 Kudos

hi,

Main diff between LSMW , BDC and BAPI.

when we will use LSMW means minimum of data we want to uplode we will go for LSMW. this is for function concultent work why because here there is no coding so thats y easily the will uploade the data form lecacy system to sap system.

When we will go for BDC while we have used in customer Exit in our tcode so that time we want go for bdc otherwise we will go for bapi why because in BAPI is standard Function module so if we r using BAPI which t code having the Enchansment we can't upload the data.

In BAPI we will transfer the data from no sap( like java...) to sap .

In BDC we can't.

regards,

S.Nehru.

Former Member
0 Kudos

Hi there,

We used LSMW for uploading some legacy data and it was a NIGHTMARE!

The next time we uploaded some data we used a program along the lines of this:

[there are no exceptions or validation in this version - but it should get you started... just copy and past then use an excel sheet with the correct no. of columns and with the CORRECT DATA types in the excel sheet and you'll see how easy it is :)]

COPY INTO NEW PROGRAM VIA SE80

____________________________________________

REPORT ZGAVAMEXBTU1.

TABLES: BSEG, BKPF, COBL, RF05A, INVFO, ACGL_ITEM.

TYPES: BEGIN OF ttab ,

  • Lower line level detail to read - declare here - used to concatenate other details into

  • (details being itab-trvl_dest itab-trvl_dept itab-trvl_sname)

LongText type ACGL_ITEM-KONTO_TXT,

  • col 001 in xcel file

  • *************** NEED TO CHECK WHETHER THIS IS REQUIRED **************************************

*InvoiceText type ACGL_ITEM-KONTO_TXT,

  • col 003 in xcel file - where traveller is going to

trvl_dest(6) type c,

  • col 004 in xcel file - travellers departure date - used in concatenation of LongText so format unimportant

trvl_dept(8) type c,

  • col 005 in xcel file - who is travelling

trvl_sname(13) type c,

  • col 008 in xcel file

CostCentre type ACGL_ITEM-KOSTL,

  • col 009 in xcel file - cost charged - could be debot or credit

AmountInLocCurr type ACGL_ITEM-WRBTR,

  • ???????????????????? ???????????????????? ???????????????????? ????????????????????

  • col 011 in xcel file - used in "if statements" - I HAVE NO IDEA WHAT THE HECK THIS IS

ref_no(20) type c,

END OF ttab.

DATA:

  • Pre-Entry Screen Level Invoice Detail to declare are caprutred at selection screen

CoCode Type BKPF-BUKRS value '9000',

  • Top Level invoice detail to declare

VendorCode type INVFO-ACCNT value '4234',

CurrencyCode type INVFO-WAERS value 'GBP',

  • To concatente 'Amex Travel of invoice date ' with pinvdat (value given in selection screen)

TopText type INVFO-SGTXT,

  • This MAY have to be summed from other amount details

Amount type INVFO-WRBTR,

  • lower lovel declarations

GLacc type ACGL_ITEM-HKONT value '741020',

  • line level details to be assigned with 'S' or 'H' based on whether amount is -ve or +ve values

D_C type ACGL_ITEM-SHKZG,

*other things that were declared in original spec but not used here... yet!

LineNo type n.

DATA: itab TYPE TABLE OF ttab WITH HEADER LINE,

SEP(1) VALUE '-'.

Data: counter type i value 1.

***********************************************************************

  • SELECTION SCREEN DEFINITION

***********************************************************************

SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE GTEST.

PARAMETER : p_bukrs LIKE t001-bukrs OBLIGATORY DEFAULT '9000',

p_budat LIKE bkpf-budat OBLIGATORY DEFAULT sy-datum,

pinvDat like INVFO-BLDAT OBLIGATORY DEFAULT '20070901',

p_file LIKE rlgrap-filename OBLIGATORY DEFAULT

'C:\Documents and Settings\grichar1\Desktop\AMEX TRAVEL NEW3.xls',

p_batch LIKE apqi-groupid OBLIGATORY Default

'TEST1'.

SELECTION-SCREEN SKIP 1.

PARAMETER : p_test AS CHECKBOX DEFAULT 'X'.

SELECTION-SCREEN : END OF BLOCK b1.

***********************************************************************

  • End of SELECTION SCREEN DEFINITION

***********************************************************************

TOP-OF-PAGE.

concatenate 'Amex Travel Invoice ' pinvdat into TopText separated by SEP.

WRITE: / 'Customer: ', VendorCode,

/ 'Invoice date: ', pinvDat,

/ 'Posting date: ', p_budat,

/ 'Text: ', TopText.

ULINE.

Write: / 'Need to know what to put for ***********************',

/ 'Reference:',

/ 'Currency: DO WE NEED THIS FILLED IN AT TOP LEVEL'.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

EXPORTING

static = 'X'

CHANGING

file_name = p_file.

START-OF-SELECTION.

CLEAR itab. REFRESH itab.

PERFORM upload_data.

LOOP AT itab.

concatenate itab-trvl_dest itab-trvl_dept itab-trvl_sname into itab-LongText separated by

SEP.

  • if no invoice number - skips line - prevent extra lines at the bottom being inputted

if itab-trvl_dept <> ''.

  • determines whether line is credit(H) or debit(S)

IF itab-AmountInLocCurr > '0'.

D_C = 'S'.

ELSE.

D_C = 'H'.

ENDIF.

WRITE:/(3) 'ROW' color COL_TOTAL INTENSIFIED,

(5) Counter color COL_TOTAL INTENSIFIED,

(6) GLacc color COL_NEGATIVE,

(30) itab-LongText color COL_Normal,

(2) D_C color COL_NEGATIVE,

(8) itab-AmountInLocCurr color col_key,

(6) CoCode color COL_NEGATIVE INTENSIFIED,

(10) itab-costCentre color COL_TOTAL INTENSIFIED.

else.

ENDIF.

Add 1 to counter.

ENDLOOP.

----


  • FORM upload_data *

----


  • ........ *

----


FORM upload_data.

DATA: file TYPE rlgrap-filename.

DATA: xcel TYPE TABLE OF alsmex_tabline WITH HEADER LINE.

file = p_file.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

filename = file

i_begin_col = '1'

i_begin_row = '4'

i_end_col = '20'

i_end_row = '500'

TABLES

intern = xcel

EXCEPTIONS

inconsistent_parameters = 1

upload_ole = 2

OTHERS = 3.

LOOP AT xcel.

CASE xcel-col.

  • WHEN '0001'.

  • itab-InvoiceText = xcel-value.

WHEN '0003'.

itab-trvl_dest = xcel-value.

WHEN '0004'.

itab-trvl_dept = xcel-value.

WHEN '0005'.

itab-trvl_sname = xcel-value.

WHEN '0008'.

itab-CostCentre = xcel-value.

WHEN '0009'.

itab-AmountInLocCurr = xcel-value.

WHEN '0009'.

itab-ref_no = xcel-value.

ENDCASE.

AT END OF row.

LineNo = xcel-row.

APPEND itab.

CLEAR itab.

ENDAT.

ENDLOOP.

ENDFORM.

____________________________________________

Excel data needs to look a bit like this

[Top 2 rows blank - row 3 headings - other rows data]

TRVL_INVNO TICKET_NO TRVLR_DEST TRVLR_DEPT TRVLR_SNAME TRVLR_INIT CUST_REF TRVL_REF CHRG_BAL MIS_REF REF_NO

91539 China 17092007 ATKINSON/JANE 900080138 -30 258333302 593000

91539 China 17092007 ATKINSON/JANE 900080138 47 258333302 594000

________________________________________________

Just name the excel file as per code. Have fun! If you can't get it to work just give me a shout.

Kind Regards,

Gavin