Bdc & Lsmw

Embed Size (px)

DESCRIPTION

BDC and LSMW in SAP

Citation preview

Slide 1

K.N.SANJAY SAP TRAINEE [8892310260] BDC LSMWBDC (BATCH DATA COMMUNICATION) is a procedure which is used to transfer or upload data from NON-SAP SYSTEM to SAP SYSTEM.BDC is a standard technique for transferring LARGE sets of data which is available in ELECTRONIC form. BDC = ?2ADVANTAGES OF BDC NO MANUAL INTERACTION is required during data transfer.

BDC ensures DATA INTEGRITY.

The transaction flow is simulated and the data is transferred as if it were entered online.

We can EASILY make CHANGES and RECTIFY ERRORS according to our client needs.

No manual interaction is required during data transfer:-BDC EXECUTES the TRANSACTIONS AUTOMATICALLY and is therefore suitable for entering large amounts of data that are already available . All BDC methods work by carrying out NORMAL SAP transactions. If the data to be transferred is already available in electronic form (on a tape, for example), then you can enter the data automatically into the SAP System using batch input. Batch input ensures data integrity. Batch input enters data into the SAP System using the same transactions that interactive users do. Batch input data is therefore submitted to all of the checks and controls that apply to data entered by normal interactive means.The advantage of this is that all relevant checks of the transaction are executed, thereby ensuring that the data is consistent.3

SAP TRANACTIONBASIC BDC FLOW :DATA TRANSFER METHODS Method 1 - >CALL TRANSACTION

Method 2 - > BATCH INPUT SESSION

Method 3 - > DIRECT

SESSION METHOD.

1) synchronous processing. 2) can transfer large amount of data. 3) processing is slower. 4) error log is created 5) data is not updated until session is processed.

CALL TRANSACTION.

1) asynchronous processing 2) can transfer small amount of data 3) processing is faster. 4) errors need to be handled explicitly 5) data is updated automatically

The first processing method could be called "classical batch input." In it, an ABAP program reads the external data that is to be entered in the SAP System and stores the data in a "batch-input session." A session stores the actions that are required to enter your data using normal SAP transactions. When the program has finished generating the session, you can run the session to execute the SAP transactions in it. You can either explicitly start and monitor a session with the batch-input management function (System Services Batch input) or have the session run in the background processing system.This method uses the function modules BDC_OPEN, BDC_INSERT, and BDC_CLOSE to generate sessions.In the second method, your program uses the ABAP CALL TRANSACTION USING statement to run an SAP transaction. Batch-input data does not have to be deposited in a session for later processing. Instead, the entire batch-input process takes place inline in your program. There is a third batch-input method using the ABAP CALL DIALOG statement. However, SAP recommends against using this method unless necessary. The CALL DIALOG method is now outdated and is more complex and less comfortable to use than the other techniques. All three batch-input methods use a common data structure for holding the instructions and data for SAP transactions. This structure is defined as structure BDCDATA in the ABAP Dictionary.For help in selecting the method to use, please see Selecting a Batch-Input Method.

7

DISPLAY MODEUPDATE MODEIn the foreground In the background During processing, with error displayYou should process batch input sessions in the foreground or using the error display if you want to test the data transfer. If you want to execute the data transfer or test its performance, process the sessions in the background.

8BDCDATA

All BDC methods use a common DATA STRUCTURE I.e., BDCDATA for HOLDING the INSTRUCTION and DATA for SAP transactions. BDCDATA structure is defined in the ABAP/4 Dictionary.9BDCMSGCOLL

BDCMSGCOLL is mainly used in call transaction method for ERROR HANDLING purpose. 10BDC session function modules

BDC_OPEN_GROUPBDC_INSERTBDC_CLOSE_GROUP

T-CODE :-> SHDB

Click on new recordingBDC Recording is a process where u identify and record the fields in SAP which are required for data transfer from legacy system to SAP.BDC Recording is the simulation by which we know the fields to be tranfer from legacy to SAP System, and also the screen no. and program name.It is normally used for mass update or uploading of data to the system. It help to save time for the users who need to mass change the system data. For e.g. tax rate change announce by the country government. It is related to bdc because bdc programming allows recording of user inputs.

15

TCodeRECORDING NAMEPRESS ENTER click "New recording", enter recording name to identified your record. enter TCode to be recorded. You will enter recording mode of the transaction, simulate action you want to perform in this transaction. At the end it will result internal table ready to upload to data transfer methods . After internal table created then we pass this to data transfer methods. There are two alternatives of data transfer methods, using Call Transaction or BDC session.CATT stands for "Computer Aided Test Tool". When the transaction contains more number of sub-screens or if the transaction is more complex to handle (for example, user defined z-transactions), then we use CATT option as they are reusable tests.CATTMODE: CATT mode (controls a CATT) CATT mode can have the following values: 1) No CATT active 2) CATT without single-screen control 3) CATT with single-screen control 1DEFSIZE : Default screen size OR Use default window size (Here we are handling those transaction by giving default window size) Cont.After commit : RACOMMIT : is not completed by COMMIT Do not end transaction at COMMIT WORK.Not a batch input session : NOBINPT : No batch input mode (that is, SY-BINPT = SPACE) .Simulate background mode : NOBIEND : No batch input mode after the end of BDC data. The components DEFSIZE , RACOMMIT, NOBINPT, and NOBIEND always take the following values: 'X' Yes .

16T CODE : -> PA30.

MENTION PERNR FOR DATA TRANSFERSelect info type 17

Select subtype which you want upload data and hit enter buttonclick oncreate18

enter value for data fields to be Record and transfer and save

Enter fields which you want to upload data for e.g. START DATE , POSTAL CODE, CITY And click on Save button.

19

Coding generated from BDC recorder .

Click save press F3Data input entered by user simulated in BDC by data packet. The transaction then started using this internal table as the input and executed in the background.

Data packet is an internal table has a structure of BDCDATA, it has fields:1. PROGRAM (program name)2. DYNPRO (screen number)3. DYNBEGIN (New screen start) X=new screen4. FNAM (Field name)5. FVAL (Field value)

Data packet contain of screen by screen packets. One screen packet contain:1. Screen no2. Cursor position3. User command4. Input fields

20

Creating ABAP Report based on recording SELECT Y0UR RECORDED MODECLICK ON PROGRAM IN SHDB TOOL BAR

SELECT FIELD CONTENTS AS TRANSFER FROM RECORDINGTYPE PROGRAM NAME 22

Coding process

BASIS BDC RECORDED REPORT PROGRAM:

DAT = TABULATOR SPACEAfter internal table created then we pass this to data transfer methods. CALL FUNCTION MODULE UPLOAD .Create an internal table for UPLOADED fields in the report AND Next call upload function

25PLACE LOOP AFTER PERFORM OPEN_GROUP

bdc_okcode is the user command that was executed. eg. '/00' means Enter command. The user command can varies during a BDC program. Therefore, we need to used tcode shdb to check what it actually contains. If BDC_OKCODE is equal to 'NO' then the recording is invalid and the type tree will fail to generate.

26

PLACE END LOOP BEFORE PERFORM CLOSE GROUP AND REPLACE THE CONSTTANTS IN PERFORM STATEMENT WITHIN LOOP BY INTERNAL TABLE NAME WITH FIELD NAME VALUES USED IN RECORDING. THEN SAVE AND ACTIVATE.

28

PERSS F8

ASSING PATH TO IMPORT LEGACY DATA Tabulator spaceclickIf you were using excel sheet to upload the data to sap system than we have to convert unformatted data into formatted data by giving fixed Colum length . Now Give respected Length for each fields. By placing Cursor in each column, Right Click, Select Column Width. Than save the data. 30

Press enter31

Press enter button to u get the legacy data

Extracted legacy dataPress enter button till u get the next legacy data

Extracted legacy dataPress enter button till u get the next legacy data

Extracted legacy dataPress enter button to display return code

Press F3

SESSION BYTES TRANSFERRED

T-code: SM35

T-CODE :-> SE11 , TABLES : -> PA0006

BDC program without using INCLUDE PROGRAM

LEGACY DATA

T-CODE : SM35SELECT SESSION AND CLICK ON PROCESS

Click Process to execute session from any of the processing mode

LSMW [LEGACY SYSTEM MIGRATION WORKBENCH]LSMW = ?R/3-based tool. LSMW also supports conversion of data. Imported into the SAP R/3 system via batch input, direct input, BAPIs or IDocs.recording function allows to generate a data migration object.The LSM Workbench is an R/3-based tool that supports You when transferring data from non-SAP systems ("Legacy Systems") to R/3 once or periodically. LSMW also supports conversion of data of the legacy system in numerous way. The data can then be imported into the SAP R/3 system via batch input, direct input, BAPIs or IDocs.

LSMW provides a recording function that allows generating a data migration object to enable migration from any required transaction.

What is data migration?Initial data transferImplement SAP R/3Move data from legacy system to SAP R/3Switch off legacy systemPeriodic data transfer (Interfacing)Exchange data between R/3 and other systems

Why is data migration important? Accounts for 15% - 20% of the total SAP R/3 implementation costsSmaller implementation projects: up to 40%Why is data migration so expensive?In many casesneed to develop conversion programsneed to deal with lots of technical detailsand different technologies

What does SAP offer now?LSMW66ADVANTAGES OF LSMW Because not much technical(ABAP) effort are required.Greatly reduces the amount of development time.

Because no ABAP effort are required for the SAP data migration.However, effort are required to map the data into the structure according to the pre-determined format as specified by the pre-written ABAP upload program of the LSMW.This is very Important during the Implementation Project when Security people needs to create multiple usersGreatly reduces the amount of development time needed to create conversion programs

67

MAIN FUNCTIONS

1> Read data

2> Convert data

3> Import data

Read data (legacy data in spreadsheet tables and/or sequential files). You can use any combination of PC and server files.Convert data (from the source into the target format).Import data (to the database used by the SAP application).=>Uploading legacy data.Use Read Data to execute the SAP generated Read Program /1CADMC/SAP_LSMW_READ_ to get the Legacy data from the Input File to an intermediate File (*.read).

Use Convert Data to execute SAP generated Conversion Program /1CADMC/SAP_LSMW_CONV_ to map the Data Read in the previous step to the Target R/3 fields using the Predefined Conversion Rules into another intermediate File (*.conv).

Execute the corresponding Batch Input or Direct Input program for uploading the Converted data into SAP.

69Key Building Blocks for LSMWProject Sub Project Object A) Structure Relationships B) Field Assignments Project serves as an organizational unit used to combine Mapping and Field assignmentsSub Project is an organizational unit subordinate to a ProjectObject is assigned to a Sub project Structure Relationships are Field mappings between the Source and the Target Structures within an ObjectField Assignments use Place Holders and Conversion Rules that define how the Field contents are to be converted

70T-CODE : LSMW

click on create buttonCreate project , subproject , object

Press F8 button to executeYou have created a project, and you have chosen Continue on the initial screen to get to the list of steps.

72

Press F8To define the project, subproject and the required (business) object and to create recording function to create a user-specific

The main screen of LSMW provides steps by steps process.To complete ur data conversion process need to execute these process.73Maintaining Object Attributes

Click on recording overviewWith a periodic data transfer, you cannot import any data from the PC. Additional step Frame program is displayed.You will be updating the customer master records with the help of Batch Input recording therefore, choose radio-button.When you select the batch input or direct input method, documentation is displayed for the program (see icon).When you select the batch input recording, you can make additional recordings after activating the icon.If you select the BAPI or IDoc method, the system checks whether a so-called partner profile for the defaulted partner and the selected message type already exists when you save the data. Otherwise, the system tries to create them. See also: Converting BAPIs/Idocs

Flag: Periodic Data Transfer

Flag for periodic data transfer. You use this to specify that you also want to use the object for the periodic transfer of data from a legacy system to R/3.

In this case you have the option of loading data that is located on th frontend (PC).

It is more usual that the legacy system provides a dataset that can be read by the R/3 application server.

The system offers you an additional process step that leads you to the main program for periodic data transfer.

IF U DOUBLE CLICK ON DISPLAY INTERFACE: Business Object

Name of business object.

All business objects are displayed with methods for which an IDoc interface exists.

74

Create recording :Enter recording name75

Enter transaction codeThe system calls the t-code pa30 and promotes to complete the change customer transaction.76

Mention pernr to transfer data Select info type

Select subtypeclick

enter data fields to be Record and transfer Save.

Default valuesField namesDouble click

Delete default value and press enterEnter field name

Enter field name

Double click

Enter field name

Double click

Default values are removedSave and press F3Note that if u have more fields in recording needed , you can remove them by clicking on remove screen field icon.The fields are populated with default values. The values we entered in recorded the transaction are set as default.

84

PRESS F3

Recording is saved with the recording name specified

Click save and press F3

We define the structures and fields of the project. These describe the transfer file and must have the same format in the export program. You then relate the structures and fields of the SAP system to those of the project.

MAINTAIN SOURCE STRUCTURE : CLICK ON CREATE BUTTONENTER STRUCTURE NAME88

CLICK ON SAVE AND PRESS F3

MAINTAIN SOURCE FIELDS : CLICK ON TABLE MAINTENANCEPLACE CURSOR ON STRUCTURE

Assign field-name, type, length as of in info type.

Click save and press F3

Maintain structure relations:Saves and press F3

Assigning field mapping and conversion rule for recorded fields96

Maintain field mapping and conversion rule :Select recorded fields and click on source fieldsInitial

Assigns the value 'Initial' to t

Use

Depending on the object type, th

Standard batch input: "Nodata" c

Batch input recording: "/"

BAPIs, IDocs: Clear on field.

Constant

Assigns a fixed value to the target field.

Transfer (MOVE)

Transfers data using the ABAP command "Move".

Use

For source fields that are not type 'C' or 'N':

Packed Field: Disassemble in target field (WRIT...TO...)

Date Field: If the target field is at least ten characters long, th

the output format is formatted according to the settings of the use

master. Otherwise, the date value remains in internal format.

Amount Field: For batch input/direct input the amount value is form according to the settings of the user master. For BAPIs and IDocs t amount value remains in internal calculation format.Fixed Value

Assigns a "Fixed Value Object" (FV_fixedvalue) to the target field. This fixed value object is assigned a concrete value in migration customizing.

Translation

Executes a 1:1 translation using a translation table.

Use

You can compare the target value and source value. You m

value selection with the indicator setting 'OK'.

Prefix

Determines any prefix that is placed before the converted data.Suffix

Determines any suffix that the converted data must end with. Concatenation

Merges two or more fields together after data conversion.Transfer Left-Aligned

Transfers the contents of the source field to the left of the target field.ABAP Code

Goes to where generated code can be revised or where new code can be saved in the ABAP editor.User-Defined Routine

Defines the routine written by the user in the rule.

This routine can also be used for other objects in the project.

X Fields for Idocs

Only Execute Rule If Source Field Not Initial

Rule must only be executed if the source field does not show the value

initial.

97

Double click on source fields

Repeat the steps for other recorded field

Click on save and press F3

SKIP 6 th STEP The system generates the conversion program from the structure and field relationships as well as the conversion rules.

data conversion file is generated out of the project data to be migrated

SPECIFY FILES :click on create buttonPlace a cursor on a LEGACYDATA

Select delimiter which you have used in legacy data ASSINGN LEGACY DATA PATH

Click save button and press F3

Assigns the files already defined to the source structures

ASSIGN FILES :Save the legacy text to structureAnd press F3

Read data :Press F8

READED DATA press F3

DISPLAY READ DATA:PRESS ENTER

Imported legacy datapress F3

The file of read data is transferred to the file of converted data during migration

CONVERT DATA :PRESS F8

press F3

CONVERTED DATA

DISPLAY CONVERTED DATA:PRESS ENTER

Legacy text datapress F3

Preparation for data import by means of the standard batch input program

CREATE BATCH INPUT SESSION:CLICK ON BATCH INPUT FOLDERS AND PRESS F8

Press enter

PRESS F8

CLICK ON PROCESSSELECT SESSION

SELECT PROCESSING MODEPRESS ENTER

Press enter button to u get the legacy data

Updated legacy textPress enter button to u get next legacy data

Updated legacy text

Press enter button to u get next legacy data

Updated legacy text

Press enter button to get next screen

QUESTIONS ? / ?THANK YOU..