Conversion and Interfaces
Conversion and Interfaces
These are the programs which are used to transfer the data from SAP SAP and SAP
Non-SAP
Conversions: This are called as the initial loads which are mainly used during the
implementation go-live and these are one time programs which are used to update the SAP
Data base with the initial data
Interfaces: These are called as real time data transfer between SAP SAP and SAP
Non SAP systems.
In these conversions we are going see the BDC, LSMW ( For SAP ECC systems) SAP HANA
systems we do have LTMC and LTMOM ( Conversion we can also called as Data migration )
In these interfaces we are going to see about BAPI ( Which uses RFC FM Technology ) and
IDOC’s and OData services
o ALE Idoc’s Transfer of data between SAP SAP system.
o EDI Idoc’s Transfer the data between SAP Non SAP Systems.
SAP Middle Ware( Such as Mulesoft, TIBCO, SNOWFLAKE, SAP PI/PO )
3rd Party system
o Odata Service This is a Microsoft tool which will convert the SAP Data in URL
based XML or JSON files
These URL will be used to get the data directly from the 3rd party system this
we will call it as (PTP Contact( Point to Point contact ) ).
Which the help of these URL we will CRUD operations
GET Is used to get the data from the date base and send back to
3rd party system
POST Its is used to create the data in SAP i.e., we will be receiving
the data from the 3rd the party system
PUT(Update) these are mainly used to changes the SAP DATA
PATCH These is also used to change the SAP Data
DELETE This is used to delete the data.
In all the conversion and Interfaces we will have sit with the 3 rd party team and we need to
design how we are going to receive the file to SAP or how we are going to send the file from
SAP.
For every interface we will create an excel sheet that sheet we will call it has the mapping
sheet
o Source tab
o Target tab
o Mapping and conversions
Its process to receive the data from an SAP system or from a Non SAP System
Mainly we will use BDC for receiving of data and transferring the same data in SAP to create
the corresponding orders in SAP.
o Different method of BDC
Call Transaction method
Session Method
Direct input method
LSMW – Legacy system migration work bench
When ever we are working on BDC we can upload the data on our own way or we can get
the SAP from 3rd party system directly
Conversion And Interfaces:
o Uploading from the Presentation server (Manual upload)
o Uploading the data from the Application Server ( 3rd party will keep the file )
o Downloading to presentation server manually
o Placing the file to the Application server ( to send the data to the 3rd party system )
When ever we are working on BDC, firstly we need to record the Tcode For doing the Tcode
recording we will use a TCODE SHDB
In this technology we are going to transfer the data from a flat file or from an application
server file in to SAP by the calling the corresponding transaction.
This method is used to transfer any master or transactional data.
This method is used when we have less amount of data (< 10k ~ 15krecords)
This method is used both synchronous and asynchronous update
The error message/success messages which will come when we are using this call
transactions we have to store in an Internal table of Type BDCMSGCOLL.*****
Syntax:
o CALL TRANSACTION <Tcode name >
Using< BDC Data >
UPDATE < A/S>
MODE <A/E/N>
Message into < Message internal table (BDCMSGCOLL).
BDC Data:
o It’s a structures define the the data base with the following fields
Program name Name of the screen program
Dynpro Screen number
Dynbegin process we are doing
FNam SAP filed Name
FVal What ever the value we are passing.
o In simple words, it holds all the screen related information and field information to
be transferred to the corresponding fields.
o To prepare the BDC data either we can do it manually by pressing the F1 and get the
corresponding details or we can get the details by recording process which we will
do it in Tcode: SHDB.
Update: we do have to types of Updates
o Asynchronous I wont check if the record as completed or not
o Synchronous I will wait till the first get completed
Mode: How we are want to process the data
Conversion And Interfaces:
o A All screen mode we can see how transferring is happening in SAP.
o E Error mode once SAP see the Error the screen will open automatically
o N No Screen Mode We can able the see how the process is happening only we
can the if its success or error with the help of BDCMSGCOLL Itab.
o In real time we will always use ‘N’
SHDB it’s a process which is used to records any SAP application transaction.
My Req is I’m going to get the material master data from 3rd party system, and same details has to
be transferred to SAP
Note: when ever we want to work on a BDC the file format support is .TXT file.
Field symbols: These are like Wa, but field symbol will point to the variable of my ITAB. So if there is
an change in value automatically the value of the ITAB will get changes. We don’t to write a Modify
statement.
50065824 created
Req: Create A recording for Vendor master and customer master data and create own files ( which
contains errors and success message) and write the BDC program using call transaction and display
the details in the output
1234 created
*-- Once uploading is done i need a o/p with customer and message
START-OF-SELECTION.
*-- FM to upload the file --> GUI_UPLOAD
gv_upload = p_upload.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gv_upload
filetype = 'ASC'
has_field_separator = ','
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
Conversion And Interfaces:
* CHECK_BOM = ' '
* VIRUS_SCAN_PROFILE =
* NO_AUTH_CHECK = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
TABLES
data_tab = gt_upload
* CHANGING
* ISSCANPERFORMED = ' '
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
BREAK-POINT.
LOOP AT gt_upload ASSIGNING <gfs_upload>.
PERFORM bdc_dynpro USING 'SAPMF02D' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF02D-BUKRS'.
Conversion And Interfaces:
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RF02D-KUNNR'
<gfs_upload>-cust_numb.
PERFORM bdc_field USING 'RF02D-BUKRS'
<gfs_upload>-comp_code.
PERFORM bdc_field USING 'RF02D-KTOKD'
<gfs_upload>-acc_grp.
PERFORM bdc_dynpro USING 'SAPMF02D' '0110'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNA1-SPRAS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'KNA1-NAME1'
<gfs_upload>-name.
PERFORM bdc_field USING 'KNA1-SORTL'
<gfs_upload>-search.
PERFORM bdc_field USING 'KNA1-ORT01'
<gfs_upload>-city.
PERFORM bdc_field USING 'KNA1-PSTLZ'
<gfs_upload>-pincode.
PERFORM bdc_field USING 'KNA1-LAND1'
<gfs_upload>-country.
PERFORM bdc_field USING 'KNA1-SPRAS'
<gfs_upload>-language.
PERFORM bdc_dynpro USING 'SAPMF02D' '0120'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNA1-LZONE'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'KNA1-LZONE'
<gfs_upload>-zone.
PERFORM bdc_dynpro USING 'SAPMF02D' '0125'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNA1-NIELS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNBK-BANKS(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0340'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNVA-ABLAD(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0370'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNEX-LNDEX(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_field USING 'KNA1-CIVVE'
'X'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0360'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNVK-NAMEV(01)'.
Conversion And Interfaces:
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0210'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNB1-AKONT'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'KNB1-AKONT'
<gfs_upload>-recoacc.
PERFORM bdc_dynpro USING 'SAPMF02D' '0215'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNB1-ZTERM'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0220'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNB5-MAHNA'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0230'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNB1-VRSNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_transaction USING 'XD01' <gfs_upload>-cust_numb.
CLEAR: gt_bdcdata.
ENDLOOP.
ls_bdcdata-program = program.
ls_bdcdata-dynpro = dynpro.
ls_bdcdata-dynbegin = 'X'.
APPEND ls_bdcdata TO gt_bdcdata.
ENDFORM.
*----------------------------------------------------------------------*
* Insert field
*
*----------------------------------------------------------------------*
FORM bdc_field USING fnam fval.
DATA: ls_bdcdata TYPE bdcdata.
CLEAR ls_bdcdata.
ls_bdcdata-fnam = fnam.
ls_bdcdata-fval = fval.
APPEND ls_bdcdata TO gt_bdcdata.
Conversion And Interfaces:
ENDFORM.
*&---------------------------------------------------------------------*
*& Form BDC_TRANSACTION
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0446 text
*----------------------------------------------------------------------*
FORM bdc_transaction USING p_0446 TYPE tcode
p_cust_numb TYPE string.
CALL TRANSACTION p_0446 USING gt_bdcdata UPDATE 'A' MODE 'N' MESSAGES INT
O gt_msg.
How to get the file from the application layer or how to place file in the application layer:
Application Layer To create the corresponding documents in SAP automatically or to place the
SAP related documents so that the 3rd party can able to consume these filed Automatically.
The Tcode: AL11 we will have different directories where we will get/keep the filed so that either
3rd party or SAP can read these files.
How to create the directories: FILE these will be created by SAP BASIS in real time
To upload the file / to download the file from application we have different Tcode ****
1. CG3Z Upload the file to application server from your local machine
2. CG3Y download the to the local machine from your application server.
Endloop.
CLOSE DATASET.
Example code:
OPEN DATASET p_upappl FOR OUTPUT ENCODING DEFAULT IN TEXT MODE.
IF sy-subrc = 0.
ENDIF.
CLOSE DATASET p_upappl
Session Method: this method is used to transfer the large amount of data into SAP, this session
method is basically of 2 steps
1. Creating of session
2. Processing of the session.
Conversion And Interfaces:
To create the session, we do have 3 fm’s
1. BDC_OPEN_GROUP
2. BDC_INSERT
3. BDC_CLOSE_GROUP
Once we call these FM’s SAP Will generate a session with all the data that is going to add into SAP
DB.
Once the session got created, we need to go the TCode: SM35 and select the corresponding session
and click on process, SAP will creates the corresponding details. To see the errors/success in the
Session it self we have a tab called as processing log.
Keep :‘X’
BDC_INSERT: This FM is used to transfer the data from BDCDATA structure into the session.
We just need to call this FM and provide the tcode name and BDCDATA internal table.
BDC_CLOSEGROUP: this is used close the session which we have created in BDC_OPENGROUP, once
we completed calling these three FM’s SAP will go head and generate the session, to process the
session we will use SM35.
BREAK-POINT.
IF sy-subrc = 0.
LOOP AT gt_input ASSIGNING FIELD-SYMBOL(<gfs_upload>).
PERFORM bdc_dynpro USING 'SAPMF02D' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF02D-BUKRS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RF02D-KUNNR'
<gfs_upload>-cust_numb.
PERFORM bdc_field USING 'RF02D-BUKRS'
<gfs_upload>-comp_code.
PERFORM bdc_field USING 'RF02D-KTOKD'
<gfs_upload>-acc_grp.
PERFORM bdc_dynpro USING 'SAPMF02D' '0110'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNA1-SPRAS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'KNA1-NAME1'
<gfs_upload>-name.
PERFORM bdc_field USING 'KNA1-SORTL'
<gfs_upload>-search.
PERFORM bdc_field USING 'KNA1-ORT01'
<gfs_upload>-city.
PERFORM bdc_field USING 'KNA1-PSTLZ'
<gfs_upload>-pincode.
PERFORM bdc_field USING 'KNA1-LAND1'
<gfs_upload>-country.
PERFORM bdc_field USING 'KNA1-SPRAS'
<gfs_upload>-language.
PERFORM bdc_dynpro USING 'SAPMF02D' '0120'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNA1-LZONE'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
Conversion And Interfaces:
PERFORM bdc_field USING 'KNA1-LZONE'
<gfs_upload>-zone.
PERFORM bdc_dynpro USING 'SAPMF02D' '0125'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNA1-NIELS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNBK-BANKS(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0340'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNVA-ABLAD(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0370'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNEX-LNDEX(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_field USING 'KNA1-CIVVE'
'X'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0360'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNVK-NAMEV(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0210'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNB1-AKONT'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'KNB1-AKONT'
<gfs_upload>-recoacc.
PERFORM bdc_dynpro USING 'SAPMF02D' '0215'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNB1-ZTERM'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0220'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNB5-MAHNA'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0230'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNB1-VRSNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = 'XD01'
* POST_LOCAL = NOVBLOCAL
* PRINTING = NOPRINT
* SIMUBATCH = ' '
Conversion And Interfaces:
* CTUPARAMS = ' '
TABLES
dynprotab = gt_bdcdata
EXCEPTIONS
internal_error = 1
not_open = 2
queue_error = 3
tcode_invalid = 4
printing_invalid = 5
posting_invalid = 6
OTHERS = 7.
IF sy-subrc = 0.
CLEAR gt_bdcdata.
ENDIF.
ENDLOOP.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
not_open = 1
queue_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.
ls_bdcdata-program = program.
ls_bdcdata-dynpro = dynpro.
ls_bdcdata-dynbegin = 'X'.
APPEND ls_bdcdata TO gt_bdcdata.
ENDFORM.
*----------------------------------------------------------------------*
* Insert field
*
*----------------------------------------------------------------------*
FORM bdc_field USING fnam fval.
DATA: ls_bdcdata TYPE bdcdata.
CLEAR ls_bdcdata.
ls_bdcdata-fnam = fnam.
ls_bdcdata-fval = fval.
APPEND ls_bdcdata TO gt_bdcdata.
ENDFORM.
Conversion And Interfaces:
Me req: I have the customer file in my application server, I need to process this file from the
application and create the customer is SAP.
Direct Input Method: This method is also used upload the values into SAP.
1. Example file struc is not been provided by SAP, i.e., as a developer we need to understand
the program and we need to create the file
2. With the help of this method we cant able to determine whether the record has been
created successfully or not bcaz SAP will not provide any logs.
3. With the help of method we cant able to fill the custom filed of a application.
For example if we need to upload the material master data then we will use the program
RMDATIND.
Conversion And Interfaces: