Beyond ABAPdesigned by@Tejoram97
Beyond ABAP / CORE ABAP / Data Migration (BDC, LSMW, BAPI)

Data Migration (BDC, LSMW, BAPI)

CORE ABAP · ABAP Development ·

Open the interactive lesson →
  1. Data migration basics
  2. File handling
  3. BDC (Batch Data Communication)
  4. Direct Input (legacy – know it for interviews)
  5. LSMW (legacy – know it for interviews)
  6. BAPI-based upload
  7. S/4HANA Migration Cockpit (the modern standard)
  8. Comparison and tool choice
  9. Interview questions

How legacy data gets into SAP: file handling, BDC, Direct Input, LSMW, BAPI uploads and the S/4HANA Migration Cockpit. This is the C – Conversion object type of RICEFW. One running example – uploading bank master data (FI01) from a CSV file – is used for BDC and BAPI so you can compare them.

Related pages: page 07 Interfaces (RFC, BAPI details, IDoc), page 02 Data Dictionary (conversion routines such as CONVERSION_EXIT_ALPHA – a different thing that only shares the word "conversion"), ABAP on HANA › 02 Migration & Performance Tools (system conversion to S/4HANA).

Part 1 – Data migration basics

Data migration: extract, convert, load, verify

Term

Meaning

Data migration

One-time move of data from an old system into SAP, usually at go-live (cut-over). RICEFW C – Conversion.

Data transfer

Data is moved again and again from or to other systems while both keep running. This is an interface (RICEFW I, page 07).

Legacy system

The old system that is being replaced or that feeds SAP. Usually non-SAP, but it can also be an older SAP system (e.g. ECC before a new S/4HANA implementation).

Inbound

Data comes into SAP from another system (SAP or non-SAP). Every migration is inbound.

Outbound

Data goes out of SAP to another system – SAP or non-SAP.

The four steps

  • 1 Extract – the legacy team exports the data into files (CSV, TXT, XLSX, XML).
  • 2 Convert / map – clean the data and map old values to SAP values (plant, unit, payment terms).
  • 3 Load – import into SAP with a tool that runs SAP's checks (see the table below).
  • 4 Verify – compare counts and totals, business users test samples, reload the failed records.

Load techniques at a glance

Technique

How it loads

Status

S/4HANA Migration Cockpit

Fiori app with predefined migration objects, staging tables or direct transfer

Standard for S/4HANA

BAPI program

Your report reads the file and calls the released BAPI (no screens)

Recommended where a BAPI exists

IDoc (inbound)

Data arrives as IDocs and is posted by the inbound function module (page 07)

Used for migration and interfaces

BDC – call transaction / session

Replays the transaction screens with recorded field values

Classic; last resort in S/4HANA

Direct Input

SAP-delivered programs write data after their own checks, no screens

Legacy

LSMW

Workbench that maps a file and then uses BDC, Direct Input, BAPI or IDoc

Legacy, not recommended in S/4HANA

Golden rule: never load SAP standard tables with INSERT/MODIFY from a program. It skips the validations, number ranges, change documents and the update logic, and leaves inconsistent data. MODIFY dbtab FROM TABLE itab is only acceptable for your own Z tables.

ALE (page 07) is not a migration tool in itself – it distributes IDocs between systems. BAPIs are not a migration tool either: they are APIs that migration tools and interfaces call.

Part 2 – File handling

A file can sit on the presentation server (the user's PC, reached through SAP GUI) or on the application server (the SAP server's file system). Each side has its own tools.

Presentation server vs application server file handling

2.1 Presentation server (PC)

Task

Class method (preferred)

Older function module

Choose a file

cl_gui_frontend_services=>file_open_dialog

F4_FILENAME

Choose a save location

cl_gui_frontend_services=>file_save_dialog

–

Read a file

cl_gui_frontend_services=>gui_upload

GUI_UPLOAD

Write a file

cl_gui_frontend_services=>gui_download

GUI_DOWNLOAD

  • Both need a running SAP GUI – they fail in background jobs. For scheduled loads, put the file on the application server.
  • filetype = 'ASC' reads text lines, 'BIN' reads binary (needed for Excel).

Upload procedure (selection screen → file → internal table)

PARAMETERS p_file TYPE string LOWER CASE OBLIGATORY.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.  " F4 help for the path
DATA lt_files TYPE filetable.
DATA lv_rc    TYPE i.
cl_gui_frontend_services=>file_open_dialog( CHANGING file_table = lt_files
rc         = lv_rc ).
IF lv_rc = 1.
p_file = lt_files[ 1 ]-filename.
ENDIF.

START-OF-SELECTION.
DATA lt_lines TYPE STANDARD TABLE OF string WITH EMPTY KEY.
cl_gui_frontend_services=>gui_upload( EXPORTING  filename = p_file
filetype = 'ASC'
CHANGING   data_tab = lt_lines
EXCEPTIONS OTHERS   = 1 ).
IF sy-subrc <> 0.
MESSAGE 'File could not be read' TYPE 'E'.
ENDIF.

LOOP AT lt_lines INTO DATA(lv_line) FROM 2.  " line 1 = column headers
APPEND INITIAL LINE TO gt_bank ASSIGNING FIELD-SYMBOL(<bank>).
SPLIT lv_line AT ',' INTO <bank>-banks <bank>-bankl <bank>-banka <bank>-ort01.
ENDLOOP.

Next step: loop over gt_bank and post each record with a BAPI (Part 6) or a BDC (Part 3).

Excel files

  • Legacy: FM ALSM_EXCEL_TO_INTERNAL_TABLE – not released, needs Excel installed on the PC, cells are cut at 50 characters, no background. Still seen in old programs.
  • Better: read the .xlsx as binary and parse it with CL_FDT_XL_SPREADSHEET (reads .xlsx – the Office Open XML format – not old .xls). Also used: TEXT_CONVERT_XLS_TO_SAP, the open-source library abap2xlsx (Apache-2.0), and in ABAP Cloud the released XCO_CP_XLSX API.
  • Simplest of all: ask for CSV – plain text, works on both servers and in background.
DATA lt_bin TYPE solix_tab.
DATA lv_len TYPE i.
cl_gui_frontend_services=>gui_upload( EXPORTING  filename   = p_file
filetype   = 'BIN'
IMPORTING  filelength = lv_len
CHANGING   data_tab   = lt_bin
EXCEPTIONS OTHERS     = 1 ).
DATA(lv_xlsx)  = cl_bcs_convert=>solix_to_xstring( it_solix = lt_bin iv_size = lv_len ).
DATA(lo_excel) = NEW cl_fdt_xl_spreadsheet( document_name = p_file xdocument = lv_xlsx ).
lo_excel->if_fdt_doc_spreadsheet~get_worksheet_names(
IMPORTING worksheet_names = DATA(lt_sheets) ).
DATA(lr_sheet) = lo_excel->if_fdt_doc_spreadsheet~get_itab_from_worksheet( lt_sheets[ 1 ] ).
ASSIGN lr_sheet->* TO FIELD-SYMBOL(<lt_sheet>).  " generic table, columns A, B, C ...

2.2 Application server

Files on the SAP server are handled with ABAP statements. Browse the folders in AL11.

Statement

Purpose

OPEN DATASET f FOR access IN mode

Open (or create) a file

READ DATASET f INTO line

Read one record; sy-subrc = 4 at end of file

TRANSFER line TO f

Write one record

CLOSE DATASET f

Close the file (always do it)

DELETE DATASET f

Delete the file

GET DATASET / SET DATASET

Read / set the position and attributes of an open file

Full syntax: OPEN DATASET dset FOR access IN mode [position] [os_additions] [error_handling].

Access

Behaviour

FOR INPUT

Read. Pointer at the start. File missing → sy-subrc = 8. No writing.

FOR OUTPUT

Write. Existing content is deleted; file created if missing. Reading also allowed.

FOR APPENDING

Write at the end. File created if missing.

FOR UPDATE

Change existing content. Pointer at the start. File missing → sy-subrc = 8.

Mode (mandatory)

Use

IN TEXT MODE ENCODING UTF-8 | DEFAULT | NON-UNICODE

Text lines; ENCODING is mandatory in text mode

IN BINARY MODE

Bytes as they are (PDF, images, XLSX)

IN LEGACY TEXT MODE / IN LEGACY BINARY MODE

Format expected by old non-Unicode systems

" Read a CSV file from the application server
DATA lv_file  TYPE string VALUE '/interfaces/in/banks.csv'.  " better: logical file name
DATA lv_line  TYPE string.
DATA lt_lines TYPE STANDARD TABLE OF string WITH EMPTY KEY.

OPEN DATASET lv_file FOR INPUT IN TEXT MODE ENCODING UTF-8.
IF sy-subrc <> 0.
MESSAGE |File { lv_file } cannot be opened| TYPE 'E'.
ENDIF.
DO.
READ DATASET lv_file INTO lv_line.
IF sy-subrc <> 0.  " 4 = end of file
EXIT.
ENDIF.
APPEND lv_line TO lt_lines.
ENDDO.
CLOSE DATASET lv_file.

" Write a file (an error list, for example)
OPEN DATASET lv_file FOR OUTPUT IN TEXT MODE ENCODING UTF-8.
LOOP AT gt_errors INTO DATA(ls_error).
DATA(lv_out) = |{ ls_error-bankl };{ ls_error-text }|.
TRANSFER lv_out TO lv_file.
ENDLOOP.
CLOSE DATASET lv_file.

Paths and security

  • Logical file names and paths (transaction FILE): define the physical folder once per system and resolve it in the program with FM FILE_GET_NAME. No hard-coded paths, works the same in DEV/QAS/PRD.
  • OPEN DATASET checks authorization object S_DATASET itself (exception CX_SY_FILE_AUTHORITY). FM AUTHORITY_CHECK_DATASET checks it beforehand; FM FILE_VALIDATE_NAME checks a user-entered path against a logical path – protection against directory traversal (../../).
  • CG3Z uploads a PC file to the application server, CG3Y downloads one – handy for testing.
  • Code pages: CL_ABAP_CODEPAGE=>CONVERT_TO( ) / CONVERT_FROM( ) convert string ↔ UTF-8 xstring; the newer released class is CL_ABAP_CONV_CODEPAGE.
  • Legacy: CL_RSAN_UT_APPSERV_FILE_WRITE / CL_RSAN_UT_APPSERV_FILE_READER appear in older code – they are internal BW helper classes, not released. Use the DATASET statements.

File archiving

After a file is processed, move it to an archive folder on the application server and delete it from the inbound folder, so it is not loaded twice and can be found later. (This is file archiving – SAP data archiving with SARA and archiving objects is a different topic.)

Part 3 – BDC (Batch Data Communication)

BDC loads data by replaying a transaction's screens with values from a file, exactly as a user would type them. Because the real screens run, all screen checks run too. It is an inbound technique – the target is always SAP.

There are three methods: Call Transaction and Session – together called batch input – and Direct Input (Part 4).

BDC: SHDB recording, BDCDATA table, call transaction vs session

3.1 Recording with SHDB

  • Transaction SHDB → New recording → enter the transaction code → run it once with sample values → save.
  • The recording lists every screen (program + screen number) and every field you filled, plus the OK-codes.
  • Don't press F1/F4 and don't enter wrong values while recording – everything is recorded.
  • SHDB can generate a program or a function module from the recording – a good starting point.

3.2 The BDCDATA table

Field

Meaning

PROGRAM

Module pool of the screen (e.g. SAPMF02B) – only on the screen row

DYNPRO

Screen number (e.g. 0100) – only on the screen row

DYNBEGIN

'X' = this row starts a new screen

FNAM

Field name (e.g. BNKA-BANKL), or the special fields BDC_OKCODE (function code, e.g. /00 = Enter, =UPDA = Save) and BDC_CURSOR (cursor position)

FVAL

Field value as text (max. 132 characters)

Two tiny helper routines build the table: bdc_dynpro adds a screen row, bdc_field adds a field row.

3.3 Call Transaction method

Syntax: CALL TRANSACTION tcode USING bdcdata [MODE m] [UPDATE u] | [OPTIONS FROM ctu_params] MESSAGES INTO msgtab.

Processing mode (DISMODE)

Meaning

A – all screens

Every screen is shown; the user presses Enter through it – for testing

E – errors only

Screens are shown only when an error occurs

N – no screens

Runs invisibly – normal for real loads and background jobs

Update mode (UPDMODE)

Meaning

A – asynchronous (default)

Like COMMIT WORK: the transaction doesn't wait for the database update – fastest, but the result isn't certain yet

S – synchronous

Like COMMIT WORK AND WAIT: waits until the update is done – slower, use it when the next record depends on this one

L – local

The update runs in the same dialog work process, not in the update work process

Better than MODE/UPDATE: pass a CTU_PARAMS structure with OPTIONS FROM. Fields: DISMODE, UPDMODE, DEFSIZE = 'X' (standard window size – table controls always show the same number of rows), RACOMMIT (don't end on COMMIT WORK), NOBINPT (sy-binpt stays space), NOBIEND (no batch-input mode after the data ends).

Messages come back in a table of type BDCMSGCOLL (MSGTYP, MSGID, MSGNR, MSGV1–MSGV4). Turn them into text with MESSAGE ID … INTO or FM FORMAT_MESSAGE. sy-subrc <> 0 means the transaction didn't finish.

  • Synchronous processing: one transaction after the other, the program waits for each.
  • No automatic error log – your program must collect errors (error file, ALV list, or put the failed records into a session so they can be corrected in SM35).
  • Fast; good for small to medium volumes and for online uploads where the user sees the result at once.

3.4 Session method

The program does not post anything itself. It writes the BDCDATA of each record into a batch input session (stored in the database, tables APQI/APQD). The session is processed later in SM35 or in a background job with report RSBDCSUB. The file can come from the PC or the application server.

Function module

What it does

BDC_OPEN_GROUP

Creates and opens the session. Parameters: CLIENT, GROUP (session name), USER (user for processing), KEEP = 'X' (keep after processing), HOLDDATE (not before this date). Only one session can be open at a time; a closed session cannot be reopened.

BDC_INSERT

Adds one transaction: TCODE + DYNPROTAB (the complete BDCDATA for that record).

BDC_CLOSE_GROUP

Closes the open session (no mandatory parameters). An unclosed session cannot be processed.

CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING client = sy-mandt
group  = 'ZBANK_LOAD'
user   = sy-uname
keep   = 'X'.  " keep the session after processing
LOOP AT gt_bank INTO DATA(ls_bank).
CLEAR gt_bdcdata.
" ... fill gt_bdcdata exactly as in the call transaction example below ...
CALL FUNCTION 'BDC_INSERT'
EXPORTING tcode     = 'FI01'
TABLES    dynprotab = gt_bdcdata.
ENDLOOP.
CALL FUNCTION 'BDC_CLOSE_GROUP'.
  • SM35 processing modes: Process/foreground, Display errors only, Background.
  • Asynchronous processing: data is stored first and posted later; the update is always synchronous.
  • Built-in log per session; failed transactions stay in the session and can be corrected and reprocessed.

3.5 Call Transaction vs Session

Point

Call Transaction

Session

How

CALL TRANSACTION … USING … MESSAGES INTO

BDC_OPEN_GROUP, BDC_INSERT, BDC_CLOSE_GROUP, then SM35

When posted

Immediately, while the program runs (synchronous)

Later, when the session is processed (asynchronous)

Error handling

Your program, via the BDCMSGCOLL table

Built in – session log, reprocess errors

Processing modes

A, E, N

Foreground, display errors only, background

Update modes

Asynchronous, synchronous, local

Synchronous only

Log

No batch input log

Detailed log per session

Speed / volume

Faster; small to medium volumes

Slower; large volumes, scheduled runs

Don't confuse synchronous/asynchronous processing (does the program wait for each transaction – call transaction yes, session no) with the update mode (does the transaction wait for the database update).

3.6 Complete example – bank master upload with call transaction

REPORT zbdc_bank_upload.

TYPES: BEGIN OF ty_bank,
banks TYPE bnka-banks,  " country
bankl TYPE bnka-bankl,  " bank key
banka TYPE bnka-banka,  " name
ort01 TYPE bnka-ort01,  " city
END OF ty_bank.

DATA gt_bank    TYPE STANDARD TABLE OF ty_bank WITH EMPTY KEY.
DATA gt_bdcdata TYPE STANDARD TABLE OF bdcdata WITH EMPTY KEY.
DATA gt_msg     TYPE STANDARD TABLE OF bdcmsgcoll WITH EMPTY KEY.

" ... selection screen and file upload into gt_bank as in Part 2.1 ...

START-OF-SELECTION.
DATA(ls_opt) = VALUE ctu_params( dismode = 'N' updmode = 'S' defsize = 'X' ).

LOOP AT gt_bank INTO DATA(ls_bank).
CLEAR gt_bdcdata.
PERFORM bdc_dynpro USING 'SAPMF02B' '0100'.  " initial screen
PERFORM bdc_field  USING 'BNKA-BANKS' ls_bank-banks.
PERFORM bdc_field  USING 'BNKA-BANKL' ls_bank-bankl.
PERFORM bdc_field  USING 'BDC_OKCODE' '/00'.
PERFORM bdc_dynpro USING 'SAPMF02B' '0110'.     " detail screen
PERFORM bdc_field  USING 'BNKA-BANKA' ls_bank-banka.
PERFORM bdc_field  USING 'BNKA-ORT01' ls_bank-ort01.
PERFORM bdc_field  USING 'BDC_OKCODE' '=UPDA'.  " save

CLEAR gt_msg.
CALL TRANSACTION 'FI01' USING gt_bdcdata OPTIONS FROM ls_opt MESSAGES INTO gt_msg.
IF sy-subrc = 0.
WRITE: / ls_bank-bankl, 'created'.
ELSE.
LOOP AT gt_msg INTO DATA(ls_msg) WHERE msgtyp CA 'EA'.
MESSAGE ID ls_msg-msgid TYPE 'S' NUMBER ls_msg-msgnr
WITH ls_msg-msgv1 ls_msg-msgv2 ls_msg-msgv3 ls_msg-msgv4
INTO DATA(lv_text).
WRITE: / ls_bank-bankl, lv_text.
ENDLOOP.
ENDIF.
ENDLOOP.

FORM bdc_dynpro USING program TYPE clike dynpro TYPE clike.
APPEND VALUE #( program = program dynpro = dynpro dynbegin = 'X' ) TO gt_bdcdata.
ENDFORM.

FORM bdc_field USING fnam TYPE clike fval TYPE simple.
APPEND VALUE #( fnam = fnam fval = fval ) TO gt_bdcdata.
ENDFORM.

Screen numbers and field names come from your SHDB recording – check them in your system.

3.7 Practical tips

  • Table controls (item lists): the number of visible rows depends on the window size – set DEFSIZE = 'X' and scroll with OK-code =P+, or use the screen's "insert line" function to always type into row 1.
  • Fields that are not on the screen in your recording (other views, other company code settings) make the BDC fail – record with exactly the data pattern you will load.
  • Put failed records from call transaction into a session (BDC_INSERT) so users can correct them in SM35.
  • In S/4HANA / clean core: many classic transactions changed or are replaced by Fiori apps (customer and vendor → Business Partner), so recordings break. Prefer the Migration Cockpit or a BAPI/API; BDC only when no API exists.

Part 4 – Direct Input (legacy – know it for interviews)

Part 5 – LSMW (legacy – know it for interviews)

LSMW (Legacy System Migration Workbench), transaction LSMW, is a migration tool (not part of the ABAP Workbench) that loads files with little or no coding. It was popular for master data in ECC.

Import methods

Method

What happens

Standard batch / direct input

Uses SAP's predefined batch input or direct input programs (e.g. RMDATIND)

Batch input recording

Uses your own SHDB-style recording – creates a batch input session

BAPI

Calls a BAPI through its inbound IDoc (message type of the BAPI) – needs port and partner profile

IDoc

Creates inbound IDocs of a standard message type – needs port and partner profile

Structure: Project (can hold several subprojects) → Subproject (any number of objects) → Object (one business object, e.g. material master or customer master).

The LSMW steps

#

Step

What you do

1

Maintain object attributes

Choose the import method (batch input, recording, BAPI, IDoc)

2

Maintain source structures

Describe the file layout (header, items)

3

Maintain source fields

Fields of each source structure

4

Maintain structure relations

Link source structures to the SAP target structures

5

Maintain field mapping and conversion rules

Source field → target field, with rules

6

Maintain fixed values, translations, user-defined routines

Reusable values and value tables

7

Specify files

Where the input file is (PC or application server)

8

Assign files

Which file feeds which source structure

9

Read data

Read the file into LSMW

10

Display read data

Check what was read

11

Convert data

Apply the mapping and rules

12

Display converted data

Check the converted result

13

Create batch input session (or start IDoc / direct input processing)

Hand the data to SAP

14

Run batch input session

Post the data (SM35) and check the log

  • Transport: LSMW settings are not recorded automatically – generate a change request manually (Extras → Generate change request) or use Export/Import project.
  • In S/4HANA / clean core: LSMW is "not recommended" (SAP Note 2287723) and doesn't work for many objects (e.g. customer/vendor are Business Partners now). Use the S/4HANA Migration Cockpit (Part 7).

Part 6 – BAPI-based upload

A BAPI is a released, remote-enabled function module of a business object (details on page 07). For uploads it is the best classic option: SAP's checks run, no screens are involved, and the interface stays stable across releases.

  • Find the BAPI: transaction BAPI (BAPI Explorer), or SE37 search BAPI_*, e.g. BAPI_BANK_CREATE for FI01.
  • Always check the RETURN parameter (type BAPIRET2): any message of type 'E' or 'A' means failure.
  • BAPIs never commit themselves: call BAPI_TRANSACTION_COMMIT (with wait = 'X') after success and BAPI_TRANSACTION_ROLLBACK after an error. Some BAPIs offer a TESTRUN flag for a simulation.
  • Change BAPIs pair each data structure with an X structure ('X' marks the fields to change).
  • Try it first in SE37 – Function Module → Test → Test Sequences lets you run the BAPI and then BAPI_TRANSACTION_COMMIT in one LUW.
" Same bank upload as the BDC example – now with the BAPI
DATA ls_return TYPE bapiret2.

LOOP AT gt_bank INTO DATA(ls_bank).
CLEAR ls_return.
CALL FUNCTION 'BAPI_BANK_CREATE'
EXPORTING
bank_ctry    = ls_bank-banks
bank_key     = ls_bank-bankl
bank_address = VALUE bapi1011_address( bank_name = ls_bank-banka
city      = ls_bank-ort01 )
IMPORTING
return       = ls_return.

IF ls_return-type CA 'EA'.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
WRITE: / ls_bank-bankl, ls_return-message.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING wait = 'X'.
WRITE: / ls_bank-bankl, 'created'.
ENDIF.
ENDLOOP.

Many BAPIs return a table of messages instead (e.g. BAPI_SALESORDER_CREATEFROMDAT2): then check line_exists( lt_return[ type = 'E' ] ) OR line_exists( lt_return[ type = 'A' ] ).

Custom fields in a BAPI upload go through ExtensionIn (see page 07, BAPI extension).

Part 7 – S/4HANA Migration Cockpit (the modern standard)

The SAP S/4HANA Migration Cockpit is SAP's tool for loading legacy data into S/4HANA (on-premise, private and public cloud). It ships predefined migration objects (bank, customer/supplier as Business Partner, product, open items, fixed assets, purchase orders …) that post through SAP's own APIs.

  • Fiori app "Migrate Your Data – Migration Cockpit". The old transaction LTMC is deprecated – use the app.

Two approaches

Approach

How the data gets in

Typical use

Migrate data using staging tables

The cockpit generates a staging table per object. Fill it by uploading the XML/CSV templates in the app, or directly with an ETL tool (e.g. SAP Data Services) or your own program

Data from non-SAP legacy systems

Migrate data directly from an SAP system

The cockpit reads the data from the SAP source system (e.g. ECC) over an RFC connection

New implementation coming from SAP ECC

Steps in the app

  • 1 Create a migration project (approach, source, mass transfer ID).
  • 2 Select the migration objects (e.g. Bank, Customer, Product).
  • 3 Fill the staging tables (template upload or tool) – or let the direct transfer select the data.
  • 4 Prepare, then complete the mapping tasks – value mapping of old codes to new ones (e.g. old plant → new plant).
  • 5 Simulate – runs all checks without saving; fix data and repeat.
  • 6 Migrate – posts the data; check the messages, correct and reload the failed records.

Migration Object Modeler (LTMOM)

  • Transaction LTMOM – change a predefined object (e.g. add your custom fields) or create your own migration object, typically based on a BAPI or function module, for data the standard objects don't cover.
  • This is where ABAP developers usually work in a Migration Cockpit project – plus writing programs that fill staging tables and checking errors.

In S/4HANA / clean core: Migration Cockpit first; BAPI programs where no object exists; BDC and LSMW only in brownfield ECC systems.

Part 8 – Comparison and tool choice

Which migration tool to choose, in order

Tool

Screens?

SAP checks

Errors

Volume / speed

S/4HANA status

Call Transaction

Yes (hidden in mode N)

Screen checks

Own code (BDCMSGCOLL)

Small–medium, fast

Last resort

Session

Yes, later in SM35

Screen checks

Session log, reprocess

Large, slower

Last resort

Direct Input

No

FM checks

Log, restart (BMV0)

Large, fast

Legacy

LSMW

Depends on method

Of the chosen method

Per method

Medium

Not recommended

BAPI program

No

Full business checks

RETURN table

Large, fast

Recommended

Inbound IDoc

No

Full business checks

Status records, BD87

Large, can be parallel

Supported

Migration Cockpit

No

Full business checks

Messages, simulate, reload

Large

Standard

Part 9 – Interview questions

Q1. What is the difference between data migration and data transfer?

Migration is a one-time load from an old system at go-live (RICEFW Conversion). Transfer is a recurring exchange while both systems run (an Interface).

Q2. What are the BDC methods?

Three: Call Transaction and Session (together: batch input) and Direct Input. Call Transaction posts immediately; Session stores the data and posts it later in SM35; Direct Input writes without screens.

Q3. Call Transaction vs Session – when do you use which?

Call Transaction: small/medium volumes, immediate result, you code the error handling. Session: large or scheduled loads, built-in log and reprocessing, update always synchronous.

Q4. What are the processing and update modes of CALL TRANSACTION?

Processing: A all screens, E errors only, N no screens. Update: A asynchronous (default), S synchronous (waits – use when records depend on each other), L local.

Q5. What is CTU_PARAMS?

A structure passed with OPTIONS FROM: DISMODE, UPDMODE, DEFSIZE (fixed window size for table controls), RACOMMIT, NOBINPT, NOBIEND. It replaces MODE/UPDATE and gives more control.

Q6. How do you handle errors in Call Transaction?

Use MESSAGES INTO a BDCMSGCOLL table, check sy-subrc, turn E/A messages into text (MESSAGE … INTO or FORMAT_MESSAGE), log them, and optionally write failed records into a session for SM35.

Q7. What is BDCDATA and what are BDC_OKCODE and BDC_CURSOR?

The table of screens and field values: PROGRAM, DYNPRO, DYNBEGIN for a screen; FNAM, FVAL for fields. BDC_OKCODE holds the function code (Enter, Save), BDC_CURSOR the cursor position.

Q8. Can you use GUI_UPLOAD in a background job?

No – it needs SAP GUI. Read the file from the application server with OPEN/READ/CLOSE DATASET instead (logical file name from transaction FILE).

Q9. What are the access types and modes of OPEN DATASET?

Access: INPUT, OUTPUT, APPENDING, UPDATE. Mode: TEXT MODE (with mandatory ENCODING), BINARY MODE, LEGACY TEXT/BINARY MODE. READ DATASET returns sy-subrc 4 at end of file.

Q10. Why prefer a BAPI over BDC for uploads?

No dependency on screens, faster, stable released interface, structured RETURN messages, works in S/4HANA. Remember BAPI_TRANSACTION_COMMIT – BAPIs don't commit.

Q11. What are the LSMW steps and methods – and do you use LSMW in S/4HANA?

Methods: standard batch/direct input, recording, BAPI, IDoc. Steps: attributes, source structures and fields, relations, mapping, files, read, convert, create and run session. In S/4HANA it is not recommended.

Q12. What replaces LSMW in S/4HANA?

The S/4HANA Migration Cockpit (app "Migrate Your Data") with staging tables or direct transfer from an SAP system, predefined objects, mapping, simulation – and LTMOM for custom objects or fields.

🏠 Start Here · ◀ 05 · Dialog Programming · 07 · Interfaces ▶ · Sections: CORE ABAP | OOPS ABAP | ABAP on HANA | Clean Core | RAP | ABAP Points | SAP Fiori | SAPUI5 | Mobile Development (MDK) | BTP Foundations | BTP Development | CAP | SAP Build | ABAP on BTP | Integration Suite | SAP Business AI | SAP BASIS | Security | SAP SDLC

Functional: FICO ABAP | TRM ABAP | VIM | SAP BIS | SD ABAP | MM ABAP | PP ABAP | QM ABAP | PM ABAP | PS ABAP | EWM | TM ABAP | EHS ABAP | HR ABAP | BW | SAP MDG | SAP Analytics Cloud | SAP Ariba | SAP CX | SAP IBP