Académique Documents
Professionnel Documents
Culture Documents
These techniques are used to upload the data from the specified file path from legacy
system into an internal table of the programs.
They are also used to download data from an internal table of program into the
specified file path of Legacy system.
There are 2 types of file handling techniques:
a. Front End System/Local PC
b. Application Server -AL11
Note:
Files from Local PC cannot be processed in back ground since standard FMs give run
time errors.
BY MR. BABU (OASIS TECHNOLOGIES)
The function module which starts with GUI* are advisable since it has a Delimiter
parameter (Has field separator) and support any format from ECC6.0
The function modules UPLOAD and DOWNLOAD are outdated.
The standard function module “ALSM-EXCEL_TO_INTERNAL_TABLE” is used to upload
the excel file data into an internal table.
It is used to provide the search help to select the required file path of the Front end
system/Local PC.
Example:
AT SELECTION SCREEN ON VALUE-REQUEST FPR <P_FILE>.
CALL FUNCTION ‘F4_FILENAME’
EXPORTING
Program_name = sy-repid.
Dynpro_number = sy-dynnr.
Field_name = <‘P_FILE’> “only in uppercase
IMPORTING
file_name = <P_FILE>
This statement is used to move corresponding field data from the source to the
destination work areas or field symbols and internal tables.
Syntax: MOVE-CORRESPONDING <wa_source> TO <wa_destination>. “ While processing
SELECT <f1>
<f2>
…..
INTO CORRESPONDING FIELDS OF TABLE <gt_itab> …. “ While Extracting
b. Application Server:
Download / Transfer:
The below ABAP statements are used to transfer the data from an internal table into the
specified file path of application server (AL11).
1. OPEN DATASET FOR OUTPUT….
2. TRANSFER …..TO
3. CLOSED DATASET…
This statement is used to open the required files in write mode in Application server.
Syntax:
OPEN DATASET <p_file> FOR OUTPUT IN TEXT/BINARY MODE ENCODING DEFAULT [MESSAGE
<gv_msg_text>]
2. TRANSFER Statement:
This statement is used to transfer the concatenated data (String Line-gv_line) into the
opened file.
Syntax:
LOOP AT <gt_final> INTO <wa_final>.
*Convert numeric data into Character.
<gv_char> = <gv_numeric>. “ Convert Number type
WRITE <wa_final-currencyt> TO <gv_amnt_c>. “ Convert Currency data type
*Concatinate the data
CONCATENATE <wa_final.field> ----<gv_char> <gv_amnt_c>
INTO <gv_line>.
BY MR. BABU (OASIS TECHNOLOGIES)
*Transfer the concatenated data
TRANSFER <gv_line> TO <P_File>.
CLEAR <gv_line>.
END LOOP.
3. CLOSED DATASET Statement:
Upload:
The below ABAP Statements are used to read or upload data from the file in an
application server into an internal table of the program.
1. OPEN DATASET.. FOR INPUT
2. READ DATASET
3. CLOSE DATASET
Note:
2. READ DATASET:
BY MR. BABU (OASIS TECHNOLOGIES)
This statement is used to read record by record (line by line) from the opened file in
Application Server.
Syntax:
DO.
*Read Record by record.
READ DATASET <P_File> INTO <wa_final>.
IF sy-subrc EQ 0.
*Append Internal Table
APPEND <wa_final> TO <gt_final>.
ELSE.
*Exit out of the loop.
EXIT.
ENDIF.
CLEAR: <wa_final>.
ENDDO.
3. CLOSE DATASET:
1. Download or Transfer:
BY MR. BABU (OASIS TECHNOLOGIES)
2. Upload:
The transaction code CG3Y is used to download the files from an application server into
the presentation server or front end system or local pc.
The transaction code ‘CG3Z’ is used to upload files from the presentation server / front
end system / Local PC into an application server (AL11).
Steps to Upload:
Note:
Make sure the directory in an application server is not opened while writing /
transferring the data.
The transaction code ‘FILE’ is used to maintain logical and physical file paths.
The standard function module ‘FILE_GET_NAME’ can be used to get the logical file
path of the physical file.
Data migration/conversion
Introduction:
This concept is used to migrate or convert a flat file data from the legacy system into sap
data base.
Following are the different methods or techniques to migrate or convert the
Flat file data.
1. LSMW (Legacy system migration work bench).
2. BDC (Batch data communication).
3. Using standard BAPI (Business application programming interface).
4. Direct input method using standard programs.
[DIAGRAM]-Refer Notes
BY MR. BABU (OASIS TECHNOLOGIES)
SD Flow and MM flow:
Refer Notes
It is the system provided tool to migrate/convert a flat file data from the legacy system
into sap data base.
The legacy system data can be imported in different import methods using LSMW.
The T-code LSMW is used work with LSMW
Following are different import methods:
a) Standard batch or direct input.
B) Batch input recording.
c) Business object method (BAPI).
d) IDOC (Intermediate document).
NOTE:
An import method batch input recording is mostly used with LSMW.
NOTE: All the process steps can be performed (14-17) are appeared.
NOTE: In the real time the functional transactional codes screen fields recordings can be done
By functional consultants.
Click on ‘Yes’ button.
Enter valid from ____ to _____ .
Enter cost center.
Press ‘Enter’ button.
Fill all the required mandatory fields such are: name, person responsible, hierarchy area,
company code and profit center.
Click on save icon.------- Related to “ks01”.
Click on save icon to save the recording.
Double click on the screen field(csksz-kokrs).
Remove the default values.
Enter the field name.
Click on yes.
NOTE: Follow the similar steps for any number of screen fields to which the data to be
Transferred from the flat file.
Example:
Screen field Default value Name
Csksz-kokrs Kokrs
Csksz-kostl Kostl
Csksz- 18:03:2014
dbtab_anb
Csksz-ktext Kyext
BY MR. BABU (OASIS TECHNOLOGIES)
Csksz-verak Verak.
Click on save.
Click on back.
Click on back.
Click on save icon to save maintain attributes step.
Click on back.
This step is preformed to maintain the structure name of the flat file.
Steps to perform:
It is performed to maintain the fields of the source structure to hold the flat file data.
Steps to perform:
NOTE:
Refer the given flat file (or) DBTAB to know field type and length.
The field type “character” is mostly used to define the source fields.
BY MR. BABU (OASIS TECHNOLOGIES)
NOTE: Follow the similar steps for any number of source fields.
This step is performed to maintain the relationships with the BDC structure.
NOTE: This step is performed by the system automatically, hence no need to perform this
Step manually.
This step is performed to map the fields and maintain the conversations.
Steps to perform:
Recording
ZB_REC_KS01
BY MR. BABU (OASIS TECHNOLOGIES)
Ktext Source structure
Kokrs ZB_SOURCE_STRCTR
Kostl Kokrs
Verak Ktext
prctr Prctr
Kostl
Verak
NOTE: ABAP source code can also be written in “LSMW” using the change icon that appears
besides recording structure field.
Click on save.
Click on back.
It is performed to maintain default values, transactions and user defined routines for
the screen fields of the recording.
NOTE: This step can be skipped in case of not required to maintain any fixed values and
Translations.
It is performed to specify the flat file and the data separators from which the data to be
migrated.
Steps to perform:
NOTE: Length of the file under imported and converted data should not exceed 45 characters.
This step is performed to assign the flat files to the source structure.
NOTE: This step is performed by the system automatically hence it can be skipped.
Steps to perform:
Steps to perform:
BY MR. BABU (OASIS TECHNOLOGIES)
Select a radio button “convert data”.
Click on execute icon.
Click on execute.
Click on back.
Click on back.
Steps to Perform:
This step is performed to create a batch input session which can be processed to
migrate the converted flat file data into data base tables through screens.
Steps to Perform:
NOTE: The check box “Keep Batch Input Folders” can be checked to keep the processed
session in the system, otherwise the processed session is deleted by the system
automatically.
It is performed to run the Created batch input session to migrate or update the data
through the screens of the t-codes.
BY MR. BABU (OASIS TECHNOLOGIES)
Steps to Perform:
NOTE: The button “log” is used to analyze the created log file while migrating the data.
NOTE: Tick mark is appeared for all the processed sessions under status column.
It is a utility to develop programs /reports to migrate or convert the flat file data into the
data base tables.
The BDC has two methods.
a)Session method.
b) Call transaction method.
Session Method:
This function module is used to create or open the batch input session which can be
processed using the t-code SM35.
The below parameters can be passed:
CALL FUNCTION ‘BDC_OPEN_GROUP’
EXPORTING
*client = sy-mandt “system client number.
Group = <p_group> “session name to be created in SM35.
BY MR. BABU (OASIS TECHNOLOGIES)
keep = ‘X’ “Xkeep the processed session in SM35.
*user = sy_uname “user name who executed the program .
*prog= sy_cprog “ system program name.
* indicates optional.
This function module is used to insert the screen table data of the structure ”BDCDATA”
with Transaction into session.
The screen table (GT_BDCDATA) can be processed to migrate the corresponding data
into data base tables through the specified t-code by processing the created session.
The below parameters can be passed:
CALL FUNCTION ‘BDC_INSERT’
EXPORTING
T-code = ‘<t-code>’ “required functional t-code.
*CTUPARMS =<wa_ctu_parms> “handles screen resolution of table control in session.
TABLES
Dynprotab =<gt_bdcdata> “screen table of type bdc data with flat fuile data.
NOTE: An export parameter “CTUPARMS” is used to handle the screen resolution in case of
table control to process the multiple line items in session method.
This function module is used to close the opened batch input session.
No need to pass any parameters to this function module.
It is used to update / migrate/ convert the data in both synchronous and asynchronous
mode from flat file into data base tables through screens.
This method is faster than the session method.
The ABAP statement “CALL TRANSACTION” is used to work with this method.
Synatx:
CALL TRANSACTION ‘<TCODE>’ USING <GT_BDCDATA> MODE
BY MR. BABU (OASIS TECHNOLOGIES)
<A/N/E>UPDATE<S/A>[messages into <gt_bdcmsgcoll>].
Here:
<TCODE> is the required transaction code through which the flat file data to be
migrated/converted.
<gt_bdcdata> is an internal table of type “bdc data” structure.
<A/N/E> are different data process modes.
A = All screens.
N = No screens.
E = Error screens.
<S/A> are the different update modes.
S = Synchronous mode.
A = Asynchronous mode.
NOTE: The screen resolution of the table controls is maintained in call trans action method
using the below
Syntax:
CALL TRANSACTION ‘<TCODE>’USING<GT_BDCDATA> OPTIONS FROM
<wa_ctu_params>[Message INTO <gt_bdcmsgcoll>].
Here:
<wa_ctu_params> is a structure data variable of the type “CTU_PARMS” DDIC structure.
Following are the different modes to process the data in call transaction method.
I. A-All Screens:
This data process mode displays all the screens while migrating/converting a flat
file data.
This data process mode is used to process the data without showing any screens
(background).
It is almost similar to no-screens mode. But only the difference is the no-screens
mode does stop the break points in called transactions. Whereas the process mode
stops at the break points.
There are 3modes to update the data into data base tables through the required t-code
screens.
a.)S-Synchronous Mode:
NOTE: The synchronous update mode is stopped with an error record whereas the
asynchronous mode skips the error records.
c.)L-Local Update:
It is used to update/migrate the data with local update task.(Set update task local).
Field Description
BY MR. BABU (OASIS TECHNOLOGIES)
Program BDC module pool
DYNPRO BDC screen number
DYN BEGIN BDC screen start
FNAM Field name
FVAL BDC field value(flat file).
Record screen flow of the required functional t-code using the t-code “SHDB”.
NOTE: In the real time screen flow recording is mostly given by the functional consultants.
The t-code SHDB is used to record the screen flow as the t-codes.
NOTE: An icon export is used to download the recording into local pc.
An icon import is used to upload the recording file into an transaction recorder.
Keep on pressing enter button until the recording process is done.
Click on back.
NOTE: An option read from file is used to generate a program using the given recording file.
Scenario on BDC:
Change the sales document data using the given flat file.
T-code: VA02.
BY MR. BABU (OASIS TECHNOLOGIES)
Tables: VBAK, VBAP.
The t-code SM35 is used to work with the created batch input session to process
session, check the log file etc.
NOTE:
The button log is used to check the system generated log file analysis the
messages.
The session can be scheduled in background to migrate the data without user
interaction using the tab “In Background”.
NOTE: Remove the processed records from the flat file, rectify error record then re process
Session in case of error record in session method.
Click on back.
Get the message details such are, message type message number into an internal table.
(gt_bdcmsgcoll) of the type BDCMSGCOLL using an addition “…..MESSAGES INTO” with
CALL TRANSACTION statement.
Set a loop into an internal table (gt_bdcmsgcoll) of the type “bdcmsgcoll”.
Use any of the function modules “FORMAT_MESSAGE”/ “WRITE_MESSAGE” to get the
corresponding message text, since the structure “BDCMSGCOLL” does not have any
message text field.
NOTE: The standard table “T100” can also be used to populate the message text.
Display the populated messages with message text either list or ALV
LSMW BDC
1.It is system provided tool 1. It is utility to develop a program.
BY MR. BABU (OASIS TECHNOLOGIES)
2. The data can be imported in different 2. The data is processed or Migrated in batch
import methods such as batch input recording, input method only.
BAPI, IDOC.
4. It is compatible for both large and small 4. It is compatible for small amount of data
amount of data. only.
5. The field mapping is done automatically by 5. The field mapping should be done manually.
the system.
6. It is not possible for custom 6. Can be used for custom screens or custom
screens/standard with custom fields of fields of applications also.
applications.
7. It cannot be used for new functional t-codes
7. It can be used for enjoy (new t-codes) (enjoy t-codes).
transaction codes also(ends with *N)
8. The t-code SM35 is used to develop BDC
8. The t-code LSMW is used to work with this program.
tool.
2. The flat file data is processed 2. The flat file data is processed
asynchronously. synchronously.
3. The log file is generated by the system. 3. The messages should be handled explicitly
using the structure “BDCMSGCOLL”, and the
function modules “FORMAT_MESSAGE” /
“WRITE_MESSAGE”.
BY MR. BABU (OASIS TECHNOLOGIES)
4. The standard function modules 4. The ABAP statement CALL TRANSACTION is
“BDC_OPEN_GROUP”, “BDC_INSERT”, used to work with the call transaction method.
“BDC_CLOSE_GROUP” are used to work with
the session method.
5. It is not as fast as call transaction method. 5. It is faster than the session method.
6. One batch input session is created which 6. The t-codes are called for each record while
can be processed using the t-code SM35 after executing the program.
the program execution.
The table control is used to update or migrate the multiple records (line items) in BDC.
Header data:
Doc No: 1
Line Items
Record screen flow with line items using the t-code “SHDB”.
NOTE:
Press page down in the table control to record the function code for page down.
In the real time the recording is given by the functional consultants.
BY MR. BABU (OASIS TECHNOLOGIES)
[diagram]-Refer Notes
NOTE: The header and item data can be processed separately using the control break
statements without splitting the flat file data.
Set a loop to header internal table then process the header related data by copy and
paste the system generated header related subroutines from the temporary recording
program.
LOOP AT <gt_header> INTO <wa_header>.
REFRESH:<gt_bdcdata>.
Set a loop to item table data to process the multiple line items.
Make the item number dynamic by concatenating the screen field name with the screen
number.
BY MR. BABU (OASIS TECHNOLOGIES)
* Process the Line Items
Use the function code “p+” to handle page down in table control.
< lv_counter = lv_counter + 1.
IF lv_counter EQ <2>.
PERFORM bdc_field USING 'BDC_OKCODE'
'=P+'.
CLEAR lv_counter.
ENDIF. >
ENDLOOP.
NOTE: The control break statements can also be used to process header and item data
separately by avoiding nested loops.
Pass the required data such are default size, display mode,update mode and etc to the
defined ctu_params structure variable.
<wa_ctu_params>-updmode = <p_umode>.
<wa_ctu_params>-defsize = <gc_x>.
<wa_ctu_params>-dismode = <p_pmode>.
Use the populated structure variable of type ctu_params (gs_ctu_params) with CALL
TRANSACTION using an addition “OPTIONS”.
Conversion Routines:
The conversion routines are used to convert the data from internal format to external
format and external format to internal format.
The conversion routines are maintained at the domain level of a field.
The standard function module which ends with “*input” and “*output” are attached to
the maintained at conversion routines.
Example: 4970000000….4970.
Example: 00000……49704970.
NOTE: The conversion routine name is appeared in the conversion routine field in case of
available
Double click on conversion routine name to find the attached conversion routine
function modules (*input, *output).
Click on back.
Read an internal table with in the loop of base internal table and get an index of current
record.
Set a loop to second internal table (item table) to process from the set index(lv_index)
Use an “EXIT” statement to come out of second loop for unmatched records.