Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
111 views69 pages

TABLE, BAPI - BDC Note

This document discusses SAP tables, BDC (Batch Data Communication), BAPI (Business Application Programming Interface), and LSMW (Legacy System Migration Workbench). It provides steps to create a BDC recording, develop a BAPI, and use LSMW for data migration including creating a project, subproject, and object, selecting menu items, and maintaining source structures and fields. LSMW is a tool for migrating legacy data to SAP systems using projects, recordings, source structures and fields to define the data and transfer process.

Uploaded by

survisuresh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
111 views69 pages

TABLE, BAPI - BDC Note

This document discusses SAP tables, BDC (Batch Data Communication), BAPI (Business Application Programming Interface), and LSMW (Legacy System Migration Workbench). It provides steps to create a BDC recording, develop a BAPI, and use LSMW for data migration including creating a project, subproject, and object, selecting menu items, and maintaining source structures and fields. LSMW is a tool for migrating legacy data to SAP systems using projects, recordings, source structures and fields to define the data and transfer process.

Uploaded by

survisuresh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 69

What is SAP table

SAP tables are created, displayed and maintained via the SAP data dictionary using transactions such as
here where all the data within your SAP system is stored ready to be processed or accessed via your AB
Table-Types
There are 4 Table-Types within the SAP System:
1. Tables which have technical control functions within the SAP system. They are maintained either by
2. Other tables contain basic commercial data (bank data, currency ...).
3. Tables for the organization of a company (company codes, customer data ...).
4. And last but not least there are tables for application data, which contain business transactions and ma
ing transactions such as SE11 and SE80 and are the building blocks of the SAP environment. It is
r accessed via your ABAP code.

re maintained either by SAP or by users with special authorization.

ness transactions and master data and are processed using SAP programs.
What is BDC or batch input
The Batch Input is a SAP technic that allows automating the input in transactions. It lies on a BDC (Batch Data Commands) scenario.  
Batch Data Communication or BDC is a batch interfacing technique that SAP developed. It is mainly used for uploading data into the SAP R/3 s
BDC works by simulating the user input from transactional screen via an ABAP program.
The data input data file will come in the form of a flat file which the user save as file type txt file or prn file from the Microsoft Excel program. A
Abaper will create a program to read the text file and upload into the SAP system.

Create SAP BDC transaction recording


Here are the simple steps to create a BDC in SAP which records a standard transaction and then uses the BDC recording to build an ABAP report that autom
data processing and input.
Step 1
Execute SAP transaction recorder, transaction SHDB or recording button via transaction SM35.
Step 2
Enter name for recording (can be anything)

Step 3
Enter SAP tcode to be executed
Step 4
The transaction will now be executed, simply perform the actions you want to record.

Step 5
Once you have finished the recording and selected the save button or exited the transaction you recorded will be presented with the following BDC informati
This details the screens and fields that have been Processed during the recording and will be used as a basis to create ABAP BDC program.
nds) scenario.  
data into the SAP R/3 system.

rosoft Excel program. An

ABAP report that automates


following BDC information.
rogram.
What is BAPI?
Business Application Programming Interface(BAPI) are standardized programming interfaces (methods) enabling external applications to acc
data in the R/3 System. They provide stable and standardized methods to achieve seamless integration
How to create a BAPI
Step 1.Go to transaction swo1 (Tools->Business Framework -> BAPI Development ->Business Object builder ) .Select the business object, acco
requirement for which the BAPI is being created.
Step2.Open the business object in change mode. Then Select Utilities ->API Methods ->Add method.Then enter the name of the function modul

Step 3.In the next dialog box, following information needs to be specified :
Method : Suggest an appropriate name for the method,
Texts : Enter description for the BAPI,
Radio buttons : Dialog, Synchronous, Instance-independent . BAPI 's are usually implemented synchronously.
Step4.To create the method select Yes in the next dialog box.
Step5.After the program has been generated and executed, check the program in the method just created.Thus , a BAPI is created.

Testing the BAPI using SE37 we can record BAPI parameter


List of BAPI Exaple.
BAPI_MATERIAL_SAVEDATA Create and Change Material Master Data
BAPI_STANDARDMATERIAL_CREATE Create/Extend Material
BAPI_MATERIAL_DELETE Flag Material for Deletion
BAPI_MATERIAL_DISPLAY Display Material
BAPI_MATERIAL_EDIT Change Material
BAPI_RETAILMATERIAL_CREATE Create Material
BAPI_MATERIAL_MAINTAINDATA_RT Create and Change Material Master Data (Retail)
ernal applications to access business processes and

he business object, according to the functional


e of the function module and select Continue.
created.
LSMW – Legacy Data Migration Workbench

The LSMW (Legacy System Migration Workbench) is a tool based on SAP software that supports single or
periodic data transfer from non-SAP to SAP systems (and with restriction from SAP to SAP system). Its core
functions are:

Master data Updation example :- http://saptechnical.com/Tutorials/LSMW/Tax/Index.htm

Step 1 – Creating Project, Subproject and Object:

For using LSMW tool, first step you need to do is Create Project, Sub Project and Object as shown in the screen

Here, Project can have multiple Subprojects and in turn Subprojects can have multiple Objects as explained belo

Create Project

Give the desired name of data migration Project (For ex: Module name as I have taken “ZPM” for Plant Mainten

Create Subproject

Give the desired name of data migration Subproject (For ex: Master’s name as I have taken “EQUIP” for Equipm

Create Object

Give the desired name of data migration Object (For ex: Master’s name as I have taken “CREATE” for Creating E

Step 2 – Selecting Menu Items:

Once Project, Subproject and Objects are created, pressing enter would generate the screen which includes all

Selecting Menu Items

First of all, pressing the User Menu button would guide you through selecting and de-selecting the Menu items.

Please tick the required Items as shown in the screen below:


Now, the screen would display only the selected Menu Items which we require for building and executing our L

Click the button “Double Click = Display” which would make it to “Double Click=Change” which means it will allo

Henceforth, we will see each Menu Item in detail as an individual step.

Step 3 – Maintain Object Attributes:

This Menu Item defines the procedure we adopt for our program which could be:

1. Standard Batch/ Direct Input


2. Batch Recording
3. Business Object Method (BAPI)
4. IDoc (Intermediate Document)

For defining the procedure, double click on the First option “Maintain Object Attributes”. The screen below sho
As mentioned earlier, this blog covers explanation of only first two methods to make it simple and easy.

(Believe me most of the Masters gets covered in this two methods.)

Method 1 – Standard Batch/ Direct Input

In this method, we are simply selecting the standard program defined by SAP for different Masters (most of the

Click on Object to select the program then click on Method to select the method (For ex: Create/ Change) as sh

Once selected, save this method.

Method 2 – Batch Input Recording

This method, involves creating a recording for a specific Master transaction Creation/ Change.
We would select this method when we require only specific fields to be created/ changed inside the Master scr

Creating a recording is explained below:

Click on

button and then click on


(Recordings: Overview) button which would guide to the Recording screen. Here press Create button which will

Fill in the desired Recording Name and description as shown and press Enter and input the Transaction code as

On pressing Enter, system will start the transaction screen as shown below:
Perform the recording for the transaction (i.e., input all the fields you require to be taken into account for batch

Remember to save the transaction to complete the recording procedure as saving is also getting recorded.

On pressing save, you will see all the fields recorded as shown below:
Here press “Default All” button to populate the fields to be made available for batch input.

This will show the exact field names against each field as shown in the screen below:

Saving this screen would guide user to the list of recordings. Here press back and select the recording in the Rec
This ends the Step 1 for creating the method for specific Master creation/ change.

Step 4 – Object Overview and Field List:

Before moving to the second Menu Item “Maintain Source Structures”, we would go for listing the fields an
button in the Menu List Screen and then “List” button which would show the screen as below (for easiness

Here in the “Target Fields” section you will find all the fields (captured by Method-1 or Method-2).

Please copy all the fields (except field TCODE and RECORDNAME which we don’t require to change while runnin
By this you will be able to capture all the required fields in your excel file which ends the Step 4.

Step 5 – Maintain Source Structures:

Source Structure will have all the Source fields which are recorded or captured during Method definition.

Double click on “Maintain Source Structures” to which will guide to screen of Source Structure creation

Here press the create button which will ask for Source Structure Name and Description as shown below:
After entering the desired Source Structure name and Description, press enter and press Save.

Step 6 – Maintain Source Fields:

Source fields are the same which we have listed in Step 4.

Before moving to this step, back to your excel sheet, change all field Types as below:

CHAR C
DATS DDMY
UNIT C
TIMS C
TIMS C

(This is to be done because the types defined in LSMW are different then field types in program or recording)

Now, double click ”Maintain Source Fields” in the Menu List screen, which will guide you to the screen as shown
Press the
(Table Maintenance) button after selecting the Structure which will generate the field definition screen. Co

Press Save and Back and it will display the fields attached to the Source Structure as shown below:
Again press save button to save this Structure field relation.

Step 7 – Maintain Structure Relations:

This Step is for maintaining relation between Structure and Recording/ Standard Program.

Double click “Maintain Structure Relations” in the Menu List screen, which will guide you to the screen as show

Select the first Structure and press


and the structure you have created will be automatically be selected as you have created only one structur
Press Save and Back.

Step 8 – Maintain Field Mapping and Conversion Rules:

We have created the Structure to Program Relationship, now we need to create the mapping (Relationship) bet

Double click “Maintain Field Mapping and Conversion Rules” in the Menu List screen, which will guide you to th

As we have copied the fields from the Program/ Recording itself as in Step 4, it will be easy to perform the field

Go to Extras à Auto Field mapping which will pop-up a dialog box as shown below:
Perform the selection exactly as shown in the screen above and press Enter.

If you have any Date fields in your Field List, it will ask for your confirmation for every individual Fields as shown
Press Enter for all the Date Fields and you will find the field mapping for all your Source Fields to Program/ Reco

Confirm all the Fields are mapped correctly and press Save and Back.

Due to certain restrictions of blogs, this document covers the steps uptil “Maintain Field mapping and Conversio

1. Specify Files

2. Assign Files

3. Read Data

4. Display Read Data

5. Convert Data

6. Display Convert Data

7. Create Batch Input Session

8. Run Batch Input Session

Step 9 – Specify Files:

Before performing this Step, you need to create your File format with exact field sequence.

For creating the Format, simply transpose your Excel File fields from column to Row as shown below:
(Here I have mentioned only Single line for data you should have all the data which you wish to create in one tim

Select only the Data from excel sheet and copy it to notepad file as shown below and Save:

Now in SAP, double click “Specify Files” in the Menu List screen which will guide you to the screen as shown bel

Double click on “Legacy Data – On the PC (Frontend)” which will pop-up the dialog box as shown below:
In File field select the Notepad File created, in the Name Field assign any desired name and make other selectio

Step 10 – Assign Files:

Double click “Assign Files” in the Menu List screen, which will guide you to the screen as shown below:

As we have single Structure and Single File, it is auto assigned to Structure. Just Press Save and Back

Step 11 – Read Data:


Double click “Read Data” in the Menu List screen, which will guide you to the screen as shown below:

Without making any changes to this screen, press execute button which will show the screen as below:

This will Show the exact number of total records/ Masters which you have mentioned in your notepad file. If th

Step 12 – Display Read Data:

Double click “Display Read Data” in the Menu List screen, will pop-up a dialog box as shown below:
Without making any changes to this screen press enter, which will show the screen as below:

This screen is displaying all the Master Data Records which are read from your notepad file. Double Clicking any

Once confirmed press back twice.

Step 13 – Convert Data:

Double click “Convert Data” in the Menu List screen, which will guide you to the screen as shown below:

Without making any changes to this screen, press execute button which will show the screen as below:
This will Show the exact number of total records/ Masters which are converted from your notepad file to Struct

Step 12 – Display Convert Data:

Doubleclick “Display Convert Data” in the Menu List screen, will pop-up a dialog box as shown below:

Without making any changes to this screen press enter, which will show the screen as below:

This screen is displaying all the Master Data Records which are read from your notepad file. Double Clicking any

Once confirmed press back twice.

Step 13 – Create Batch Input Session:

Double click “Create Batch Input Session” in the Menu List screen, which will guide you to the screen as shown
Make the selections as per shown in the screen above and press execute. This will guide you to screen as shown

This will display the number of transactions saved for execution. This all fields should be in green. If any record

Note: For some masters or for recording method Step 13 would show a simple screen where you need to tick “K
Step 13 – Create Batch Input Session:

Double click “Run Batch Input Session” in the Menu List screen, which will guide you to the screen as shown bel

This screen can also be executed through SM35.

Here select the record you want to process and press


which will pop-up a dialog box as shown below:

Processing Mode:
First Option “Process/ foreground” will guide you to each field of each screen of your Master records.

Second option “Display errors only” will process your program in Background but will stop at Errors in any Field

Third Option “Background” will process your program completely in background and will update the errors at la

(Recommended to use “Display errors only” option)

Additional Functions

Select the “Extended Log”, “Expert Mode” and “Dynpro Standard Size” options.

Once made the above selections, press process.

Once all the data are uploaded will pop-up a dialog box as shown below:

Pressing “Session overview” will show the session details and “Exit Batch input” will exit the transaction.

Here it completes the Legacy Data Migration Workbench (LSMW) process.


at supports single or
SAP system). Its core

htm

t as shown in the screen below:

Objects as explained below:

“ZPM” for Plant Maintenance Module)

aken “EQUIP” for Equipment Master)

n “CREATE” for Creating Equipment Master)

creen which includes all the menu items for both Master upload as well as IDoc updation which we might not require. Let us select the

electing the Menu items.


ding and executing our LSMW program as shown below:

e” which means it will allow all the Menu Items to open in Change mode on double clicking else every item is in display mode by defau

s”. The screen below shows how to select the method:


simple and easy.

ent Masters (most of the Masters are listed here):

ex: Create/ Change) as shown in screen below:


ged inside the Master screen.

Create button which will show the screen as below:

the Transaction code as shown in the next screen:


en into account for batch input).

so getting recorded.
t the recording in the Recording field as shown below and save:
o for listing the fields and viewing the structuring of the fields by pressing the
n as below (for easiness I have used Method-1 i.e., Standard Batch/ Direct Input but list will be similar in both the cases only the

Method-2).

re to change while running our batch) and arrange the same in excel file as shown below:
Method definition.

tructure creation

ption as shown below:


program or recording)

ou to the screen as shown below:


eld definition screen. Copy paste all the excel fields to the screen as shown below:

own below:
ou to the screen as shown below:

eated only one structure. This will create the relationship between program and Structure as shown below:
apping (Relationship) between Fields from Structure and Fields from Program/ Recording.

which will guide you to the screen as shown below:

easy to perform the field mapping in a simple step.


ndividual Fields as shown below and make selection as per your requirement (This is how system will interpret Date further throughou
e Fields to Program/ Recording Fields as shown below:

d mapping and Conversion Rules” below steps,

shown below:
u wish to create in one time as in screen shot below)

o the screen as shown below:

as shown below:
and make other selections exactly as shown in the screen and Press Enter, Save and Back.

as shown below:

ave and Back


s shown below:

screen as below:

in your notepad file. If this does not match the exact value, check your notepad and excel file for data. Once Confirmed, Press back twi

hown below:
d file. Double Clicking any record will show Field-wise Data where you can check the correctness of your data (this step is not mandato

n as shown below:

screen as below:
our notepad file to Structure. If this does not match the exact value, check your notepad and excel file for data. Once Confirmed, Press

shown below:

d file. Double Clicking any record will show Field-wise Data where you can check the correctness of your data (this step is not mandato

u to the screen as shown below:


de you to screen as shown below:

e in green. If any record is in red, please check your entries again. If all records are green, press back twice.

where you need to tick “Keep Batch Input Session” and execute.
o the screen as shown below:
Master records.

top at Errors in any Field of any Screen which you can change.

will update the errors at last.

it the transaction.
t not require. Let us select the menu items which are required only for Master uploads.
m is in display mode by default.
ar in both the cases only the fields would differ):
erpret Date further throughout the program):
nce Confirmed, Press back twice
data (this step is not mandatory).
r data. Once Confirmed, Press back twice

data (this step is not mandatory).

You might also like